/* =========================================================
   AGE CALCULATOR — DESIGN TOKENS
   Theme: precision chronograph / instrument panel
   ========================================================= */
:root{
  /* Light theme (default) */
  --bg: #F4F5F7;
  --bg-grid: rgba(18,22,28,0.045);
  --panel-bg: rgba(255,255,255,0.55);
  --panel-border: rgba(18,22,28,0.10);
  --panel-shadow: 0 20px 60px -20px rgba(18,22,28,0.25);
  --text: #12161C;
  --text-muted: #565F6B;
  --brass: #9C7A0E;
  --brass-strong: #7A5F0A;
  --teal: #0E8F84;
  --danger: #C4383F;
  --success: #1C8A5D;
  --dial-ring: rgba(18,22,28,0.16);
  --input-bg: rgba(255,255,255,0.75);
  --card-bg: rgba(255,255,255,0.6);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

[data-theme="dark"]{
  --bg: #0D1117;
  --bg-grid: rgba(255,255,255,0.035);
  --panel-bg: rgba(255,255,255,0.055);
  --panel-border: rgba(255,255,255,0.10);
  --panel-shadow: 0 20px 60px -20px rgba(0,0,0,0.6);
  --text: #EDEFF2;
  --text-muted: #9AA5B1;
  --brass: #E8C766;
  --brass-strong: #C9A227;
  --teal: #4FD1C5;
  --danger: #F0787D;
  --success: #4CD1A0;
  --dial-ring: rgba(255,255,255,0.18);
  --input-bg: rgba(255,255,255,0.06);
  --card-bg: rgba(255,255,255,0.045);
}

/* =========================================================
   RESET & BASE
   ========================================================= */
*,*::before,*::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *,*::before,*::after{ animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
body{
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-grid), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}
h1,h2,h3,h4{ font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; }
p{ margin: 0 0 1em; }
a{ color: var(--brass-strong); }
img{ max-width: 100%; display: block; }

.skip-link{
  position: absolute; left: -999px; top: 0; background: var(--brass); color: #0D1117;
  padding: .75rem 1.25rem; z-index: 999; border-radius: 0 0 8px 0; font-weight: 600;
}
.skip-link:focus{ left: 0; }

:focus-visible{ outline: 3px solid var(--teal); outline-offset: 3px; border-radius: 4px; }

/* =========================================================
   HEADER
   ========================================================= */
.site-header{
  position: sticky; top: 0; z-index: 50;
  background: var(--panel-bg);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--panel-border);
}
.header-inner{
  max-width: 1160px; margin: 0 auto; padding: .85rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand{
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem;
  color: var(--text); text-decoration: none;
}
.brand-mark{ color: var(--brass-strong); display: inline-flex; }
.main-nav{ display: flex; gap: 1.5rem; }
.main-nav a{ color: var(--text-muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
.main-nav a:hover, .main-nav a.active{ color: var(--brass-strong); }

.theme-toggle{
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--panel-border); background: var(--card-bg); color: var(--text);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: transform .15s ease, background .2s ease;
}
.theme-toggle:hover{ transform: rotate(15deg); }

.breadcrumb{ max-width: 1160px; margin: 0 auto; padding: .9rem 1.5rem 0; }
.breadcrumb ol{ list-style: none; display: flex; gap: .4rem; margin: 0; padding: 0; font-size: .85rem; color: var(--text-muted); }
.breadcrumb li:not(:last-child)::after{ content: "/"; margin-left: .4rem; opacity: .5; }
.breadcrumb a{ color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover{ color: var(--brass-strong); }

/* =========================================================
   HERO
   ========================================================= */
.hero{ max-width: 1160px; margin: 0 auto; padding: clamp(2rem, 6vw, 5rem) 1.5rem 2rem; }
.hero-inner{ display: grid; grid-template-columns: 1.2fr .8fr; gap: 3rem; align-items: center; }
.eyebrow{
  text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 600;
  color: var(--teal); margin-bottom: .75rem;
}
.hero h1{ font-size: clamp(2.1rem, 4.5vw, 3.4rem); letter-spacing: -.01em; }
.hero-sub{ color: var(--text-muted); font-size: 1.05rem; max-width: 46ch; }
.hero-cta{ margin-top: .5rem; }

.hero-dial{ display: flex; justify-content: center; }
.dial-face{ position: relative; color: var(--text); }
.dial-readout{
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.dial-label{ font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.dial-number{ font-family: var(--font-mono); font-size: 1.05rem; font-weight: 600; color: var(--brass-strong); margin-top: .2rem; }

/* =========================================================
   GLASS PANEL
   ========================================================= */
.glass-panel{
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  padding: clamp(1.5rem, 4vw, 2.75rem);
}

.calculator-section{ max-width: 1160px; margin: 0 auto; padding: 1rem 1.5rem 3rem; }
.calculator-panel h2{ font-size: 1.6rem; margin-bottom: 1.25rem; }

/* =========================================================
   FORM
   ========================================================= */
.form-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.field{ display: flex; flex-direction: column; gap: .4rem; }
.field label{ font-weight: 600; font-size: .92rem; }
.field .optional{ font-weight: 400; color: var(--text-muted); font-size: .82rem; }
.req{ color: var(--danger); }
input[type="date"]{
  font-family: var(--font-body); font-size: 1rem; padding: .7rem .9rem;
  border-radius: var(--radius-sm); border: 1px solid var(--panel-border);
  background: var(--input-bg); color: var(--text); min-height: 48px;
}
input[type="date"]:focus{ border-color: var(--teal); }
.field-error{ color: var(--danger); font-size: .85rem; min-height: 1.2em; margin: 0; }

.button-row{ display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }

.btn{
  font-family: var(--font-body); font-weight: 600; font-size: .95rem;
  padding: .85rem 1.5rem; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; min-height: 48px; display: inline-flex; align-items: center; justify-content: center;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}
.btn:active{ transform: translateY(1px); }
.btn-primary{
  background: linear-gradient(135deg, var(--brass-strong), var(--brass));
  color: #16130A; box-shadow: 0 8px 24px -8px rgba(156,122,14,0.55);
}
.btn-primary:hover{ box-shadow: 0 10px 28px -6px rgba(156,122,14,0.65); }
.btn-ghost{ background: transparent; color: var(--text); border-color: var(--panel-border); }
.btn-ghost:hover{ border-color: var(--brass-strong); color: var(--brass-strong); }
.btn-small{
  background: var(--card-bg); color: var(--text); border-color: var(--panel-border);
  padding: .55rem 1.1rem; font-size: .85rem; min-height: 40px;
}
.btn-small:hover{ border-color: var(--teal); color: var(--teal); }

/* =========================================================
   RESULTS
   ========================================================= */
.results-wrapper{ margin-top: 2.5rem; animation: fadeUp .4s ease; }
@keyframes fadeUp{ from{ opacity: 0; transform: translateY(10px); } to{ opacity: 1; transform: translateY(0); } }

.headline-result{
  text-align: center; padding: 1.75rem 1rem; border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(156,122,14,0.08), transparent);
  border: 1px solid var(--panel-border);
}
.headline-label{ color: var(--text-muted); font-size: .9rem; margin-bottom: .5rem; }
.headline-value{
  font-family: var(--font-mono); font-size: clamp(1.4rem, 4vw, 2.1rem); font-weight: 700;
  color: var(--text); display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; align-items: baseline;
}
.headline-value .unit{ font-family: var(--font-body); font-size: .55em; font-weight: 500; color: var(--text-muted); margin-right: .4rem; }
.headline-value .old{ font-family: var(--font-body); font-size: .55em; font-weight: 500; color: var(--text-muted); }
.headline-value span[id]{ color: var(--brass-strong); }

.section-subhead{ font-size: 1.05rem; margin: 2rem 0 1rem; color: var(--text); }

.stat-grid{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.stat-card{
  background: var(--card-bg); border: 1px solid var(--panel-border); border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .4rem;
}
.stat-icon{ color: var(--teal); }
.stat-label{ font-size: .82rem; color: var(--text-muted); }
.stat-label em{ font-style: normal; color: var(--teal); }
.stat-value{ font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700; color: var(--text); }
.stat-card--live{ border-color: rgba(79,209,197,.4); }

.detail-grid{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.detail-card{
  background: var(--card-bg); border: 1px solid var(--panel-border); border-radius: var(--radius-md);
  padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: .3rem;
}
.detail-label{ font-size: .8rem; color: var(--text-muted); }
.detail-value{ font-weight: 600; font-size: 1.02rem; }

.action-row{ display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 2rem; }
.action-status{ font-size: .85rem; color: var(--success); margin: 0; }

/* =========================================================
   ARTICLE
   ========================================================= */
.seo-article{ max-width: 820px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
.article-header h2{ font-size: clamp(1.6rem, 4vw, 2.2rem); }
.article-meta{ color: var(--text-muted); font-size: .88rem; }
.seo-article h3{ font-size: 1.35rem; margin-top: 2.5rem; scroll-margin-top: 90px; }
.seo-article h4{ font-size: 1.05rem; margin-top: 1.5rem; }
.seo-article p, .seo-article li{ color: var(--text); }
.seo-article ul, .seo-article ol{ padding-left: 1.3rem; }
.seo-article li{ margin-bottom: .5rem; }

.toc{
  background: var(--card-bg); border: 1px solid var(--panel-border); border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem; margin: 1.5rem 0 2rem;
}
.toc h3{ margin-top: 0; font-size: 1.05rem; }
.toc ol{ columns: 2; column-gap: 2rem; padding-left: 1.1rem; }
.toc a{ text-decoration: none; font-size: .92rem; }
.toc a:hover{ text-decoration: underline; }

.data-table{ width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: .92rem; }
.data-table caption{ text-align: left; color: var(--text-muted); font-size: .85rem; margin-bottom: .5rem; }
.data-table th, .data-table td{ text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--panel-border); }
.data-table thead th{ color: var(--text-muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }

.checklist{ list-style: none; padding-left: 0; }
.checklist li{ padding-left: 1.7rem; position: relative; }
.checklist li::before{
  content: ""; position: absolute; left: 0; top: .15em; width: 1.1em; height: 1.1em;
  border: 2px solid var(--teal); border-radius: 5px;
}

.faq-item{ margin-bottom: 1.5rem; }
.faq-item h4{ margin-bottom: .35rem; }

.cta-final{ font-weight: 600; font-size: 1.1rem; text-align: center; margin-top: 2rem; }

/* =========================================================
   RELATED TOOLS
   ========================================================= */
.related-tools{ max-width: 1160px; margin: 0 auto; padding: 1rem 1.5rem 4rem; }
.related-tools h2{ font-size: 1.3rem; margin-bottom: 1rem; }
.related-grid{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.related-card{
  display: block; text-align: center; padding: 1.1rem; border-radius: var(--radius-md);
  background: var(--card-bg); border: 1px solid var(--panel-border); color: var(--text);
  text-decoration: none; font-weight: 600; font-size: .92rem; transition: border-color .2s ease, color .2s ease;
}
.related-card:hover{ border-color: var(--brass-strong); color: var(--brass-strong); }

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer{ text-align: center; padding: 2rem 1.5rem 3rem; color: var(--text-muted); font-size: .85rem; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px){
  .hero-inner{ grid-template-columns: 1fr; }
  .hero-dial{ order: -1; }
  .stat-grid, .detail-grid{ grid-template-columns: repeat(2, 1fr); }
  .related-grid{ grid-template-columns: repeat(2, 1fr); }
  .toc ol{ columns: 1; }
}
@media (max-width: 640px){
  .form-grid{ grid-template-columns: 1fr; }
  .stat-grid, .detail-grid{ grid-template-columns: 1fr; }
  .main-nav{ display: none; }
  .headline-value{ font-size: 1.5rem; }
}

/* =========================================================
   PRINT
   ========================================================= */
@media print{
  .site-header, .breadcrumb, .hero, #ageForm, .action-row, .related-tools, .site-footer, .toc, .theme-toggle{ display: none !important; }
  body{ background: #fff; color: #000; }
  .glass-panel{ box-shadow: none; border: 1px solid #ccc; backdrop-filter: none; }
}
