/* Jaden's SAT Playbook - one shared stylesheet.
   Semantic tokens (shadcn naming) mapped to the Adsalt classroom palette.
   Old-school schoolhouse theme: chalkboard header, ruled worksheet body.
   No JS, no external images. Fonts load from Google with full system fallbacks. */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Hanken+Grotesk:wght@400;500;600;700&display=swap');

:root {
  /* color tokens - light (premium editorial) */
  --background: #F4F0E7;          /* warm ivory */
  --foreground: #211F1A;          /* ink */
  --card: #FBF9F3;                /* paper white */
  --card-foreground: #211F1A;
  --primary: #1F3B31;             /* deep forest */
  --primary-foreground: #F3EFE4;  /* soft chalk */
  --secondary: #B0894C;           /* brass */
  --secondary-dark: #8A6836;      /* deep brass */
  --accent: #9F3E27;              /* clay */
  --accent-foreground: #FBF9F3;
  --muted: #EAE3D5;
  --muted-foreground: #6A614F;
  --border: #DCD3C1;
  --ring: #9F3E27;
  --rule-line: rgba(106, 97, 79, 0.14);
  --banner-bg: #F0E4C4;
  --banner-border: #B0894C;
  --shadow-soft: 0 1px 2px rgba(31, 28, 22, 0.05), 0 6px 20px rgba(31, 28, 22, 0.07);
  --shadow-lift: 0 2px 6px rgba(31, 28, 22, 0.07), 0 18px 40px rgba(31, 28, 22, 0.13);

  --radius: 8px;

  /* type + space scales (fluid, 8pt rhythm) */
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --step--1: clamp(0.85rem, 0.81rem + 0.2vw, 0.95rem);
  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --step-1: clamp(1.3rem, 1.2rem + 0.5vw, 1.55rem);
  --step-2: clamp(1.6rem, 1.42rem + 0.9vw, 2.15rem);
  --step-3: clamp(2.1rem, 1.7rem + 2vw, 3.2rem);
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 56px;
  --space-section: clamp(32px, 5vw, 64px);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* night (premium editorial) */
    --background: #14130F;
    --foreground: #EAE3D5;
    --card: #1C1A15;
    --card-foreground: #EAE3D5;
    --primary: #24473B;
    --primary-foreground: #F1ECDF;
    --secondary: #C8A163;
    --secondary-dark: #9A7B44;
    --accent: #CF7150;
    --accent-foreground: #17130C;
    --muted: #26231C;
    --muted-foreground: #A99A80;
    --border: #362F24;
    --ring: #CF7150;
    --rule-line: rgba(169, 154, 128, 0.14);
    --banner-bg: #2C2410;
    --banner-border: #9A7B44;
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.45), 0 8px 24px rgba(0, 0, 0, 0.55);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.55), 0 20px 44px rgba(0, 0, 0, 0.65);
  }
}

/* base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
}
h1, h2, h3 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-2);
}
h1 { font-size: var(--step-3); font-weight: 600; }
h2 { font-size: var(--step-2); margin-top: var(--space-4); }
h3 { font-size: var(--step-1); margin-top: var(--space-3); }
p, ul, ol { max-width: 68ch; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:active { opacity: 0.8; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--secondary); color: var(--accent-foreground); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-foreground);
  padding: 12px 20px;
  z-index: 10;
}
.skip-link:focus-visible { left: var(--space-2); top: var(--space-2); }

/* masthead */
.chalkboard {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(130% 150% at 50% -25%, color-mix(in srgb, var(--secondary) 20%, transparent), transparent 62%),
    radial-gradient(ellipse at 12% 118%, rgba(243, 239, 228, 0.06), transparent 55%),
    var(--primary);
  color: var(--primary-foreground);
  border: 1px solid color-mix(in srgb, var(--secondary) 40%, transparent);
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: var(--shadow-soft);
  margin: var(--space-2);
  padding: clamp(44px, 6vw, 88px) var(--space-section);
  text-align: center;
}
.chalkboard::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--secondary), transparent);
  opacity: 0.75;
}
.chalkboard nav { text-align: left; position: relative; }
.home-link {
  display: inline-block;
  color: var(--primary-foreground);
  text-decoration: none;
  padding: 10px 4px; /* comfortable tap target */
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
  transition: opacity 150ms ease-out, color 150ms ease-out;
}
.home-link::before { content: "\2190\00a0"; color: var(--secondary); }
.home-link:hover { opacity: 1; color: var(--secondary); }
.board-icon svg {
  width: 40px;
  height: 40px;
  stroke: var(--secondary);
  opacity: 0.95;
}
.chalkboard h1 { margin: var(--space-2) 0 var(--space-1); letter-spacing: -0.02em; }
.board-sub {
  margin: 0 auto;
  font-size: var(--step--1);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.72;
}
.board-lede {
  margin: var(--space-3) auto 0;
  max-width: 48ch;
  font-size: var(--step-1);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.4;
  opacity: 0.92;
}

/* content surface */
.worksheet {
  position: relative;
  max-width: 820px;
  margin: 0 auto var(--space-5);
  padding: clamp(28px, 4vw, 56px);
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

/* welcome block */
.welcome {
  background: color-mix(in srgb, var(--muted) 55%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
}
.welcome h2 { margin-top: 0; }
.goal {
  border-left: 4px solid var(--secondary);
  padding-left: var(--space-2);
  font-size: var(--step-1);
  font-family: var(--font-display);
}

/* cards (shadcn anatomy) */
.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: var(--space-3);
}
.card-header { margin-bottom: var(--space-2); }
.card-title {
  font-family: var(--font-display);
  font-size: var(--step-1);
  margin: 0;
}
.card-description { color: var(--muted-foreground); margin: 4px 0 0; }
.card-content > :first-child { margin-top: 0; }
.card-content > :last-child { margin-bottom: 0; }

/* index section grid */
.section-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3);
  padding: 0;
  margin: var(--space-4) 0;
  max-width: none;
}
.section-grid a {
  display: block;
  height: 100%;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 200ms ease-out, box-shadow 200ms ease-out;
}
.section-grid a:hover { transform: translateY(-3px); }
.section-grid a:hover .card { box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--secondary) 55%, var(--border)); }
.section-grid a:active { transform: translateY(-1px); }
.section-grid .card { height: 100%; transition: border-color 200ms ease-out; }
.section-grid .card-icon svg {
  width: 28px;
  height: 28px;
  stroke: var(--secondary);
  margin-bottom: var(--space-2);
}
.section-grid .card-title { color: var(--foreground); margin-top: 2px; }
.section-num {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step--1);
  color: var(--secondary-dark);
  letter-spacing: 0.18em;
  margin-bottom: 2px;
}

/* primary CTA */
.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-foreground);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  padding: 15px 32px;
  border-radius: var(--radius);
  margin-top: var(--space-3);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 200ms ease-out, box-shadow 200ms ease-out, background 200ms ease-out;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn:active { transform: translateY(0); }

/* play cards */
.play {
  margin: var(--space-5) 0 var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.play-label {
  display: inline-block;
  color: var(--secondary-dark);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}

/* badges + placeholder blocks */
.badge {
  display: inline-block;
  background: var(--secondary);
  color: var(--accent-foreground);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 12px;
  border-radius: var(--radius);
}
.placeholder {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--muted) 35%, transparent);
  padding: var(--space-3);
  margin: var(--space-3) 0;
  text-align: center;
}
.placeholder .badge { margin-bottom: var(--space-1); }
.placeholder h3 { margin-top: 4px; }
.placeholder p { margin: 4px auto 0; color: var(--muted-foreground); max-width: 52ch; }

/* alerts (notes, disclaimers) */
.alert {
  border: 1px solid var(--secondary);
  border-left-width: 6px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--banner-bg) 45%, var(--card));
  padding: var(--space-2) var(--space-3);
  margin: var(--space-3) 0;
}
.alert > :first-child { margin-top: 0; }
.alert > :last-child { margin-bottom: 0; }

/* questions */
.question {
  margin: var(--space-4) 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}
.question .passage {
  font-style: italic;
  border-left: 3px solid var(--border);
  padding-left: var(--space-2);
  color: var(--muted-foreground);
}
.choices { list-style: none; padding: 0; }
.choices li { display: flex; gap: 12px; align-items: baseline; margin: 10px 0; }
.choices .letter {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9em;
  height: 1.9em;
  border: 1.5px solid var(--foreground);
  border-radius: 50%;
  font-weight: 600;
  font-size: var(--step--1);
}
details.answer-key {
  margin: var(--space-4) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
}
details.answer-key summary {
  cursor: pointer;
  font-weight: 700;
  padding: 14px var(--space-3);
}
details.answer-key[open] summary { border-bottom: 1px solid var(--border); }
details.answer-key .key-body { padding: var(--space-2) var(--space-3); }

/* tables */
.table-wrap { overflow-x: auto; margin: var(--space-3) 0; }
table {
  border-collapse: collapse;
  width: 100%;
  background: var(--card);
  font-size: var(--step--1);
}
caption {
  text-align: left;
  font-weight: 700;
  padding-bottom: var(--space-1);
}
th, td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}
th {
  background: var(--primary);
  color: var(--primary-foreground);
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.03em;
}
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--muted) 45%, transparent); }
td.blank { height: 44px; }

/* form controls (error log selects/inputs) */
select, input[type="text"] {
  font: inherit;
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--card-foreground);
  width: 100%;
}
/* keep the auto-filled log usable: one-line rows, controls never crushed; .table-wrap scrolls sideways */
[data-error-log] td { white-space: nowrap; }
[data-error-log] select { min-width: 10rem; }
[data-error-log] input[type="text"] { min-width: 16rem; }

/* reflection checklist */
.reflection-checklist {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  margin: var(--space-3) 0;
}
.reflection-checklist legend { padding: 0 6px; font-weight: 700; }
.reflection-checklist label { display: block; margin: 6px 0; }

/* footer */
.page-footer {
  max-width: 880px;
  margin: 0 auto var(--space-4);
  padding: 0 var(--space-2);
  text-align: center;
  color: var(--muted-foreground);
  font-size: var(--step--1);
}

@media (max-width: 480px) {
  .chalkboard { margin: var(--space-1); }
  .worksheet { border-left: none; border-right: none; border-radius: 0; }
}

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

/* quiz engine (assessments + play practice) */
button.btn, button.btn-outline { border: 0; font: inherit; }
.btn-outline {
  display: inline-block;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  padding: 12px 24px;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 200ms ease-out, background 200ms ease-out;
}
.btn-outline:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

.quiz-section-title { margin-top: var(--space-5); border-bottom: 2px solid var(--border); padding-bottom: 6px; }
.timer-chip {
  position: sticky;
  top: 8px;
  z-index: 5;
  margin-left: auto;
  width: max-content;
  max-width: 100%;
  display: flex;
  gap: 8px;
  align-items: baseline;
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 8px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  font-weight: 700;
}
.timer-cap { font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.8; font-weight: 400; }
.timer-chip.timer-up { background: var(--accent); color: var(--accent-foreground); }

.q-block { margin: var(--space-4) 0; padding-top: var(--space-2); border-top: 1px solid var(--border); }
.q-passage { font-style: italic; border-left: 3px solid var(--border); padding-left: var(--space-2); color: var(--muted-foreground); }
.q-review-verdict { font-weight: 700; margin: 0 0 4px; }
.choice-why { margin: 2px 0 10px; }

.choice-btn {
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--card);
  color: inherit;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 8px 0;
  min-height: 44px;
  cursor: pointer;
  font: inherit;
  transition: border-color 150ms ease-out, background 150ms ease-out;
}
.choice-btn:hover { border-color: var(--secondary); }
.choice-btn .letter {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9em;
  height: 1.9em;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-weight: 600;
  font-size: var(--step--1);
}
.choice-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
  box-shadow: inset 0 0 0 1px var(--accent);
}
.choice-btn:disabled { cursor: default; }
.choice-btn.is-correct { border-color: var(--primary); border-width: 2px; background: color-mix(in srgb, var(--primary) 12%, var(--card)); }
.choice-btn.is-incorrect { border-color: var(--accent); border-width: 2px; background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.choice-tag { margin-left: auto; flex: none; font-size: var(--step--1); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }

.why-box {
  border: 1px solid var(--border);
  border-left: 6px solid var(--secondary);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--muted) 55%, transparent);
  padding: var(--space-2) var(--space-3);
  margin: var(--space-2) 0;
}
.why-box p { margin: 6px 0; }

.quiz-actions { margin: var(--space-4) 0; display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.quiz-note { color: var(--muted-foreground); font-size: var(--step--1); }

.progress-dots { display: flex; gap: 6px; margin: var(--space-2) 0; flex-wrap: wrap; }
.progress-dots span { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--muted-foreground); }
.progress-dots .done { background: var(--primary); border-color: var(--primary); }
.progress-dots .missed { background: var(--accent); border-color: var(--accent); }
.progress-dots .current { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }

.results-card {
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--muted) 40%, var(--card));
  padding: var(--space-3);
  margin: var(--space-3) 0;
}
.results-card h2, .results-card h3 { margin-top: 0; }
.results-score { font-family: var(--font-display); font-size: var(--step-3); margin: 0; }
.results-sub { color: var(--muted-foreground); }

.status-badge {
  display: inline-block;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: var(--step--1);
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius);
  margin-top: 6px;
}
.status-badge.has-score { background: var(--primary); color: var(--primary-foreground); }
.status-badge.in-progress { background: var(--secondary); color: var(--accent-foreground); }

.practice-set { margin: var(--space-5) 0; padding-top: var(--space-3); border-top: 1px solid var(--border); }

/* play picker on practice pages */
.play-nav { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: var(--space-3) 0 0; }
.play-nav button {
  font: inherit;
  font-weight: 700;
  color: var(--accent);
  background: transparent;
  padding: 8px 18px;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 200ms ease-out, background 200ms ease-out;
}
.play-nav button:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.play-nav button[aria-current="true"] { background: var(--accent); color: var(--accent-foreground); }

/* course progress bar */
.progress-track { height: 12px; border-radius: var(--radius); background: var(--muted); overflow: hidden; margin-top: var(--space-2); }
.progress-fill { height: 100%; background: var(--primary); border-radius: var(--radius); transition: width 200ms ease-out; }

/* demo sample ribbon (this playbook is shown as a sales sample) */
.sample-ribbon {
  margin: var(--space-2) var(--space-2) 0;
  padding: 12px var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: baseline;
  justify-content: center;
  text-align: center;
  background: color-mix(in srgb, var(--secondary) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--secondary) 42%, var(--border));
  border-radius: var(--radius);
  color: var(--muted-foreground);
  font-size: var(--step--1);
  line-height: 1.45;
}
.sample-ribbon .ribbon-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--secondary-dark);
}
.sample-ribbon strong { color: var(--foreground); font-weight: 600; }

/* inert form preview (replaces a live embedded form in the demo) */
.form-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--muted) 28%, var(--card));
  padding: var(--space-3);
  margin: var(--space-3) 0;
}
.form-preview-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-bottom: var(--space-2);
}
.form-preview-head .quiz-note { margin: 0; }
.fp-field { display: block; margin: var(--space-2) 0; }
.fp-field > span { display: block; font-weight: 600; margin-bottom: 6px; }
.fp-input { display: block; height: 40px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--card); }
.fp-textarea { height: 76px; }
