/* =============================================================================
 * Teach the Machine — page styling.
 * Tokens and type scale are lifted from the curriculum hub so this page reads as
 * part of the same site. LIGHT ONLY — this site has no dark theme, so this file
 * deliberately contains no dark-scheme media query anywhere.
 * ========================================================================== */

:root {
  --navy: #15487f;
  --teal: #205fa6;
  --teal-light: rgba(32, 95, 166, 0.1);
  --green: #1f6a58;
  --green-light: rgba(31, 106, 88, 0.1);
  --coral: #b5431c;
  --coral-light: rgba(181, 67, 28, 0.1);
  --cream: #eaf0f7;
  --ink: #14223a;
  --muted: #4d5870;
  --line: rgba(20, 34, 58, 0.14);
  --card: #ffffff;
  --surface-2: #f3f7fc;
  --focus-ring: #b5431c;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(20, 34, 58, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--cream);
  color: var(--ink);
  font-family:
    "Atkinson Hyperlegible",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  font-size: 18px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 420px at 92% -10%, rgba(31, 106, 88, 0.13), transparent 60%),
    radial-gradient(820px 420px at -6% 4%, rgba(32, 95, 166, 0.15), transparent 56%), var(--cream);
}

h1,
h2,
h3 {
  font-family: "Nunito", "Atkinson Hyperlegible", system-ui, sans-serif;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

a {
  color: var(--teal);
  text-decoration: none;
}
a:hover,
a:focus-visible {
  color: var(--navy);
  text-decoration: underline;
}

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

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

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 72px;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 18px 0 4px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 15px;
}

.spacer {
  flex: 1 1 auto;
}

.lang-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.lang-toggle button {
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  min-height: 44px;
  min-width: 56px;
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.lang-toggle button[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */

.hero {
  padding: 18px 0 10px;
}

.hero h1 {
  font-size: clamp(30px, 5vw, 44px);
  color: var(--navy);
}

.hero .lede {
  margin-top: 8px;
  max-width: 62ch;
  color: var(--muted);
  font-size: 18px;
}

.why-card {
  margin: 18px 0 26px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 6px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.why-card .why-kicker {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
}

.why-card .why-text {
  margin-top: 4px;
  font-size: 17px;
}

.why-card .why-meta {
  margin-top: 6px;
  font-size: 15px;
  color: var(--muted);
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }
  /* The checklist IS the scoring model. On a phone it goes first. */
  .rail {
    order: -1;
  }
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel + .panel {
  margin-top: 20px;
}

.panel h2 {
  font-size: 20px;
  color: var(--navy);
}

.panel .hint {
  margin-top: 4px;
  font-size: 15px;
  color: var(--muted);
}

/* ── Learner card + chat ─────────────────────────────────────────────────── */

.learner-head {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.avatar {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 900;
  font-size: 24px;
}

.learner-name {
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: var(--navy);
}

.learner-blurb {
  font-size: 15px;
  color: var(--muted);
}

.log {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 0 6px;
}

.msg {
  max-width: 92%;
  padding: 13px 16px;
  border-radius: 16px;
  font-size: 17px;
}

.msg-learner {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}

.msg-student {
  align-self: flex-end;
  background: var(--teal-light);
  border: 1px solid rgba(32, 95, 166, 0.28);
  border-bottom-right-radius: 5px;
}

.msg-who {
  display: block;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}

.msg-thinking {
  color: var(--muted);
  font-style: italic;
}

/* ── Composer ────────────────────────────────────────────────────────────── */

.composer {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.chip-label {
  width: 100%;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.chip {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 14px;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  text-align: left;
}

.chip:hover {
  background: var(--teal-light);
  border-color: var(--teal);
}

.chip-word {
  background: var(--green-light);
  border-color: rgba(31, 106, 88, 0.3);
}

.chip-word:hover {
  background: rgba(31, 106, 88, 0.18);
  border-color: var(--green);
}

textarea {
  width: 100%;
  min-height: 148px;
  padding: 14px 16px;
  font: inherit;
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  resize: vertical;
}

textarea:focus {
  border-color: var(--teal);
}

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

.btn {
  font: inherit;
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 800;
  font-size: 17px;
  min-height: 52px;
  padding: 12px 26px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--navy);
  color: #fff;
}

.btn:hover {
  background: var(--teal);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-quiet {
  background: var(--card);
  color: var(--navy);
  border-color: var(--line);
}

.btn-quiet:hover {
  background: var(--surface-2);
  color: var(--navy);
}

.coach-note {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--coral-light);
  border-left: 5px solid var(--coral);
  border-radius: var(--radius-sm);
  font-size: 16px;
}

.coach-note:empty {
  display: none;
}

/* ── Checklist (the visible scoring model) ───────────────────────────────── */

.rail .panel {
  position: sticky;
  top: 16px;
}

@media (max-width: 900px) {
  .rail .panel {
    position: static;
  }
}

.checklist {
  list-style: none;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.check-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 16px;
}

.check-item.done {
  background: var(--green-light);
  border-color: rgba(31, 106, 88, 0.4);
}

.check-box {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid var(--muted);
  background: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 17px;
  color: transparent;
}

.check-item.done .check-box {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.check-item.done .check-text {
  font-weight: 700;
}

.progress-line {
  margin-top: 14px;
  font-size: 15px;
  color: var(--muted);
}

.bar {
  margin-top: 6px;
  height: 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  background: var(--green);
  transition: width 0.35s ease;
}

/* ── Win state ───────────────────────────────────────────────────────────── */

.win {
  margin-top: 24px;
  border: 2px solid var(--green);
  border-left-width: 8px;
}

.win h2 {
  color: var(--green);
}

.summary-card {
  margin-top: 16px;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #ffffff, var(--surface-2));
}

.summary-card .sc-kicker {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
}

.summary-card .sc-title {
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(22px, 3.4vw, 30px);
  color: var(--navy);
  margin-top: 4px;
}

.summary-card ul {
  margin: 14px 0 0 20px;
  font-size: 16px;
}

.summary-card li {
  margin-bottom: 6px;
}

.summary-card .sc-foot {
  margin-top: 14px;
  font-size: 14px;
  color: var(--muted);
}

details.model-answer {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 12px 14px;
}

details.model-answer summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--navy);
  min-height: 44px;
  display: flex;
  align-items: center;
}

details.model-answer p {
  margin-top: 10px;
  font-size: 16px;
}

.note-offline {
  margin-top: 12px;
  font-size: 15px;
  color: var(--muted);
}

.footer-note {
  margin-top: 30px;
  font-size: 15px;
  color: var(--muted);
  max-width: 72ch;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
