/* ============================================================
   CalcMate — styles.css (Apple-style minimal edition)
   Mobile-first, vanilla CSS. No external dependencies.
   Direction: apple.com — strong and minimal. Generous
   whitespace, crisp hierarchy, calm neutral base, ONE calm blue
   accent used sparingly (mic, primary actions, key highlights).
   Color contrast targets: body text >= 7:1, large text >= 4.5:1.
   ============================================================ */

:root {
  --bg: #fbfbfd;            /* calm neutral page base */
  --surface: #ffffff;
  --ink: #1d1d1f;           /* near-black */
  --muted: #515154;         /* secondary text — 7.5:1 on white */
  --faint: #6e6e73;         /* tertiary text — 5.7:1 on white */
  --brand: #0066cc;         /* the ONE calm blue accent */
  --brand-hover: #0058b0;
  --brand-soft: #f0f5fc;    /* whisper of blue, highlights only */
  --border: #e4e4e9;        /* hairlines, not boxes */
  --ring: rgba(0, 102, 204, 0.3);
  --radius: 20px;
  --shadow: 0 2px 24px rgba(0, 0, 0, 0.05);
  /* Soft diffused shadow for the answer card — the one elevated hero surface */
  --shadow-card: 0 24px 70px rgba(17, 24, 39, 0.10), 0 3px 10px rgba(17, 24, 39, 0.05);
  /* Pastels: reserved ONLY for secondary tiles (example-question chips) */
  --pastel-a: #fdf1e3;         /* apricot */
  --pastel-b: #e9f6ef;         /* mint */
  --pastel-c: #edf1fd;         /* periwinkle */
  --pastel-d: #fbeef3;         /* blush */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }

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

h1, h2, h3 { line-height: 1.18; letter-spacing: -0.022em; margin: 0 0 0.6em; font-weight: 600; }
h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
h3 { font-size: 1.12rem; letter-spacing: -0.01em; }

p { margin: 0 0 1em; }

.container { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 1.5rem; }

/* ---------- Accessibility helpers ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: #fff; padding: 0.7rem 1.2rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

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

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(251, 251, 253, 0.85);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.8rem 1.5rem; max-width: 920px; margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 1.25rem; letter-spacing: -0.01em; }
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; flex: none; display: block; }
.site-nav ul { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.site-nav a {
  display: inline-block; padding: 0.5rem 0.9rem; border-radius: 980px;
  color: var(--muted); text-decoration: none; font-weight: 400; font-size: 0.95rem;
}
.site-nav a:hover { color: var(--ink); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--ink); background: rgba(0, 0, 0, 0.05); }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 5.5rem 0 2.5rem; }
.hero h1 { max-width: 18ch; margin-left: auto; margin-right: auto; }
.hero .lead { color: var(--muted); font-size: 1.25rem; line-height: 1.5; max-width: 56ch; margin: 0 auto; }

/* ---------- Voice section ---------- */
.voice { text-align: center; padding: 2.5rem 0 4.5rem; }

/* ---------- Ask row: input + mic + forward arrow, kept simple ---------- */
.ask-row {
  display: flex; gap: 0.6rem; align-items: stretch;
  max-width: 620px; margin: 0 auto;
}
.ask-row input[type="text"] {
  flex: 1; min-width: 0; border-radius: 980px;
  padding: 1rem 1.4rem; font-size: 1.1rem;
}
.icon-btn {
  flex: none; width: 3.6rem; border-radius: 50%; border: 1px solid #d2d2d7;
  background: #fff; color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.icon-btn svg { width: 1.5rem; height: 1.5rem; }
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.go { background: var(--brand); border-color: var(--brand); color: #fff; }
.icon-btn.go:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
#mic-btn.listening {
  background: #d70015; border-color: #d70015; color: #fff;
  animation: micPulse 1.6s ease-in-out infinite;
}
#mic-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
@keyframes micPulse {
  0%, 100% { box-shadow: 0 8px 30px rgba(215, 0, 21, 0.3); }
  50% { box-shadow: 0 8px 30px rgba(215, 0, 21, 0.1); }
}

.voice-status {
  margin: 1rem auto 0; max-width: 52ch; color: var(--muted); font-size: 1rem;
  display: flex; gap: 0.6rem; align-items: center; justify-content: center; flex-wrap: wrap;
  min-height: 2.2em;
}
.voice-status:empty { display: none; }
.voice-status .dot { width: 10px; height: 10px; border-radius: 50%; background: #d70015; animation: micPulse 1s infinite; }

/* ---------- Answer card ----------
   Hero-stat pattern: the answer is the star. Borderless card carried
   by one soft diffused shadow; huge display numerals, tight leading. */
.answer {
  background: var(--surface); border-radius: 24px;
  box-shadow: var(--shadow-card); padding: 3.5rem 2.5rem; margin: 3rem auto 0; max-width: 680px;
}
.answer.pop { animation: answerPop 0.35s ease-out; }
@keyframes answerPop {
  0% { transform: translateY(8px); opacity: 0.2; }
  100% { transform: translateY(0); opacity: 1; }
}
.answer-kicker {
  margin: 0 0 0.6rem; font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand);
}
.answer-big {
  margin: 0 0 0.7rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05;
  font-size: clamp(2.6rem, 9vw, 4.25rem);
  font-variant-numeric: tabular-nums lining-nums;
}
.answer.miss .answer-big { font-size: clamp(1.4rem, 5vw, 2rem); line-height: 1.15; }
.answer-sub { color: var(--muted); margin: 0; font-size: 1.05rem; }
.answer-sub:empty { display: none; }
.answer-meta {
  margin-top: 1.6rem; display: flex; gap: 1rem; justify-content: center; align-items: center; flex-wrap: wrap;
}
.speak-toggle {
  display: inline-flex; gap: 0.45rem; align-items: center;
  font-size: 0.9rem; color: var(--muted); cursor: pointer;
}
.speak-toggle input { width: 1.1rem; height: 1.1rem; accent-color: var(--brand); }

/* "Try asking..." follow-ups under the answer card — small, secondary to the answer. */
.followups { margin-top: 1.6rem; border-top: 1px solid var(--border); padding-top: 1.1rem; }
.followups-label { font-size: 0.82rem; font-weight: 600; color: var(--faint); margin: 0; letter-spacing: 0.02em; }
.followups .chips { margin-top: 0.7rem; }

/* Subtle, unlabeled "AI at work" shimmer — neutral tones, no blue glow. */
.answer.loading .answer-kicker, .answer.loading .answer-sub { visibility: hidden; }
.answer.loading .answer-big {
  color: transparent; user-select: none;
  background: linear-gradient(90deg, #ededf1 25%, #f7f7fa 50%, #ededf1 75%);
  background-size: 220% 100%;
  border-radius: 20px; min-height: 2.6em;
  animation: aiShimmer 1.2s linear infinite;
}
@keyframes aiShimmer {
  from { background-position: 220% 0; }
  to { background-position: -220% 0; }
}



input[type="text"], input[type="number"], input[type="date"], input[type="search"], input[type="email"],
select, textarea {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #d2d2d7; border-radius: 12px; padding: 0.8rem 1rem; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 3px solid var(--ring); outline-offset: 0; }

/* Pastel secondary tiles — chips only. Ink text, no accent color here. */
.chips { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.4rem; justify-content: center; }
.chip {
  border: none; background: var(--pastel-a); color: var(--ink);
  border-radius: 980px; padding: 0.6rem 1.2rem; font-size: 0.92rem; cursor: pointer; font-family: inherit;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.chip:nth-child(4n+2) { background: var(--pastel-b); }
.chip:nth-child(4n+3) { background: var(--pastel-c); }
.chip:nth-child(4n+4) { background: var(--pastel-d); }
.chip:hover { filter: brightness(0.965); transform: translateY(-1px); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font: inherit; font-weight: 500; border: none; border-radius: 980px; cursor: pointer;
  padding: 0.8rem 1.6rem; text-decoration: none; min-height: 48px; white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); color: #fff; }
.btn-ghost { background: transparent; color: var(--brand); border: 1px solid #d2d2d7; }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-hover); }
.btn-small { padding: 0.5rem 1.1rem; font-size: 0.9rem; min-height: 38px; }

/* ---------- What you can ask ---------- */
.topics { padding: 1rem 0 4.5rem; }
.topics h2, .topics-lede { text-align: center; }
.topics-lede { color: var(--muted); font-size: 1.1rem; max-width: 60ch; margin: 0 auto 2.2rem; }
.ask-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
.ask-grid li {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 2rem 2.1rem;
}
.ask-grid h3 { margin-bottom: 0.35rem; }
.ask-grid p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.ask-grid .ex { display: block; margin-top: 0.6rem; font-size: 0.9rem; color: var(--faint); font-style: italic; }

/* ---------- FAQ ---------- */
.faq { padding: 1rem 0 5rem; }
.faq h2 { text-align: center; margin-bottom: 1.8rem; }
.faq details { border-bottom: 1px solid var(--border); margin-bottom: 0; background: transparent; }
.faq details:first-of-type { border-top: 1px solid var(--border); }
.faq summary { cursor: pointer; font-weight: 600; font-size: 1.05rem; padding: 1.1rem 0.2rem; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+ "; color: var(--brand); font-weight: 600; }
.faq details[open] summary::before { content: "– "; }
.faq details p { padding: 0 0.2rem 1.2rem; margin: 0; color: var(--muted); max-width: 72ch; }

/* ---------- Footer ---------- */
.site-footer { background: #f5f5f7; color: var(--muted); margin-top: 1rem; padding: 3rem 0 2rem; border-top: 1px solid var(--border); font-size: 0.88rem; }
.site-footer a { color: #424245; }
.site-footer a:hover { color: var(--ink); }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 1.8rem; margin-bottom: 2rem; }
.footer-grid h2, .footer-grid h3 { color: var(--ink); font-size: 1rem; font-weight: 600; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.footer-grid p { font-size: 0.88rem; color: var(--faint); max-width: 44ch; }
.footer-bottom { border-top: 1px solid #d2d2d7; padding-top: 1.4rem; display: flex; gap: 1rem; flex-wrap: wrap; justify-content: space-between; font-size: 0.82rem; color: var(--faint); }

/* ---------- Content pages ---------- */
.page-hero { background: linear-gradient(180deg, #f5f7fb, var(--bg)); padding: 3.5rem 0 2.5rem; border-bottom: 1px solid var(--border); }
.page-hero h1 { color: var(--ink); }
.page-hero p { color: var(--muted); max-width: 64ch; font-size: 1.15rem; }
.prose { max-width: 76ch; padding: 1.5rem 0 4rem; }
.prose h2 { margin-top: 2.4rem; }
.prose ul { padding-left: 1.3rem; }
.prose li { margin-bottom: 0.5rem; }
.contact-form { display: grid; gap: 1rem; max-width: 560px; margin-top: 1.4rem; }
.note { color: var(--muted); font-size: 0.9rem; }
.field { display: grid; gap: 0.4rem; }
.field label { font-weight: 600; font-size: 0.95rem; }

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
  .ask-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
}
@media (min-width: 900px) {
  .ask-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
