/* =========================================================================
   123AgeCalculator — one stylesheet.

   Colour lives in the tokens at the top; the dark theme only redefines
   them. Light is the default whatever the device prefers: dark applies only
   when the reader has chosen it and theme.js has put .theme-dark on <html>
   (before the first paint).
   No web fonts: the system stack is fast, private and looks native.
   ========================================================================= */

:root {
  --ink: #0b2e33;            /* the brand's deep teal: header, result hero */
  --ink-2: #0d4148;
  --brand: #0d5c63;          /* buttons, links */
  --brand-hover: #0a4a50;
  --accent: #14a3ad;         /* the calendar's header band */
  --pop: #f97316;            /* the candle */
  --pop-ink: #9a3412;
  --gold: #fbbf24;           /* the flame */

  --bg: #f3f7f7;
  --bg-hero: #e4f1f1;
  --surface: #ffffff;
  --surface-2: #f7fafa;
  --text: #10282c;
  --muted: #4e6669;
  --faint: #7c9194;
  --line: #d6e3e4;
  --line-strong: #b9cdcf;
  --link: #0b6e77;
  --focus: #f97316;
  --tint: #e8f5f5;           /* highlighted rows, answer box */
  --pop-tint: #fff4ea;
  --danger: #b42318;
  --danger-tint: #fdecea;
  --shadow: 0 1px 2px rgba(11, 46, 51, .06), 0 6px 24px rgba(11, 46, 51, .07);
  --shadow-lg: 0 10px 40px rgba(11, 46, 51, .18);

  --radius: 16px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
          "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

:root.theme-dark {
  --ink: #061619;
  --ink-2: #0a2428;
  --brand: #2ab7c1;
  --brand-hover: #4ccbd4;
  --accent: #2ab7c1;
  --pop: #fb8a3c;
  --pop-ink: #fdba8c;
  --bg: #071b1e;
  --bg-hero: #0b262a;
  --surface: #0e2a2f;
  --surface-2: #11323a;
  --text: #e3f0f0;
  --muted: #a3bcbe;
  --faint: #7d999c;
  --line: #1f444a;
  --line-strong: #2d5b62;
  --link: #6fd6dd;
  --tint: #123a40;
  --pop-tint: #33200f;
  --danger: #ff8a7a;
  --danger-tint: #3a1814;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* --- Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 80px; }
html.modal-open { overflow: hidden; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 1rem/1.6 var(--font); -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
}
.site-main { flex: 1 0 auto; }
img, svg { max-width: 100%; }
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.5rem); font-weight: 800; }
h2 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.6rem); font-weight: 750; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }
small { font-size: .85em; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); border: 1px solid var(--line);
       border-radius: 6px; padding: .05em .35em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 24px; } }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-weight: 700;
}
.skip-link:focus { top: 12px; }

/* --- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: 44px; padding: .55em 1.1em; border-radius: 999px; border: 1px solid transparent;
  font: 650 1rem/1.2 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
:root.theme-dark .btn-primary { color: #04181b; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-lg { min-height: 52px; font-size: 1.06rem; padding: .65em 1.5em; }
.btn-sm { min-height: 38px; font-size: .9rem; padding: .4em .9em; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line-strong); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-pop { background: var(--pop); color: #fff; }
.btn-pop:hover { background: #ea580c; }
.btn-ghost-light { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn-ghost-light:hover { background: rgba(255, 255, 255, .2); }
.btn-chip {
  min-height: 48px; padding: 0 .9em; border-radius: var(--radius-sm); background: var(--surface-2);
  color: var(--brand); border-color: var(--line-strong); font-size: .92rem;
}
.btn-chip:hover { border-color: var(--brand); }

/* --- Header ---------------------------------------------------------------- */
.site-header { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 40;
               box-shadow: 0 1px 0 rgba(255, 255, 255, .06); }
.header-inner { display: flex; align-items: center; gap: 12px; min-height: 62px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.logo-mark { flex: none; display: block; }
.logo-text { font-size: 1.16rem; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.logo-text b { color: #5fe0e7; font-weight: 800; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav-link { color: #d8eeef; text-decoration: none; font-weight: 600; font-size: .95rem; padding: 8px 12px; border-radius: 999px; }
.nav-link:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.nav-menu { position: relative; }
.nav-menu > summary {
  list-style: none; cursor: pointer; color: #fff; font-weight: 650; font-size: .95rem;
  padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .1); display: flex; align-items: center; gap: 6px;
}
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu > summary:hover, .nav-menu[open] > summary { background: rgba(255, 255, 255, .18); }
.caret { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
         transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.nav-menu[open] .caret { transform: translateY(1px) rotate(-135deg); }
.nav-pop {
  position: absolute; right: 0; top: calc(100% + 10px); width: min(860px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 18px; z-index: 50;
}
.nav-groups { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 18px; }
.nav-group-title { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint);
                   font-weight: 750; margin: 0 0 6px; }
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-group a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin: 0 -8px; border-radius: 8px;
               color: var(--text); text-decoration: none; font-size: .93rem; font-weight: 550; line-height: 1.3; }
.nav-group a:hover { background: var(--tint); }
.nav-group a .icon { color: var(--accent); flex: none; }
.nav-extra { display: flex; flex-wrap: wrap; gap: 6px 20px; border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.nav-extra a { font-weight: 650; text-decoration: none; }
.theme-btn {
  flex: none; width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .22);
  background: transparent; color: #fff; cursor: pointer; display: grid; place-items: center;
}
.theme-btn:hover { background: rgba(255, 255, 255, .1); }
.theme-btn .i-sun { display: none; }
:root.theme-dark .theme-btn .i-sun { display: block; }
:root.theme-dark .theme-btn .i-moon { display: none; }
.theme-btn { display: none; }
:root.js .theme-btn { display: grid; }

@media (max-width: 859px) {
  .nav-groups { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 719px) {
  .header-inner { min-height: 56px; gap: 8px; }
  .logo-text { font-size: 1.02rem; }
  .logo-mark { width: 30px; height: 30px; }
  .nav-link { display: none; }
  .nav-menu { position: static; }
  .nav-pop { position: absolute; left: 8px; right: 8px; width: auto; top: calc(100% + 6px);
             max-height: calc(100vh - 80px); overflow-y: auto; }
  .site-header { position: relative; }
}
@media (max-width: 380px) {
  .logo-text { font-size: .94rem; }
  .nav-menu > summary { padding: 8px 10px; }
}

/* --- Breadcrumbs ----------------------------------------------------------- */
.crumbs ol { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: .86rem; color: var(--muted); }
.crumbs li:not(:last-child)::after { content: "/"; margin-left: 6px; color: var(--faint); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--link); text-decoration: underline; }

/* --- Calculator hero ------------------------------------------------------- */
.calc-hero { background: linear-gradient(180deg, var(--bg-hero), var(--bg)); padding: 22px 0 34px; }
.calc-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.calc-icon { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
             background: var(--ink); color: #5fe0e7; box-shadow: var(--shadow); margin-top: 2px; }
.calc-head h1 { margin: 0 0 4px; }
.calc-sub { margin: 0; color: var(--muted); font-size: 1.04rem; max-width: 62ch; }
.calc-grid { display: grid; gap: 18px; align-items: start; }
@media (min-width: 900px) {
  .calc-grid { grid-template-columns: minmax(330px, 5fr) 7fr; gap: 24px; }
  .page-home .calc-hero { padding-top: 30px; }
}
@media (max-width: 560px) {
  .calc-head { gap: 12px; }
  .calc-icon { width: 44px; height: 44px; border-radius: 12px; }
  .calc-icon .icon { width: 22px; height: 22px; }
  .calc-sub { font-size: .98rem; }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.form-card { padding: 20px; }
@media (min-width: 900px) { .form-card { padding: 24px; position: sticky; top: 82px; } }

/* --- Form ------------------------------------------------------------------ */
.fields { display: grid; gap: 16px; }
@media (min-width: 480px) {
  .fields { grid-template-columns: 1fr 1fr; }
  .fields > .field { grid-column: 1 / -1; }
  .fields > .field:has(select), .fields > .field:has(input[type="number"]), .fields > .field:has(input[type="time"]) { grid-column: auto; }
  .fields > .span-2 { grid-column: 1 / -1 !important; }
}
.field { min-width: 0; margin: 0; padding: 0; border: 0; }
.field > label, .field > legend { display: block; font-weight: 650; font-size: .95rem; margin-bottom: 6px; padding: 0; }
.opt { font-weight: 450; color: var(--faint); }
.field-help { display: block; color: var(--muted); font-size: .84rem; margin-top: 6px; line-height: 1.45; }
.field input, .field select {
  width: 100%; min-height: 48px; padding: 10px 12px; font: 500 1rem/1.3 var(--font); color: var(--text);
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
.field input[type="date"], .field input[type="time"] { font-variant-numeric: tabular-nums; }
.field input::-webkit-date-and-time-value { text-align: left; }
.field input:hover, .field select:hover { border-color: var(--muted); }
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: 15px; top: 50%; width: 8px; height: 8px; pointer-events: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg);
}
.select-wrap select { padding-right: 38px; cursor: pointer; }
.input-unit { position: relative; }
.input-unit input { padding-right: 70px; }
.input-unit span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: .92rem; pointer-events: none; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; min-width: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label {
  flex: 1 1 auto; text-align: center; min-height: 44px; display: flex; align-items: center; justify-content: center;
  padding: 8px 12px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer;
  font-weight: 600; font-size: .93rem; background: var(--surface); color: var(--text); line-height: 1.25;
}
.seg label:hover { border-color: var(--muted); }
.seg input:checked + label { background: var(--brand); border-color: var(--brand); color: #fff; }
:root.theme-dark .seg input:checked + label { color: #04181b; }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.form-actions .btn-primary { flex: 1 1 auto; }
:root.js .form-actions .btn-primary { flex: 1 1 auto; }

/* --- Result ---------------------------------------------------------------- */
.result-slot { min-width: 0; }
.result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
          overflow: hidden; transition: opacity .15s; }
.result-slot[aria-busy="true"] .result { opacity: .6; }
.result-hero {
  background: radial-gradient(120% 140% at 100% 0%, #14a3ad55 0%, transparent 55%), linear-gradient(135deg, #0b2e33, #0d4f56);
  color: #fff; padding: 22px 22px 18px;
}
.result-label { margin: 0 0 2px; font-size: .8rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 750; color: #9be7ea; }
.result-big { margin: 0; font-size: clamp(1.9rem, 1.3rem + 2.8vw, 2.9rem); font-weight: 820; line-height: 1.12;
              letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-wrap: balance; }
.result-sub { margin: 8px 0 0; color: #cfe9ea; font-size: .97rem; }
.result-sub strong { color: #fff; }
.result-sub time { white-space: nowrap; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.result-actions .btn { min-height: 40px; }
/* Grid lines drawn by each tile (inset right and bottom edges), so an
   incomplete last row leaves plain surface rather than a grey block. The
   negative margins tuck the outer lines under the box's own border. */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0; margin: 0 -1px -1px 0; }
.tile { background: var(--surface); padding: 14px 16px; min-width: 0; box-shadow: inset -1px -1px 0 var(--line); }
.tile dt { font-size: .78rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.tile dd { margin: 0; font-size: 1.22rem; font-weight: 750; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile dd > span { font-size: .8em; font-weight: 600; color: var(--muted); }
.tile dd small { display: block; font-size: .8rem; font-weight: 450; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.tile-pop { background: var(--pop-tint); }
.tile-pop dt { color: var(--pop-ink); }
.result-section { position: relative; padding: 18px 20px 6px; border-top: 1px solid var(--line); background: var(--surface); }
.result-section h3 { font-size: 1.02rem; margin-bottom: 10px; }
.result-section .note { font-size: .84rem; color: var(--muted); margin: 10px 0 14px; }
.result-empty { padding: 34px 24px; text-align: center; border-style: dashed; border-width: 2px; box-shadow: none; background: var(--surface-2); }
.empty-art { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center;
             background: var(--tint); color: var(--accent); }
.empty-title { font-size: 1.15rem; font-weight: 700; margin: 0 0 6px; }
.empty-sub { color: var(--muted); font-size: .92rem; margin: 0 auto; max-width: 40ch; }
@media (max-width: 899px) {
  .result-empty { padding: 18px 16px; display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; text-align: left; align-items: center; }
  .empty-art { width: 52px; height: 52px; margin: 0; grid-row: span 2; }
  .empty-art .icon { width: 28px; height: 28px; }
  .empty-title { font-size: 1rem; margin: 0; }
  .empty-sub { font-size: .85rem; margin: 0; }
}
.result-error { padding: 18px 20px; background: var(--danger-tint); border-color: color-mix(in srgb, var(--danger) 40%, transparent); box-shadow: none; }
.error-title { display: flex; gap: 10px; align-items: flex-start; margin: 0; color: var(--danger); font-weight: 650; }
.error-title .icon { flex: none; margin-top: 1px; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px;
        background: var(--pop-tint); color: var(--pop-ink); vertical-align: 1px; margin-left: 4px; }

.numbers { list-style: none; margin: 0 0 6px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.numbers li { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.n-val { display: block; font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.n-key { display: block; font-weight: 600; font-size: .9rem; line-height: 1.35; }
.numbers small { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }

.life-grid-wrap { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.life-grid { display: block; width: 100%; height: auto; }
.lw-f { fill: var(--line); }
.lw-p { fill: var(--accent); }
.lw-now { fill: var(--pop); }
.lw-label { font: 600 6px var(--font); fill: var(--faint); text-anchor: end; }

/* --- Tables ---------------------------------------------------------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 1em; border: 1px solid var(--line); border-radius: 12px; }
.data-table { width: 100%; border-collapse: collapse; font-size: .93rem; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table thead th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; white-space: nowrap; }
.data-table tbody th { font-weight: 650; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table tr.is-next > * { background: var(--tint); }
.data-table tr.is-next > th { box-shadow: inset 3px 0 0 var(--accent); }
.data-table tr.is-past > * { color: var(--faint); }
.data-table small { color: var(--muted); }
.work-table td, .work-table th { text-align: right; font-family: var(--mono); }
.work-table th:first-child { text-align: left; font-family: var(--font); }

/* --- Card grid of calculators ---------------------------------------------- */
.more-calcs { padding: 6px 0 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; }
.section-head a { font-weight: 650; text-decoration: none; white-space: nowrap; }
.calc-cards { list-style: none; margin: 0 0 1.5em; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.calc-cards li { margin: 0; }
.calc-card {
  display: flex; gap: 12px; align-items: flex-start; height: 100%; padding: 14px 16px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.calc-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.calc-card-icon { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--tint); color: var(--brand); }
.calc-card-text strong { display: block; font-size: 1rem; line-height: 1.3; }
.calc-card-text small { display: block; color: var(--muted); font-size: .86rem; line-height: 1.4; margin-top: 2px; }

/* --- Below the tool: article + aside --------------------------------------- */
.below { padding: 10px 16px 40px; }
.below-grid { display: grid; gap: 28px; }
@media (min-width: 960px) {
  .below-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; }
  .below-aside { position: sticky; top: 82px; align-self: start; }
}
.below-aside { display: grid; gap: 16px; align-content: start; }
.below-aside .card { padding: 18px 20px; }
.below-aside h2 { font-size: 1.05rem; margin-bottom: 12px; }

.prose { max-width: 74ch; font-size: 1.04rem; }
.prose h2 { margin-top: 1.8em; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: .4em; }
.prose li::marker { color: var(--accent); }
.prose .table-scroll { margin: 1.2em 0; }
.prose .note { font-size: .92rem; color: var(--muted); }
.answer { background: var(--tint); border-left: 4px solid var(--accent); border-radius: 0 12px 12px 0; padding: 16px 18px 2px; margin-bottom: 1.5em; }
.answer p { margin-bottom: .9em; }

.example { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 16px 18px; margin: 0 0 1.6em; box-shadow: var(--shadow); }
.example-title { display: flex; align-items: center; gap: 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 750; color: var(--muted); margin: 0 0 10px; }
.example-title .icon { color: var(--accent); }
.example-in { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 8px; font-size: .95rem; }
.example-in b { font-weight: 650; color: var(--muted); }
.example-out { font-size: 1.1rem; margin: 0 0 8px; }
.example-note { color: var(--muted); font-size: .95rem; }
.example-try { font-weight: 650; text-decoration: none; }
.example-try:hover { text-decoration: underline; }

.steps { counter-reset: step; list-style: none; padding: 0 !important; }
.steps li { counter-increment: step; position: relative; padding: 2px 0 2px 44px; margin-bottom: 12px; min-height: 30px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  background: var(--ink); color: #fff; font-weight: 750; font-size: .9rem; display: grid; place-items: center;
}

.faq { border-top: 1px solid var(--line); margin-bottom: 1.4em; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 14px 36px 14px 0; font-weight: 700; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 6px; top: 50%; width: 9px; height: 9px; margin-top: -7px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s;
}
.faq details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq-a { padding: 0 0 6px; color: var(--muted); }
.faq-a p { color: var(--text); }
.doc-note { color: var(--faint); font-size: .88rem; margin-top: 1.5em; }

.facts dl { margin: 0; display: grid; gap: 10px; }
.facts dl > div { display: grid; gap: 1px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.facts dl > div:last-child { border-bottom: 0; padding-bottom: 0; }
.facts dt { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700; }
.facts dd { margin: 0; font-weight: 600; font-size: .95rem; }
.related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.related a { display: flex; gap: 10px; align-items: flex-start; padding: 8px; margin: 0 -8px; border-radius: 10px; text-decoration: none; color: var(--text); }
.related a:hover { background: var(--tint); }
.rel-icon { flex: none; width: 32px; height: 32px; border-radius: 9px; background: var(--tint); color: var(--brand); display: grid; place-items: center; }
.related strong { display: block; font-size: .95rem; line-height: 1.3; }
.related small { display: block; color: var(--muted); font-size: .82rem; line-height: 1.35; }
.share-card { background: linear-gradient(135deg, var(--ink), #0d4f56) !important; color: #fff; border: 0 !important; }
.share-card h2 { color: #fff; }
.share-card p { color: #cfe9ea; font-size: .93rem; }
.share-card .btn-primary { background: var(--pop); color: #fff; width: 100%; }
.share-card .btn-primary:hover { background: #ea580c; }

/* --- Content pages --------------------------------------------------------- */
.doc { max-width: 860px; padding-top: 24px; padding-bottom: 48px; }
.doc-head { margin-bottom: 24px; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.doc-body { max-width: none; }
.doc .calc-cards { margin-bottom: 2em; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; margin: 0 0 1.6em; }
.toc-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 750; color: var(--muted); margin: 0 0 6px; }
.toc ol { columns: 2; column-gap: 28px; margin: 0; }
.toc li { break-inside: avoid; }
@media (max-width: 560px) { .toc ol { columns: 1; } }
.sources li { font-size: .95rem; }
.doc-404 { max-width: 1180px; }
.big-404 { font-size: clamp(4rem, 3rem + 6vw, 7rem); font-weight: 900; line-height: 1; margin: 0 0 8px; color: var(--accent); letter-spacing: -.04em; }

/* --- Footer ---------------------------------------------------------------- */
.site-footer { background: var(--ink); color: #c4dcdd; margin-top: 30px; font-size: .93rem; }
.site-footer a { color: #e8f6f6; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-grid { display: grid; gap: 28px; padding-top: 40px; padding-bottom: 28px; grid-template-columns: 1fr 1fr; }
.footer-brand { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .footer-grid { grid-template-columns: 1.6fr repeat(4, 1fr); }
  .footer-brand { grid-column: auto; }
}
.footer-brand p { margin: 12px 0 0; max-width: 42ch; }
.footer-privacy { display: flex; gap: 8px; align-items: flex-start; color: #9fc4c6; font-size: .88rem; }
.footer-privacy .icon { flex: none; color: var(--pop); margin-top: 3px; }
.site-footer h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: #8fb6b9; margin: 0 0 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer-more { margin-top: 20px !important; }
.footer-sisters { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; padding-top: 16px; padding-bottom: 16px;
                  border-top: 1px solid rgba(255, 255, 255, .1); }
.footer-sisters span { font-weight: 700; color: #e8f6f6; }
.footer-sisters a { font-weight: 650; color: #5fe0e7; }
.footer-sisters small { color: #9fc4c6; margin-right: 10px; }
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; padding-top: 14px; padding-bottom: 24px;
               border-top: 1px solid rgba(255, 255, 255, .1); color: #8fb6b9; font-size: .85rem; }
.footer-base p { margin: 0; }

/* --- Share dialog ---------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(4, 18, 20, .62); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal-box { position: relative; width: 100%; max-width: 560px; background: var(--surface); color: var(--text); border-radius: 20px;
             padding: 22px; box-shadow: var(--shadow-lg); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal-box h2 { font-size: 1.3rem; margin: 0 40px 14px 0; }
.modal-x { position: absolute; right: 12px; top: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface-2);
           color: var(--text); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.modal-x:hover { background: var(--tint); }
.share-preview { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 12px; aspect-ratio: 1200 / 630; background: var(--surface-2); }
.share-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.share-result { background: var(--tint); border-radius: 10px; padding: 10px 12px; font-size: .95rem; margin-bottom: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; font-size: .93rem; margin-bottom: 12px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.check small { display: block; font-weight: 450; color: var(--muted); }
.share-link { display: flex; gap: 8px; }
.share-link input { flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--line-strong); border-radius: 999px;
                    background: var(--surface-2); color: var(--text); font: 500 .9rem var(--font); }
.share-note { min-height: 1.2em; font-size: .84rem; color: var(--muted); margin: 8px 0 12px; }
.share-nets { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.net { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); white-space: nowrap;
       background: var(--surface-2); color: var(--text); text-decoration: none; font: 600 .92rem var(--font); cursor: pointer; }
.net:hover { border-color: var(--line-strong); background: var(--tint); }
.net-x svg { color: var(--text); }
.net-fb svg { color: #1877f2; }
.net-wa svg { color: #25d366; }
.net-tg svg { color: #229ed9; }
.net-rd svg { color: #ff4500; }
.net-li svg { color: #0a66c2; }
.net-mail svg, .net-native svg { color: var(--brand); }
.net-dl { background: var(--pop-tint); }
.net-dl svg { color: var(--pop); }

/* --- Motion and print ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .site-footer, .form-card, .result-actions, .below-aside, .more-calcs, .modal, .example-try { display: none !important; }
  body { background: #fff; color: #000; }
  .calc-hero { background: none; padding: 0; }
  .calc-grid { display: block; }
  .result, .card { box-shadow: none; }
  .result-hero { background: none; color: #000; border-bottom: 2px solid #000; }
  .result-label, .result-sub, .result-sub strong { color: #000; }
  a { color: #000; }
}
