/* =====================================================================
   AI Challenge 4W — Design tokens
   Palette: Ink (near-black, blue-tinted) / Paper (warm off-white) /
            Signal Gold (achievement) / Deep Teal (progress) /
            Moss (passed/success) / Slate (muted text)
   Type: serif display for headlines (editorial, confident) +
         system sans for UI/body (fast, no external font requests)
   ===================================================================== */
:root {
  --ink: #12181d;
  --ink-soft: #232c33;
  --paper: #f7f5f0;
  --paper-dim: #ece8e0;
  --line: #dcd6c9;
  --gold: #c8912f;
  --gold-soft: #f1e0bb;
  --teal: #1f5c56;
  --teal-soft: #dcebe8;
  --moss: #3f7a4f;
  --moss-soft: #ddeee0;
  --rust: #a63d2f;
  --slate: #5b6670;

  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 3px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { max-width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 .4em;
  letter-spacing: -0.01em;
}
h1 { font-size: 2.3rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }
p { max-width: 62ch; }

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

/* ---------- Layout shells ---------- */
.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

.topbar {
  background: var(--ink);
  color: var(--paper);
  border-bottom: 1px solid #000;
}
.topbar .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
}
.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  color: var(--paper);
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.brand small { font-family: var(--sans); font-weight: 400; color: #9aa4ab; font-size: .72rem; }
.topnav { display: flex; align-items: center; gap: 22px; font-size: .92rem; }
.topnav a { text-decoration: none; color: #cfd6da; }
.topnav a:hover { color: var(--paper); }
.topnav .points-pill {
  background: var(--gold-soft);
  color: #4a340c;
  border-radius: 999px;
  padding: 5px 14px;
  font-weight: 600;
  font-size: .85rem;
}

main { padding: 40px 0 70px; min-height: 60vh; }

.footer {
  border-top: 1px solid var(--line);
  color: var(--slate);
  font-size: .85rem;
  padding: 26px 0 50px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: .93rem;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  text-decoration: none;
  transition: transform .08s ease, background .15s ease;
}
.btn:hover { background: var(--ink-soft); }
.btn:active { transform: translateY(1px); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #241a05; }
.btn.gold:hover { background: #b17f26; }
.btn.outline { background: transparent; color: var(--ink); }
.btn.outline:hover { background: var(--ink); color: var(--paper); }
.btn.sm { padding: 7px 14px; font-size: .82rem; }
.btn.block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- Forms ---------- */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--ink-soft); }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%;
  font-family: var(--sans);
  font-size: .96rem;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
.field { margin-bottom: 18px; }
.field-hint { font-size: .78rem; color: var(--slate); margin-top: 5px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 18px; }
legend { font-family: var(--serif); padding: 0 6px; }

/* ---------- Alerts ---------- */
.alert {
  border-left: 3px solid var(--ink);
  background: var(--paper-dim);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: .92rem;
}
.alert.success { border-color: var(--moss); background: var(--moss-soft); }
.alert.error { border-color: var(--rust); background: #f4e2de; }

/* ---------- Card ---------- */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

/* ---------- Login / landing screen ---------- */
.landing {
  min-height: 100vh;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
}
.landing-hero {
  flex: 1;
  display: flex;
  align-items: center;
}
.landing-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
  width: 100%;
}
.eyebrow-tagline { color: var(--gold); font-family: var(--serif); font-style: italic; font-size: 1.1rem; }
.landing h1 {
  font-size: 2.9rem;
  color: var(--paper);
  margin: 10px 0 20px;
}
.landing .lede { color: #b9c1c6; font-size: 1.05rem; max-width: 46ch; }

.stepline {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 34px;
  flex-wrap: wrap;
}
.stepline .step { display: flex; align-items: center; gap: 10px; }
.stepline .num {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid #4d5860; display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: .85rem; color: var(--gold);
  flex-shrink: 0;
}
.stepline .label { font-size: .85rem; color: #c7cdd1; }
.stepline .sep { width: 26px; height: 1px; background: #3a444b; margin: 0 12px; }

.login-card {
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 34px 32px;
}
.login-card h2 { margin-bottom: 4px; }
.login-card .sub { color: var(--slate); font-size: .88rem; margin-bottom: 22px; }
.login-card .forgot { display: block; text-align: center; margin-top: 14px; font-size: .85rem; color: var(--slate); text-decoration: none; }

@media (max-width: 860px) {
  .landing-grid { grid-template-columns: 1fr; }
  .landing h1 { font-size: 2.2rem; }
}

/* ---------- Dashboard welcome ---------- */
.welcome-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  margin-bottom: 34px;
}
.welcome-panel {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 30px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.welcome-panel .greeting { font-family: var(--serif); font-size: 1.7rem; margin-bottom: 6px; }
.welcome-panel .sub { color: #b9c1c6; font-size: .95rem; }

.ring-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.ring-panel .metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; flex: 1; }
.metric .val { font-family: var(--serif); font-size: 1.5rem; }
.metric .lbl { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--slate); }

.progress-ring { flex-shrink: 0; }

/* ---------- The Trail: sequential week journey (numbered markers justified: real sequence) ---------- */
.trail { position: relative; margin: 10px 0 40px; }
.trail-item {
  position: relative;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 20px;
  padding-bottom: 34px;
}
.trail-item:last-child { padding-bottom: 0; }
.trail-item::before {
  content: '';
  position: absolute;
  left: 31px;
  top: 64px;
  bottom: -2px;
  width: 2px;
  background: var(--line);
}
.trail-item:last-child::before { display: none; }
.trail-item.passed::before { background: var(--moss); }

.trail-marker {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 1.4rem;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--slate);
  z-index: 1;
}
.trail-item.passed .trail-marker { border-color: var(--moss); background: var(--moss); color: #fff; }
.trail-item.in_progress .trail-marker,
.trail-item.available .trail-marker { border-color: var(--gold); color: var(--gold); background: #fff; }
.trail-item.locked .trail-marker { color: #b9b2a1; }

.trail-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.trail-item.locked .trail-card { background: var(--paper-dim); }
.trail-card h3 { margin-bottom: 2px; }
.trail-card .subtitle { color: var(--slate); font-size: .88rem; margin-bottom: 8px; }
.status-tag {
  font-size: .78rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  display: inline-block;
}
.status-tag.locked { background: #e6e1d5; color: #7c7460; }
.status-tag.available { background: var(--gold-soft); color: #6b4b0e; }
.status-tag.in_progress { background: var(--teal-soft); color: var(--teal); }
.status-tag.passed { background: var(--moss-soft); color: var(--moss); }

.mini-bar { width: 130px; height: 6px; border-radius: 4px; background: var(--paper-dim); overflow: hidden; margin-top: 8px; }
.mini-bar > span { display: block; height: 100%; background: var(--teal); }
.trail-item.passed .mini-bar > span { background: var(--moss); }

/* ---------- Week content cards (six components) ---------- */
.week-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.week-header .kicker { color: var(--gold); font-family: var(--serif); font-style: italic; }
.week-progress-bar { height: 8px; border-radius: 5px; background: var(--paper-dim); overflow: hidden; margin-top: 10px; width: 260px; }
.week-progress-bar > span { display: block; height: 100%; background: var(--teal); }

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.lesson-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lesson-card .icon { font-size: 1.6rem; }
.lesson-card .n { color: var(--slate); font-size: .78rem; }
.lesson-card h3 { margin-bottom: 0; }
.lesson-card .desc { color: var(--slate); font-size: .88rem; flex: 1; }

/* ---------- Presentation viewer ---------- */
.slide-shell { background: var(--ink); border-radius: var(--radius); color: var(--paper); padding: 54px 50px; min-height: 320px; display: flex; flex-direction: column; justify-content: center; }
.slide-shell h2 { color: var(--paper); font-size: 1.9rem; }
.slide-shell p { color: #cbd2d6; font-size: 1.05rem; max-width: 70ch; }
.slide-controls { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.slide-progress-track { flex: 1; height: 4px; background: var(--paper-dim); border-radius: 3px; margin: 0 16px; overflow: hidden; }
.slide-progress-track > span { display: block; height: 100%; background: var(--gold); }

/* ---------- Quiz ---------- */
.quiz-q { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; background: #fff; }
.quiz-q .opt { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.quiz-result-score { font-family: var(--serif); font-size: 3.2rem; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--slate); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
tr:hover td { background: var(--paper-dim); }

/* ---------- Badges display ---------- */
.badge-row { display: flex; flex-wrap: wrap; gap: 14px; }
.badge-chip { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-align: center; width: 120px; background: #fff; }
.badge-chip .icon { font-size: 1.8rem; display: block; margin-bottom: 6px; }
.badge-chip .name { font-size: .78rem; font-weight: 600; }

/* ---------- Certificate ---------- */
.certificate {
  border: 8px double var(--gold);
  padding: 60px 50px;
  text-align: center;
  background: #fffdf7;
  max-width: 760px;
  margin: 0 auto;
}
.certificate .cert-kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; color: var(--slate); }
.certificate h1 { font-size: 2rem; margin: 18px 0 6px; }
.certificate .name { font-family: var(--serif); font-size: 2.1rem; color: var(--teal); margin: 18px 0; border-bottom: 1px solid var(--line); display: inline-block; padding-bottom: 8px; }
.certificate .tagline { font-style: italic; color: var(--gold); }

@media print {
  .topbar, .footer, .no-print { display: none !important; }
  body { background: #fff; }
}

/* ---------- Utility ---------- */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-10 { gap: 10px; }
.gap-16 { gap: 16px; }
.mt-0 { margin-top: 0; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-20 { margin-bottom: 20px; }
.muted { color: var(--slate); }
.small { font-size: .85rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) {
  .grid-2 { grid-template-columns: 1fr; }
  .welcome-row { grid-template-columns: 1fr; }
  .ring-panel { flex-direction: column; text-align: center; }
}
