/* ======================================================================
   Challenge 15/15 · William Angora
   Design : épuré et chaleureux
   ====================================================================== */

:root {
  --bg:        #faf6ef;
  --bg-warm:   #f4ece0;
  --surface:   #ffffff;
  --ink:       #2a2320;
  --ink-soft:  #6a5f57;
  --ink-faint: #9a8d82;
  --line:      #e7dccd;
  --line-soft: #f0e7db;
  --clay:      #b85c38;
  --clay-dark: #97462a;
  --clay-tint: #f6e6dd;
  --sage:      #5c7358;
  --sage-tint: #e6ede2;
  --gold:      #c99a3f;
  --shadow:    0 1px 2px rgba(42,35,32,.04), 0 8px 24px rgba(42,35,32,.06);
  --shadow-lg: 0 4px 12px rgba(42,35,32,.08), 0 24px 48px rgba(42,35,32,.10);
  --radius:    16px;
  --radius-sm: 10px;
  --sidebar-w: 300px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--clay);
  color: #fff;
  padding: 10px 16px;
  z-index: 100;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bg-warm);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  z-index: 40;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  margin-bottom: 22px;
}
.brand__badge {
  flex: none;
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--clay);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 20px;
  box-shadow: var(--shadow);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__text strong { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.brand__text small { color: var(--ink-soft); font-size: 12.5px; font-style: italic; }

.progress { margin-bottom: 20px; }
.progress__bar {
  height: 8px;
  background: #e5d8c7;
  border-radius: 99px;
  overflow: hidden;
}
.progress__bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--clay), var(--gold));
  border-radius: 99px;
  transition: width .5s cubic-bezier(.2,.8,.2,1);
}
.progress__label { font-size: 12.5px; color: var(--ink-soft); margin-top: 7px; }
.progress__label span { font-weight: 700; color: var(--clay-dark); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
  line-height: 1.3;
}
.nav a:hover { background: #ece0d0; color: var(--ink); }
.nav a.active { background: var(--clay); color: #fff; }
.nav a.active .nav__num { background: rgba(255,255,255,.22); color: #fff; }
.nav a.nav--home { font-weight: 600; color: var(--ink); }
.nav__num {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 7px;
  background: #ece0d0;
  color: var(--clay-dark);
  display: grid; place-items: center;
  font-size: 12.5px;
  font-weight: 700;
}
.nav a .nav__done {
  margin-left: auto;
  color: var(--sage);
  font-size: 13px;
  opacity: 0;
  transition: opacity .2s;
}
.nav a.is-complete .nav__done { opacity: 1; }
.nav a.active .nav__done { color: #fff; }

.sidebar__foot { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.btn-reset {
  width: 100%;
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-faint);
  padding: 8px;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 12.5px;
  cursor: pointer;
  transition: all .15s;
}
.btn-reset:hover { border-color: var(--clay); color: var(--clay); }

/* ---------- Main ---------- */
.main {
  margin-left: var(--sidebar-w);
  padding: 56px clamp(20px, 5vw, 72px) 120px;
  max-width: calc(760px + var(--sidebar-w));
  outline: none;
}

/* ---------- Nav toggle (mobile) ---------- */
.nav-toggle {
  position: fixed;
  top: 16px; right: 16px;
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 50;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}
.nav-toggle span {
  display: block; width: 20px; height: 2px;
  background: var(--ink); border-radius: 2px;
  transition: transform .25s, opacity .2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.scrim {
  position: fixed; inset: 0;
  background: rgba(42,35,32,.4);
  z-index: 35;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------- Typography ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--clay);
  margin: 0 0 14px;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 2px;
  background: var(--clay);
  border-radius: 2px;
}

h1.res-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(30px, 4.4vw, 44px);
  line-height: 1.1;
  letter-spacing: -.01em;
  margin: 0 0 18px;
}
.res-lead {
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0 0 8px;
  max-width: 60ch;
}

.res-body h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 25px;
  letter-spacing: -.01em;
  margin: 48px 0 14px;
  padding-top: 8px;
  scroll-margin-top: 20px;
}
.res-body h3 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 17px;
  margin: 28px 0 8px;
  color: var(--ink);
}
.res-body p { margin: 0 0 14px; }
.res-body ul, .res-body ol { margin: 0 0 16px; padding-left: 22px; }
.res-body li { margin: 4px 0; }
.res-body strong { font-weight: 600; }
.res-body a { color: var(--clay-dark); }

/* objective block */
.objective {
  background: var(--sage-tint);
  border: 1px solid #d5e0cf;
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 0 0 8px;
}
.objective .objective__label {
  font-size: 12.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--sage); margin: 0 0 6px;
}
.objective p:last-child { margin-bottom: 0; }

/* callout (punchy lines) */
.callout {
  border-left: 3px solid var(--clay);
  background: var(--clay-tint);
  padding: 16px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  color: var(--clay-dark);
  margin: 22px 0;
}

/* comparison before/after */
.compare { display: grid; gap: 12px; margin: 16px 0; }
@media (min-width: 640px) { .compare { grid-template-columns: 1fr 1fr; } }
.compare > div {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 15px;
}
.compare .before { background: #f7ecec; border: 1px solid #ecd6d6; }
.compare .after  { background: var(--sage-tint); border: 1px solid #d5e0cf; }
.compare .tag { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.compare .before .tag { color: #b1554f; }
.compare .after .tag  { color: var(--sage); }

/* tables */
.res-body .table-wrap { overflow-x: auto; margin: 16px 0; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.res-body table { border-collapse: collapse; width: 100%; font-size: 14.5px; background: var(--surface); }
.res-body th, .res-body td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.res-body th { background: var(--bg-warm); font-weight: 600; color: var(--ink); }
.res-body tr:last-child td { border-bottom: none; }

/* ---------- Prompt block ---------- */
.prompt {
  background: #2b2420;
  border-radius: var(--radius);
  margin: 22px 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.prompt__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #201b18;
  color: #e9ddd0;
  font-size: 13px;
  font-weight: 600;
}
.prompt__head .ai-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); flex: none; }
.prompt__head .prompt__title { flex: 1; }
.prompt__copy {
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: #f4ece0;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.prompt__copy:hover { background: var(--clay); border-color: var(--clay); }
.prompt__copy.copied { background: var(--sage); border-color: var(--sage); }
.prompt__body {
  margin: 0;
  padding: 16px 18px;
  color: #e5dccf;
  font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 340px;
  overflow-y: auto;
}
.prompt__body::-webkit-scrollbar { width: 8px; }
.prompt__body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 8px; }

/* ---------- Checklist ---------- */
.checklist {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.checklist li {
  margin: 0;
  border-bottom: 1px solid var(--line-soft);
}
.checklist li:last-child { border-bottom: none; }
.checklist label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 15px;
  transition: background .12s;
}
.checklist label:hover { background: var(--bg-warm); }
.checklist input { position: absolute; opacity: 0; width: 0; height: 0; }
.checklist .box {
  flex: none;
  width: 21px; height: 21px;
  border: 2px solid var(--line);
  border-radius: 6px;
  margin-top: 1px;
  display: grid; place-items: center;
  transition: all .15s;
}
.checklist .box::after {
  content: "";
  width: 10px; height: 6px;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) scale(0);
  margin-top: -2px;
  transition: transform .15s;
}
.checklist input:checked + .box { background: var(--sage); border-color: var(--sage); }
.checklist input:checked + .box::after { transform: rotate(-45deg) scale(1); }
.checklist input:focus-visible + .box { outline: 2px solid var(--clay); outline-offset: 2px; }
.checklist input:checked ~ .txt { color: var(--ink-faint); text-decoration: line-through; }
.checklist .txt { transition: color .15s; }

.checklist__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin: 40px 0 4px;
}
.checklist__count {
  font-size: 13px; font-weight: 600; color: var(--sage);
  background: var(--sage-tint); padding: 3px 11px; border-radius: 99px;
}

/* ---------- Worksheet ---------- */
.worksheet {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 4px 20px 20px;
  margin: 18px 0;
  box-shadow: var(--shadow);
}
.worksheet__intro { font-size: 14.5px; color: var(--ink-soft); margin: 16px 0 4px; }
.field { margin: 14px 0 0; }
.field > label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.field > label .field__hint { font-weight: 400; color: var(--ink-faint); font-size: 13px; }
.field textarea, .field input[type="text"] {
  width: 100%;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 62px; line-height: 1.5; }
.field textarea:focus, .field input:focus {
  outline: none;
  border-color: var(--clay);
  box-shadow: 0 0 0 3px var(--clay-tint);
}
.worksheet__actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft);
  align-items: center;
}
.ws-btn {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  transition: all .15s;
}
.ws-btn:hover { border-color: var(--clay); color: var(--clay); }
.ws-btn--primary { background: var(--clay); border-color: var(--clay); color: #fff; }
.ws-btn--primary:hover { background: var(--clay-dark); border-color: var(--clay-dark); color: #fff; }
.ws-btn.copied { background: var(--sage); border-color: var(--sage); color: #fff; }
.ws-saved { font-size: 12.5px; color: var(--ink-faint); margin-left: auto; }
.ws-saved.show { color: var(--sage); }

/* ---------- Home ---------- */
.home-hero { margin-bottom: 8px; }
.home-hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.05;
  letter-spacing: -.015em;
  margin: 0 0 18px;
}
.home-hero h1 em { font-style: italic; color: var(--clay); }
.home-hero .home-lead { font-size: 19px; color: var(--ink-soft); max-width: 58ch; margin: 0 0 26px; }

.home-stats { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 12px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  flex: 1 1 130px;
  box-shadow: var(--shadow);
}
.stat b { font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--clay); display: block; line-height: 1; }
.stat span { font-size: 13.5px; color: var(--ink-soft); }

.home-section-title {
  font-family: var(--serif); font-weight: 600; font-size: 24px;
  margin: 44px 0 6px;
}
.home-section-sub { color: var(--ink-soft); margin: 0 0 22px; }

.cards { display: grid; gap: 16px; }
@media (min-width: 720px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s, border-color .18s;
  position: relative;
  overflow: hidden;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #d9c9b4; }
.card__top { display: flex; align-items: center; gap: 12px; }
.card__num {
  width: 40px; height: 40px; flex: none;
  border-radius: 11px;
  background: var(--clay-tint);
  color: var(--clay-dark);
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; font-size: 18px;
}
.card__done {
  margin-left: auto; font-size: 13px; font-weight: 600;
  color: var(--sage); opacity: 0; transition: opacity .2s;
}
.card.is-complete .card__done { opacity: 1; }
.card.is-complete .card__num { background: var(--sage-tint); color: var(--sage); }
.card h3 { font-family: var(--serif); font-weight: 600; font-size: 19px; margin: 0; line-height: 1.25; }
.card p { font-size: 14.5px; color: var(--ink-soft); margin: 0; flex: 1; }
.card__meta { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-faint); margin-top: 4px; }
.card__meta span { display: inline-flex; align-items: center; gap: 5px; }

.home-note {
  margin-top: 40px;
  background: var(--bg-warm);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  font-size: 15px;
  color: var(--ink-soft);
}
.home-note strong { color: var(--ink); }

/* ---------- Resource footer nav ---------- */
.res-foot {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 60px; padding-top: 26px; border-top: 1px solid var(--line);
}
.res-foot a {
  display: flex; flex-direction: column; gap: 2px;
  text-decoration: none; color: var(--ink);
  padding: 12px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  max-width: 48%; transition: border-color .15s, transform .15s;
}
.res-foot a:hover { border-color: var(--clay); transform: translateY(-2px); }
.res-foot a small { font-size: 12px; color: var(--ink-faint); }
.res-foot a span { font-weight: 600; font-size: 14.5px; }
.res-foot a.next { text-align: right; margin-left: auto; }

/* toast */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 11px 20px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 80;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Password gate ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: linear-gradient(160deg, #f4ece0, #eaddcb);
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 40px 34px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}
.gate__badge {
  width: 62px; height: 62px;
  border-radius: 17px;
  background: var(--clay);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; font-size: 27px;
  margin: 0 auto 20px;
  box-shadow: var(--shadow);
}
.gate h1 { font-family: var(--serif); font-weight: 600; font-size: 25px; margin: 0 0 6px; }
.gate__sub { font-style: italic; color: var(--clay); font-size: 13.5px; margin: 0 0 16px; }
.gate p.gate__hint { color: var(--ink-soft); font-size: 14.5px; margin: 0 0 22px; line-height: 1.55; }
.gate form { display: flex; flex-direction: column; gap: 12px; }
.gate input {
  font-family: var(--sans); font-size: 16px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  text-align: center;
  transition: border-color .15s, box-shadow .15s;
}
.gate input:focus { outline: none; border-color: var(--clay); box-shadow: 0 0 0 3px var(--clay-tint); }
.gate button {
  font-family: var(--sans); font-weight: 600; font-size: 15px;
  padding: 13px;
  border: none; border-radius: 12px;
  background: var(--clay); color: #fff;
  cursor: pointer;
  transition: background .15s;
}
.gate button:hover { background: var(--clay-dark); }
.gate__error { color: #b1554f; font-size: 13.5px; min-height: 18px; margin: 2px 0 0; }

/* ---------- Recommendation banner (home) ---------- */
.reco {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--clay-tint);
  border: 1px solid #ecd0c2;
  border-left: 3px solid var(--clay);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 4px 0 4px;
}
.reco__icon {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--clay);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; font-size: 16px;
}
.reco p { margin: 0; font-size: 14.5px; color: var(--ink); line-height: 1.55; }
.reco strong { color: var(--clay-dark); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.2,.8,.2,1);
    width: min(320px, 86vw);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 72px 20px 100px; }
}

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