/* ---------- Tokens ---------- */
:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --ink: #15171C;
  --text-2: #4A5060;
  --text-3: #5A6070;
  --muted: #6E7484;
  --line: #DADDE3;
  --border: #E3E6EB;
  --border-strong: #D5D9E0;
  --dot-idle: #AEB4BF;

  --accent: #3346C8;
  --accent-ink: #2A3AB0;
  --accent-soft: #E8EBFB;

  --sesi-a-bg: #F3F4F8;
  --sesi-b-bg: #FBF6EE;
  --sesi-b-ink: #8A520F;

  /* Radius: outer = inner + padding (12 + 24 = 36) */
  --radius-inner: 12px;
  --radius-card: 36px;

  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Timeline geometry */
  --dot-y: 34px;          /* top of dot; centre = dot-y + 6 */
  --dot-size: 12px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 24px;
}

a { color: var(--accent); }
a:hover { color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 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;
}

/* ---------- Layout ---------- */
.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 80px 24px 144px;
}

.hero { display: flex; flex-direction: column; gap: 16px; }

.eyebrow {
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.eyebrow--accent { color: var(--accent); }
.eyebrow--a { color: var(--accent-ink); }
.eyebrow--b { color: var(--sesi-b-ink); }

.title {
  margin: 0;
  font-size: 40px;
  line-height: 48px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.lead { margin: 0; color: var(--text-2); }
.meta { font-size: 12px; line-height: 16px; color: var(--text-3); }

/* ---------- Progress ---------- */
.progress { margin-top: 48px; display: flex; flex-direction: column; gap: 16px; }
.progress[hidden] { display: none; }
.progress__head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 16px; flex-wrap: wrap;
}
.progress__text { font-weight: 600; }
.progress__bar { display: flex; gap: 4px; }
.progress__seg { flex: 1; height: 4px; border-radius: 999px; background: var(--line); }
.progress__seg.is-done { background: var(--ink); }
.progress__seg.is-now { background: var(--accent); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 48px 0 0; padding: 0; display: flex; flex-direction: column; }
.week { scroll-margin-top: 24px; }

.row {
  display: grid;
  grid-template-columns: 64px 28px minmax(0, 1fr);
  column-gap: 16px;
}

.phase { padding: 32px 24px 12px; }

.week-no {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 4px; padding-top: 24px;
}
.week-no__word { font-size: 12px; line-height: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.week-no__num { font-size: 24px; line-height: 24px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.is-done .week-no__num { color: var(--ink); }
.is-now .week-no__num { color: var(--accent); }

/* Spine: each row draws its own segments so the line never breaks
   and never runs past the first or last dot. */
.spine { position: relative; }
.spine__seg { position: absolute; left: 13px; width: 2px; background: var(--line); }
.spine__seg.is-passed { background: var(--ink); }
.spine__seg--full { top: 0; bottom: 0; }
.spine__seg--top { top: 0; height: calc(var(--dot-y) + var(--dot-size) / 2); }
.spine__seg--bottom { top: calc(var(--dot-y) + var(--dot-size) / 2); bottom: 0; }

.spine__dot {
  position: absolute; z-index: 1;
  top: var(--dot-y); left: 8px;
  width: var(--dot-size); height: var(--dot-size);
  border-radius: 999px;
  background: var(--bg);
  border: 2px solid var(--dot-idle);
}
.is-done .spine__dot { background: var(--ink); border-color: var(--ink); }
.is-now .spine__dot {
  background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(51, 70, 200, 0.16);
}

.week__body { padding-bottom: 12px; min-width: 0; }

.card {
  border: 1px solid transparent;
  border-radius: var(--radius-card);
}
.card.is-open {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 16px 40px -24px rgba(21, 23, 28, 0.3);
}

.card__toggle {
  width: 100%;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 24px;
  border: 0; background: transparent; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
  border-radius: var(--radius-card);
}
.card__heading { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.card__title { font-size: 20px; line-height: 32px; font-weight: 600; letter-spacing: -0.01em; }
.card.is-open .card__title { font-size: 24px; }
.card__sub { color: var(--text-3); }

.badge {
  flex: none;
  display: inline-flex; align-items: center;
  height: 28px; padding: 0 12px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--accent-soft); color: var(--accent-ink);
}

.card__detail { padding: 0 24px 24px; display: flex; flex-direction: column; gap: 32px; }
.card__detail[hidden] { display: none; }

.sessions { display: flex; flex-wrap: wrap; gap: 16px; }
.session {
  flex: 1 1 240px; min-width: 0;
  padding: 24px;
  border-radius: var(--radius-inner);
  display: flex; flex-direction: column; gap: 12px;
}
.session--a { background: var(--sesi-a-bg); }
.session--b { background: var(--sesi-b-bg); }
.session p { margin: 0; }

.list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }

.block { display: flex; flex-direction: column; gap: 12px; }
.block__result { margin: 0; color: var(--text-3); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; padding: 0 24px;
  border-radius: var(--radius-inner);
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none;
  cursor: pointer;
}
.button:hover { color: var(--ink); border-color: var(--dot-idle); }
.button--primary { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.button--primary:hover { color: #FFFFFF; background: #2A2E37; }
.button[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

.gate { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 24px 4px; }
.gate__mark { width: 8px; height: 8px; background: var(--ink); transform: rotate(45deg); margin-right: 4px; }
.gate__name { font-size: 12px; line-height: 16px; font-weight: 600; }

.load-error { margin-top: 32px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
.load-error p { margin: 0; }

/* ---------- Floating button + dialog ---------- */
.fab {
  position: fixed; z-index: 20; right: 24px; bottom: 24px;
  height: 48px; padding: 0 20px 0 16px;
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px;
  background: var(--ink); color: #FFFFFF;
  font: inherit; font-weight: 600; cursor: pointer;
  box-shadow: 0 8px 24px -8px rgba(21, 23, 28, 0.45);
}

.dialog {
  width: min(600px, calc(100% - 32px));
  max-height: calc(100vh - 64px);
  padding: 32px;
  border: 0;
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 64px -24px rgba(21, 23, 28, 0.5);
}
.dialog::backdrop { background: rgba(21, 23, 28, 0.4); }
.dialog[open] { display: flex; flex-direction: column; gap: 32px; }

.dialog__head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.dialog__title { margin: 0; font-size: 24px; line-height: 32px; font-weight: 600; }

.icon-button {
  width: 44px; height: 44px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius-inner);
  background: var(--sesi-a-bg); color: var(--ink); cursor: pointer;
}

.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 32px 24px; }
.info-item { display: flex; flex-direction: column; gap: 4px; }
.info-item__title { font-weight: 600; }
.info-item__note { font-size: 12px; line-height: 16px; color: var(--text-2); }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  :root { --radius-card: 28px; } /* 12 inner + 16 horizontal padding */
  .page { padding: 40px 16px 120px; }
  .title { font-size: 32px; line-height: 40px; }
  .row { grid-template-columns: 20px 28px minmax(0, 1fr); column-gap: 8px; }
  .week-no__word { display: none; }
  .week-no__num { font-size: 16px; line-height: 24px; }
  .phase { padding: 32px 16px 12px; }
  .card__toggle { padding: 24px 16px; }
  .card__detail { padding: 0 16px 24px; }
  .gate { padding: 12px 16px 4px; }
  .fab { right: 16px; bottom: 16px; }
  .dialog { padding: 24px; }
}
