/* ════════════════════════════════════════════════════════════════
   Ageifier — shared styles (linked by every tool page)
   ════════════════════════════════════════════════════════════════ */

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --bg:        #0d0f14;
  --surface:   #161920;
  --surface2:  #1e222d;
  --border:    #2a2f3d;
  --text:      #e8eaf2;
  --muted:     #7a809a;
  --accent-a:  #7c6ff7;   /* violet */
  --accent-b:  #f7c26f;   /* amber  */
  --accent-a-glow: rgba(124,111,247,.35);
  --accent-b-glow: rgba(247,194,111,.35);
  --radius:    14px;
  --font-head: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --trans:     .2s ease;
}

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* subtle grid overlay */
  background-image:
    linear-gradient(rgba(124,111,247,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,111,247,.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ── Layout shells ─────────────────────────────────────────── */
header, main, footer {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Header ────────────────────────────────────────────────── */
header {
  padding-top: 52px;
  padding-bottom: 12px;
  text-align: center;
}

header .eyebrow {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-a);
  margin-bottom: 12px;
}

h1 {
  font-family: var(--font-head);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text);
}

h1 span { color: var(--accent-b); }

header p.tagline {
  margin-top: 10px;
  color: var(--muted);
  font-size: .95rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Tool nav ──────────────────────────────────────────────── */
.toolnav {
  max-width: 860px;
  margin: 18px auto 4px;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.toolnav a {
  font-size: .8rem;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: color var(--trans), border-color var(--trans), background var(--trans);
  white-space: nowrap;
}
.toolnav a:hover { color: var(--text); border-color: var(--accent-a); }
.toolnav a[aria-current="page"] {
  color: var(--accent-a);
  border-color: var(--accent-a);
  background: rgba(124,111,247,.1);
}

/* ── Ad unit ───────────────────────────────────────────────── */
.ad-unit {
  width: 100%;
  max-width: 728px;
  margin: 28px auto;
  min-height: 90px;
  background: var(--surface2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-unit ins { display: block; width: 100%; }
.ad-unit::before {
  content: attr(data-label);
  font-size: .7rem;
  color: var(--border);
  letter-spacing: .08em;
  text-transform: uppercase;
  pointer-events: none;
}

/* ── Main cards ────────────────────────────────────────────── */
main {
  flex: 1;
  padding-top: 8px;
  padding-bottom: 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--trans), box-shadow var(--trans);
}

.card:hover { border-color: var(--accent-a); box-shadow: 0 0 28px var(--accent-a-glow); }
.card.amber:hover { border-color: var(--accent-b); box-shadow: 0 0 28px var(--accent-b-glow); }

/* accent stripe top */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-a);
  border-radius: var(--radius) var(--radius) 0 0;
}
.card.amber::before { background: var(--accent-b); }

/* mode number badge */
.card .badge {
  position: absolute;
  top: 16px; right: 18px;
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--accent-a);
  background: rgba(124,111,247,.12);
  border: 1px solid rgba(124,111,247,.25);
  padding: 2px 8px;
  border-radius: 20px;
}
.card.amber .badge {
  color: var(--accent-b);
  background: rgba(247,194,111,.1);
  border-color: rgba(247,194,111,.25);
}

h2 {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.3;
}

/* ── Form fields ───────────────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 12px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

label {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}

input[type="number"], input[type="text"], input[type="date"], select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .95rem;
  padding: 10px 14px;
  width: 100%;
  transition: border-color var(--trans), box-shadow var(--trans);
  outline: none;
  -moz-appearance: textfield;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { -webkit-appearance: none; }
/* make the native date picker indicator visible on the dark theme */
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.7); cursor: pointer; }

.card input:focus, .card select:focus {
  border-color: var(--accent-a);
  box-shadow: 0 0 0 3px var(--accent-a-glow);
}
.card.amber input:focus, .card.amber select:focus {
  border-color: var(--accent-b);
  box-shadow: 0 0 0 3px var(--accent-b-glow);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 340px;
  align-items: end;
}

/* Force select and number input to identical height so they sit flush */
.row select,
.row input[type="number"] {
  height: 42px;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 42px;
}

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='%237a809a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.hint {
  font-size: .75rem;
  color: var(--muted);
  font-style: italic;
}

/* ── Explanatory copy ──────────────────────────────────────── */
.card-explainer {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.65;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 2px;
}

/* ── FAQ ───────────────────────────────────────────────────── */
.faq { gap: 14px; }
.faq .faq-item + .faq-item {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.faq h3 {
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.faq p {
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.65;
}

/* ── Result block ──────────────────────────────────────────── */
.result {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  min-height: 68px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  transition: border-color var(--trans);
}

.result.has-value { border-color: var(--accent-a); }
.card.amber .result.has-value { border-color: var(--accent-b); }

.result .result-label {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.result .result-value {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--accent-a);
  line-height: 1.2;
  transition: color var(--trans);
}
.result .result-value.sm { font-size: 1.2rem; }
.card.amber .result .result-value { color: var(--accent-b); }

.result .result-sub {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 2px;
}

.result .result-error {
  font-size: .82rem;
  color: #f77a6f;
}

/* ── Countdown / unit grid ─────────────────────────────────── */
.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.countdown .unit {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 8px;
  text-align: center;
}
.card.amber .countdown .unit { border-color: var(--border); }
.countdown .unit .num {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 500;
  color: var(--accent-a);
  line-height: 1.1;
}
.card.amber .countdown .unit .num { color: var(--accent-b); }
.countdown .unit .lbl {
  display: block;
  margin-top: 4px;
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
@media (max-width: 460px) {
  .countdown { grid-template-columns: repeat(2, 1fr); }
}

/* secondary stat row (age-in-days, etc.) */
.statlist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.statlist .stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: .85rem;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.statlist .stat:first-child { border-top: none; padding-top: 0; }
.statlist .stat .k { color: var(--muted); }
.statlist .stat .v { font-family: var(--font-mono); color: var(--text); }

/* ── Tool list (homepage cross-links) ──────────────────────── */
.toollist { display: flex; flex-direction: column; gap: 2px; }
.toollist a { color: var(--accent-a); text-decoration: none; font-weight: 600; }
.toollist a:hover { text-decoration: underline; }
.toollist li {
  list-style: none;
  font-size: .9rem;
  color: var(--muted);
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.toollist li:first-child { border-top: none; }

/* ── Footer ─────────────────────────────────────────────────── */
footer {
  padding-top: 0;
  padding-bottom: 28px;
  text-align: center;
}

footer p {
  font-size: .78rem;
  color: var(--muted);
}

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

/* ── Fade-in on load ─────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
header  { animation: fadeUp .55s ease both; }
.card:nth-child(1) { animation: fadeUp .55s .1s ease both; }
.card:nth-child(2) { animation: fadeUp .55s .2s ease both; }
.card:nth-child(3) { animation: fadeUp .55s .3s ease both; }
.card:nth-child(4) { animation: fadeUp .55s .4s ease both; }
.card:nth-child(5) { animation: fadeUp .55s .5s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
