/* Two Days Out — timetable-board editorial.
   Warm paper, ink-blue text, one vermilion accent. Signature: the 8am–10pm time rail,
   repeated in the hero strip, every row, the detail sheet and the shortlist. */

:root {
  --canvas: #f2ead8;
  --surface: #fbf7ec;
  --ink: #161f2e;
  --muted: #4d5666;
  --line: #161f2e;
  --hair: #cfc4aa;
  --accent: #d2401c;
  --accent-text: #a82d0e;
  --pine: #1d5a4c;
  --on-ink: #f6f0e0;
  --focus: #0b57d0;

  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --gutter: 20px;
  --max: 1320px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 17px/1.55 var(--sans);
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

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

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--ink); color: var(--on-ink); padding: 10px 14px;
}
.skip:focus { top: 12px; }

/* ---------- header ---------- */
.site {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--max); margin: 0 auto; padding: 14px var(--gutter);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font: 800 22px/1 var(--display); letter-spacing: -0.01em;
}
.mark { width: 30px; height: 30px; color: var(--ink); }
.site nav { display: flex; gap: 6px; }
.site nav a {
  color: var(--ink); text-decoration: none; padding: 9px 12px;
  font: 600 13px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  border-bottom: 2px solid transparent;
}
.site nav a:hover { border-bottom-color: var(--accent); }
.count {
  display: inline-block; min-width: 1.7em; padding: 2px 6px; margin-left: 4px;
  background: var(--ink); color: var(--on-ink); text-align: center; border-radius: 99px;
}

/* ---------- hero ---------- */
.hero {
  max-width: var(--max); margin: 0 auto; padding: 8px var(--gutter) 28px;
  display: grid; gap: 28px; border-bottom: 4px solid var(--ink);
}
.kicker {
  font: 600 12.5px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-text); margin-bottom: 14px;
}
.hero h1 {
  font: 800 clamp(44px, 12vw, 92px)/0.94 var(--display);
  letter-spacing: -0.03em;
}
.hero h1 em { font-style: italic; font-weight: 700; color: var(--accent-text); }
.lede { margin-top: 18px; max-width: 46ch; font-size: 18px; color: var(--muted); }

.strip {
  align-self: end; background: var(--surface); border: 2px solid var(--ink);
  padding: 14px 14px 12px; position: relative;
}
.axis { position: relative; height: 14px; font: 500 11px/1 var(--mono); color: var(--muted); }
.axis span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.axis span:first-child { transform: none; }
.strip-axis { padding-left: 38px; margin-bottom: 4px; }
.strip-day { position: relative; padding-left: 38px; margin-top: 8px; min-height: 40px; }
.strip-day::before {
  content: attr(data-label); position: absolute; left: 0; top: 0;
  font: 700 12px/1.2 var(--mono); letter-spacing: 0.04em;
}
.strip-lanes {
  position: relative;
  background:
    linear-gradient(90deg, var(--hair) 1px, transparent 1px) 0 0 / calc(100% / 3.5) 100%,
    transparent;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
}
.strip-bar {
  position: absolute; height: 10px; background: var(--ink);
  transition: opacity .2s;
}
.strip-bar.dim { opacity: .16; }
.strip-bar.saved { background: var(--accent); }
.strip figcaption { margin-top: 10px; font-size: 13px; line-height: 1.4; color: var(--muted); }

/* ---------- controls ---------- */
.controls {
  max-width: var(--max); margin: 0 auto; padding: 20px var(--gutter) 8px;
  display: grid; gap: 12px; grid-template-columns: 1fr;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label {
  font: 600 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
}
.field input, .field select {
  width: 100%; height: 48px; padding: 0 14px;
  background: var(--surface); border: 2px solid var(--ink); border-radius: 0;
}
.field select { appearance: none; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px;
  background-size: 6px 6px; background-repeat: no-repeat;
}
.field input::placeholder { color: #6a7282; }
.toggle {
  height: 48px; align-self: end; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 18px; background: var(--surface); border: 2px solid var(--ink);
  font-weight: 700;
}
.toggle svg { width: 16px; height: 16px; }
.toggle[aria-pressed="true"] { background: var(--accent-text); border-color: var(--ink); color: #fff; }
.toggle[aria-pressed="true"] svg path { fill: currentColor; }

/* ---------- layout ---------- */
.layout {
  max-width: var(--max); margin: 0 auto; padding: 16px var(--gutter) 96px;
  display: grid; gap: 40px; align-items: start;
}
.results { outline: none; }
.results-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.results-head h2 { font: 800 28px/1.1 var(--display); letter-spacing: -0.01em; }
#status { font: 500 13px/1.4 var(--mono); color: var(--muted); }

.day { margin-top: 22px; }
.day-head {
  display: flex; align-items: baseline; gap: 14px;
  border-top: 4px solid var(--ink); padding-top: 10px; margin-bottom: 4px;
}
.day-num { font: 800 54px/0.9 var(--display); letter-spacing: -0.03em; }
.day-name { font: 700 20px/1.1 var(--display); }
.day-sub { font: 500 12px/1.3 var(--mono); color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; margin-left: auto; text-align: right; }

/* ---------- item rows ---------- */
.item {
  position: relative;
  display: grid; gap: 10px 16px;
  grid-template-columns: 74px 1fr auto;
  grid-template-areas: "when what act" "when how how";
  padding: 18px 0; border-bottom: 1px solid var(--hair);
}
.item.is-saved::before {
  content: ""; position: absolute; left: -10px; top: 18px; bottom: 18px; width: 4px; background: var(--accent);
}
.when { grid-area: when; font-family: var(--mono); line-height: 1.1; }
.when .start { display: block; font: 700 26px/1 var(--display); letter-spacing: -0.02em; }
.when .ampm { font: 600 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.when .to { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.3; }
.what { grid-area: what; min-width: 0; }
.cat {
  display: flex; align-items: center; gap: 8px;
  font: 600 12px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.dot { width: 10px; height: 10px; flex: none; background: var(--c, var(--ink)); border-radius: 50%; }
.item h3 { font: 700 clamp(20px, 5vw, 25px)/1.15 var(--display); margin: 5px 0 4px; letter-spacing: -0.01em; text-wrap: balance; }
.where { font-size: 15px; color: var(--muted); }
.sum { margin-top: 8px; font-size: 16px; max-width: 62ch; }
.how { grid-area: how; display: flex; align-items: center; gap: 14px; }
.price { font: 700 15px/1 var(--mono); min-width: 3.4em; }
.price.free { color: var(--pine); }
.rail { flex: 1; max-width: 300px; }
.rail-track {
  position: relative; height: 10px; border-left: 1px solid var(--ink); border-right: 1px solid var(--ink);
  background: linear-gradient(var(--ink), var(--ink)) 0 50% / 100% 1px no-repeat;
}
.rail-track i { position: absolute; top: 0; bottom: 0; background: var(--ink); min-width: 3px; }
.is-saved .rail-track i { background: var(--accent); }
.act { grid-area: act; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.btn, .open-item {
  min-height: 44px; padding: 0 16px; background: var(--ink); color: var(--on-ink);
  border: 2px solid var(--ink); font-weight: 700; letter-spacing: 0.01em;
}
.btn:hover, .open-item:hover { background: var(--accent-text); border-color: var(--accent-text); }
.mini-save {
  width: 44px; height: 44px; display: grid; place-items: center;
  background: transparent; border: 2px solid transparent;
}
.mini-save svg { width: 20px; height: 20px; }
.mini-save:hover { border-color: var(--ink); }
.mini-save[aria-pressed="true"] { color: var(--accent-text); }
.mini-save[aria-pressed="true"] svg path { fill: currentColor; }

.empty { margin-top: 28px; padding: 28px; border: 2px dashed var(--ink); background: var(--surface); }
.empty[hidden] { display: none; }
.empty-title { font: 800 26px/1.15 var(--display); }
.empty p + p { margin: 8px 0 18px; color: var(--muted); }

/* ---------- shortlist ---------- */
.shortlist {
  background: var(--ink); color: var(--on-ink); padding: 22px 20px 24px;
}
.short-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.short-head h2 { font: 800 26px/1.1 var(--display); }
.link { background: none; border: 0; color: var(--on-ink); text-decoration: underline; padding: 10px 4px; min-height: 44px; font-size: 14px; }
.link[hidden] { display: none; }
.short-empty { margin-top: 10px; color: #d6d2c4; font-size: 15px; }
.short-list { margin-top: 12px; }
.short-list li { border-top: 1px solid #45506a; padding: 14px 0; }
.short-list .s-when { font: 600 12px/1.3 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: #f0b9a6; }
.short-list .s-title { font: 700 19px/1.2 var(--display); margin: 4px 0 2px; }
.short-list .s-where { font-size: 14px; color: #d6d2c4; }
.s-row { display: flex; gap: 8px; margin-top: 8px; }
.s-row button {
  min-height: 44px; padding: 0 14px; background: transparent; border: 1.5px solid #8a93a8;
  color: var(--on-ink); font-size: 14px; font-weight: 600;
}
.s-row button:hover { border-color: var(--on-ink); background: #232e44; }
.s-row :focus-visible, .link:focus-visible, .shortlist :focus-visible { outline-color: #9cc2ff; }
.clash {
  margin-top: 8px; padding: 8px 10px; background: #3a1f1a; border-left: 4px solid #ff9a7a;
  font-size: 14px; color: #ffd9cc;
}
.short-total { margin-top: 6px; padding-top: 14px; border-top: 2px solid var(--on-ink); font: 600 14px/1.4 var(--mono); }
.short-total[hidden] { display: none; }

/* ---------- footer + pill ---------- */
.site-foot { border-top: 4px solid var(--ink); }
.site-foot p { max-width: var(--max); margin: 0 auto; padding: 22px var(--gutter) 90px; font-size: 14px; color: var(--muted); }
.pill {
  position: fixed; right: 14px; bottom: 14px; z-index: 20;
  background: var(--accent-text); color: #fff; text-decoration: none; font-weight: 700;
  padding: 13px 18px; min-height: 44px; border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
}
.pill span { margin-left: 4px; font-family: var(--mono); }

/* ---------- detail dialog ---------- */
.sheet {
  padding: 0; border: 0; background: var(--surface); color: var(--ink);
  width: 100%; max-width: 100%; max-height: 92dvh;
  margin: auto 0 0; inset-inline: 0; border-top: 4px solid var(--ink);
  overflow: auto; overscroll-behavior: contain;
}
.sheet::backdrop { background: rgba(22, 31, 46, .6); }
.sheet-inner { padding: 20px var(--gutter) 28px; }
.sheet-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-top .cat { color: var(--ink); }
.close {
  min-height: 44px; padding: 0 14px; background: transparent; border: 2px solid var(--ink); font-weight: 700;
}
.close:hover { background: var(--ink); color: var(--on-ink); }
.sheet h2 { font: 800 clamp(30px, 8vw, 44px)/1.05 var(--display); letter-spacing: -0.02em; margin: 16px 0 14px; text-wrap: balance; }
.facts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 2px solid var(--ink); border-left: 2px solid var(--ink);
  margin: 0 0 18px;
}
.facts div { padding: 10px 12px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.facts dt { font: 600 11px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 4px 0 0; font: 700 18px/1.25 var(--display); }
.facts .wide { grid-column: 1 / -1; }
.sheet .rail { max-width: none; margin: 4px 0 6px; }
.sheet .axis { margin-top: 4px; }
.body p { max-width: 58ch; margin-bottom: 14px; font-size: 18px; }
.body p:last-child { margin-bottom: 0; }
.access {
  margin: 18px 0 0; padding: 14px 16px; background: #e5eee5; border-left: 5px solid var(--pine);
}
.access h3 { font: 600 12px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--pine); margin-bottom: 6px; }
.access p { font-size: 17px; }
.save-item {
  margin-top: 22px; width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--ink); color: var(--on-ink); border: 2px solid var(--ink); font-size: 17px; font-weight: 700;
}
.save-item svg { width: 20px; height: 20px; }
.save-item:hover { background: var(--accent-text); border-color: var(--accent-text); }
.save-item[aria-pressed="true"] { background: var(--accent-text); border-color: var(--ink); color: #fff; }
.save-item[aria-pressed="true"] svg path { fill: currentColor; }
.save-item[aria-pressed="true"]:hover { background: var(--ink); border-color: var(--ink); }
.sheet :focus-visible { outline-color: var(--focus); }

/* ---------- tablet ---------- */
@media (min-width: 640px) {
  :root { --gutter: 32px; }
  .controls { grid-template-columns: 1fr 220px auto; align-items: end; }
  .item { grid-template-columns: 96px 1fr 150px; grid-template-areas: "when what act" "when how act"; }
  .act { justify-content: space-between; }
  .sheet { max-width: 640px; margin: auto 0 auto auto; max-height: 100dvh; height: 100dvh; border-top: 0; border-left: 4px solid var(--ink); }
  .facts { grid-template-columns: repeat(3, 1fr); }
  .facts .wide { grid-column: auto; }
}

/* ---------- desktop ---------- */
@media (min-width: 1080px) {
  :root { --gutter: 40px; }
  .hero { grid-template-columns: 1.15fr 1fr; gap: 56px; padding-bottom: 36px; align-items: end; }
  .hero h1 { font-size: clamp(76px, 7.2vw, 104px); }
  .layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 56px; }
  .shortlist { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
  .pill { display: none; }
  .site-foot p { padding-bottom: 28px; }
  .item { grid-template-columns: 110px 1fr 150px; }
}

@media (max-width: 380px) {
  .item { grid-template-columns: 64px 1fr auto; }
  .day-num { font-size: 44px; }
}

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