/* GMAT GRE Prep - Study Plan Builder
   Tokens: warm paper neutral + single pine-green accent. System sans, no external fonts. */
:root {
  --surface: #fbfaf7;
  --surface-2: #f3efe8;
  --card: #ffffff;
  --ink: #1c2126;
  --ink-2: #414b54;
  --muted: #6b7480;
  --accent: #0f5c43;
  --accent-hover: #0c4a36;
  --accent-soft: #e7f0ec;
  --accent-ink: #0a3a2b;
  --hairline: #e5e0d8;
  --danger: #a3341f;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(28, 40, 33, .05), 0 8px 24px rgba(28, 40, 33, .06);
  --shadow-lift: 0 2px 4px rgba(28, 40, 33, .06), 0 14px 34px rgba(28, 40, 33, .10);
  --maxw: 1120px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.15; text-wrap: balance; margin: 0; }
p { text-wrap: pretty; }
a { color: var(--accent-ink); }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(20px, 5vw, 40px); }

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

:where(a, button, input, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 13px 22px; border-radius: var(--radius-sm); border: 1px solid transparent;
  min-height: 46px; text-decoration: none; transition: background .16s ease, transform .06s ease, box-shadow .16s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--hairline); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost:active { transform: translateY(1px); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--accent); }
.brand-mark { display: inline-flex; }
.brand-name { font-weight: 700; letter-spacing: -.01em; color: var(--ink); font-size: 17px; }
.site-nav { display: flex; gap: 22px; }
.site-nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 15px; }
.site-nav a:hover { color: var(--accent-ink); }

/* Hero */
.hero { padding: clamp(40px, 7vw, 80px) 0 clamp(32px, 5vw, 56px); }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(24px, 5vw, 56px); align-items: center; }
.hero h1 { font-size: clamp(30px, 5vw, 48px); letter-spacing: -.02em; font-weight: 700; }
.lede { font-size: clamp(17px, 2.2vw, 20px); color: var(--ink-2); max-width: 46ch; margin: 18px 0 26px; }
.hero .btn-primary { font-size: 17px; }
.hero-note { color: var(--muted); font-size: 14px; margin: 14px 0 0; }
.hero-visual svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 18px 40px rgba(15, 92, 67, .12)); }

/* Builder */
.builder { padding: clamp(32px, 5vw, 56px) 0; }
.builder h2, .how h2 { font-size: clamp(24px, 3.4vw, 34px); letter-spacing: -.015em; }
.section-sub { color: var(--ink-2); margin: 10px 0 26px; max-width: 60ch; }
.builder-panel { background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(20px, 3.5vw, 34px); }

.plan-form { display: grid; gap: 26px; }
.field { border: 0; padding: 0; margin: 0; min-width: 0; }
.field > label, .field legend { display: block; font-weight: 600; font-size: 15px; margin-bottom: 8px; padding: 0; }
.opt { color: var(--muted); font-weight: 400; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

input[type="number"], input[type="date"], input[type="text"] {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  padding: 12px 14px; border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color .15s ease, box-shadow .15s ease;
}
input:hover { border-color: #d2ccc0; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
input[aria-invalid="true"] { border-color: var(--danger); }
.hint { color: var(--muted); font-size: 13px; margin: 7px 0 0; }
.error { color: var(--danger); font-size: 13px; font-weight: 500; margin: 7px 0 0; min-height: 0; }

/* Segmented control */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 4px; gap: 4px; }
.seg { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; justify-content: center; min-width: 96px; min-height: 38px; padding: 0 18px; border-radius: 6px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: background .15s ease, color .15s ease; }
.seg input:checked + span { background: var(--card); color: var(--accent-ink); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Section comfort grid */
.sections-grid { display: grid; gap: 14px; }
.comfort { border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--surface); }
.comfort .comfort-name { font-weight: 600; margin-bottom: 10px; font-size: 15px; }
.comfort-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.comfort-opts label { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--hairline); border-radius: 999px; background: var(--card); font-size: 14px; cursor: pointer; transition: border-color .15s ease, background .15s ease; min-height: 40px; }
.comfort-opts input { accent-color: var(--accent); width: 16px; height: 16px; }
.comfort-opts label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.comfort-opts label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

.form-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* Result */
.result { margin-top: 30px; }
.plan-head { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--hairline); margin-bottom: 24px; }
.plan-head h3 { font-size: clamp(20px, 3vw, 26px); letter-spacing: -.01em; }
.plan-meta { color: var(--ink-2); font-size: 15px; margin-top: 6px; }
.plan-meta strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.plan-actions { display: flex; gap: 10px; }
.plan-callout { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--hairline)); border-radius: var(--radius-sm); padding: 14px 16px; color: var(--accent-ink); font-size: 15px; margin-bottom: 24px; }

.focus-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 28px; }
.focus-chip { border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--card); }
.focus-chip .fc-name { font-weight: 600; font-size: 14px; }
.focus-chip .fc-bar { height: 6px; border-radius: 999px; background: var(--surface-2); margin: 8px 0 6px; overflow: hidden; }
.focus-chip .fc-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.focus-chip .fc-note { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.weeks { display: grid; gap: 14px; }
.week { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 18px 20px; background: var(--card); box-shadow: var(--shadow); transition: box-shadow .16s ease, transform .16s ease; }
.week:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.week-top { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; margin-bottom: 12px; }
.week-num { font-weight: 700; font-size: 18px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.phase-tag { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-ink); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; }
.week-hours { color: var(--muted); font-size: 13px; margin-left: auto; font-variant-numeric: tabular-nums; }
.week-focus { color: var(--ink-2); font-weight: 600; font-size: 14px; margin: 0 0 10px; }
.week ul { margin: 0; padding-left: 20px; color: var(--ink-2); }
.week li { margin: 4px 0; }
.week .milestone { margin-top: 12px; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--accent-ink); }
.week .milestone::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }

/* Recommendations */
.recs { margin-top: 30px; border-top: 1px solid var(--hairline); padding-top: 26px; }
.recs h3 { font-size: 20px; letter-spacing: -.01em; }
.recs p.recs-sub { color: var(--ink-2); margin: 8px 0 18px; max-width: 62ch; }
.rec-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.rec { border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 16px; background: var(--card); }
.rec h4 { margin: 0 0 6px; font-size: 16px; }
.rec p { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }
.rec .rec-tag { font-size: 12px; color: var(--muted); }
.rec a { display: inline-block; margin-top: 4px; font-weight: 600; color: var(--accent-ink); text-decoration: none; border-bottom: 2px solid var(--accent-soft); }
.rec a:hover { border-color: var(--accent); }

/* How it works */
.how { padding: clamp(28px, 4vw, 48px) 0 clamp(40px, 6vw, 72px); }
.steps { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--hairline); }
.steps li { display: flex; gap: 14px; padding: 22px 24px 22px 0; align-items: flex-start; border-right: 1px solid var(--hairline); }
.steps li:last-child { border-right: 0; }
.step-n { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.steps h3 { font-size: 16px; margin-bottom: 4px; }
.steps p { color: var(--ink-2); font-size: 14px; margin: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--hairline); background: var(--surface-2); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 20px 40px; justify-content: space-between; padding-top: 34px; padding-bottom: 20px; }
.disclosure { color: var(--muted); font-size: 13px; max-width: 52ch; margin: 8px 0 0; }
.footer-nav { display: flex; gap: 20px; align-items: flex-start; }
.footer-nav a { color: var(--ink-2); text-decoration: none; font-size: 14px; }
.footer-nav a:hover { color: var(--accent-ink); }
.copyright { color: var(--muted); font-size: 12px; padding: 0 clamp(20px, 5vw, 40px) 26px; max-width: var(--maxw); margin-inline: auto; }

/* Responsive */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { order: -1; max-width: 420px; }
  .steps { grid-template-columns: 1fr; border-top: 0; }
  .steps li { border-right: 0; border-bottom: 1px solid var(--hairline); padding-right: 0; }
  .steps li:last-child { border-bottom: 0; }
}
@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
  .site-nav { display: none; }
  .segmented { width: 100%; }
  .seg { flex: 1; }
  .seg span { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
  .week:hover { transform: none; }
}

/* ---------- Motion: gated behind .anim (JS adds it only when motion is allowed) ---------- */
@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes growBar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.anim .hero-copy > * { opacity: 0; animation: riseIn .6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.anim .hero-copy > *:nth-child(1) { animation-delay: .04s; }
.anim .hero-copy > *:nth-child(2) { animation-delay: .12s; }
.anim .hero-copy > *:nth-child(3) { animation-delay: .20s; }
.anim .hero-copy > *:nth-child(4) { animation-delay: .28s; }
.anim .hero-visual { opacity: 0; animation: riseIn .7s cubic-bezier(0.16, 1, 0.3, 1) .18s forwards; }
.anim .hero-visual .draw { stroke-dasharray: 340; stroke-dashoffset: 340; animation: drawLine 1.15s ease-out .55s forwards; }

.anim .reveal { opacity: 0; transform: translateY(16px); }
.anim .reveal.in { opacity: 1; transform: none; transition: opacity .55s cubic-bezier(0.16, 1, 0.3, 1), transform .55s cubic-bezier(0.16, 1, 0.3, 1); transition-delay: var(--d, 0ms); }

.anim #result.show { animation: popIn .45s cubic-bezier(0.16, 1, 0.3, 1) both; }
.anim .week.wk-in { animation: cardIn .5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.anim .focus-chip .fc-bar > span { transform-origin: left; animation: growBar .9s cubic-bezier(0.16, 1, 0.3, 1) both; }

.rec { transition: box-shadow .16s ease, transform .16s ease; }
.rec:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }

/* Safety: if reduced-motion is on, never leave an animated element hidden */
@media (prefers-reduced-motion: reduce) {
  .anim .reveal, .anim .hero-copy > *, .anim .hero-visual { opacity: 1 !important; transform: none !important; }
  .anim .hero-visual .draw { stroke-dashoffset: 0 !important; }
}

/* Print: show only the generated plan */
@media print {
  .site-header, .hero, .plan-form, .how, .site-footer, .skip-link, .plan-actions, .section-sub, #builder-title { display: none !important; }
  body { background: #fff; }
  .builder { padding: 0; }
  .result { margin: 0; }
  .week, .builder-panel, .rec, .focus-chip { box-shadow: none !important; break-inside: avoid; }
  .week:hover { transform: none; }
  a { color: #000; }
}
