/* Two Days Out. Timetable-style weekend guide.
   One accent, square corners everywhere, light and dark via prefers-color-scheme. */

@font-face { font-family: "Oswald"; src: url("assets/oswald.ttf") format("truetype"); font-weight: 200 700; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("assets/dm-sans.ttf") format("truetype"); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("assets/ibm-plex-mono.ttf") format("truetype"); font-weight: 400; font-display: swap; }

:root {
  --bg: #eceff1;
  --surface: #f8f9fa;
  --ink: #0f1419;
  --muted: #46515b;
  --line: #c5cdd2;
  --accent: #b9320c;
  --on-accent: #ffffff;
  --scrim: rgb(10 14 18 / 0.55);
  --img-filter: none;

  --display: "Oswald", "Arial Narrow", sans-serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --pad: 40px;
  --header-h: 60px;
  --z-header: 10;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1216;
    --surface: #161c22;
    --ink: #e9edf0;
    --muted: #a0abb4;
    --line: #2b353d;
    --accent: #ff8057;
    --on-accent: #1a0b05;
    --scrim: rgb(0 0 0 / 0.7);
    --img-filter: brightness(0.9);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
img { display: block; max-width: 100%; filter: var(--img-filter); }
h1, h2, h3, p, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 10px 16px; text-decoration: none; font-weight: 600;
}
.skip:focus { top: 12px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: var(--z-header);
  background: var(--bg); border-bottom: 2px solid var(--ink);
}
.top-inner {
  max-width: 1360px; margin: 0 auto; padding: 0 var(--pad);
  height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  font: 700 1.5rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.02em;
  color: var(--ink); text-decoration: none;
}
.top nav { display: flex; gap: 8px; }
.top nav a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px;
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.95rem;
}
.top nav a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.count {
  display: inline-grid; place-items: center; min-width: 1.6em; padding: 0 0.4em;
  font: 400 0.8rem/1.6 var(--mono); background: var(--ink); color: var(--bg);
}

/* Hero */
.hero {
  max-width: 1360px; margin: 0 auto; padding: 40px var(--pad) 48px;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 56px; align-items: stretch;
}
.hero-copy { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 20px; }
.hero h1 {
  font: 700 clamp(3.5rem, 8.2vw, 7.25rem)/0.94 var(--display);
  text-transform: uppercase; letter-spacing: -0.005em;
}
.hero p { max-width: 36ch; font-size: 1.15rem; color: var(--muted); }
.hero-img {
  width: 100%; height: 100%; min-height: 300px; max-height: 360px; object-fit: cover; object-position: 50% 40%;
  margin-top: 24px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 26px;
  border: 2px solid var(--ink); background: transparent; color: var(--ink);
  font-weight: 700; text-decoration: none; white-space: nowrap; border-radius: 0;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.08); }

/* Layout */
.layout {
  max-width: 1360px; margin: 0 auto; padding: 0 var(--pad) 72px;
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 56px; align-items: start;
}

/* Controls */
.controls {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto auto; gap: 16px 20px; align-items: end;
  padding-top: 24px; border-top: 2px solid var(--ink);
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field label, .field legend { font-size: 0.85rem; font-weight: 700; padding: 0; }
input[type="search"], select {
  width: 100%; height: 48px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 0;
  background-color: var(--surface); appearance: none; -webkit-appearance: none;
}
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
select {
  padding-right: 40px; cursor: pointer;
  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, 6px 6px; background-repeat: no-repeat;
}
.seg { display: inline-flex; height: 48px; border: 2px solid var(--ink); background: var(--surface); }
.seg button {
  border: 0; border-right: 2px solid var(--ink); background: transparent; padding: 0 16px; font-weight: 600; white-space: nowrap;
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.seg button:focus-visible { outline-offset: -5px; }
.toggle {
  display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 18px; white-space: nowrap;
  border: 2px solid var(--ink); border-radius: 0; background: var(--surface); font-weight: 700;
  transition: transform 0.15s ease;
}
.toggle:active { transform: translateY(1px); }
.toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.toggle[aria-pressed="true"] .count { background: var(--on-accent); color: var(--accent); }

.meta-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 52px; }
.result-count { font: 400 0.85rem var(--mono); color: var(--muted); }
.link-btn {
  background: none; border: 0; padding: 8px 0; font-weight: 700; color: var(--ink);
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px;
}
.link-btn:hover { color: var(--accent); }

/* List */
.day { margin-bottom: 40px; }
.day-head {
  display: flex; align-items: baseline; gap: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--ink);
}
.day-head h2 { font: 700 2rem/1 var(--display); text-transform: uppercase; }
.day-head span { font: 400 0.85rem var(--mono); color: var(--muted); }

.row {
  position: relative; display: grid; grid-template-columns: 112px 128px minmax(0, 1fr) 96px; gap: 0 24px; align-items: center;
  padding: 18px 12px; border-bottom: 1px solid var(--line);
  transition: background-color 0.15s ease;
}
.row:hover { background: var(--surface); }
.row:has(.row-open:active) { transform: translateY(1px); }
.row-time { grid-area: time; font-family: var(--mono); line-height: 1.3; }
.row-time strong { display: block; font: 400 1.5rem/1.1 var(--mono); }
.row-time strong small { font-size: 0.8rem; margin-left: 3px; color: var(--muted); }
.row-time span { font-size: 0.8rem; color: var(--muted); }
.row-img { grid-area: thumb; width: 128px; height: 92px; object-fit: cover; }
.row-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-cat { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.row-main h3 { font: 700 1.3rem/1.2 var(--sans); }
.row-open {
  all: unset; cursor: pointer; display: block;
}
.row-open::after { content: ""; position: absolute; inset: 0; }
.row-open:focus-visible::after { outline: 3px solid var(--accent); outline-offset: -3px; }
.row:hover .row-open { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.row-where { color: var(--muted); font-size: 0.95rem; }
.row-sum {
  color: var(--muted); font-size: 0.95rem; max-width: 62ch;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row-side { grid-area: price; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.row-price { font: 600 1.7rem/1 var(--display); }
.row-format { font-size: 0.85rem; color: var(--muted); }
.row-saved { font-size: 0.8rem; font-weight: 700; color: var(--accent); }
.row-saved[hidden] { display: none; }

.skeleton {
  height: 128px; margin-bottom: 12px; background: var(--surface); border-bottom: 1px solid var(--line);
}

.empty { padding: 56px 24px; border: 2px dashed var(--ink); display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.empty[hidden] { display: none; }
.empty h3 { font: 700 2rem/1.05 var(--display); text-transform: uppercase; }
.empty p { color: var(--muted); max-width: 46ch; margin-bottom: 8px; }

/* Shortlist */
.shortlist {
  position: sticky; top: calc(var(--header-h) + 24px); margin-top: 24px;
  background: var(--surface); border: 2px solid var(--ink); padding: 20px;
  max-height: calc(100dvh - var(--header-h) - 48px); overflow-y: auto;
}
.shortlist h2 { font: 700 1.6rem/1 var(--display); text-transform: uppercase; }
.sl-summary { margin-top: 8px; font: 400 0.85rem var(--mono); color: var(--muted); }
.sl-list { margin-top: 12px; }
.sl-item { padding: 12px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
.sl-when { grid-column: 1 / -1; font: 400 0.8rem var(--mono); color: var(--muted); }
.sl-open {
  all: unset; cursor: pointer; font-weight: 700; line-height: 1.3;
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px; text-decoration-thickness: 2px;
}
.sl-open:hover { text-decoration-color: currentColor; }
.sl-open:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sl-remove { background: none; border: 0; padding: 0 0 0 8px; min-height: 32px; font-size: 0.85rem; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.sl-remove:hover { color: var(--ink); }
.sl-clash { grid-column: 1 / -1; font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.sl-empty { margin-top: 12px; color: var(--muted); font-size: 0.95rem; }
.sl-empty[hidden] { display: none; }

.foot { border-top: 2px solid var(--ink); }
.foot p { max-width: 1360px; margin: 0 auto; padding: 24px var(--pad); color: var(--muted); font-size: 0.9rem; }

/* Detail dialog */
dialog {
  margin: 0 0 0 auto; padding: 0; border: 0; border-left: 2px solid var(--ink);
  width: min(580px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  background: var(--bg); color: var(--ink); overflow: hidden;
}
dialog::backdrop { background: var(--scrim); }
.sheet { display: flex; flex-direction: column; height: 100%; }
.sheet-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px 10px 24px;
  border-bottom: 2px solid var(--ink); flex: none;
}
.sheet-kicker { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.close {
  min-height: 44px; padding: 0 18px; border: 2px solid var(--ink); border-radius: 0; background: transparent; font-weight: 700;
}
.close:hover { background: var(--ink); color: var(--bg); }
.sheet-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.sheet-img { width: 100%; height: 220px; object-fit: cover; }
.sheet-body { padding: 24px 24px 32px; display: flex; flex-direction: column; gap: 24px; }
.sheet-body h2 { font: 700 clamp(2.2rem, 5vw, 3rem)/1 var(--display); text-transform: uppercase; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; padding: 16px 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); }
.facts dt { font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.facts dd { font-size: 1.05rem; font-weight: 600; }
.body { display: flex; flex-direction: column; gap: 14px; max-width: 60ch; }
.body p { font-size: 1.05rem; }
.body p.access { padding-top: 14px; border-top: 1px solid var(--line); }
.body p.access::before {
  content: "Access and practical notes"; display: block; margin-bottom: 4px;
  font-size: 0.8rem; font-weight: 700; color: var(--muted);
}
.clash { padding: 12px 14px; border: 2px solid var(--accent); font-weight: 600; }
.clash[hidden] { display: none; }
.sheet-foot { flex: none; padding: 14px 24px; border-top: 2px solid var(--ink); background: var(--bg); }
.btn-save { width: 100%; min-height: 56px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-size: 1.05rem; }
.btn-save[aria-pressed="true"] { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-save:hover { filter: brightness(1.08); }

/* Motion, only when allowed */
@media (prefers-reduced-motion: no-preference) {
  .list.enter .row { animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: calc(var(--i, 0) * 45ms); }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  dialog[open] { animation: slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
  dialog[open]::backdrop { animation: fade-in 0.3s ease; }
  @keyframes slide-in { from { transform: translateX(48px); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
  .skeleton { animation: pulse 1.3s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: 0.55; } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Tablet */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .shortlist { position: static; max-height: none; margin-top: 8px; }
  .controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .field-search { grid-column: 1 / -1; }
}

/* Mobile */
@media (max-width: 767px) {
  :root { --pad: 18px; --header-h: 56px; }
  .brand { font-size: 1.3rem; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 0; padding-bottom: 32px; }
  .hero-img { order: -1; height: 190px; min-height: 0; margin: 0 calc(var(--pad) * -1) 24px; width: calc(100% + var(--pad) * 2); max-width: none; }
  .hero h1 { font-size: 3.6rem; }
  .hero p { font-size: 1.05rem; }
  .controls { grid-template-columns: minmax(0, 1fr); padding-top: 18px; }
  .field-day .seg { display: flex; }
  .field-day .seg button { flex: 1; padding: 0 8px; }
  .toggle { width: 100%; justify-content: center; }
  .day-head h2 { font-size: 1.6rem; }
  .row {
    grid-template-columns: 84px minmax(0, 1fr) auto; grid-template-areas: "thumb time price" "thumb main main";
    gap: 6px 14px; align-items: start; padding: 16px 0;
  }
  .row-img { width: 84px; height: 84px; }
  .row-time strong { font-size: 1.2rem; display: inline; }
  .row-time span { display: block; }
  .row-main h3 { font-size: 1.15rem; }
  .row-sum { display: none; }
  .row-price { font-size: 1.4rem; }
  .row-format { display: none; }
  dialog { width: 100vw; border-left: 0; }
  .sheet-bar { padding-left: 18px; }
  .sheet-img { height: 170px; }
  .sheet-body { padding: 20px 18px 28px; }
  .sheet-foot { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
  .empty { padding: 36px 18px; }
}
