:root {
  --bg: #f4f2ec;
  --surface: #ebe8df;
  --ink: #14130f;
  --muted: #5a574d;
  --rule: #c9c5b8;
  --accent: #c42a18;
  --accent-ink: #ffffff;
  --accent-on-dark: #ff6a55;
  --sans: "Helvetica Neue", "Arial Nova", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pad: clamp(24px, 4vw, 56px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  overflow-x: clip;
}
h1, h2, h3, h4, p, dl, dd, ul { margin: 0; padding: 0; }
ul { list-style: none; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
.vh {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.wrap { max-width: 1440px; margin-inline: auto; padding-inline: var(--pad); }

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

.label, .field label, .field-label {
  font: 600 12px/1.2 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* skip + header */
.skip {
  position: absolute; left: 16px; top: -80px; z-index: 50;
  background: var(--ink); color: var(--bg); padding: 12px 20px;
}
.skip:focus { top: 12px; }

.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 60px; padding-inline: var(--pad);
  background: var(--bg);
  border-bottom: 1px solid var(--ink);
}
.wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; text-decoration: none;
  font-weight: 700; font-size: 20px; letter-spacing: -0.03em;
}
.site-header nav { display: flex; gap: clamp(0px, 1.5vw, 16px); }
.site-header nav a {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding-inline: 10px;
  text-decoration: none; font-size: 15px; font-weight: 500;
  transition: color 150ms var(--ease);
}
.nav-count {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding-inline: 5px;
  font: 600 12px/1 var(--mono);
  background: var(--ink); color: var(--bg);
  transition: background-color 150ms var(--ease);
}
.nav-count.has { background: var(--accent); color: var(--accent-ink); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 24px;
  border: 2px solid var(--ink); background: transparent;
  font-weight: 600; font-size: 16px; text-decoration: none; cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease), transform 150ms var(--ease);
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:active, .toggle:active, .seg button:active, .close:active, .save-btn:active { transform: scale(0.97); }

/* hero */
.hero { padding-top: 32px; border-bottom: 1px solid var(--ink); overflow-x: clip; }
.hero-top {
  display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  gap: 32px var(--pad); align-items: end;
  max-width: 1440px; margin-inline: auto; padding-inline: var(--pad);
}
h1 { display: flex; flex-direction: column; }
.big {
  display: block;
  font-weight: 700;
  font-size: clamp(8rem, 27vw, 24rem);
  line-height: 0.78;
  letter-spacing: -0.07em;
  margin-left: -0.05em;
  padding-top: 0.06em;
  animation: rise 700ms var(--ease) both;
}
.h1-sub {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 700; line-height: 1.05; letter-spacing: -0.03em;
  margin-top: 20px;
  animation: rise 700ms 120ms var(--ease) both;
}
.hero-side { padding-bottom: 8px; animation: rise 700ms 200ms var(--ease) both; }
.lede { font-size: 18px; max-width: 46ch; margin-bottom: 24px; }
.ledger { margin-top: 32px; border-top: 2px solid var(--ink); }
.ledger div {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-block: 8px; border-bottom: 1px solid var(--rule);
}
.ledger dt { font-size: 15px; color: var(--muted); }
.ledger dd { font: 600 20px/1.2 var(--mono); }

/* timetable chart */
.tl { margin-top: 48px; border-top: 1px solid var(--ink); background: var(--surface); padding-bottom: 24px; }
.tl-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 8px 24px; max-width: 1440px; margin-inline: auto; padding: 16px var(--pad) 8px;
}
.tl-hint { font-weight: 400; letter-spacing: 0.04em; text-transform: none; color: var(--muted); margin-left: 12px; font-size: 13px; }
.tl-key { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.key { display: inline-block; width: 14px; height: 14px; margin-left: 8px; border: 2px solid var(--ink); }
.key:first-child { margin-left: 0; }
.key-ink { background: var(--ink); }
.key-red { background: var(--accent); border-color: var(--accent); }
.key-dim { background: transparent; border-style: dashed; border-color: var(--muted); }
.tl-scroll { overflow-x: auto; padding-inline: var(--pad); max-width: 1440px; margin-inline: auto; }
.tl-plot { position: relative; min-width: 760px; padding-bottom: 4px; }
.tl-axis { position: relative; height: 24px; margin-left: 64px; }
.tl-axis span {
  position: absolute; top: 0; padding-left: 4px;
  font: 500 12px/24px var(--mono); color: var(--muted);
}
.tl-row { display: grid; grid-template-columns: 64px 1fr; border-top: 1px solid var(--ink); }
.tl-day { padding-top: 10px; font: 700 15px/1.2 var(--sans); letter-spacing: -0.01em; }
.tl-day small { display: block; font: 500 12px/1.4 var(--mono); color: var(--muted); }
.tl-track {
  position: relative;
  background-image: linear-gradient(to right, var(--rule) 1px, transparent 1px);
  background-size: calc(100% / 14) 100%;
  border-right: 1px solid var(--rule);
}
.bar {
  position: absolute;
  left: calc(var(--l) * 1%); width: calc(var(--w) * 1%);
  top: calc(var(--lane) * 52px + 4px); height: 44px;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 8px; overflow: hidden; text-align: left;
  background: var(--ink); color: var(--bg);
  border: 2px solid var(--ink); cursor: pointer;
  transform-origin: left center;
  animation: grow 600ms var(--ease) both;
  animation-delay: calc(var(--i) * 70ms + 250ms);
  transition: background-color 150ms var(--ease), color 150ms var(--ease), opacity 150ms var(--ease), border-color 150ms var(--ease);
}
.bar b { font: 600 11px/1.2 var(--mono); letter-spacing: 0.02em; }
.bar span { font: 600 13px/1.25 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar.saved { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.bar.dim { background: transparent; border: 2px dashed var(--muted); color: var(--muted); }
.bar:active { transform: scale(0.97); }
.bar:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; z-index: 3; }
.bar.saved:focus-visible { outline-color: var(--accent); }

.tl-cursor {
  position: absolute; top: 0; bottom: 0; width: 0; left: 0;
  pointer-events: none; display: none; z-index: 2;
  border-left: 1px solid var(--accent);
}
.tl-cursor.on { display: block; }
.tl-cursor span {
  position: absolute; top: 0; left: 0; transform: translateX(-50%);
  background: var(--accent); color: var(--accent-ink);
  font: 600 12px/20px var(--mono); padding-inline: 6px;
}

/* listings */
.listings { padding-block: 128px 96px; }
.sec-head { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 16px var(--pad); align-items: baseline; margin-bottom: 48px; }
.sec-head h2 { font-size: clamp(2rem, 5vw, 4rem); line-height: 1.02; letter-spacing: -0.04em; font-weight: 700; }
.sec-head .label { color: var(--accent); }

.controls {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) auto auto;
  gap: 16px 24px; align-items: end;
  padding-block: 24px; border-block: 2px solid var(--ink);
}
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field input, .field select {
  min-height: 48px; padding: 8px 12px; font-size: 16px;
  background: #fffdf8; border: 2px solid var(--ink); border-radius: 0;
  width: 100%;
}
.field select { appearance: none; padding-right: 36px;
  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:focus-visible, .field select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.seg { display: flex; border: 2px solid var(--ink); }
.seg button {
  min-height: 44px; padding-inline: 16px; border: 0; background: transparent; cursor: pointer; font-weight: 600;
  transition: background-color 150ms var(--ease), color 150ms var(--ease), transform 150ms var(--ease);
}
.seg button + button { border-left: 2px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.seg button:focus-visible { outline-offset: -4px; outline-color: var(--accent); }
.seg button[aria-pressed="true"]:focus-visible { outline-color: var(--accent-on-dark); }
.toggle {
  display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 16px;
  border: 2px solid var(--ink); background: transparent; cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: background-color 150ms var(--ease), color 150ms var(--ease), transform 150ms var(--ease);
}
.toggle-box { width: 18px; height: 18px; border: 2px solid currentColor; display: grid; place-items: center; }
.toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.toggle[aria-pressed="true"] .toggle-box::after { content: ""; width: 8px; height: 8px; background: currentColor; }
.toggle-n { font-family: var(--mono); font-weight: 500; }

.count { margin-block: 16px 0; font: 500 13px/1.4 var(--mono); color: var(--muted); min-height: 24px; }

.day-group + .day-group { margin-top: 48px; }
.day-head {
  display: flex; align-items: baseline; gap: 16px; padding-block: 16px 8px;
  font-size: clamp(1.4rem, 2.4vw, 2rem); letter-spacing: -0.03em; font-weight: 700;
}
.day-head small { font: 500 13px/1 var(--mono); color: var(--muted); letter-spacing: 0; }

.row {
  position: relative;
  display: grid; grid-template-columns: 7rem minmax(0, 1fr) 14rem 5.5rem;
  gap: 8px 32px; align-items: center;
  padding: 24px 16px 24px 0; border-top: 1px solid var(--ink);
  transition: background-color 150ms var(--ease), padding 150ms var(--ease);
}
.row:last-child { border-bottom: 1px solid var(--ink); }
.r-time { font: 600 22px/1.1 var(--mono); letter-spacing: -0.03em; }
.r-time small { display: block; font: 400 13px/1.5 var(--mono); color: var(--muted); letter-spacing: 0; }
.r-main h4 { font-size: clamp(1.25rem, 2vw, 1.7rem); line-height: 1.12; letter-spacing: -0.025em; font-weight: 700; }
.open {
  all: unset; box-sizing: border-box; cursor: pointer;
}
.open::after { content: ""; position: absolute; inset: 0; }
.open:focus-visible { outline: none; }
.open:focus-visible::after { outline: 3px solid var(--accent); outline-offset: -3px; }
.r-meta { margin-top: 6px; font-size: 15px; color: var(--muted); }
.r-meta .cat { font: 600 12px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); margin-right: 8px; }
.saved-tag {
  display: inline-block; margin-left: 8px; padding: 2px 8px; vertical-align: 2px;
  background: var(--accent); color: var(--accent-ink); font: 600 11px/1.5 var(--sans); letter-spacing: 0.1em; text-transform: uppercase;
}
.ruler { position: relative; display: block; height: 12px; border-bottom: 2px solid var(--ink);
  background-image: linear-gradient(to right, var(--rule) 1px, transparent 1px); background-size: calc(100% / 14) 100%; }
.ruler i { position: absolute; left: calc(var(--s) * 1%); bottom: -2px; height: 12px; width: calc(var(--w) * 1%); background: var(--ink); transform-origin: left; transition: background-color 150ms var(--ease), transform 250ms var(--ease); }
.r-price { font: 700 22px/1 var(--mono); text-align: right; letter-spacing: -0.03em; }
.r-price small { display: block; margin-top: 6px; font: 400 12px/1 var(--sans); letter-spacing: 0.04em; color: var(--muted); }

.empty { margin-top: 32px; padding: 48px var(--pad); border: 2px dashed var(--ink); }
.empty[hidden] { display: none; }
.empty-title { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 8px; }
.empty .btn { margin-top: 24px; }

/* shortlist band */
.shortlist { background: var(--ink); color: var(--bg); padding-block: 128px; }
.shortlist .sec-head .label { color: var(--accent-on-dark); }
.sl-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 32px var(--pad); align-items: start; }
.sl-big { font-weight: 700; font-size: clamp(6rem, 14vw, 12rem); line-height: 0.8; letter-spacing: -0.06em; }
.sl-big small { display: block; margin-top: 16px; font: 500 14px/1.5 var(--mono); letter-spacing: 0; color: #d6d2c4; }
.sl-row {
  position: relative; display: grid; grid-template-columns: 7rem minmax(0, 1fr) auto; gap: 8px 24px; align-items: center;
  padding-block: 20px; border-top: 1px solid #5a574d;
  transition: background-color 150ms var(--ease);
}
.sl-row:last-child { border-bottom: 1px solid #5a574d; }
.sl-row .r-time small { color: #d6d2c4; }
.sl-row h3 { font-size: clamp(1.15rem, 2vw, 1.5rem); letter-spacing: -0.02em; line-height: 1.15; }
.sl-row .r-meta { color: #d6d2c4; }
.sl-row .r-meta .cat { color: var(--bg); }
.clash { display: inline-block; margin-top: 8px; font: 600 12px/1.5 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-on-dark); }
.sl-row .open:focus-visible::after { outline-color: var(--accent-on-dark); }
.rm {
  position: relative; z-index: 2; min-height: 44px; padding: 8px 16px; background: transparent; cursor: pointer;
  border: 2px solid var(--bg); color: var(--bg); font-weight: 600; font-size: 15px;
  transition: background-color 150ms var(--ease), color 150ms var(--ease), transform 150ms var(--ease);
}
.rm:active { transform: scale(0.97); }
.rm:focus-visible { outline-color: var(--accent-on-dark); }
.sl-empty { border: 2px dashed #8d897b; padding: 32px; }
.sl-empty p + p { margin-top: 8px; }
.sl-empty a { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; font-weight: 600; color: var(--accent-on-dark); }
.sl-empty p:first-child { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }

.site-footer { padding-block: 48px 64px; }
.foot { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 16px var(--pad); }
.foot-mark { font-weight: 700; font-size: 2rem; letter-spacing: -0.04em; line-height: 1; }
.foot p:last-child { color: var(--muted); font-size: 15px; max-width: 62ch; }

/* detail drawer */
body.lock { overflow: hidden; }
dialog.detail {
  position: fixed; inset: 0 0 0 auto; margin: 0;
  width: min(560px, 100%); max-width: 100%; height: 100%; max-height: 100%;
  padding: 0; border: 0; border-left: 2px solid var(--ink);
  background: var(--bg); color: var(--ink); overflow-y: auto;
  animation: slide 250ms var(--ease) both;
}
dialog.detail::backdrop { background: rgba(20, 19, 15, 0.55); }
.d-inner { padding: 24px var(--pad) 48px; min-height: 100%; display: flex; flex-direction: column; }
.d-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.close {
  min-height: 44px; padding: 8px 16px; background: transparent; cursor: pointer;
  border: 2px solid var(--ink); font-weight: 600;
  transition: background-color 150ms var(--ease), color 150ms var(--ease), transform 150ms var(--ease);
}
.d-kicker { font: 600 12px/1.4 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.d-inner h2 { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.02; letter-spacing: -0.04em; font-weight: 700; margin-bottom: 24px; }
.d-facts { border-top: 2px solid var(--ink); margin-bottom: 24px; }
.d-facts div { display: grid; grid-template-columns: 7rem 1fr; gap: 16px; padding-block: 10px; border-bottom: 1px solid var(--rule); }
.d-facts dt { font: 600 12px/1.7 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.d-facts dd { font-weight: 500; }
.d-body p { max-width: 60ch; }
.d-body p + p { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--rule); }
.d-clash { margin-top: 24px; padding: 12px 16px; border-left: 4px solid var(--accent); background: var(--surface); font-size: 15px; }
.d-clash[hidden] { display: none; }
.d-actions { margin-top: auto; padding-top: 32px; }
.save-btn {
  display: flex; width: 100%; align-items: center; justify-content: center; gap: 12px;
  min-height: 56px; padding: 12px 24px; cursor: pointer; font-size: 17px; font-weight: 700;
  border: 2px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  transition: background-color 150ms var(--ease), color 150ms var(--ease), transform 150ms var(--ease);
}
.save-btn[aria-pressed="true"] { background: transparent; color: var(--accent); }
.save-btn:focus-visible, .close:focus-visible { outline-offset: 3px; }

@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { opacity: 0; transform: scaleX(0.2); } to { opacity: 1; transform: none; } }
@keyframes slide { from { opacity: 0; transform: translateX(32px); } to { opacity: 1; transform: none; } }

@media (hover: hover) and (pointer: fine) {
  .site-header nav a:hover { color: var(--accent); }
  .btn:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
  .btn-primary:hover { background: var(--ink); }
  .bar:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  .bar.dim:hover { background: transparent; border-color: var(--ink); color: var(--ink); }
  .seg button:hover:not([aria-pressed="true"]) { background: var(--surface); }
  .toggle:hover:not([aria-pressed="true"]) { background: var(--surface); }
  .toggle[aria-pressed="true"]:hover { background: var(--ink); border-color: var(--ink); }
  .row:hover { background: var(--surface); padding-left: 12px; }
  .row:hover .ruler i { background: var(--accent); transform: scaleX(1.0); }
  .sl-row:hover { background: #26241d; }
  .rm:hover { background: var(--bg); color: var(--ink); }
  .close:hover { background: var(--ink); color: var(--bg); }
  .save-btn:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
  .save-btn[aria-pressed="true"]:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  .field input:hover, .field select:hover { background: #fff; }
}
.row:focus-within .ruler i { background: var(--accent); }

@media (max-width: 1000px) {
  .hero-top, .sec-head, .sl-grid, .foot { grid-template-columns: 1fr; }
  .controls { grid-template-columns: 1fr 1fr; }
  .field-search { grid-column: 1 / -1; }
  .row { grid-template-columns: 6rem minmax(0, 1fr) 5.5rem; }
  .row .ruler { grid-column: 2 / 3; grid-row: 2; }
  .row .r-price { grid-row: 1 / 3; grid-column: 3; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .site-header { min-height: 56px; padding-inline: 16px; }
  .site-header nav { gap: 0; }
  .site-header nav a { padding-inline: 6px; font-size: 14px; }
  .wordmark span { font-size: 18px; }
  .hero { padding-top: 16px; }
  .listings { padding-block: 96px 64px; }
  .shortlist { padding-block: 96px 80px; }
  .controls { grid-template-columns: 1fr; }
  .seg button { flex: 1; }
  .field-saved .toggle { width: 100%; }
  .row { grid-template-columns: minmax(0, 1fr) auto; padding-block: 20px; gap: 6px 16px; }
  .r-time { grid-column: 1; grid-row: 1; font-size: 18px; }
  .r-time small { display: inline; margin-left: 8px; }
  .r-price { grid-column: 2; grid-row: 1; font-size: 18px; text-align: right; }
  .r-price small { display: none; }
  .r-main { grid-column: 1 / -1; grid-row: 2; }
  .row .ruler { grid-column: 1 / -1; grid-row: 3; margin-top: 8px; }
  .sl-row { grid-template-columns: minmax(0, 1fr) auto; }
  .sl-row .r-time { grid-column: 1 / -1; }
  .d-facts div { grid-template-columns: 5.5rem 1fr; }
  .tl-hint { display: block; margin: 4px 0 0; }
  dialog.detail { border-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .big, .h1-sub, .hero-side, dialog.detail { animation: none; }
  .bar { animation: none; }
  .row, .ruler i, * { transition-duration: 0.01ms !important; }
  .row:hover { padding-left: 0; }
}
