/* ==========================================================================
   Assessment3 — Student page
   Brand: NXTHarbor navy / orange / teal. Headings Georgia, body Segoe UI.
   ========================================================================== */

:root {
  --navy: #0A2342;
  --navy-2: #163454;
  --orange: #C96A16;
  --orange-bright: #E07B1C;
  --orange-tint: #FCEEDD;
  --teal: #00707F;
  --ink: #13212F;
  --muted: #4C5A6E;
  --faint: #6F7C8E;
  --line: #DBE1EA;
  --bg: #F6F7F9;
  --white: #FFFFFF;
  --ok: #1F7A4D;
  --ok-tint: #E7F5EC;
  --red: #9A2B2B;
  --red-tint: #FBEAEA;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

/* ---------- Header / footer ---------- */
.site-header {
  background: var(--navy);
  padding: 14px 24px;
}
.site-logo { display: block; height: 36px; width: auto; }

.site-footer {
  text-align: center;
  font-size: 13px;
  color: var(--faint);
  padding: 8px 16px 40px;
}

/* ---------- Page frame ---------- */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 36px 20px 40px;
}

h1, h2, h3 { font-family: var(--serif); color: var(--navy); line-height: 1.25; margin: 0; }
h1 { font-size: 32px; letter-spacing: -0.2px; }
h2 { font-size: 22px; margin-bottom: 14px; }
h3 { font-size: 17px; }

.lead { font-size: 17px; color: var(--muted); max-width: 60ch; margin: 10px 0 0; }
.muted { color: var(--muted); margin: -6px 0 18px; }

.intro { margin-bottom: 34px; }
#setup-section, #summary-section, #activities-section { margin-bottom: 36px; }

/* ---------- Integrity notice ---------- */
.integrity {
  background: var(--orange-tint);
  border-left: 4px solid var(--orange);
  border-radius: 0 10px 10px 0;
  padding: 16px 20px;
  margin-bottom: 22px;
}
.integrity h3 { font-size: 16px; margin-bottom: 6px; color: var(--navy); }
.integrity p { margin: 0; color: #4a3517; font-size: 15px; }

/* ---------- Details form ---------- */
.details {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px 20px;
}
@media (min-width: 640px) {
  .field-grid { grid-template-columns: 1fr 1fr; }
}

.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #B9C3D0;
  border-radius: 8px;
}
.field input::placeholder { color: #8C97A6; }
.field input:hover { border-color: var(--faint); }
.field input[aria-invalid="true"] { border-color: var(--red); background: #FFFAFA; }

.field-error {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--red);
}

.declaration {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  font-size: 15px;
  color: var(--ink);
}
.check input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--navy);
}

.form-message {
  margin: 18px 0 0;
  padding: 11px 14px;
  border-radius: 8px;
  background: var(--red-tint);
  color: var(--red);
  font-size: 14.5px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 22px;
  margin-top: 22px;
}

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  border-radius: 8px;
}
.btn-primary {
  background: var(--orange);
  color: var(--white);
  padding: 12px 24px;
}
.btn-primary:hover { background: var(--orange-bright); }
.btn-primary:disabled { background: #D9B58C; cursor: wait; }
.btn-link {
  background: none;
  color: var(--navy);
  padding: 8px 0;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-link:hover { color: var(--orange); }
.btn-link:disabled { color: var(--faint); cursor: wait; }

/* ---------- Registered summary ---------- */
.summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
}
.summary > div { flex: 1 1 280px; min-width: 0; }
.summary-name { margin: 0; font-family: var(--serif); font-size: 19px; font-weight: 700; color: var(--navy); }
.summary-meta { margin: 2px 0 0; font-size: 14px; color: var(--muted); }

/* ---------- Banner (live updates) ---------- */
.banner {
  margin: 0 0 22px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--ok-tint);
  color: var(--ok);
  font-size: 15px;
  font-weight: 600;
}
.banner.is-error { background: var(--red-tint); color: var(--red); }

/* ---------- Step rail ---------- */
.steps { list-style: none; margin: 0; padding: 0; }

.step {
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr;
  column-gap: 16px;
  padding-bottom: 22px;
}
.step:last-child { padding-bottom: 0; }

/* the rail connecting one marker to the next */
.step::before {
  content: '';
  position: absolute;
  left: 21px;
  top: 46px;
  bottom: 2px;
  width: 2px;
  background: var(--line);
}
.step:last-child::before { display: none; }
.step.is-submitted::before { background: var(--navy); }

.step-marker {
  position: relative;
  z-index: 1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  background: var(--white);
  border: 2px solid var(--line);
  color: var(--faint);
}
.step-marker svg, .step-marker .mk-num { grid-area: 1 / 1; }
.mk-lock, .mk-check { display: none; }

.is-locked .mk-num { display: none; }
.is-locked .mk-lock { display: block; }

.is-open .step-marker,
.is-in_progress .step-marker {
  border-color: var(--orange);
  background: var(--orange-tint);
  color: var(--orange);
}

.is-submitted .step-marker {
  border-color: var(--navy);
  background: var(--navy);
  color: var(--white);
}
.is-submitted .mk-num { display: none; }
.is-submitted .mk-check { display: block; }

.step-main {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 0;
}
.is-locked .step-main {
  background: transparent;
  border-style: dashed;
}
.is-open .step-main,
.is-in_progress .step-main {
  border-color: var(--orange);
  box-shadow: 0 4px 16px rgba(201, 106, 22, 0.12);
}

.step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
}
.is-locked .step-title { color: var(--muted); }

.step-state {
  font-size: 13px;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 100px;
  background: #E9EDF2;
  color: var(--muted);
}
.is-open .step-state,
.is-in_progress .step-state { background: var(--orange-tint); color: var(--orange); }
.is-submitted .step-state { background: var(--ok-tint); color: var(--ok); }

.step-note { margin: 6px 0 0; font-size: 14.5px; color: var(--muted); }

.step-body { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- Inside an open step ---------- */
.step-body h4 {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--navy);
  margin: 0 0 6px;
}
.panel-start p { margin: 0 0 14px; color: var(--muted); font-size: 15px; }

.work-intro { margin: 0 0 14px; color: var(--muted); font-size: 15px; }

.mail {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #FAFBFC;
  margin-bottom: 16px;
  overflow: hidden;
}
.mail-head { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #F1F4F8; }
.mail-head > div { display: flex; gap: 12px; padding: 2px 0; font-size: 14px; }
.mail-head dt { flex: 0 0 56px; color: var(--faint); }
.mail-head dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.m-subject { font-weight: 600; }
.mail-body { margin: 0; padding: 14px 16px; white-space: pre-line; }

.scenario {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #FAFBFC;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.scenario-text { margin: 0; white-space: pre-line; }

.know {
  border-left: 4px solid var(--teal);
  background: #E8F3F5;
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.know-sub { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.know-text { margin: 0; white-space: pre-line; }

.tasks { margin-bottom: 18px; }
.task-list { margin: 0; padding-left: 20px; }
.task-list li { margin-bottom: 4px; }

.answer-label { display: block; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.answer {
  display: block;
  width: 100%;
  min-height: 240px;
  padding: 12px 14px;
  font: inherit;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #B9C3D0;
  border-radius: 8px;
  resize: vertical;
}
.answer:hover { border-color: var(--faint); }

.work-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--muted);
}
.save-status { color: var(--faint); }
.save-status.is-error { color: var(--red); font-weight: 600; }

.work-error {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--red-tint);
  color: var(--red);
  font-size: 14.5px;
}

.work-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 16px;
}
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.confirm-text { font-size: 14.5px; font-weight: 600; color: var(--navy); }
.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border: 1px solid #B9C3D0;
  padding: 11px 18px;
}
.btn-secondary:hover { border-color: var(--navy); }
.btn:disabled { cursor: wait; opacity: 0.7; }

.done-answer {
  margin-top: 10px;
  padding: 12px 14px;
  background: #FAFBFC;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.done-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* a step that just opened while the student was waiting */
@keyframes just-opened {
  0%   { box-shadow: 0 0 0 0 rgba(201, 106, 22, 0.55); }
  100% { box-shadow: 0 0 0 14px rgba(201, 106, 22, 0); }
}
.step.just-opened .step-main { animation: just-opened 1.4s ease-out 2; }

.complete {
  margin: 26px 0 0;
  padding: 16px 20px;
  border-radius: 10px;
  background: var(--ok-tint);
  color: var(--ok);
  font-weight: 600;
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  h1 { font-size: 26px; }
  .page { padding-top: 26px; }
  .details { padding: 18px; }
  .step { grid-template-columns: 36px 1fr; column-gap: 12px; }
  .step-marker { width: 36px; height: 36px; font-size: 15px; }
  .step::before { left: 17px; top: 38px; }
  .step-main { padding: 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .step.just-opened .step-main { animation: none; }
}