/* Luis' Applied AI Journey.
   One memorable element: the strand — one segment per resource, coloured by
   status. Everything else stays quiet: one typeface, one column, rows not cards. */

:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --ink: #1d2440;
  --ink-soft: #4a5370;
  --rule: #d5dbe3;
  --done: #0f7c74;
  --doing: #c98a1b;
  --todo: #c9d1db;
  --skip: #8d97a5;
  --wall: #8a4f7d;
  --focus: #2f5bd3;
  --error: #b3261e;
  --radius-s: 4px;
  --radius-m: 10px;
  --measure: 46rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151a2b;
    --surface: #1d2338;
    --ink: #e6e9f0;
    --ink-soft: #a9b0c4;
    --rule: #2e3650;
    --done: #4fc1b5;
    --doing: #e3b04b;
    --todo: #36405c;
    --skip: #6f7891;
    --wall: #c48ab8;
    --focus: #8fb0ff;
    --error: #ff8a80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem 1rem 4rem;
}

a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 0.18em; text-decoration-thickness: 1.5px; }
a:hover { text-decoration-color: currentColor; }

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

h1, h2 { line-height: 1.15; margin: 0; }
h2 { font-size: 1.25rem; font-weight: 800; margin-top: 3rem; }

.quiet, .section-note { color: var(--ink-soft); }
.section-note { margin: 0.25rem 0 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- the strand ---------------------------------------------------- */

.strand { display: flex; gap: 2px; height: 0.6rem; }
.seg { flex: 1 1 0; min-width: 3px; border-radius: 1.5px; background: var(--todo); }
.seg-done { background: var(--done); }
.seg-in_progress { background: var(--doing); }
.seg-paywalled { background: var(--wall); }
.seg-skipped {
  background: repeating-linear-gradient(135deg, var(--skip) 0 2px, transparent 2px 4px);
}

/* Hero: every topic's strand laid end to end — the whole path in one line. */
.hero { padding-bottom: 0.5rem; }
.wordmark {
  font-size: clamp(2.1rem, 7vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.02;
  max-width: 12ch;
}
.hero-count { margin: 1rem 0 0.75rem; font-size: 1.125rem; color: var(--ink-soft); }
.hero-count strong { color: var(--ink); font-size: 1.5rem; font-weight: 800; }
.hero-strand { display: flex; gap: 6px; }
.hero-strand > a { display: block; flex-grow: var(--n, 1); padding: 0.4rem 0; }
.hero-strand .strand { height: 1.75rem; }
.hero-strand .seg { border-radius: 2px; }

.legend {
  display: flex; flex-wrap: wrap; gap: 0.35rem 1rem;
  list-style: none; padding: 0; margin: 0.6rem 0 0;
  font-size: 0.875rem; color: var(--ink-soft);
}
.legend li { display: flex; align-items: center; gap: 0.4rem; }
.legend .seg { flex: none; width: 0.9rem; height: 0.9rem; }

/* ---- journey topic rows -------------------------------------------- */

.topics { list-style: none; padding: 0; margin: 1rem 0 0; }
.topic-row { padding: 1rem 0 1.1rem; border-top: 1px solid var(--rule); }
.topic-row:last-child { border-bottom: 1px solid var(--rule); }
.topic-link {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  text-decoration: none; margin-bottom: 0.55rem;
}
.topic-link:hover .topic-title { text-decoration: underline; text-decoration-color: currentColor; }
.topic-title { font-weight: 600; font-size: 1.125rem; }
.topic-count { color: var(--ink-soft); white-space: nowrap; }
.next { margin: 0.55rem 0 0; font-size: 0.95rem; color: var(--ink-soft); }
.next a { color: var(--ink); }

.new-list { padding-left: 1.1rem; }
.new-list li { margin: 0.35rem 0; }

.logout { margin-top: 3rem; }

/* ---- topic page ---------------------------------------------------- */

.crumb { margin-bottom: 1.5rem; font-size: 0.95rem; }
.crumb a::before { content: "‹ "; }
.topic-head h1 { font-size: clamp(1.8rem, 5.5vw, 2.5rem); font-weight: 800; letter-spacing: -0.02em; }
.summary { color: var(--ink-soft); margin: 0.6rem 0 1.25rem; max-width: 38rem; }
.topic-head .strand { height: 1rem; }
.topic-stats { margin: 0.6rem 0 0; color: var(--ink-soft); }
.topic-stats strong { color: var(--ink); }

.items { list-style: none; padding: 0; margin: 1rem 0 0; }
.item {
  position: relative;
  padding: 1.1rem 0 1.2rem 1rem;
  border-top: 1px solid var(--rule);
}
.item::before {
  content: ""; position: absolute; left: 0; top: 1.25rem; bottom: 1.3rem;
  width: 4px; border-radius: 2px; background: var(--todo);
}
.item[data-status="done"]::before { background: var(--done); }
.item[data-status="in_progress"]::before { background: var(--doing); }
.item[data-status="paywalled"]::before { background: var(--wall); }
.item[data-status="skipped"]::before { background: repeating-linear-gradient(180deg, var(--skip) 0 3px, transparent 3px 6px); }
.item[data-status="skipped"] .item-title,
.item[data-status="skipped"] .why { color: var(--ink-soft); }

.item:target { background: color-mix(in srgb, var(--doing) 10%, transparent); }

.item-title { font-weight: 600; font-size: 1.1rem; }
.meta {
  display: flex; flex-wrap: wrap; gap: 0.15rem 1rem;
  margin: 0.3rem 0 0; font-size: 0.875rem; color: var(--ink-soft);
}
.price { color: var(--ink); font-weight: 600; }
.why { margin: 0.5rem 0 0; }
.roi { margin: 0.5rem 0 0; font-size: 0.95rem; color: var(--ink-soft); }
.roi strong { color: var(--ink); font-weight: 600; }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; margin-top: 0.8rem; }

select, input, textarea, button { font: inherit; color: inherit; }
select {
  appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238d97a5' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 0.7rem center;
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  padding: 0.5rem 2.2rem 0.5rem 0.8rem;
  min-height: 44px;
  font-size: 1rem;
}

button.link {
  background: none; border: 0; padding: 0.5rem 0; min-height: 44px; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 0.18em;
}
button.link:hover { text-decoration-color: currentColor; }
button.primary {
  background: var(--ink); color: var(--bg);
  border: 0; border-radius: var(--radius-m);
  padding: 0.65rem 1.2rem; min-height: 44px; font-weight: 600; cursor: pointer;
}

.rating-view { margin-top: 0.6rem; font-size: 0.95rem; }
.stars { letter-spacing: 0.05em; margin-right: 0.6rem; }
.stars .on { color: var(--doing); }
.stars .off { color: var(--todo); }
.depth { color: var(--ink-soft); }
.rating-note, .note-view {
  margin: 0.4rem 0 0; padding-left: 0.8rem; border-left: 2px solid var(--rule);
  color: var(--ink-soft); white-space: pre-wrap;
}

/* ---- dialogs ------------------------------------------------------- */

dialog {
  width: min(28rem, calc(100vw - 2rem));
  border: 1px solid var(--rule); border-radius: 14px;
  background: var(--surface); color: var(--ink);
  padding: 1.5rem;
}
dialog::backdrop { background: rgb(10 13 24 / 0.6); }
.dialog-form { display: flex; flex-direction: column; gap: 0.75rem; }
.dialog-form h2 { margin: 0; }
.dialog-item { margin: 0; color: var(--ink-soft); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; margin-bottom: 0.35rem; padding: 0; }
textarea {
  width: 100%; border: 1px solid var(--rule); border-radius: var(--radius-m);
  background: var(--bg); padding: 0.6rem 0.75rem; font-size: 1rem; resize: vertical;
}
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 1.25rem; margin-top: 0.25rem; }

/* Inputs run 5..1 in the DOM and the row is reversed, so `:checked ~ label`
   lights the chosen star and every star to its left. */
.star-row { display: flex; flex-direction: row-reverse; justify-content: flex-end; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label {
  font-size: 2rem; line-height: 1; padding: 0.1rem 0.15rem; cursor: pointer; color: var(--todo);
  min-width: 44px; text-align: center;
}
.star-input input:checked ~ label,
.star-input label:hover, .star-input label:hover ~ label { color: var(--doing); }
.star-input input:focus-visible + label { outline: 3px solid var(--focus); border-radius: var(--radius-s); }
.depth-input label { display: flex; align-items: center; gap: 0.5rem; min-height: 40px; }
.depth-input input { width: 1.15rem; height: 1.15rem; accent-color: var(--done); }

.error { color: var(--error); margin: 0; }

/* ---- login --------------------------------------------------------- */

.login .page { min-height: 100dvh; display: grid; place-items: center; }
.login-card { width: min(24rem, 100%); display: flex; flex-direction: column; gap: 0.75rem; }
.login-card .wordmark { margin-bottom: 1.5rem; }
.login-card label { font-weight: 600; }
.login-card input {
  border: 1px solid var(--rule); border-radius: var(--radius-m);
  background: var(--surface); padding: 0.7rem 0.85rem; font-size: 1rem; min-height: 48px;
}

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