/* ==========================================================================
   SunSoft World Tools - shared stylesheet (no frameworks, no CDN)
   Linked by EVERY page:  <link rel="stylesheet" href="css/global-layout.css">

   1.  Design tokens (colours, fonts, shadows, per-page accent)
   2.  Base / reset
   3.  Page layout (body, container, main, headings, card, stack, grids)
   4.  Header + mobile menu   (markup is injected by js/global-layout.js)
   5.  Footer                 (markup is injected by js/global-layout.js)
   6.  Buttons
   7.  Form controls
   8.  Tabs
   9.  Status message
   10. Stat tiles
   11. Panels, password + QR pieces
   12. Home page (hero + tool cards)
   ========================================================================== */


/* ==========================================================================
   1. DESIGN TOKENS
   Pick a page colour with <body data-accent="indigo">.
   Available: blue (default) indigo purple pink amber emerald sky teal rose orange cyan
   ========================================================================== */
:root {
    --container: 72rem;   /* content width shared by header, footer and page cards */
    --gutter: 1rem;

    --slate-50:  #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    --rose-50:  #fff1f2;
    --rose-200: #fecdd3;
    --rose-600: #e11d48;
    --rose-700: #be123c;
    --green-50:  #ecfdf5;
    --green-200: #a7f3d0;
    --green-700: #047857;

    --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    --brand: #2563eb;

    /* default accent = blue */
    --accent:        #2563eb;
    --accent-hover:  #3b82f6;
    --accent-soft:   #eff6ff;
    --accent-line:   #dbeafe;
    --accent-ring:   rgba(59, 130, 246, 0.2);
}

[data-accent="blue"]    { --accent:#2563eb; --accent-hover:#3b82f6; --accent-soft:#eff6ff; --accent-line:#dbeafe; --accent-ring:rgba(59,130,246,.2); }
[data-accent="indigo"]  { --accent:#4f46e5; --accent-hover:#6366f1; --accent-soft:#eef2ff; --accent-line:#e0e7ff; --accent-ring:rgba(99,102,241,.2); }
[data-accent="purple"]  { --accent:#9333ea; --accent-hover:#a855f7; --accent-soft:#faf5ff; --accent-line:#f3e8ff; --accent-ring:rgba(168,85,247,.2); }
[data-accent="pink"]    { --accent:#db2777; --accent-hover:#ec4899; --accent-soft:#fdf2f8; --accent-line:#fce7f3; --accent-ring:rgba(236,72,153,.2); }
[data-accent="amber"]   { --accent:#d97706; --accent-hover:#f59e0b; --accent-soft:#fffbeb; --accent-line:#fef3c7; --accent-ring:rgba(245,158,11,.2); }
[data-accent="emerald"] { --accent:#059669; --accent-hover:#10b981; --accent-soft:#ecfdf5; --accent-line:#d1fae5; --accent-ring:rgba(16,185,129,.2); }
[data-accent="teal"]    { --accent:#0d9488; --accent-hover:#14b8a6; --accent-soft:#f0fdfa; --accent-line:#ccfbf1; --accent-ring:rgba(20,184,166,.2); }
[data-accent="rose"]    { --accent:#e11d48; --accent-hover:#f43f5e; --accent-soft:#fff1f2; --accent-line:#ffe4e6; --accent-ring:rgba(244,63,94,.2); }
[data-accent="orange"]  { --accent:#ea580c; --accent-hover:#f97316; --accent-soft:#fff7ed; --accent-line:#ffedd5; --accent-ring:rgba(249,115,22,.2); }
[data-accent="cyan"]    { --accent:#0891b2; --accent-hover:#06b6d4; --accent-soft:#ecfeff; --accent-line:#cffafe; --accent-ring:rgba(6,182,212,.2); }
[data-accent="sky"]     { --accent:#0284c7; --accent-hover:#0ea5e9; --accent-soft:#f0f9ff; --accent-line:#e0f2fe; --accent-ring:rgba(14,165,233,.2); }


/* ==========================================================================
   2. BASE / RESET
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body, h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }

img, svg, canvas, video { max-width: 100%; }

button, input, select, textarea {
    font: inherit;
    color: inherit;
}
button { cursor: pointer; }

/* The [hidden] attribute must win over any display: value set by a class. */
[hidden] { display: none !important; }

::selection { background: var(--accent); color: #ffffff; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}


/* ==========================================================================
   3. PAGE LAYOUT
   ========================================================================== */
body {
    font-family: var(--font-sans);
    line-height: 1.5;
    color: var(--slate-800);
    background: linear-gradient(to bottom right, #f8fafc, rgba(239, 246, 255, 0.4), rgba(238, 242, 255, 0.5));
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* One width for everything: header, footer, hub and tool cards all use --container,
   so their left/right edges line up. It grows on large monitors. */
@media (min-width: 640px)  { :root { --gutter: 1.5rem; } }
@media (min-width: 1024px) { :root { --gutter: 2rem; } }
@media (min-width: 1536px) { :root { --container: 80rem; } }

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

/* <main class="page"> - the tool area. Grows to push the footer down.
   Default = full container width. Use a modifier for single-column tools. */
.page {
    flex: 1 0 auto;
    width: 100%;
    max-width: var(--container);
    margin: 2rem auto;
    padding: 1rem var(--gutter);
}
.page--medium  { max-width: 60rem; }   /* age calculator, GST */
.page--narrow  { max-width: 44rem; }   /* password generator */
.page--compact { max-width: 34rem; }   /* calculator */
@media (min-width: 640px) { .page { padding-block: 1.5rem; } }

.page-heading {
    text-align: center;
    margin-bottom: 1.5rem;
}
.page-heading h1 {
    font-size: 1.875rem;
    line-height: 1.2;
    font-weight: 800;
    color: var(--slate-900);
    margin-bottom: 0.5rem;
}
.page-heading p {
    font-size: 0.875rem;
    color: var(--slate-600);
}
@media (min-width: 640px) {
    .page-heading h1 { font-size: 2.25rem; }
    .page-heading p  { font-size: 1rem; }
}
.page--narrow  .page-heading h1,
.page--compact .page-heading h1 { font-size: 1.875rem; }
.page--narrow  .page-heading p,
.page--compact .page-heading p  { font-size: 0.875rem; }

.card {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
    padding: 1rem;
}
@media (min-width: 640px) { .card { padding: 1.5rem; } }

/* Vertical rhythm: children get an even gap. */
.stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}
.stack--xs { gap: 0.5rem; }
.stack--sm { gap: 0.75rem; }
.stack--md { gap: 1.25rem; }
.stack--lg { gap: 1.5rem; }

/* Two-column layout that collapses to one column on phones. */
.grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}
.grid-2--wide   { gap: 2rem; }
.grid-2--center { align-items: center; }
.grid-2--start  { align-items: start; }
@media (min-width: 768px) {
    .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Row of buttons / controls that wraps instead of overflowing. */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--slate-100);
}
.toolbar--plain { padding-bottom: 0; border-bottom: 0; }
.toolbar__group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.rule-top {
    padding-top: 0.5rem;
    border-top: 1px solid var(--slate-100);
}

.credit-link {
    font-size: 0.75rem;
    color: var(--slate-500);
    text-decoration: none;
    transition: color 0.15s;
}
.credit-link:hover { color: var(--accent); }


/* ==========================================================================
   4. HEADER + MOBILE MENU
   #site-header is the sticky element (a sticky child inside a short wrapper
   would never stick, so the wrapper itself carries position: sticky).
   ========================================================================== */
#site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: calc(4rem + 1px);   /* reserve space so the page doesn't jump when JS injects the header */
}

.site-header {
    position: relative;
    background: rgba(255, 255, 255, 0.8);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-sm);
}

.site-header__inner {
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--slate-900);
    white-space: nowrap;
}
.brand__mark {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: var(--brand);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.25);
}
.brand__name {
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.025em;
}
.brand__accent { color: var(--brand); }
.brand__sub {
    margin-left: 0.25rem;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--slate-400);
}

/* Nav: dropdown under the header on small screens... */
.site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 0.5rem 1rem 1rem;
    background: #ffffff;
    border-bottom: 1px solid var(--slate-200);
    box-shadow: var(--shadow-md);
}
.site-header.is-open .site-nav { display: flex; }

.site-nav a {
    padding: 0.625rem 0.5rem;
    border-radius: 0.5rem;
    color: var(--slate-600);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s;
}
.site-nav a:hover { color: var(--brand); background: var(--slate-50); }
.site-nav a[aria-current="page"] { color: var(--brand); font-weight: 600; }

/* Hamburger button (animated into an X when open). */
.nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: 0.5rem;
}
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
    display: block;
    width: 1.125rem;
    height: 2px;
    background: var(--slate-700);
    border-radius: 2px;
    transition: transform 0.2s, top 0.2s, background-color 0.2s;
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before,
.nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after  { top: 6px; }
.site-header.is-open .nav-toggle__bars { background: transparent; }
.site-header.is-open .nav-toggle__bars::before { top: 0; transform: rotate(45deg); }
.site-header.is-open .nav-toggle__bars::after  { top: 0; transform: rotate(-45deg); }


/* ...and a single row on wide screens (9 links need ~1100px). */
@media (min-width: 1100px) {
    .site-nav {
        display: flex;
        position: static;
        flex-direction: row;
        align-items: center;
        gap: 1.25rem;
        padding: 0;
        background: none;
        border: 0;
        box-shadow: none;
    }
    .site-nav a { padding: 0; border-radius: 0; }
    .site-nav a:hover { background: none; }
    .nav-toggle { display: none; }
}


/* --- "All Tools" grouped menu ---------------------------------------------
   Mobile: the groups are listed inside the hamburger dropdown.
   Desktop: a button opens a full-width panel under the header. */
.site-nav { max-height: calc(100vh - 4rem); max-height: calc(100dvh - 4rem); overflow-y: auto; }

.nav-tools {
    display: none;
    align-items: center;
    gap: 0.375rem;
    padding: 0;
    background: none;
    border: 0;
    color: var(--slate-600);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s;
}
.nav-tools:hover, .nav-tools[aria-expanded="true"] { color: var(--brand); }
.nav-tools__caret {
    width: 0.4rem;
    height: 0.4rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s;
}
.nav-tools[aria-expanded="true"] .nav-tools__caret { transform: rotate(225deg) translateY(-2px); }

.tools-menu {
    display: block;
    margin-top: 0.5rem;
    padding-top: 0.25rem;
    border-top: 1px solid var(--slate-100);
}
.tools-menu__lead {
    padding: 0.75rem 0.5rem 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--slate-400);
}
.tools-menu__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 2rem; }
.site-nav .tools-menu a { display: block; }   /* one link per row (anchors are inline by default) */
.tools-menu__title {
    padding: 0.75rem 0.5rem 0.25rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--slate-900);
}

@media (min-width: 1100px) {
    .site-nav { max-height: none; overflow: visible; }
    .nav-tools { display: inline-flex; }
    .tools-menu__lead { display: none; }
    .tools-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin: 0;
        padding: 1.75rem 0 2rem;
        background: #ffffff;
        border-top: 1px solid var(--slate-200);
        border-bottom: 1px solid var(--slate-200);
        box-shadow: var(--shadow-md);
    }
    .tools-menu.is-open { display: block; }
    .tools-menu__inner {
        max-width: var(--container);
        margin-inline: auto;
        padding-inline: var(--gutter);
    }
    .tools-menu__grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .tools-menu__title { padding: 0 0 0.5rem; }
    .site-nav .tools-menu a {
        display: block;
        margin-inline: -0.5rem;
        padding: 0.375rem 0.5rem;
        border-radius: 0.5rem;
    }
    .site-nav .tools-menu a:hover { background: var(--slate-50); }
}


/* ==========================================================================
   5. FOOTER
   ========================================================================== */
.site-footer {
    margin-top: 2rem;
    padding: 2.5rem 0 1.5rem;
    background: #ffffff;
    border-top: 1px solid var(--slate-200);
    color: var(--slate-500);
    font-size: 0.8125rem;
}
.footer-cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}
@media (min-width: 640px)  { .footer-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .footer-cols { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.footer-col__title {
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--slate-900);
}
.site-footer a {
    color: var(--slate-600);
    text-decoration: none;
    transition: color 0.15s;
}
.site-footer a:hover { color: var(--brand); }
.site-footer a[aria-current="page"] { color: var(--brand); font-weight: 600; }
.footer-col a { display: block; padding: 0.25rem 0; }

.site-footer__bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--slate-100);
    text-align: center;
}
@media (min-width: 640px) { .site-footer__bottom { flex-direction: row; text-align: left; } }
.site-footer__copy a { color: var(--slate-700); font-weight: 500; }
.site-footer__copy a:hover { text-decoration: underline; }
.footer-legal { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.25rem; font-weight: 500; }


/* ==========================================================================
   6. BUTTONS
   <button class="btn btn--primary">   accent colour of the page
   <button class="btn btn--secondary"> grey with border
   <button class="btn btn--dark">      near-black
   <button class="btn btn--danger">    red text, transparent
   modifiers: btn--sm  btn--block
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--sm    { padding: 0.5rem 0.75rem; font-size: 0.75rem; line-height: 1rem; }
.btn--block { display: flex; width: 100%; }

.btn--primary { background: var(--accent); color: #ffffff; box-shadow: var(--shadow-md); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn--secondary { background: var(--slate-100); color: var(--slate-700); border-color: var(--slate-200); }
.btn--secondary:hover:not(:disabled) { background: var(--slate-200); }

.btn--dark { background: var(--slate-900); color: #ffffff; box-shadow: var(--shadow-sm); }
.btn--dark:hover:not(:disabled) { background: var(--slate-800); }

.btn--danger { background: transparent; color: var(--rose-600); }
.btn--danger:hover:not(:disabled) { background: var(--rose-50); }

.btn--outline { border-color: var(--slate-200); }   /* add to btn--danger for a bordered look */

.btn--link {
    padding: 0;
    background: none;
    border: 0;
    color: var(--rose-600);
    font-size: 0.75rem;
    font-weight: 400;
}
.btn--link:hover { text-decoration: underline; }


/* ==========================================================================
   7. FORM CONTROLS
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 0.375rem; }

.label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--slate-500);
}
.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.label-value { color: var(--accent); font-weight: 900; font-size: 0.875rem; }

.select--narrow { max-width: 8rem; flex: none; }

.input, .textarea, .select {
    display: block;
    width: 100%;
    padding: 0.75rem;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 0.75rem;
    font-size: 0.875rem;
    color: var(--slate-800);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder, .textarea::placeholder { color: var(--slate-400); }
.input:focus, .textarea:focus, .select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-ring);
}
.textarea { resize: vertical; }
.textarea--mono, .input--mono { font-family: var(--font-mono); }

/* Input with a button floating inside its right edge (password field). */
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input {
    padding: 0.75rem 6rem 0.75rem 1rem;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--slate-900);
}
.input-group .btn {
    position: absolute;
    right: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    border-radius: 0.5rem;
}

input[type="range"] {
    display: block;
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
}

.check {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--slate-700);
    cursor: pointer;
}
.check input {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--accent);
}

input[type="file"] {
    display: block;
    width: 100%;
    font-size: 0.75rem;
    color: var(--slate-500);
    cursor: pointer;
}
input[type="file"]::file-selector-button {
    margin-right: 1rem;
    padding: 0.5rem 1rem;
    border: 0;
    border-radius: 0.75rem;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s;
}
input[type="file"]::file-selector-button:hover { background: var(--accent-line); }


/* ==========================================================================
   8. TABS  (calculator + QR page)
   <div class="tabs"><button class="tab is-active">..</button><button class="tab">..</button></div>
   ========================================================================== */
.tabs {
    display: flex;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--slate-200);
}
.tabs--lg { margin-bottom: 1.5rem; }

.tab {
    flex: 1;
    padding: 0 0 0.5rem;
    margin-bottom: -2px;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--slate-500);
    font-size: 0.875rem;
    font-weight: 600;
    transition: color 0.2s, border-color 0.2s;
}
.tabs--lg .tab { padding-bottom: 0.75rem; }
.tab:hover { color: var(--slate-800); }
.tab.is-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 700;
}


/* ==========================================================================
   9. STATUS MESSAGE  (JSON formatter)
   <div class="status status--ok" role="status" hidden>
   ========================================================================== */
.status {
    padding: 0.625rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
}
.status--ok    { background: var(--green-50); color: var(--green-700); border-color: var(--green-200); }
.status--error { background: var(--rose-50);  color: var(--rose-700);  border-color: var(--rose-200); }


/* ==========================================================================
   10. STAT TILES  (word counter)
   <div class="stat" data-accent="blue"><span class="stat__value">0</span><span class="stat__label">Words</span></div>
   ========================================================================== */
.stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.stat {
    padding: 1rem;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: 0.75rem;
    text-align: center;
}
.stat__value {
    display: block;
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 900;
    color: var(--accent);
}
.stat__label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--slate-500);
}


/* ==========================================================================
   11. PANELS + PASSWORD / QR PIECES
   ========================================================================== */
.panel {
    padding: 1rem;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 1rem;
}
.panel--center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem;
}
.panel__title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--slate-500);
}

.qr-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 220px;
    min-height: 220px;
    max-width: 100%;
    padding: 1rem;
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
}
.qr-frame img, .qr-frame canvas { max-width: 100%; height: auto; }
.qr-download { width: 100%; max-width: 220px; }

.scan-reader {
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: 0.75rem;
}
/* Before the camera starts the box is empty: drop the border so it doesn't look like a stray line.
   (Not display:none - the scanner library measures this element's width when it starts.) */
.scan-reader:empty { border: 0; }
.row { display: flex; gap: 0.5rem; }
.row > .grow { flex: 1; }


/* ==========================================================================
   12. HOME PAGE (hero, search, tool cards)  +  related tools on every page
   ========================================================================== */
.hero {
    max-width: 56rem;
    margin: 0 auto;
    padding: 3rem 1rem 1.5rem;
    text-align: center;
}
@media (min-width: 768px) { .hero { padding: 4rem 1rem 2rem; } }

.badge {
    display: inline-block;
    margin-bottom: 0.75rem;
    padding: 0.25rem 0.75rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 9999px;
    color: #1d4ed8;
    font-size: 0.75rem;
    font-weight: 600;
}

.hero h1 {
    margin-bottom: 1rem;
    font-size: 1.875rem;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--slate-900);
}
@media (min-width: 640px) { .hero h1 { font-size: 2.25rem; } }
@media (min-width: 768px) { .hero h1 { font-size: 3rem; } }

.gradient-text {
    background: linear-gradient(to right, #2563eb, #4f46e5);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.hero p {
    max-width: 42rem;
    margin: 0 auto;
    font-size: 1rem;
    color: var(--slate-600);
}
@media (min-width: 640px) { .hero p { font-size: 1.125rem; } }

.home-main { flex: 1 0 auto; }

.hub-search { max-width: 30rem; margin: 1.75rem auto 0; }
.hub-search .input {
    padding: 0.875rem 1.25rem;
    border-radius: 9999px;
    box-shadow: var(--shadow-sm);
    font-size: 1rem;
}
.hub-count { margin-top: 0.75rem; font-size: 0.8125rem; color: var(--slate-500); }

.hub { display: grid; gap: 2.5rem; padding: 1.5rem 0 2rem; }
.cat__head { margin-bottom: 1rem; }
.cat__head h2 { font-size: 1.25rem; font-weight: 700; color: var(--slate-900); }
.cat__head p { font-size: 0.875rem; color: var(--slate-500); }
.hub-empty { padding: 2rem 0 4rem; text-align: center; color: var(--slate-500); }

.tool-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}
@media (min-width: 640px)  { .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .tool-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.tool-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.tool-card:hover { border-color: var(--accent-hover); box-shadow: var(--shadow-md); }
.tool-card[aria-current="page"] { border-color: var(--accent); }
.tool-card__icon {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 700;
    transition: background-color 0.2s, color 0.2s;
}
.tool-card:hover .tool-card__icon { background: var(--accent); color: #ffffff; }
.tool-card h3 { margin-bottom: 0.25rem; font-size: 1rem; font-weight: 600; color: var(--slate-900); }
.tool-card p { font-size: 0.8125rem; line-height: 1.45; color: var(--slate-600); }

/* "More free tools" + call to action, filled in by js/global-layout.js */
.related { margin-top: 3rem; }
.related h2 { margin-bottom: 1rem; font-size: 1.125rem; font-weight: 700; color: var(--slate-900); }

.cta-band {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    margin-top: 2rem;
    padding: 1.25rem 1.5rem;
    background: var(--slate-900);
    border-radius: 1rem;
    color: #ffffff;
}
.cta-band strong { display: block; font-size: 1rem; }
.cta-band p { margin-top: 0.125rem; font-size: 0.875rem; color: var(--slate-300); }


/* ==========================================================================
   13. ARTICLE CONTENT UNDER A TOOL (how to use + FAQ)
   ========================================================================== */
.content {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    margin-top: 2.5rem;
}
@media (min-width: 1024px) { .content { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3rem; } }

.content h2 { margin-bottom: 0.75rem; font-size: 1.125rem; font-weight: 700; color: var(--slate-900); }
.content h2:not(:first-child) { margin-top: 1.75rem; }
.content p, .content li { font-size: 0.9375rem; line-height: 1.65; color: var(--slate-600); }
.content p + p { margin-top: 0.75rem; }
.content ol, .content ul { margin: 0; padding-left: 1.25rem; }
.content li + li { margin-top: 0.375rem; }
.content a { color: var(--accent); }
.content code {
    padding: 0.125rem 0.375rem;
    background: var(--slate-100);
    border-radius: 0.375rem;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--slate-800);
}

.faq {
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: 0.75rem;
}
.faq + .faq { margin-top: 0.5rem; }
.faq summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--slate-800);
    cursor: pointer;
    list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; font-size: 1.25rem; line-height: 1; color: var(--accent); }
.faq[open] summary::after { content: "\2212"; }
.faq p { padding: 0 1rem 0.875rem; }


/* ==========================================================================
   14. SHARED TOOL COMPONENTS
   ========================================================================== */
.sr-only {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.hint { font-size: 0.8125rem; color: var(--slate-500); }
.btn--light { background: #ffffff; color: var(--slate-900); }
.btn--light:hover:not(:disabled) { background: var(--slate-100); }

/* rows of 2 or 3 fields that stay side by side on small screens */
.form-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 480px) { .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 720px) { .form-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* number input with a prefix (e.g. rupee sign) or suffix (%) */
.input-affix { position: relative; }
.input-affix__pre, .input-affix__post {
    position: absolute; top: 50%; transform: translateY(-50%);
    color: var(--slate-400); font-weight: 600; pointer-events: none;
}
.input-affix__pre  { left: 0.875rem; }
.input-affix__post { right: 0.875rem; }
.input-affix .input { padding-left: 2rem; }
.input-affix--post .input { padding-left: 0.75rem; padding-right: 2rem; }

/* pill buttons for presets (GST rates) */
.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
    padding: 0.375rem 0.875rem;
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: 9999px;
    color: var(--slate-700);
    font-size: 0.8125rem;
    font-weight: 600;
    transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--accent-hover); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #ffffff; }

/* two-or-three-way switch */
.segmented { display: inline-flex; padding: 0.25rem; gap: 0.25rem; background: var(--slate-100); border-radius: 0.75rem; }
.segmented button {
    padding: 0.375rem 0.875rem;
    background: transparent;
    border: 0;
    border-radius: 0.5rem;
    color: var(--slate-600);
    font-size: 0.8125rem;
    font-weight: 600;
    transition: background-color 0.15s, color 0.15s;
}
.segmented button.is-active { background: #ffffff; color: var(--accent); box-shadow: var(--shadow-sm); }

/* result panels */
.result {
    padding: 1.25rem;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: 1rem;
    text-align: center;
}
.result__label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--slate-500); }
.result__value {
    display: block;
    margin-top: 0.25rem;
    font-size: 2rem;
    line-height: 1.2;
    font-weight: 800;
    color: var(--accent);
    overflow-wrap: anywhere;
}
.result-list { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.result-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.625rem 0.875rem;
    background: var(--slate-50);
    border: 1px solid var(--slate-100);
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    color: var(--slate-600);
}
.result-list strong { font-variant-numeric: tabular-nums; color: var(--slate-900); text-align: right; overflow-wrap: anywhere; }
.result-list .is-total { background: var(--accent-soft); border-color: var(--accent-line); }

/* donut chart (EMI): set --pct on the element */
.donut {
    --pct: 50;
    --c2: var(--slate-200);
    display: grid;
    place-items: center;
    width: 9rem;
    height: 9rem;
    margin: 0 auto;
    border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--c2) 0);
}
.donut::after { content: ""; width: 6rem; height: 6rem; border-radius: 50%; background: #ffffff; }
.donut--split { --c2: #fb923c; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1rem; font-size: 0.8125rem; color: var(--slate-600); }
.dot { display: inline-block; width: 0.75rem; height: 0.75rem; margin-right: 0.375rem; border-radius: 50%; }
.dot--accent { background: var(--accent); }
.dot--orange { background: #fb923c; }

/* data tables */
.table-wrap { max-height: 24rem; overflow: auto; border: 1px solid var(--slate-200); border-radius: 0.75rem; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 0.625rem 0.875rem; text-align: right; white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; }
.table thead th {
    position: sticky; top: 0;
    background: var(--slate-50);
    border-bottom: 1px solid var(--slate-200);
    font-size: 0.75rem; font-weight: 700; color: var(--slate-600);
}
.table tbody tr + tr td { border-top: 1px solid var(--slate-100); }
.table--wrapcells td { white-space: normal; overflow-wrap: anywhere; text-align: left; }

/* slider + typed number sharing one label (EMI) */
.slider-field { display: grid; gap: 0.5rem; }
.slider-field .input { width: 9rem; padding: 0.375rem 0.625rem; text-align: right; font-weight: 700; }
.slider-field .input.input--narrow { width: 5.5rem; }

/* small status pills */
.pill {
    display: inline-block; padding: 0.125rem 0.5rem; border-radius: 9999px;
    font-size: 0.75rem; font-weight: 700; background: var(--slate-100); color: var(--slate-600);
}
.pill--ok { background: var(--green-50); color: var(--green-700); }
.pill--no { background: var(--rose-50); color: var(--rose-700); }

/* image compressor */
.dropzone {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem;
    padding: 2.5rem 1rem;
    background: var(--slate-50);
    border: 2px dashed var(--slate-300);
    border-radius: 1rem;
    text-align: center;
    color: var(--slate-600);
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropzone strong { color: var(--slate-800); }

.file-list { display: grid; gap: 0.75rem; }
.file-row {
    display: grid;
    grid-template-columns: 4rem minmax(0, 1fr);
    gap: 0.75rem 1rem;
    align-items: center;
    padding: 0.75rem;
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: 0.75rem;
}
@media (min-width: 640px) { .file-row { grid-template-columns: 4rem minmax(0, 1fr) auto; } }
.file-row img { width: 4rem; height: 4rem; object-fit: cover; border-radius: 0.5rem; background: var(--slate-100); }
.file-row__name { overflow: hidden; font-size: 0.875rem; font-weight: 600; color: var(--slate-800); text-overflow: ellipsis; white-space: nowrap; }
.file-row__meta { font-size: 0.8125rem; color: var(--slate-500); }
.file-row .btn { grid-column: 1 / -1; }
@media (min-width: 640px) { .file-row .btn { grid-column: auto; } }

/* text diff */
.diff-out {
    max-height: 32rem;
    overflow: auto;
    padding: 1rem;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: var(--slate-800);
}
.diff-line { display: block; padding: 0.0625rem 0.5rem; border-radius: 0.25rem; }
.diff-line::before { content: attr(data-sign); display: inline-block; width: 1.25rem; opacity: 0.6; }
.diff-line--add { background: #dcfce7; color: #166534; }
.diff-line--del { background: #fee2e2; color: #991b1b; }
ins.diff-w, del.diff-w { border-radius: 0.125rem; text-decoration: none; }
ins.diff-w { background: #bbf7d0; color: #166534; }
del.diff-w { background: #fecaca; color: #991b1b; text-decoration: line-through; }

/* colour converter */
.swatch { height: 8rem; border: 1px solid var(--slate-200); border-radius: 1rem; }
.color-input { display: block; width: 100%; height: 3rem; padding: 0.25rem; background: #ffffff; border: 1px solid var(--slate-200); border-radius: 0.75rem; cursor: pointer; }
.copy-field { display: flex; gap: 0.5rem; }
.copy-field .input { font-family: var(--font-mono); }
.input[aria-invalid="true"] { border-color: var(--rose-600); box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.15); }
.contrast { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.contrast__sample { padding: 1rem; border: 1px solid var(--slate-200); border-radius: 0.75rem; text-align: center; }
.contrast__sample strong { display: block; font-size: 1.125rem; }
.contrast__sample span { font-size: 0.8125rem; }
.contrast__pills { margin-top: 0.5rem; display: flex; justify-content: center; gap: 0.375rem; flex-wrap: wrap; }

/* meta tag generator */
.serp { padding: 1rem 1.25rem; background: #ffffff; border: 1px solid var(--slate-200); border-radius: 0.75rem; }
.serp__url { font-size: 0.8125rem; color: #188038; overflow-wrap: anywhere; }
.serp__title { margin: 0.125rem 0; font-size: 1.25rem; line-height: 1.3; color: #1a0dab; overflow-wrap: anywhere; }
.serp__desc { font-size: 0.875rem; color: #4d5156; overflow-wrap: anywhere; }
.counter { font-size: 0.75rem; font-weight: 600; color: var(--slate-500); }
.counter.is-over { color: var(--rose-600); }

/* label + value + copy rows (hashes) */
.kv { display: grid; gap: 0.75rem; }
.kv__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.75rem; align-items: center; }
.kv__key { grid-column: 1 / -1; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; color: var(--slate-500); }
.kv__val {
    min-height: 2.5rem; padding: 0.625rem 0.75rem;
    background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: 0.75rem;
    font-family: var(--font-mono); font-size: 0.8125rem; overflow-wrap: anywhere; user-select: all;
}
@media (min-width: 720px) {
    .kv__row { grid-template-columns: 6rem minmax(0, 1fr) auto; }
    .kv__key { grid-column: auto; }
}

.preview-img { max-width: 100%; max-height: 16rem; border: 1px solid var(--slate-200); border-radius: 0.75rem; background: var(--slate-50); }


/* ==========================================================================
   Motion preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
