/* Layover — a departures-board take on a weekend guide.
   Midnight ink, signal yellow, condensed display type, tabular times. */

:root {
  --ink: #0e1220;
  --panel: #151a2d;
  --panel-2: #1c2238;
  --line: #2b3253;
  --text: #eef0f7;
  --muted: #aab1ca;
  --signal: #ffd23f;
  --paper: #f3efe4;
  --paper-ink: #14182a;
  --paper-muted: #4b5068;
  --c: #ffd23f;

  --display: "Avenir Next Condensed", "Arial Narrow", "Roboto Condensed", "Liberation Sans Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --rail: 22.5rem;
}

[data-category="art"] { --c: #ff8fc2; }
[data-category="film"] { --c: #b9a4ff; }
[data-category="food"] { --c: #ffb35c; }
[data-category="literature"] { --c: #f2e46a; }
[data-category="music"] { --c: #5eead4; }
[data-category="outdoors"] { --c: #a3e36b; }
[data-category="walks"] { --c: #ff9a7a; }

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
html.lock { overflow: hidden; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 400 1rem/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

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

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 50;
  background: var(--signal); color: var(--ink); padding: .6rem 1rem; font-weight: 700; border-radius: 6px;
}
.skip:focus { top: 1rem; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; }

.rail {
  padding: 1.25rem 1.25rem 1.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: .75rem; }
.brand-mark { width: 2.5rem; height: 2.5rem; color: var(--signal); flex: none; }
.brand-name {
  font: 800 1.75rem/1 var(--display);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.brand-sub { font: 500 .8125rem/1.3 var(--mono); color: var(--muted); margin-top: .2rem; }
.lede { display: none; color: var(--muted); margin-top: 1.25rem; max-width: 30ch; }

/* ---------- controls ---------- */
.controls {
  display: grid; grid-template-columns: 1fr 1fr; gap: .875rem 1rem; margin-top: 1.1rem;
}
.field { display: grid; gap: .35rem; min-width: 0; }
.field:nth-child(1) { grid-column: 1 / -1; }
.field:nth-child(3) { grid-column: 1 / -1; }
label, .label {
  font: 600 .75rem/1.2 var(--mono);
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
input[type="text"], select {
  width: 100%; min-height: 2.75rem; padding: .55rem .8rem;
  background: var(--ink); border: 1.5px solid var(--line); border-radius: 8px;
  color: var(--text);
}
input::placeholder { color: #8a92ae; }
input[type="text"]:hover, select:hover { border-color: #4a5380; }
input[type="text"]:focus-visible, select:focus-visible { border-color: var(--signal); outline-offset: 1px; }
select { appearance: none; -webkit-appearance: none; padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23ffd23f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center;
}
select option { background: var(--panel); color: var(--text); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1.5px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--ink); }
.seg-btn {
  min-height: 2.75rem; border: 0; background: transparent; color: var(--muted);
  font: 700 .9375rem/1 var(--body); border-right: 1px solid var(--line);
}
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover { color: var(--text); background: var(--panel-2); }
.seg-btn[aria-pressed="true"] { background: var(--signal); color: var(--ink); }
.seg-btn:focus-visible { outline-offset: -3px; outline-color: var(--text); }
.seg-btn[aria-pressed="true"]:focus-visible { outline-color: var(--ink); }

.saved-toggle {
  grid-column: 2; grid-row: 2; align-self: end;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 2.75rem; padding: .5rem .8rem; border-radius: 8px;
  background: transparent; border: 1.5px solid var(--line); font-weight: 700;
}
.saved-toggle svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; flex: none; }
.saved-toggle .count {
  min-width: 1.5rem; padding: 0 .4rem; border-radius: 99px; text-align: center;
  font: 700 .8125rem/1.5rem var(--mono); background: var(--panel-2); color: var(--text);
}
.saved-toggle:hover { border-color: #4a5380; background: var(--panel-2); }
.saved-toggle[aria-pressed="true"] { background: var(--signal); border-color: var(--signal); color: var(--ink); }
.saved-toggle[aria-pressed="true"] svg { fill: currentColor; }
.saved-toggle[aria-pressed="true"] .count { background: var(--ink); color: var(--signal); }

/* shortlist (wide screens only) */
.plan { display: none; }
.plan h2 { font: 600 .75rem/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.plan-list { margin-top: .75rem; display: grid; gap: .5rem; }
.plan-item {
  width: 100%; text-align: left; padding: .65rem .8rem; border-radius: 8px;
  background: var(--ink); border: 1px solid var(--line); display: grid; gap: .1rem;
}
.plan-item:hover { border-color: var(--signal); }
.plan-time { font: 600 .75rem/1.3 var(--mono); color: var(--signal); }
.plan-title { font-weight: 600; line-height: 1.3; }
.plan-clash { font-size: .8125rem; color: #ffb4a2; }
.plan-empty { margin-top: .75rem; color: var(--muted); font-size: .9375rem; max-width: 32ch; }
.plan-empty[hidden] { display: none; }

/* ---------- board ---------- */
.board {
  padding: 1.75rem 1.25rem 3rem;
  background-image:
    linear-gradient(to right, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 4.5rem 100%;
}
.board:focus { outline: none; }

.eyebrow { font: 600 .8125rem/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--signal); }
.masthead h1 {
  margin-top: .6rem;
  font: 800 clamp(2.5rem, 11vw, 3rem)/.95 var(--display);
  text-transform: uppercase; letter-spacing: .005em;
}
.masthead h1 span { color: transparent; -webkit-text-stroke: 1.5px var(--text); }
.status { margin-top: 1rem; color: var(--muted); font: 500 .875rem/1.3 var(--mono); min-height: 1.1rem; }

.day { margin-top: 1.75rem; }
.day-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: .7rem 1rem; background: var(--signal); color: var(--ink);
  border-radius: 8px 8px 0 0;
}
.day-head h2 { font: 800 1.25rem/1.1 var(--display); text-transform: uppercase; letter-spacing: .04em; }
.day-count { font: 700 .8125rem/1 var(--mono); }

.rows { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px; background: rgba(21,26,45,.72); }
.row {
  position: relative; display: grid; gap: .5rem 1rem; padding: 1rem 1rem 1rem 1.25rem;
  grid-template-columns: 1fr auto; grid-template-areas: "when cost" "what what";
  border-top: 1px solid var(--line); cursor: pointer;
}
.row:first-child { border-top: 0; }
.row:last-child { border-radius: 0 0 8px 8px; }
.row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.row:hover { background: var(--panel-2); }
.row:has(.open:focus-visible) { outline: 3px solid var(--signal); outline-offset: -3px; }
.open:focus-visible { outline: none; }

.when { grid-area: when; display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .6rem; font-family: var(--mono); }
.start { font-size: 1.375rem; font-weight: 700; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.until { font-size: .8125rem; color: var(--muted); }
.cost { grid-area: cost; align-self: start; font: 800 1.375rem/1.1 var(--display); text-align: right; }
.cost.free span { color: var(--ink); background: var(--c); padding: .1rem .5rem; border-radius: 4px; font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; }
.what { grid-area: what; min-width: 0; }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; font-size: .8125rem; }
.tag {
  display: inline-block; padding: .15rem .55rem; border-radius: 4px; background: var(--c); color: #11142a;
  font: 700 .75rem/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase;
}
.fmt { color: var(--muted); font-family: var(--mono); }
.mark { display: inline-flex; align-items: center; gap: .3rem; color: var(--signal); font-weight: 700; }
.mark svg { width: .9rem; height: .9rem; fill: currentColor; }

.title { margin-top: .4rem; font: 700 1.375rem/1.2 var(--body); letter-spacing: -.01em; }
.open { all: unset; cursor: pointer; }
.open::after { content: ""; position: absolute; inset: 0; }
.row:hover .open { text-decoration: underline; text-decoration-color: var(--c); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.where { margin-top: .25rem; color: var(--text); font-weight: 500; }
.sum { margin-top: .35rem; color: var(--muted); max-width: 62ch; }

.empty { margin-top: 2rem; padding: 2.5rem 1.25rem; border: 2px dashed var(--line); border-radius: 12px; text-align: center; display: grid; justify-items: center; gap: .6rem; }
.empty[hidden] { display: none; }
.empty svg { width: 4rem; height: 4rem; color: var(--signal); }
.empty h2 { font: 800 1.75rem/1.1 var(--display); text-transform: uppercase; }
.empty p { color: var(--muted); max-width: 44ch; }
.btn {
  margin-top: .5rem; min-height: 2.75rem; padding: .6rem 1.2rem; border: 0; border-radius: 8px;
  background: var(--signal); color: var(--ink); font-weight: 700;
}
.btn:hover { background: #ffe07a; }
.error { margin-top: 2rem; padding: 1rem; border: 1px solid #ff9a7a; border-radius: 8px; }

.foot { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }

/* ---------- detail ticket ---------- */
dialog.ticket {
  padding: 0; border: 0; color: var(--paper-ink); background: var(--paper);
  margin: auto 0 0 0; width: 100%; max-width: 100%;
  max-height: 92dvh; height: auto; overflow: auto;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -20px 60px rgba(0,0,0,.5);
}
dialog.ticket::backdrop { background: rgba(6, 8, 18, .72); }
.ticket-inner { padding: 1.25rem 1.25rem 1.75rem; border-top: 10px solid var(--c); }
.ticket .tag { background: var(--c); color: #11142a; box-shadow: inset 0 0 0 1.5px rgba(17,20,42,.55); }
.t-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.close {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 2.75rem; padding: .4rem .9rem .4rem .7rem;
  background: transparent; border: 2px solid var(--paper-ink); border-radius: 99px; color: var(--paper-ink); font-weight: 700;
}
.close svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }
.close:hover { background: var(--paper-ink); color: var(--paper); }
.ticket :focus-visible { outline-color: #0b57d0; }

.t-title { margin-top: 1rem; font: 800 clamp(2rem, 8vw, 2.5rem)/1 var(--display); text-transform: uppercase; letter-spacing: .005em; }
.t-title:focus { outline: none; }
.t-day { margin-top: .5rem; font: 600 .9375rem/1.3 var(--mono); color: var(--paper-muted); }

.t-facts { margin-top: 1.25rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
.t-facts .wide { grid-column: 1 / -1; }
.t-facts dt { font: 600 .75rem/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--paper-muted); }
.t-facts dd { margin-top: .2rem; font-weight: 600; font-size: 1.0625rem; line-height: 1.3; }
.t-facts dd.big { font: 800 1.75rem/1.1 var(--display); letter-spacing: .01em; }
.t-facts dd small { display: block; margin-top: .2rem; font: 500 .8125rem/1.3 var(--mono); color: var(--paper-muted); letter-spacing: 0; }

.t-perf { margin: 1.5rem -1.25rem; border-top: 2px dashed rgba(20,24,42,.4); }
.t-sub { font: 600 .75rem/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--paper-muted); }
.t-body { margin-top: .6rem; white-space: pre-line; font-size: 1.0625rem; line-height: 1.6; max-width: 60ch; }
.t-warn { margin-top: 1.1rem; padding: .75rem .9rem; border-left: 5px solid #b3261e; background: #fbe4df; color: #5c120d; font-size: .9375rem; }

.t-actions { margin-top: 1.5rem; }
.save {
  width: 100%; min-height: 3.25rem; display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  padding: .7rem 1.25rem; border-radius: 10px; border: 2px solid var(--paper-ink);
  background: var(--paper-ink); color: var(--paper); font: 700 1.0625rem/1.2 var(--body);
}
.save svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.save:hover { background: #262c47; }
.save[aria-pressed="true"] { background: transparent; color: var(--paper-ink); }
.save[aria-pressed="true"] svg { fill: currentColor; }
.save[aria-pressed="true"]:hover { background: rgba(20,24,42,.08); }

/* ---------- wide screens ---------- */
@media (min-width: 60em) {
  .shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); }
  .rail {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    padding: 2rem 1.75rem; border-bottom: 0; border-right: 1px solid var(--line);
    display: flex; flex-direction: column;
  }
  .lede { display: block; }
  .brand-name { font-size: 2.25rem; }
  .brand-mark { width: 3rem; height: 3rem; }
  .controls { grid-template-columns: 1fr; margin-top: 1.75rem; gap: 1.1rem; }
  .field:nth-child(n) { grid-column: auto; }
  .saved-toggle { grid-column: auto; grid-row: auto; justify-content: flex-start; }
  .saved-toggle .saved-text { flex: 1; text-align: left; }
  .plan { display: block; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }

  .board { padding: 3rem 3.5rem 4rem; }
  .masthead h1 { font-size: clamp(4rem, 6.2vw, 6rem); }
  .day { margin-top: 2.5rem; max-width: 62rem; }
  .row {
    grid-template-columns: 8.5rem minmax(0, 1fr) 5.5rem; grid-template-areas: "when what cost";
    padding: 1.35rem 1.5rem 1.35rem 1.75rem; gap: 1.5rem;
  }
  .when { display: grid; gap: .15rem; align-content: start; }
  .start { font-size: 1.5rem; }
  .title { font-size: 1.5rem; }
  .ticket-inner { padding: 1.75rem 2rem 2.25rem; }
  .t-perf { margin-left: -2rem; margin-right: -2rem; }

  dialog.ticket {
    margin: 0 0 0 auto; width: min(32.5rem, 100%); height: 100dvh; max-height: 100dvh;
    border-radius: 0; box-shadow: -24px 0 60px rgba(0,0,0,.5);
  }
  .ticket-inner { min-height: 100%; border-top-width: 12px; }
}

@media (min-width: 60em) and (max-height: 760px) {
  .masthead h1 { font-size: 3.5rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .row, .seg-btn, .saved-toggle, .btn, .save, .close { transition: background-color .15s ease, color .15s ease, border-color .15s ease; }
  dialog.ticket[open] { animation: sheet-up .26s cubic-bezier(.2,.8,.2,1); }
  dialog.ticket[open]::backdrop { animation: fade .2s ease; }
  @keyframes sheet-up { from { transform: translateY(2rem); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
  @media (min-width: 60em) {
    dialog.ticket[open] { animation-name: sheet-in; }
    @keyframes sheet-in { from { transform: translateX(2rem); opacity: 0; } to { transform: none; opacity: 1; } }
  }
}
