/* =========================================================
   September 11, 2001-2026: Remembrance, Security, and the
   Digital World -- stylesheet
   ========================================================= */

:root {
  --navy: #0B1F3A;
  --navy-deep: #081527;
  --red: #A6192E;
  --white: #FFFFFF;
  --gray: #E5E7EB;
  --text: #172033;
  --gold: #B08D57;
  --gold-soft: #d9c8a8;
  --green-ok: #2f6b3f;
  --red-err: #A6192E;
  --radius: 4px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --max-width: 780px;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--white);
  line-height: 1.55;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--navy);
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h2 { font-size: 1.6rem; border-bottom: 1px solid var(--gray); padding-bottom: 0.5rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1rem; }

a { color: var(--navy); }
a:hover { color: var(--red); }

.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;
}

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--navy); color: var(--white);
  padding: 0.75rem 1rem; z-index: 200; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus {
  left: 0;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: var(--white);
  border-bottom: 3px solid var(--gold);
}
.header-inner {
  max-width: 980px; margin: 0 auto; padding: 1.5rem 1.25rem 1rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
}
.header-emblem { flex: 0 0 auto; }
.header-text { flex: 1 1 260px; }
.header-text h1 { color: var(--white); font-size: 1.7rem; margin-bottom: 0.15rem; }
.header-sub { color: var(--gold-soft); font-family: var(--serif); font-size: 1.05rem; margin: 0; }
.eyebrow { color: var(--gold-soft); font-size: 0.85rem; margin: 0 0 0.2rem; letter-spacing: 0.02em; }
.header-meta { flex: 0 0 auto; font-size: 0.85rem; color: var(--gray); text-align: right; }
.header-meta p { margin: 0 0 0.2rem; }

.progress-wrap { max-width: 980px; margin: 0 auto; padding: 0 1.25rem 1rem; }
.progress-track {
  background: rgba(255,255,255,0.15); border-radius: 999px; height: 10px; overflow: hidden;
}
.progress-bar {
  background: var(--gold); height: 100%; transition: width 0.4s ease;
}
@media (prefers-reduced-motion: reduce) {
  .progress-bar { transition: none; }
}
.progress-label { color: var(--gray); font-size: 0.8rem; margin: 0.4rem 0 0; }

/* ---------- Section nav ---------- */
.section-nav {
  background: var(--gray); border-bottom: 1px solid #d6d9de; overflow-x: auto;
}
.section-nav ol {
  list-style: none; display: flex; gap: 0.4rem; margin: 0; padding: 0.5rem 1rem;
  max-width: 980px; margin-inline: auto;
}
.nav-pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.78rem; padding: 0.35rem 0.7rem; border-radius: 999px;
  background: var(--white); border: 1px solid #cfd3d9; color: var(--text);
  white-space: nowrap; cursor: pointer; font-family: var(--sans);
}
.nav-pill[aria-current="step"] { background: var(--navy); color: var(--white); border-color: var(--navy); }
.nav-pill.is-complete { border-color: var(--green-ok); }
.nav-pill.is-complete::before { content: "\2713"; color: var(--green-ok); font-weight: bold; }
.nav-pill.is-locked { opacity: 0.55; cursor: not-allowed; }

/* ---------- Layout ---------- */
main { max-width: 980px; margin: 0 auto; padding: 0 1.25rem; }
.section-inner { max-width: var(--max-width); margin: 0 auto; padding: 2.25rem 0; }

.lesson-section { border-bottom: 1px solid var(--gray); scroll-margin-top: 1rem; }
.lesson-section.is-locked { display: none; }

.section-time {
  display: inline-block; font-size: 0.78rem; text-transform: none; color: var(--navy);
  background: var(--gray); padding: 0.2rem 0.6rem; border-radius: 999px; margin-bottom: 0.75rem;
  font-family: var(--sans);
}

.lead-copy { font-size: 1.02rem; }
.helper-text { color: #4a5468; font-size: 0.95rem; }

/* ---------- Cards ---------- */
.notice-card, .content-card, .response-card, .remembrance-card, .moment-card, .score-summary {
  background: var(--gray); border-left: 4px solid var(--navy);
  padding: 1rem 1.25rem; border-radius: var(--radius); margin: 1rem 0;
}
.remembrance-card {
  background: #f7f4ee; border-left: 4px solid var(--gold);
  font-family: var(--serif); font-size: 1.05rem; text-align: left;
}
.remembrance-card p:last-child { margin-bottom: 0; }
.moment-card { text-align: center; background: #f7f4ee; border-left: 4px solid var(--gold); }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
input[type="text"], textarea, select {
  width: 100%; padding: 0.6rem 0.7rem; border: 1px solid #b7bcc4; border-radius: var(--radius);
  font-family: var(--sans); font-size: 1rem; color: var(--text);
}
textarea { resize: vertical; }
.form-row { margin-bottom: 1rem; }
.checkbox-row { display: flex; align-items: flex-start; gap: 0.6rem; }
.checkbox-row input { width: auto; margin-top: 0.3rem; }
.checkbox-row label { font-weight: 500; margin: 0; }
.field-error { color: var(--red-err); font-size: 0.85rem; margin: 0.3rem 0 0; }
.field-error::before { content: "\26A0 "; }
.privacy-note { font-size: 0.82rem; color: #5a6478; }
.word-count { font-size: 0.82rem; color: #5a6478; margin-top: 0.3rem; }
.word-count.is-met { color: var(--green-ok); font-weight: 600; }
.field-status { font-size: 0.88rem; margin-top: 0.4rem; min-height: 1.1em; }
.field-status.is-success { color: var(--green-ok); }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--sans); font-size: 0.95rem; font-weight: 600; padding: 0.7rem 1.3rem;
  border-radius: var(--radius); border: 2px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--navy-deep); }
.btn-primary:disabled { background: #9aa3b5; cursor: not-allowed; }
.btn-secondary { background: var(--white); color: var(--navy); border-color: var(--navy); }
.btn-secondary:hover { background: var(--gray); }
.btn-danger { background: var(--white); color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: #fbeaec; }
.btn-large { font-size: 1.05rem; padding: 0.9rem 1.6rem; }
.section-continue { margin-top: 1.5rem; }

/* ---------- Before/After grid ---------- */
.ba-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.8rem; margin: 1rem 0; }
.ba-card {
  background: var(--white); border: 1px solid var(--gray); border-radius: var(--radius); padding: 0.9rem;
  cursor: pointer; text-align: left; font: inherit;
}
.ba-card h4 { margin: 0 0 0.4rem; font-size: 1rem; color: var(--navy); }
.ba-card .ba-before, .ba-card .ba-after { font-size: 0.88rem; margin: 0.3rem 0; }
.ba-card .ba-label { font-weight: 700; color: var(--red); }
.ba-card .ba-after-label { font-weight: 700; color: var(--green-ok); }
.ba-card .ba-after { display: none; }
.ba-card.is-open .ba-after { display: block; }
.ba-card.is-open { border-color: var(--gold); }

/* ---------- Timeline ---------- */
.timeline-list { display: flex; flex-direction: column; gap: 0.6rem; margin: 1rem 0; }
.timeline-item {
  display: flex; align-items: center; gap: 0.9rem; background: var(--white);
  border: 1px solid var(--gray); border-left: 5px solid var(--navy);
  border-radius: var(--radius); padding: 0.8rem 1rem; cursor: pointer; text-align: left;
  font: inherit; width: 100%;
}
.timeline-item:hover { background: #f6f7f9; }
.timeline-item.is-viewed { border-left-color: var(--gold); }
.timeline-item.is-viewed .timeline-check { visibility: visible; }
.timeline-year { font-family: var(--serif); font-weight: 700; color: var(--navy); min-width: 4.2rem; font-size: 1.1rem; }
.timeline-item-title { flex: 1; font-weight: 600; }
.timeline-check { color: var(--green-ok); visibility: hidden; font-weight: 700; }

.modal {
  position: fixed; inset: 0; background: rgba(11,31,58,0.6); display: flex;
  align-items: center; justify-content: center; z-index: 300; padding: 1rem;
}
.modal-content {
  background: var(--white); max-width: 560px; width: 100%; border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.75rem; position: relative; border-top: 4px solid var(--gold);
}
.modal-close {
  position: absolute; top: 0.6rem; right: 0.6rem; background: none; border: none;
  font-size: 1.5rem; cursor: pointer; color: var(--text); line-height: 1;
}
.modal-tag {
  display: inline-block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--navy); background: var(--gray); padding: 0.2rem 0.6rem;
  border-radius: 999px; margin-bottom: 0.5rem;
}

/* ---------- Matching activity ---------- */
.match-activity { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.match-col-title { font-size: 0.95rem; margin-bottom: 0.5rem; }
.match-list { display: flex; flex-direction: column; gap: 0.4rem; }
.match-option {
  background: var(--white); border: 1px solid var(--gray); border-radius: var(--radius);
  padding: 0.6rem 0.8rem; cursor: pointer; text-align: left; font: inherit; font-size: 0.92rem;
}
.match-option[aria-selected="true"] { border-color: var(--gold); background: #f7f0e3; }
.match-option:disabled { opacity: 0.45; cursor: not-allowed; }
.match-pairs { margin: 1rem 0; }
.match-pair-row {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.8rem; border-radius: var(--radius);
  margin-bottom: 0.4rem; font-size: 0.92rem;
}
.match-pair-row.is-correct { background: #e8f3ea; border-left: 4px solid var(--green-ok); }
.match-pair-row.is-incorrect { background: #fbeaec; border-left: 4px solid var(--red); }
@media (max-width: 640px) { .match-activity { grid-template-columns: 1fr; } }

/* ---------- Scenario cards ---------- */
.scenario-stack { display: flex; flex-direction: column; gap: 1.25rem; margin: 1rem 0; }
.scenario-card { border: 1px solid var(--gray); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.scenario-card h4 { color: var(--navy); margin-bottom: 0.3rem; }
.scenario-sector {
  display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  color: var(--red); margin-bottom: 0.4rem; letter-spacing: 0.03em;
}
.scenario-options { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.7rem 0; }
.scenario-option {
  text-align: left; background: var(--white); border: 1px solid var(--gray); border-radius: var(--radius);
  padding: 0.6rem 0.8rem; cursor: pointer; font: inherit; font-size: 0.92rem;
}
.scenario-option:disabled { cursor: default; }
.scenario-option.is-chosen-correct { border-color: var(--green-ok); background: #e8f3ea; }
.scenario-option.is-chosen-incorrect { border-color: var(--red); background: #fbeaec; }
.scenario-option.is-correct-unchosen { border-color: var(--green-ok); border-style: dashed; }
.scenario-feedback { font-size: 0.9rem; padding: 0.6rem 0.8rem; border-radius: var(--radius); background: var(--gray); margin-top: 0.4rem; }

/* ---------- Options fieldset (privacy) ---------- */
.option-fieldset { border: none; padding: 0; margin: 1rem 0; }
.option-fieldset legend { font-weight: 600; margin-bottom: 0.6rem; padding: 0; font-size: 0.98rem; }
.option-choice {
  display: flex; align-items: flex-start; gap: 0.6rem; border: 1px solid var(--gray);
  border-radius: var(--radius); padding: 0.7rem 0.9rem; margin-bottom: 0.5rem; cursor: pointer;
}
.option-choice input { margin-top: 0.25rem; }
.option-choice label { font-weight: 500; margin: 0; cursor: pointer; }

/* ---------- Knowledge checks ---------- */
.check-card {
  border: 1px dashed var(--gold); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 1.25rem 0;
  background: #fbf8f2;
}
.check-card:empty { display: none; }
.single-check + .single-check { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px dashed #d9c8a8; }
.check-prompt { font-weight: 600; margin-bottom: 0.5rem; }
.check-options { display: flex; flex-direction: column; gap: 0.4rem; }
.check-option {
  text-align: left; background: var(--white); border: 1px solid var(--gray); border-radius: var(--radius);
  padding: 0.5rem 0.7rem; cursor: pointer; font: inherit; font-size: 0.9rem;
}
.check-option.is-correct-answer { border-color: var(--green-ok); background: #e8f3ea; }
.check-option.is-wrong-answer { border-color: var(--red); background: #fbeaec; }
.check-feedback { margin-top: 0.5rem; font-size: 0.88rem; }
.check-retry { margin-top: 0.5rem; }

/* ---------- Assessment ---------- */
.assessment-question {
  border: 1px solid var(--gray); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.assessment-question h4 { font-size: 1rem; margin-bottom: 0.2rem; }
.assessment-question .aq-meta { font-size: 0.78rem; color: #5a6478; margin-bottom: 0.5rem; }
.assessment-choice {
  display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.4rem 0; cursor: pointer;
}
.assessment-choice input { margin-top: 0.25rem; }
.assessment-choice label { font-weight: 400; margin: 0; cursor: pointer; }
.assessment-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1rem 0; }
.assessment-results { border-top: 3px solid var(--gold); padding-top: 1rem; margin-top: 1rem; }
.aq-review { border-left: 4px solid var(--gray); padding: 0.6rem 0.9rem; margin-bottom: 0.8rem; }
.aq-review.is-correct { border-left-color: var(--green-ok); }
.aq-review.is-incorrect { border-left-color: var(--red); }
.aq-your-answer { font-size: 0.88rem; }
.aq-explain { font-size: 0.88rem; color: #4a5468; }

/* ---------- Checklist / review ---------- */
.checklist { list-style: none; padding: 0; margin: 1rem 0; }
.checklist li {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid var(--gray);
  font-size: 0.94rem;
}
.checklist li .status-icon { font-weight: 700; width: 1.2rem; text-align: center; }
.checklist li.is-done .status-icon { color: var(--green-ok); }
.checklist li.is-pending .status-icon { color: var(--red); }

.sources-section, .teacher-panel { margin-top: 2rem; }
.sources-list { padding-left: 1.2rem; font-size: 0.92rem; }
.sources-list li { margin-bottom: 0.6rem; }
.teacher-panel summary { cursor: pointer; font-weight: 700; color: var(--navy); padding: 0.5rem 0; }
.teacher-panel-body { font-size: 0.9rem; }
.teacher-panel-body p { margin-bottom: 0.7rem; }

.utility-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1rem 0; }

/* ---------- Toasts ---------- */
.toast-region { position: fixed; bottom: 1rem; right: 1rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 400; }
.toast {
  background: var(--navy); color: var(--white); padding: 0.7rem 1rem; border-radius: var(--radius);
  font-size: 0.88rem; box-shadow: 0 4px 12px rgba(0,0,0,0.2); max-width: 280px;
}
.toast.is-error { background: var(--red); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy-deep); color: var(--gray); text-align: center; padding: 1.5rem 1rem;
  font-size: 0.85rem; margin-top: 2rem;
}
.site-footer p { margin: 0.2rem 0; }

/* ---------- Print ---------- */
@media print {
  .site-header, .section-nav, .site-footer, .toast-region, .btn, .modal { display: none !important; }
  .lesson-section.is-locked { display: block !important; }
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .header-meta { text-align: left; }
  h2 { font-size: 1.35rem; }
}
