/* ==========================================================================
   RabixAI — Shared Design System + Tool-UI Components
   --------------------------------------------------------------------------
   Aesthetic: editorial / financial-paper. Warm cream ground, near-black ink,
   ONE signal-orange accent. Fraunces (display serif), Hanken Grotesk (body),
   IBM Plex Mono (labels/eyebrows/numbers). Hairline rules + "worksheet"
   result cards that read like a calculation receipt.

   This single stylesheet powers EVERY page (homepage, trust pages, and all
   tool pages). Other agents building new tool pages should NOT add new CSS
   files — reuse the classes documented below.

   QUICK CLASS MAP (for agents building tool pages):
     Layout ......... .site-header / .site-footer / .tool-shell / .tool-layout
     Directory ...... .tools-grid / .tool-card / .tag
     Forms .......... .field / .field-row / .btn / .btn-primary
     Results ........ .result-card / .result-primary / .result-row / .result-note
     Explainer ...... .formula / .how-it-works
     Cross-links .... .related-tools
     Ads ............ .ad-slot (label is rendered automatically)
   ========================================================================== */

/* ----------------------------------------------------------------- TOKENS */
:root {
  /* Color — OKLCH. Cream paper ground, ink text, single signal orange.    */
  --paper:        oklch(97.5% 0.012 85);   /* warm cream page background    */
  --paper-2:      oklch(95.2% 0.016 84);   /* slightly deeper panel / card  */
  --paper-3:      oklch(92.8% 0.018 83);   /* inset / input wells           */
  --ink:          oklch(22% 0.012 70);     /* near-black primary text       */
  --ink-2:        oklch(40% 0.010 72);     /* secondary text                */
  --ink-3:        oklch(55% 0.010 74);     /* muted / captions              */
  --rule:         oklch(22% 0.012 70 / 0.24); /* hairline divider (≥3:1 visible) */
  --rule-strong:  oklch(22% 0.012 70 / 0.46);

  --accent:       oklch(64% 0.19 42);      /* signal orange                 */
  --accent-ink:   oklch(46% 0.17 41);      /* darker orange for AA text     */
  --accent-soft:  oklch(64% 0.19 42 / 0.12);
  --on-accent:    oklch(98% 0.01 85);      /* text on orange fill           */

  --good:         oklch(52% 0.12 150);     /* positive figures              */
  --bad:          oklch(52% 0.17 27);      /* negative figures              */

  /* Type */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body:    "Hanken Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Modular type scale (1.22 ratio, base 1rem).
     Larger steps are FLUID via clamp() so headings scale smoothly from phone to
     desktop without per-breakpoint overrides — body/label steps stay fixed for
     legibility. Min is the phone size, max the original desktop size. */
  --t-xs:   0.75rem;
  --t-sm:   0.875rem;
  --t-base: 1rem;
  --t-md:   clamp(1.1rem,  0.99rem + 0.55vw, 1.22rem);
  --t-lg:   clamp(1.3rem,  1.14rem + 0.8vw,  1.49rem);
  --t-xl:   clamp(1.5rem,  1.27rem + 1.15vw, 1.82rem);
  --t-2xl:  clamp(1.78rem, 1.45rem + 1.65vw, 2.22rem);
  --t-3xl:  clamp(2.1rem,  1.66rem + 2.2vw,  2.71rem);
  --t-4xl:  clamp(2.4rem,  1.78rem + 3.1vw,  3.3rem);
  --t-5xl:  clamp(2.85rem, 2.0rem + 4.25vw,  4.03rem);

  /* Spacing (8px rhythm) */
  --s-1: 0.25rem;  --s-2: 0.5rem;   --s-3: 0.75rem;  --s-4: 1rem;
  --s-5: 1.5rem;   --s-6: 2rem;     --s-7: 3rem;     --s-8: 4rem;
  --s-9: 6rem;

  /* Radii — kept tight & paper-like, never pill-soft */
  --r-sm: 3px;
  --r-md: 6px;
  --r-lg: 10px;

  /* Shadow — ink-tinted, low, like print impression */
  --shadow-sm: 0 1px 0 var(--rule);
  --shadow-md: 0 1px 2px oklch(22% 0.012 70 / 0.08), 0 8px 24px oklch(22% 0.012 70 / 0.06);

  /* Layout */
  --wrap: 1140px;
  --wrap-narrow: 760px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 180ms;
  --dur-fast: 110ms;

  /* Minimum comfortable touch target (WCAG 2.5.8 / 2.5.5). */
  --touch: 44px;
}

/* ---------------------------------------------------- DARK THEME (WARM) */
/* "Lamplit ledger": deep espresso/ink-brown ground, warm bone text, the
   SAME signal orange (lifted slightly for AA on the dark ground). Activated
   by data-theme="dark" on <html>, set by main.js (saved pref or OS default). */
:root[data-theme="dark"] {
  --paper:        oklch(18.5% 0.014 64);   /* deep warm espresso page       */
  --paper-2:      oklch(22% 0.016 62);      /* raised panel / card           */
  --paper-3:      oklch(25.5% 0.018 60);    /* inset / input wells           */
  --ink:          oklch(93% 0.014 80);      /* warm bone primary text        */
  --ink-2:        oklch(78% 0.014 78);      /* secondary text                */
  --ink-3:        oklch(64% 0.014 76);      /* muted / captions (AA on paper)*/
  --rule:         oklch(93% 0.014 80 / 0.24);
  --rule-strong:  oklch(93% 0.014 80 / 0.46);

  --accent:       oklch(70% 0.14 48);       /* brighter orange for dark (chroma trimmed to cut OLED vibration) */
  --accent-ink:   oklch(80% 0.15 52);       /* AA orange text on dark ground */
  --accent-soft:  oklch(72% 0.17 48 / 0.16);
  --on-accent:    oklch(20% 0.02 60);       /* dark ink on the orange fill   */

  --good:         oklch(74% 0.15 152);      /* lifted positive green         */
  --bad:          oklch(70% 0.17 30);       /* lifted negative red           */

  --shadow-sm: 0 1px 0 var(--rule);
  --shadow-md: 0 1px 2px oklch(0% 0 0 / 0.40), 0 12px 30px oklch(0% 0 0 / 0.45);

  color-scheme: dark;
}

/* Header glass tint must follow the theme (it hard-codes the light cream). */
:root[data-theme="dark"] .site-header {
  background: oklch(18.5% 0.014 64 / 0.86);
}
/* Result-card head keeps its inverted "printed bone" look in dark so the
   receipt still reads as paper at night, rather than a black void. */
:root[data-theme="dark"] .result-card__head {
  background: transparent;
  color: var(--ink);
  border-bottom-color: var(--ink);
}
:root[data-theme="dark"] .result-card__head .stamp { color: var(--ink-3); }
/* Buttons: default (outlined) hover inverts to ink — keep readable in dark. */
:root[data-theme="dark"] .btn:hover { background: var(--ink); color: var(--paper); }
/* Select chevron is a light-gray SVG baked for cream; recolor for dark. */
:root[data-theme="dark"] .field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23b8b0a2' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}
/* Cookie banner is hard-coded dark already, so it reads fine in both themes. */

/* ----------------------------------------------- THEME TOGGLE (injected) */
.theme-toggle {
  display: inline-grid; place-items: center;
  width: var(--touch); height: var(--touch);
  background: none;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink); }
.theme-toggle:active { background: var(--paper-3); transform: translateY(0.5px); }
.theme-toggle svg { width: 18px; height: 18px; transition: transform var(--dur) var(--ease-out); }
.theme-toggle:hover svg { transform: rotate(12deg); }
/* Show only the relevant glyph for the active theme. */
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun  { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }

/* ------------------------------------------------------------------ RESET */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* keep in-page anchor targets (e.g. #categories) clear of the sticky header */
  scroll-padding-top: 80px;
}
body {
  font-family: var(--font-body);
  font-size: var(--t-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  /* faint paper grain via layered gradients, no images */
  background-image:
    radial-gradient(oklch(22% 0.012 70 / 0.025) 0.5px, transparent 0.5px);
  background-size: 4px 4px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01";
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* --------------------------------------------------------------- UTILITY */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--s-5); }
.wrap--narrow { max-width: var(--wrap-narrow); }
.eyebrow {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--t-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.rule { border: 0; border-top: 1px solid var(--rule); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2.5px solid var(--accent-ink);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
/* Remove the lingering tap-highlight flash on touch devices; we provide our own
   :active / :focus-visible affordances. */
a, button, .tool-card, .rail-card, .theme-toggle, .nav-toggle, summary {
  -webkit-tap-highlight-color: transparent;
}
.skip-link {
  position: absolute; left: var(--s-4); top: -3rem;
  background: var(--ink); color: var(--paper);
  padding: var(--s-2) var(--s-4); border-radius: var(--r-sm); z-index: 100;
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--s-4); }

/* Headings */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 540; line-height: 1.08; letter-spacing: -0.012em; color: var(--ink); }
h1 { font-size: var(--t-4xl); }
h2 { font-size: var(--t-3xl); }
h3 { font-size: var(--t-lg); }

/* ============================================================== HEADER */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: oklch(97.5% 0.012 85 / 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header__bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-5); min-height: 64px;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--t-md);
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
  display: inline-flex; align-items: center; gap: 0.1em;
}
.wordmark b { font-weight: 600; }
.wordmark .ai {
  color: var(--accent-ink);
  font-style: italic;
}
.wordmark::before {
  content: ""; width: 9px; height: 9px; margin-right: 0.45em;
  background: var(--accent); border-radius: 2px;
  transform: rotate(45deg);
  transition: transform var(--dur) var(--ease-out), background var(--dur) var(--ease);
}
.wordmark:hover::before { transform: rotate(135deg); }
.site-nav { display: flex; align-items: center; gap: var(--s-6); }
.site-nav a {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink-2);
  padding: var(--s-2) 0;
  position: relative;
  transition: color var(--dur) var(--ease);
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--accent-ink); }
.site-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1.5px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.site-nav a:hover::after, .site-nav a[aria-current="page"]::after { transform: scaleX(1); }

.nav-toggle {
  display: none; background: none; border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm); width: var(--touch); height: var(--touch); cursor: pointer;
  align-items: center; justify-content: center;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav-toggle:hover { border-color: var(--ink); }
.nav-toggle:active { background: var(--paper-3); }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 18px; height: 1.5px; background: var(--ink); position: relative;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.nav-toggle span::before { content: ""; position: absolute; top: -6px; left: 0; }
.nav-toggle span::after  { content: ""; position: absolute; top:  6px; left: 0; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after  { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .site-header__bar { gap: var(--s-3); }
  /* Drawer: always present in flow but visually collapsed, so we can animate
     open/close (height + opacity) instead of a hard display flip. */
  .site-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--rule);
    padding-inline: var(--s-5);
    box-shadow: var(--shadow-md);
    /* collapsed state */
    display: flex;
    overflow: hidden;
    max-height: 0;
    padding-block: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      max-height 280ms var(--ease-out),
      padding-block 280ms var(--ease-out),
      opacity 200ms var(--ease),
      visibility 0s linear 280ms;
  }
  .site-nav.is-open {
    max-height: 70vh;
    overflow-y: auto;
    padding-block: var(--s-2) var(--s-4);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition:
      max-height 320ms var(--ease-out),
      padding-block 320ms var(--ease-out),
      opacity 220ms var(--ease),
      visibility 0s;
  }
  .site-nav a {
    padding: var(--s-3) var(--s-2);
    min-height: var(--touch);
    display: flex; align-items: center;
    border-bottom: 1px solid var(--rule);
    border-radius: var(--r-sm);
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  }
  .site-nav a:last-child { border-bottom: 0; }
  .site-nav a:hover, .site-nav a:active { background: var(--paper-2); color: var(--ink); }
  .site-nav a::after { display: none; }
  /* Dim backdrop behind the open drawer (injected element, see main.js). */
  .nav-scrim {
    position: fixed; inset: 0; z-index: 40;
    background: oklch(22% 0.012 70 / 0.34);
    opacity: 0; pointer-events: none;
    transition: opacity 220ms var(--ease);
  }
  .nav-scrim.is-on { opacity: 1; pointer-events: auto; }
}
:root[data-theme="dark"] .nav-scrim { background: oklch(0% 0 0 / 0.5); }
/* Lock background scroll while the mobile drawer is open. */
body.nav-open { overflow: hidden; }

/* ================================================================ HERO */
.hero { padding-block: var(--s-8) var(--s-6); border-bottom: 1px solid var(--rule); }
@media (max-width: 600px) { .hero { padding-block: var(--s-6) var(--s-5); } }
.hero__inner { max-width: 820px; }
.hero h1 {
  font-size: clamp(2.4rem, 6.5vw, 4.03rem);
  margin-block: var(--s-3) var(--s-4);
}
.hero h1 em { font-style: italic; color: var(--accent-ink); }
.hero p.lede { font-size: var(--t-md); color: var(--ink-2); max-width: 60ch; }
.hero__meta {
  display: flex; flex-wrap: wrap; gap: var(--s-5);
  margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--rule);
}
.hero__meta span { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); letter-spacing: 0.04em; }
.hero__meta b { color: var(--ink); font-weight: 600; }

/* Search box (homepage live filter) */
.toolsearch { margin-top: var(--s-6); position: relative; max-width: 560px; }
.toolsearch input {
  width: 100%;
  min-height: 52px;
  padding: var(--s-4) var(--s-5) var(--s-4) 3rem;
  font-size: max(16px, var(--t-md)); /* >=16px avoids iOS focus-zoom */
  background: var(--paper-2);
  border: 1.5px solid var(--rule-strong);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.toolsearch input:focus { border-color: var(--accent); background: var(--paper); box-shadow: 0 0 0 3px var(--accent-soft); }
.toolsearch:focus-within .toolsearch__icon { color: var(--accent-ink); }
.toolsearch input::placeholder { color: var(--ink-3); }
.toolsearch__icon {
  position: absolute; left: var(--s-4); top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; pointer-events: none; color: var(--ink-3);
}
.toolsearch__count {
  font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3);
  margin-top: var(--s-2); letter-spacing: 0.04em;
}

/* ====================================================== TOOLS DIRECTORY */
.section { padding-block: var(--s-7); }
.section__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-3) var(--s-4); margin-bottom: var(--s-5); }
.section__head h2 { font-size: var(--t-xl); }

.category { margin-bottom: var(--s-7); }
.category__title {
  display: flex; align-items: baseline; gap: var(--s-3);
  padding-bottom: var(--s-3); margin-bottom: var(--s-5);
  border-bottom: 1.5px solid var(--ink);
}
.category__title h3 { font-size: var(--t-lg); }
.category__title .num { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); }

.tools-grid {
  display: grid;
  /* min(100%, 248px) keeps a single card from forcing horizontal overflow on
     narrow phones; the grid fluidly grows 1→2→3→4 columns as width allows. */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 248px), 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
}
.tool-card {
  display: flex; flex-direction: column; gap: var(--s-3);
  background: var(--paper);
  padding: var(--s-5);
  min-height: var(--touch);
  text-decoration: none; color: inherit;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  position: relative;
  isolation: isolate;
}
.tool-card:hover { background: var(--paper-2); }
/* Subtle accent edge slides in on hover/focus — a print-margin cue, reduced-motion safe. */
.tool-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 2px;
  background: var(--accent); transform: scaleY(0); transform-origin: top;
  transition: transform var(--dur) var(--ease-out);
}
.tool-card:hover::before, .tool-card:focus-visible::before { transform: scaleY(1); }
.tool-card:focus-visible { outline-offset: -2.5px; z-index: 1; }
.tool-card:active { background: var(--paper-3); }
.tool-card__mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1.5px solid var(--ink); border-radius: var(--r-sm);
  font-family: var(--font-display); font-size: var(--t-md); font-weight: 600;
  color: var(--ink); background: var(--paper-2);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.tool-card:hover .tool-card__mark,
.tool-card:focus-visible .tool-card__mark { border-color: var(--accent); color: var(--accent-ink); }
.tool-card__name { font-family: var(--font-display); font-size: var(--t-md); font-weight: 560; letter-spacing: -0.01em; }
.tool-card__desc { font-size: var(--t-sm); color: var(--ink-2); line-height: 1.5; flex: 1; }
.tool-card__arrow { position: absolute; top: var(--s-5); right: var(--s-5); color: var(--ink-3); transition: transform var(--dur) var(--ease-out), color var(--dur) var(--ease); }
.tool-card:hover .tool-card__arrow,
.tool-card:focus-visible .tool-card__arrow { transform: translate(2px, -2px); color: var(--accent-ink); }

.tag {
  display: inline-block; align-self: flex-start;
  font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3);
  border: 1px solid var(--rule-strong); border-radius: 999px;
  padding: 2px var(--s-2);
}
.tag--soon { color: var(--accent-ink); border-color: var(--accent); }

/* ----- Recently-used / Popular rail (homepage, injected by main.js) ----- */
.tool-rail { margin-bottom: var(--s-7); }
.tool-rail:not(.is-ready) { display: none; }
.tool-rail__head {
  display: flex; align-items: baseline; gap: var(--s-3);
  padding-bottom: var(--s-3); margin-bottom: var(--s-4);
  border-bottom: 1.5px solid var(--accent);
}
.tool-rail__head h2 {
  font-size: var(--t-lg);
  display: inline-flex; align-items: baseline; gap: 0.5ch;
}
.tool-rail__head .lbl {
  font-family: var(--font-mono); font-size: var(--t-xs);
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3);
}
/* Rail cards: compact horizontal chips that still echo the tool-card look. */
.tool-rail__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
}
.rail-card {
  display: flex; align-items: center; gap: var(--s-3);
  background: var(--paper-2);
  padding: var(--s-4);
  min-height: var(--touch);
  text-decoration: none; color: inherit;
  transition: background var(--dur) var(--ease);
}
.rail-card:hover, .rail-card:focus-visible { background: var(--paper-3); }
.rail-card:focus-visible { outline-offset: -2.5px; }
.rail-card:active { background: var(--rule); }
.rail-card .rail-card__mark {
  flex: none;
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 1.5px solid var(--rule-strong); border-radius: var(--r-sm);
  font-family: var(--font-display); font-size: var(--t-base); font-weight: 600;
  color: var(--ink-2);
}
.rail-card:hover .rail-card__mark { border-color: var(--accent); color: var(--accent-ink); }
.rail-card .rail-card__name {
  font-family: var(--font-display); font-size: var(--t-base); font-weight: 560;
  letter-spacing: -0.01em; line-height: 1.2;
}

.tools-empty {
  display: none; text-align: center; padding: var(--s-7);
  color: var(--ink-3); font-family: var(--font-mono); font-size: var(--t-sm);
}
.tools-empty.is-visible { display: block; }
/* When filtering hides every card in a category, JS hides the whole block. */
.category[hidden] { display: none; }
/* The HTML hidden attribute must always win over component display rules
   (.field/.field-row set display, which would otherwise override it). Tools
   that toggle alternate inputs (BMI units, sales-tax modes, etc.) rely on this. */
[hidden] { display: none !important; }

/* ================================================ TOOL-PAGE LAYOUT/SHELL */
.tool-shell { padding-block: var(--s-6) var(--s-8); }

.breadcrumb { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); margin-bottom: var(--s-5); letter-spacing: 0.04em; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s-2); padding: 0; }
.breadcrumb a { text-decoration: none; color: var(--ink-2); padding-block: var(--s-2); transition: color var(--dur) var(--ease); }
.breadcrumb a:hover, .breadcrumb a:focus-visible { color: var(--accent-ink); }
.breadcrumb li + li::before { content: "/"; margin-right: var(--s-2); color: var(--rule-strong); }
.breadcrumb [aria-current="page"] { color: var(--ink); }

.tool-header { max-width: 70ch; margin-bottom: var(--s-6); }
.tool-header h1 { font-size: clamp(2rem, 5vw, 3.3rem); margin-block: var(--s-2) var(--s-4); }
.tool-header p { font-size: var(--t-md); color: var(--ink-2); }

/* E-E-A-T byline — "built & reviewed by" on finance/health pages */
.byline { display: flex; align-items: center; gap: 0.55em; font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); letter-spacing: 0.02em; margin-block: var(--s-3) 0; }
.byline a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--rule); }
.byline a:hover { color: var(--accent); }
.byline::before { content: "AR"; display: inline-flex; align-items: center; justify-content: center; width: 1.7em; height: 1.7em; border-radius: 50%; flex: none; font-size: 0.78em; font-weight: 600; letter-spacing: 0; color: var(--accent-ink, #fff); background: linear-gradient(135deg, var(--ink-2), var(--ink)); }
.prose .byline { margin-block: calc(-1 * var(--s-4)) var(--s-6); }

/* Snippet-target answer line on single-pair converter pages */
.lead-answer { font-size: var(--t-lg); line-height: 1.5; color: var(--ink); border-left: 3px solid var(--accent); padding: 0.15rem 0 0.15rem 1rem; margin-block: var(--s-3) var(--s-4); }
.lead-answer strong { font-weight: 600; }

/* Popular-conversions quick links (homepage + converter hub) */
.convlinks { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: var(--s-4); }
.convlinks a { font-family: var(--font-mono); font-size: var(--t-sm); color: var(--ink-2); background: var(--paper-2); border: 1px solid var(--rule); border-radius: 999px; padding: 0.45rem 0.9rem; text-decoration: none; transition: border-color .15s, color .15s; }
.convlinks a:hover { color: var(--ink); border-color: var(--accent); }

.tool-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-6);
  align-items: start;
}
@media (max-width: 880px) {
  .tool-layout { grid-template-columns: 1fr; gap: var(--s-5); }
}

.tool-panel {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-6);
}
.tool-panel__title {
  font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--s-5);
  padding-bottom: var(--s-3); border-bottom: 1px solid var(--rule);
}

/* ---------------------------------------------------------- FORM CONTROLS */
.field { display: block; margin-bottom: var(--s-5); }
.field > label, .field__label {
  display: block; font-size: var(--t-sm); font-weight: 600; color: var(--ink);
  margin-bottom: var(--s-2);
}
.field__hint { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); font-weight: 400; letter-spacing: 0.02em; }
.field input[type="text"],
.field input[type="number"],
.field input[type="email"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  min-height: var(--touch);
  padding: var(--s-3) var(--s-4);
  font-size: max(16px, var(--t-base)); /* >=16px keeps iOS from zooming on focus */
  background: var(--paper);
  border: 1.5px solid var(--rule-strong);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  font-variant-numeric: tabular-nums;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
/* Keyboard users still get the global focus-visible ring; pointer-focus uses the
   softer inset glow above (the outline only appears for :focus-visible). */
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23555' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--s-4) center;
  padding-right: 2.5rem; cursor: pointer;
}
/* input with a leading unit / currency adornment */
.field__group { display: flex; align-items: stretch; }
.field__group .field__adorn {
  display: grid; place-items: center; padding-inline: var(--s-4);
  background: var(--paper-3); border: 1.5px solid var(--rule-strong); border-right: 0;
  border-radius: var(--r-md) 0 0 var(--r-md);
  font-family: var(--font-mono); font-size: var(--t-sm); color: var(--ink-2);
}
.field__group input { border-radius: 0 var(--r-md) var(--r-md) 0 !important; }
.field__group .field__adorn--suffix { border: 1.5px solid var(--rule-strong); border-left: 0; border-radius: 0 var(--r-md) var(--r-md) 0; }
.field__group .field__adorn--suffix + input { border-radius: var(--r-md) 0 0 var(--r-md) !important; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
@media (max-width: 460px) { .field-row { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  font-family: var(--font-body); font-size: var(--t-sm); letter-spacing: 0;
  font-weight: 600; text-transform: none;
  min-height: var(--touch);
  padding: var(--s-3) var(--s-5);
  background: var(--paper); color: var(--ink);
  border: 1.5px solid var(--ink); border-radius: var(--r-md);
  cursor: pointer; text-decoration: none;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:active { transform: translateY(1px) scale(0.99); }
/* --accent-ink (darker orange) so white label clears WCAG AA (was --accent = 3.4:1, failed) */
.btn-primary { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); transform: translateY(-1px); }
.btn--full { width: 100%; }
.btn--ghost { border-color: var(--rule-strong); }
.btn--ghost:hover { background: var(--paper-3); color: var(--ink); }

/* ===================================================== RESULT WORKSHEET CARD */
.result-card {
  background: var(--paper);
  border: 1px solid var(--ink);
  border-top: 3px solid var(--accent); /* the one orange "here's your answer" moment */
  border-radius: var(--r-md);
  overflow: hidden;
  position: sticky; top: 84px;
}
@media (max-width: 880px) { .result-card { position: static; } }
/* Tighter padding on small phones so panels/worksheet don't feel cramped at the
   edges while still leaving breathing room. */
@media (max-width: 480px) {
  .tool-panel { padding: var(--s-5) var(--s-4); }
  .result-primary { padding: var(--s-5) var(--s-4) var(--s-4); }
  .result-rows { padding: var(--s-3) var(--s-4) var(--s-4); }
  .result-card__head,
  .result-output,
  .result-actions,
  .result-note { padding-inline: var(--s-4); }
  .result-actions .btn { flex: 1 1 auto; }
}
.result-card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-4) var(--s-5);
  background: transparent; color: var(--ink);
  border-bottom: 1.5px solid var(--ink);
}
.result-card__head .label { font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.result-card__head .stamp { font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: 0.08em; color: var(--ink-3); }

.result-primary {
  padding: var(--s-6) var(--s-5) var(--s-5);
  border-bottom: 1px dashed var(--rule-strong);
  text-align: left;
}
.result-primary .result-primary__label { font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.result-primary .result-primary__value {
  font-family: var(--font-mono); font-weight: 600;
  font-size: clamp(2.15rem, 7vw, 2.95rem); line-height: 1;
  letter-spacing: -0.01em; color: var(--ink);
  margin-top: var(--s-2); font-variant-numeric: tabular-nums slashed-zero;
}
.result-primary .result-primary__value .unit { color: var(--accent-ink); font-size: 0.5em; font-weight: 500; }
.result-primary .result-primary__sub { font-size: var(--t-sm); color: var(--ink-2); margin-top: var(--s-2); }

.result-rows { padding: var(--s-4) var(--s-5) var(--s-5); }
.result-row {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px dotted var(--rule-strong);
}
.result-row:last-child { border-bottom: 0; }
.result-row .k { font-size: var(--t-sm); color: var(--ink-2); }
.result-row .k small { display: block; font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); }
.result-row .v { font-family: var(--font-mono); font-size: var(--t-base); font-variant-numeric: tabular-nums; color: var(--ink); text-align: right; word-break: break-word; }
.result-row--total { border-top: 1.5px solid var(--ink); border-bottom: 0; margin-top: var(--s-2); padding-top: var(--s-4); }
.result-row--total .k { font-weight: 700; color: var(--ink); font-size: var(--t-base); }
.result-row--total .v { font-size: var(--t-md); font-weight: 600; }
.result-row .v.pos { color: var(--good); }
.result-row .v.neg { color: var(--bad); }

.result-note {
  padding: var(--s-3) var(--s-5) var(--s-5);
  font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3);
  letter-spacing: 0.02em; line-height: 1.6;
}
.result-note::before { content: "→ "; color: var(--accent-ink); }

/* Output area for text-builder tools (prompt builders, generators) */
.result-output {
  padding: var(--s-5);
  border-bottom: 1px dashed var(--rule-strong);
}
.result-output pre {
  font-family: var(--font-mono); font-size: var(--t-sm); line-height: 1.7;
  white-space: pre-wrap; word-break: break-word; color: var(--ink);
  background: var(--paper-2); border: 1px solid var(--rule);
  border-radius: var(--r-md); padding: var(--s-4); max-height: 360px; overflow: auto;
}
.result-actions { display: flex; gap: var(--s-3); padding: var(--s-4) var(--s-5) var(--s-5); flex-wrap: wrap; }
.copied-flash { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--good); align-self: center; opacity: 0; transition: opacity var(--dur) var(--ease); }
.copied-flash.is-on { opacity: 1; }

/* ============================================================ EXPLAINERS */
.how-it-works { margin-top: var(--s-8); max-width: var(--wrap-narrow); }
.how-it-works h2 { font-size: var(--t-xl); margin-bottom: var(--s-4); }
.how-it-works h3 { font-size: var(--t-md); margin-block: var(--s-5) var(--s-2); }
.how-it-works p { color: var(--ink-2); margin-bottom: var(--s-3); }
.how-it-works ul, .how-it-works ol { color: var(--ink-2); padding-left: var(--s-5); margin-bottom: var(--s-4); }
.how-it-works li { margin-bottom: var(--s-2); }
/* Cap reading measure to ~68ch (was ~95ch) on text only — tables, figures & formulas stay full-width */
.how-it-works > p, .how-it-works > ul, .how-it-works > ol, .how-it-works > details { max-width: 68ch; }
.how-it-works p, .prose p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; }

.formula {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  padding: var(--s-5);
  margin-block: var(--s-4);
}
.formula .formula__label { font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--s-3); }
.formula code, .formula .eq {
  display: block; font-family: var(--font-mono); font-size: var(--t-base);
  line-height: 1.8; color: var(--ink); font-variant-numeric: tabular-nums;
  white-space: pre-wrap; word-break: break-word;
}
.formula .eq + .eq { margin-top: var(--s-3); }
.formula .where { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); margin-top: var(--s-3); line-height: 1.7; }

/* ========================================================== RELATED TOOLS */
.related-tools { margin-top: var(--s-8); padding-top: var(--s-6); border-top: 1.5px solid var(--ink); }
.related-tools h2 { font-size: var(--t-lg); margin-bottom: var(--s-4); }
.related-tools ul { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; }
.related-tools li { background: var(--paper); }
.related-tools a {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-4); min-height: var(--touch); text-decoration: none; color: var(--ink);
  font-weight: 500; transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.related-tools a:hover, .related-tools a:focus-visible { background: var(--paper-2); color: var(--accent-ink); }
.related-tools a:focus-visible { outline-offset: -2.5px; }
.related-tools a:hover span.arr { transform: translateX(2px); }
.related-tools a span.arr { color: var(--ink-3); transition: transform var(--dur) var(--ease-out); }

/* ================================================================ AD SLOT */
.ad-slot {
  margin-block: var(--s-7);
  padding: var(--s-3);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r-md);
  background: var(--paper-2);
  text-align: center;
}
.ad-slot::before {
  content: "Advertisement";
  display: block;
  font-family: var(--font-mono); font-size: 0.625rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-3);
  margin-bottom: var(--s-2);
}
/* Reserve vertical space so ad loads never shift layout (Core Web Vitals/CLS).
   ~250px mobile, ~280px desktop — covers common AdSense in-content unit heights.
   The ~26px is the label + dashed padding above the <ins> render box. */
.ad-slot { min-height: 276px; }
.ad-slot ins { display: block; min-height: 250px; }
.ad-slot--inline { max-width: 728px; margin-inline: auto; }
@media (min-width: 768px) {
  .ad-slot { min-height: 306px; }
  .ad-slot ins { min-height: 280px; }
}

/* ============================================================ PROSE PAGES */
.prose-shell { padding-block: var(--s-7) var(--s-8); }
.prose { max-width: var(--wrap-narrow); }
/* Cap long-form reading measure; tables, figures & charts keep the full column */
.prose > p, .prose > ul, .prose > ol, .prose > h2, .prose > h3, .prose > details, .prose > .lead-answer { max-width: 68ch; }
.prose h1 { font-size: clamp(2rem, 5vw, 3.3rem); margin-bottom: var(--s-3); }
.prose .updated { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); letter-spacing: 0.04em; margin-bottom: var(--s-6); display: block; }
.prose h2 { font-size: var(--t-xl); margin-block: var(--s-6) var(--s-3); padding-top: var(--s-4); border-top: 1px solid var(--rule); }
.prose h3 { font-size: var(--t-md); margin-block: var(--s-4) var(--s-2); }
.prose p, .prose li { color: var(--ink-2); margin-bottom: var(--s-3); }
.prose ul, .prose ol { padding-left: var(--s-5); margin-bottom: var(--s-4); }
.prose a { color: var(--accent-ink); text-underline-offset: 3px; }
.prose strong { color: var(--ink); }

/* ---- Editorial tables (guides/blog). Bare <table> sits inside .table-wrap; the
   wrapper scrolls horizontally on narrow screens so wide tables never break the
   page layout, with a subtle edge fade hinting there's more to scroll. ---- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  margin-block: var(--s-5);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  /* keyboard users can scroll the region; expose it as such */
}
.table-wrap:focus-visible { outline: 2.5px solid var(--accent-ink); outline-offset: 2px; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-sm);
  min-width: 30rem; /* forces horizontal scroll rather than crushing columns */
}
.prose table th,
.prose table td {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
  vertical-align: top;
}
.prose table thead th {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--t-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper-2);
  border-bottom: 1.5px solid var(--ink);
  white-space: nowrap;
}
.prose table tbody tr:last-child td { border-bottom: 0; }
.prose table tbody tr:hover td { background: var(--paper-2); }
.prose table td:first-child { color: var(--ink); font-weight: 500; }
/* numeric cells read as figures */
.prose table td.mono, .prose table .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Contact form */
.contact-form { max-width: 520px; margin-top: var(--s-5); }
.contact-card {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-4); padding: var(--s-5); margin-top: var(--s-5);
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-lg);
}
.contact-card dt { font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--s-1); }
.contact-card dd { margin: 0; font-weight: 500; }
.contact-card a { color: var(--accent-ink); text-decoration: none; }

/* ================================================================ FOOTER */
.site-footer {
  margin-top: var(--s-9);
  border-top: 1.5px solid var(--ink);
  background: var(--paper-2);
  padding-block: var(--s-7) var(--s-6);
}
.site-footer__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-6); }
.site-footer__brand { max-width: 34ch; }
.site-footer__brand .wordmark { font-size: var(--t-lg); }
.site-footer__brand p { color: var(--ink-2); font-size: var(--t-sm); margin-top: var(--s-3); }
.site-footer nav { display: flex; gap: var(--s-7); flex-wrap: wrap; }
.site-footer .foot-col h4 { font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; margin-bottom: var(--s-3); }
.site-footer .foot-col ul { list-style: none; padding: 0; display: grid; gap: var(--s-2); }
.site-footer .foot-col a { text-decoration: none; color: var(--ink-2); font-size: var(--t-sm); transition: color var(--dur) var(--ease); display: inline-block; padding-block: 2px; }
.site-footer .foot-col a:hover, .site-footer .foot-col a:focus-visible { color: var(--accent-ink); }
@media (max-width: 560px) {
  .site-footer__top { gap: var(--s-6); }
  .site-footer nav { gap: var(--s-6); }
  .site-footer .foot-col ul { gap: var(--s-3); } /* roomier tap spacing on phones */
}
.site-footer__bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-3);
  margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--rule);
  font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); letter-spacing: 0.02em;
}
.site-footer__bottom .indep { color: var(--ink-2); }

/* Reveal on load (respects reduced-motion via the media query above) */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(12px); animation: reveal 0.55s var(--ease-out) both; }
  .reveal[data-delay="1"] { animation-delay: 0.07s; }
  .reveal[data-delay="2"] { animation-delay: 0.14s; }
  .reveal[data-delay="3"] { animation-delay: 0.21s; }
  .reveal[data-delay="4"] { animation-delay: 0.28s; }
  @keyframes reveal { to { opacity: 1; transform: none; } }

  /* Scroll-driven reading-progress hairline under the sticky header. Pure CSS,
     zero JS, and only painted when motion is allowed. */
  @supports (animation-timeline: scroll()) {
    .site-header::after {
      content: ""; position: absolute; left: 0; bottom: -1px; height: 2px;
      width: 100%; transform-origin: left; transform: scaleX(0);
      background: var(--accent);
      animation: header-progress linear both;
      animation-timeline: scroll(root);
    }
    @keyframes header-progress { to { transform: scaleX(1); } }
  }
}

/* ============================================================ PRINT / SAVE-AS-PDF
   Strips site chrome + ads so the browser's "Save as PDF" yields a clean result sheet.
   Powers the Print button in tool result cards; also works from the browser menu. */
@media print {
  .site-header, .site-footer, .nav-toggle, .site-nav, .breadcrumb,
  .rx-consent, .skip-link, .tool-rail, .related-tools, .convlinks,
  .result-actions, .export-actions, ins.adsbygoogle, .ad-slot,
  #theme-toggle, .theme-toggle { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  * { box-shadow: none !important; }
  main, .wrap, .tool-shell, .prose-shell { max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
  .result-card { border: 1px solid #999 !important; break-inside: avoid; }
  .result-card__head { background: #000 !important; color: #fff !important; }
  a[href]::after { content: ""; }            /* don't append raw URLs */
  table { page-break-inside: auto; width: 100%; }
  tr { break-inside: avoid; page-break-after: auto; }
  thead { display: table-header-group; }      /* repeat header on each printed page */
  .tool-header h1 { font-size: 22pt; }
  body::after {
    content: "Generated with the free calculator at rabixai.com";
    display: block; margin-top: 1.5rem; padding-top: 0.5rem;
    border-top: 1px solid #ccc; font-size: 9pt; color: #666;
  }
}

/* ===================================================== RESULT-FIRST ON MOBILE
   The answer is the product — show it above the input form on phones. */
@media (max-width: 880px) {
  .tool-layout > section[aria-label="Result"] { order: -1; }
}
/* Tabular figures utility for any live-updating number */
.tnum { font-variant-numeric: tabular-nums slashed-zero; }

/* ===================================================== TOOL ACTIONS (export + share)
   Injected by main.js into every tool's result card. Editorial/minimal:
   monochrome inline-SVG icons, no third-party social scripts. */
.tool-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--rule);
}
.ta-btn {
  display: inline-flex; align-items: center; gap: 0.4em;
  font-family: var(--font-body); font-size: var(--t-xs); font-weight: 600;
  color: var(--ink-2); background: var(--paper);
  border: 1px solid var(--rule-strong); border-radius: var(--r-sm);
  padding: 0.4rem 0.65rem; min-height: 34px; cursor: pointer;
  transition: color .12s var(--ease), border-color .12s var(--ease), background .12s var(--ease);
}
.ta-btn:hover { color: var(--ink); border-color: var(--ink); }
.ta-btn:active { transform: translateY(0.5px); }
.ta-btn svg { width: 15px; height: 15px; }
.ta-social { display: inline-flex; align-items: center; gap: 0.15rem; margin-left: auto; }
.ta-ico {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  color: var(--ink-3); border-radius: var(--r-sm); text-decoration: none;
  transition: color .12s var(--ease), background .12s var(--ease);
}
.ta-ico:hover { color: var(--ink); background: var(--paper-2); }
.ta-ico svg { width: 18px; height: 18px; }
.ta-social::before {
  content: "Share"; font-family: var(--font-body); font-size: var(--t-xs);
  color: var(--ink-3); margin-right: 0.3rem;
}
@media (max-width: 520px) {
  .ta-social { margin-left: 0; width: 100%; margin-top: 0.3rem; }
  .ta-btn span { display: none; }
  .ta-btn { padding: 0.4rem; }
}

/* Toast used by main.js tool actions (copy/CSV/share feedback) */
.rx-toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%) translateY(1rem); background: var(--ink); color: var(--paper); font-size: var(--t-sm); padding: 0.6rem 1rem; border-radius: var(--r-md); box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 1000; }
.rx-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
