/* ==========================================================================
   AgeGapCalc — design system "A: Soft Modern"
   Light, elevated, gradient-accented. Inter + Sora.
   All legacy class names preserved so every existing page keeps working.
   ========================================================================== */

:root {
  /* surfaces */
  --bg: #f7f9fd;
  --surface: #ffffff;
  --surface-2: #f5f8fc;
  --border: #e6eaf2;
  --border-strong: #d7dfeb;
  /* type */
  --text: #0f172a;
  --text-muted: #5a6472;
  --text-faint: #8b95a5;
  /* brand */
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-2: #4f46e5;          /* indigo */
  --accent-3: #0ea5e9;          /* sky */
  --accent-soft: #eef1ff;
  --teal: #0d9488;
  --teal-soft: #e6f7f4;
  --grad: linear-gradient(135deg, var(--accent-2), var(--accent) 55%, var(--accent-3));
  --grad-soft: linear-gradient(160deg, #eef2ff 0%, #f6fbff 55%, #ecfeff 100%);
  /* shape */
  --radius: 20px;
  --radius-sm: 14px;
  --radius-lg: 26px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 12px rgba(15, 23, 42, .05);
  --shadow: 0 2px 4px rgba(15, 23, 42, .04), 0 14px 32px rgba(15, 23, 42, .08);
  --shadow-lg: 0 4px 8px rgba(15, 23, 42, .04), 0 26px 64px rgba(37, 99, 235, .16);
  --font-display: 'Sora', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.68;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 78% -8%, rgba(14, 165, 233, .13), transparent 60%),
    radial-gradient(900px 480px at 4% 2%, rgba(79, 70, 229, .11), transparent 58%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 3px solid rgba(37, 99, 235, .35); outline-offset: 2px; border-radius: 6px; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .78);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid rgba(15, 23, 42, .07);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; height: 64px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-weight: 800; font-size: 18px; letter-spacing: -.02em;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 30px; height: 30px; border-radius: 9px;
  display: inline-grid; place-items: center; flex: none;
  background: var(--grad);
  box-shadow: 0 6px 16px rgba(79, 70, 229, .34);
}
.brand .dot svg { width: 19px; height: 19px; display: block; }
.nav { display: flex; gap: 20px; flex-wrap: wrap; }
.nav a {
  color: var(--text-muted); font-size: 14px; font-weight: 500;
  transition: color .15s ease;
}
.nav a:hover { color: var(--accent); text-decoration: none; }
.hpill {
  display: inline-flex; align-items: center;
  font-size: 13px; font-weight: 700; color: #fff;
  background: var(--grad);
  padding: 8px 16px; border-radius: 999px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .28);
  white-space: nowrap;
}

/* ---------- Breadcrumb ------------------------------------------------ */
.breadcrumb {
  background: rgba(255, 255, 255, .6);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.breadcrumb .container {
  padding-top: 11px; padding-bottom: 11px;
  color: var(--text-faint);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); text-decoration: none; }
.breadcrumb .sep { color: #aab4c3; }
.breadcrumb .current { color: var(--text); font-weight: 600; }

.byline { color: var(--text-muted); font-size: 14px; margin: 6px 0 22px; }

/* ---------- Hero ------------------------------------------------------ */
.hero { padding: 60px 0 52px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 56px;
  align-items: center;
}
.hero-copy { max-width: 560px; }
.hero-calc { min-width: 0; }

.chip {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 600; color: var(--accent-2);
  background: #eef1ff; border: 1px solid #dfe4ff;
  padding: 7px 14px; border-radius: 999px;
}
.chip .cdot, .chip-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .16);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(34px, 4.4vw, 52px);
  line-height: 1.06; letter-spacing: -.035em;
  font-weight: 800;
  margin: 20px 0 16px;
}
.hero p.lead {
  font-size: 17px; color: var(--text-muted);
  max-width: 520px; margin: 0 0 24px;
}
.trust {
  list-style: none; display: flex; flex-wrap: wrap; gap: 10px 22px;
  padding: 0; margin: 0;
  font-size: 14px; font-weight: 500; color: var(--text-muted);
}
.trust li { display: flex; align-items: center; gap: 8px; }
.tick {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: #e9fbf3; color: #10b981;
  font-size: 11px; font-weight: 800; line-height: 1;
}

/* ---------- Calculator card ------------------------------------------ */
.calc-card {
  background: var(--surface);
  border: 1px solid rgba(15, 23, 42, .06);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 26px;
}
.calc-grid {
  display: grid; grid-template-columns: 1fr 40px 1fr;
  gap: 12px; align-items: end;
}
.person { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.person label {
  font-size: 12px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--text-muted);
}
.person input[type="text"], .person input[type="date"] {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  font-size: 15px; font-weight: 600; font-family: inherit;
  color: var(--text); background: var(--surface-2);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.person input::placeholder { color: var(--text-faint); font-weight: 500; }
.person input:focus {
  outline: none; background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.swap-col { display: flex; align-items: center; justify-content: center; padding-bottom: 3px; }
.btn-swap {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: #fff;
  color: var(--accent); font-size: 16px; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .25s ease, background .15s ease, color .15s ease;
}
.btn-swap:hover { transform: rotate(180deg); background: var(--accent-soft); }

.btn-calc {
  margin-top: 16px; width: 100%;
  padding: 15px; border: none; border-radius: 14px;
  background: var(--grad); color: #fff;
  font-family: inherit; font-size: 16px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(37, 99, 235, .32);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn-calc:hover { filter: brightness(1.05); box-shadow: 0 16px 32px rgba(37, 99, 235, .38); transform: translateY(-1px); }
.btn-calc:active { transform: translateY(0); }

/* ---------- Result ---------------------------------------------------- */
.result {
  margin-top: 18px; padding: 20px;
  border-radius: 18px;
  background: var(--grad-soft);
  border: 1px solid #dbe4ff;
  text-align: center;
}
.result .big {
  font-family: var(--font-display);
  font-size: clamp(23px, 2.2vw, 32px);
  font-weight: 800; letter-spacing: -.03em; line-height: 1.15;
  text-wrap: balance;
  background: linear-gradient(120deg, #3730a3, #0284c7);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.result .sub { color: var(--text-muted); margin-top: 8px; font-size: 15px; }
/* extras lists injected by app.js (ul.faq inside .result) */
.result ul.faq { display: block; margin: 14px 0 0; padding: 0; list-style: none; text-align: left; }
.result ul.faq li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 2px; font-size: 14.5px; color: var(--text);
  border-bottom: 1px solid rgba(37, 99, 235, .12);
}
.result ul.faq li:last-child { border-bottom: none; }
.result ul.faq li strong { color: var(--text-muted); font-weight: 600; }

.badge {
  display: inline-block; margin-top: 12px; padding: 7px 14px;
  background: var(--teal-soft); color: var(--teal);
  font-weight: 700; border-radius: 999px; font-size: 13.5px;
}
.result-actions { margin-top: 14px; }
.btn-copy {
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border: 1px solid var(--border);
  background: #fff; border-radius: 10px; cursor: pointer; color: var(--text-muted);
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.btn-copy:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Sections / prose ----------------------------------------- */
.section { padding: 30px 0; }
.section h2 { font-family: var(--font-display); font-size: 25px; letter-spacing: -.02em; margin: 0 0 12px; }
.section p, .section li { color: #374151; }

.prose {
  background: var(--surface);
  border: 1px solid rgba(15, 23, 42, .06);
  border-radius: var(--radius);
  padding: 28px 30px;
  box-shadow: var(--shadow-sm);
}
article.prose { max-width: 840px; }
.prose h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.14; letter-spacing: -.03em;
  margin: 0 0 10px;
}
.prose h2 {
  font-family: var(--font-display);
  font-size: 22px; letter-spacing: -.02em;
  margin: 30px 0 10px; padding-top: 4px;
}
.prose h3 { font-size: 18px; margin: 22px 0 8px; }
.prose > h2:first-child { margin-top: 4px; }
.prose ol, .prose ul { padding-left: 22px; }
.prose li { margin: 7px 0; }
.prose p { margin: 0 0 14px; }
.prose strong { color: var(--text); }

.formula {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 14px 16px; border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px; line-height: 1.6; color: #334155;
  overflow-x: auto; white-space: pre-wrap;
}

/* ---------- Examples -------------------------------------------------- */
.examples { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 8px; }
.example {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 15px; background: var(--surface); cursor: pointer;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.example:hover, .example:focus-visible { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.example .t { font-weight: 600; font-size: 14px; }
.example .r { color: var(--accent); font-size: 14px; margin-top: 5px; }

/* ---------- FAQ accordion (div.faq) ---------------------------------- */
div.faq { display: flex; flex-direction: column; gap: 10px; }
div.faq details {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 2px 16px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
div.faq details[open] { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
div.faq summary {
  cursor: pointer; font-weight: 600; padding: 13px 0;
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 14px;
}
div.faq summary::-webkit-details-marker { display: none; }
div.faq summary::after {
  content: "+"; flex: none;
  color: var(--accent); font-weight: 600; font-size: 20px; line-height: 1;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent-soft);
}
div.faq details[open] summary::after { content: "−"; }
div.faq p { margin: 0 0 15px; color: #374151; }

/* ---------- Related tools / cards ------------------------------------ */
.related { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 8px; }
.rel-card {
  display: block; color: var(--text); text-decoration: none;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 18px; background: var(--surface); box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.rel-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.rel-card .ic {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; font-size: 18px;
  background: var(--accent-soft);
}
.rel-card .ttl { font-weight: 700; margin-top: 12px; }
.rel-card .desc { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* ---------- CTA card -------------------------------------------------- */
.cta-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid transparent;
  border-image: linear-gradient(180deg, var(--accent-2), var(--accent-3)) 1;
  border-radius: 12px;
  padding: 18px 20px; margin: 22px 0;
}
.cta-card p { margin: 0 0 12px; color: var(--text); }
.cta-card .btn-calc {
  display: inline-block; width: auto;
  background: var(--grad); color: #fff;
  margin-top: 0; padding: 10px 18px; border-radius: 10px;
  font-size: 14.5px; font-weight: 700; text-decoration: none;
  box-shadow: 0 10px 22px rgba(37, 99, 235, .28);
}
.cta-card .btn-calc:hover { opacity: .95; text-decoration: none; transform: translateY(-1px); }

/* ---------- Author box / sources ------------------------------------- */
.author-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px 20px; margin: 20px 0 8px;
}
.author-box .ab-name { font-weight: 700; color: var(--text); margin-bottom: 6px; }
.author-box .ab-bio { color: var(--text-muted); font-size: 14px; margin: 0 0 10px; }
.author-box .ab-social a { margin-right: 14px; color: var(--accent); text-decoration: none; font-size: 14px; font-weight: 600; }
.author-box .ab-social a:hover { text-decoration: underline; }

.sources { list-style: none; padding: 0; margin: 0 0 8px; }
.sources li {
  font-size: 14px; color: var(--text-muted); padding: 7px 0;
  border-bottom: 1px dashed var(--border);
}
.sources li:last-child { border-bottom: none; }
.sources a { color: var(--accent); text-decoration: none; }
.sources a:hover { text-decoration: underline; }

/* ---------- Ad slot --------------------------------------------------- */
.ad-slot {
  margin: 26px 0; padding: 26px 20px; min-height: 90px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  border: 1px dashed #cfd8e6; border-radius: 14px;
  background: rgba(255, 255, 255, .5);
  color: var(--text-faint);
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
}
.ad-slot .note { font-size: 12px; color: #b6c0cd; margin-top: 6px; text-transform: none; letter-spacing: 0; }

/* ---------- Footer ---------------------------------------------------- */
.site-footer {
  background: rgba(255, 255, 255, .7);
  border-top: 1px solid var(--border);
  margin-top: 48px; padding: 30px 0;
}
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-links a { color: var(--text-muted); font-size: 14px; }
.footer-links a:hover { color: var(--accent); }
.footer-social { display: flex; flex-wrap: wrap; gap: 10px; }
.footer-social a {
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 13px;
  background: #fff;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.footer-social a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; background: var(--accent-soft); }
.site-footer .copy { color: var(--text-faint); font-size: 13px; width: 100%; }

/* ---------- Scroll-to-top -------------------------------------------- */
.to-top {
  position: fixed; right: 22px; bottom: 22px;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--border); background: #fff;
  color: var(--accent); font-size: 20px; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease, transform .2s ease, background .2s ease;
  z-index: 50;
}
.to-top.show { opacity: 1; visibility: visible; }
.to-top:hover { transform: translateY(-2px); background: var(--accent-soft); }

/* ---------- Contact form --------------------------------------------- */
.contact-form { display: flex; flex-direction: column; gap: 8px; margin: 18px 0; max-width: 540px; }
.contact-form label { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-top: 6px; }
.contact-form input, .contact-form textarea {
  width: 100%; padding: 12px 13px; border: 1px solid var(--border);
  border-radius: 13px; font-size: 15px; font-family: inherit;
  color: var(--text); background: var(--surface-2);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.contact-form input:focus, .contact-form textarea:focus {
  outline: none; background: #fff; border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.contact-form .btn-calc { width: auto; padding: 12px 24px; margin-top: 12px; }
.contact-form .form-note { font-size: 13px; color: var(--text-muted); margin: 4px 0 0; }

/* ---------- Responsive ----------------------------------------------- */
@media (max-width: 900px) {
  .hero { padding: 40px 0 34px; }
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero-copy { max-width: none; }
  .hero h1 { font-size: clamp(30px, 7vw, 40px); }
  .hero p.lead { font-size: 16px; }
}
/* ---------- Page hero / About ---------------------------------------- */
.page-hero { padding: 54px 0 6px; }
.page-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.08; letter-spacing: -.035em; font-weight: 800;
  margin: 18px 0 14px;
}
.page-hero p.lead {
  font-size: 17.5px; color: var(--text-muted);
  max-width: 780px; margin: 0 0 16px;
}
.page-hero .byline { margin: 0 0 20px; }
.page-hero .trust { margin-bottom: 8px; }

.stat-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin: 24px 0 4px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px 14px;
  text-align: center; box-shadow: var(--shadow-sm);
}
.stat .n {
  font-family: var(--font-display); font-weight: 800;
  font-size: 27px; letter-spacing: -.03em; line-height: 1.1;
  background: linear-gradient(120deg, #3730a3, #0284c7);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat .l { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

.value-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; margin-top: 18px;
}
.value-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.value-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.value-card .ic {
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center; font-size: 20px;
  background: var(--accent-soft);
}
.value-card .ttl {
  font-family: var(--font-display); font-weight: 700;
  font-size: 17px; letter-spacing: -.01em; margin: 14px 0 7px;
}
.value-card p { margin: 0; color: #374151; font-size: 14.5px; line-height: 1.62; }

@media (max-width: 900px) {
  .value-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .page-hero { padding: 36px 0 4px; }
  .page-hero h1 { font-size: clamp(28px, 8vw, 36px); }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .container { padding: 0 18px; }
  .calc-grid { grid-template-columns: 1fr; }
  .swap-col { justify-content: flex-start; }
  .btn-swap { transform: rotate(90deg); }
  .btn-swap:hover { transform: rotate(270deg); }
  .examples, .related { grid-template-columns: 1fr; }
  .site-header .container {
    height: auto; flex-direction: column; align-items: flex-start;
    gap: 10px; padding: 12px 18px;
  }
  .nav { gap: 14px; }
  .prose { padding: 22px 18px; }
  .result { padding: 18px 14px; }
}
