/* Weekend Lines — a weekend drawn as a transit diagram */

@font-face {
  font-family: 'Space Grotesk';
  src: url('assets/space-grotesk.ttf') format('truetype');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Work Sans';
  src: url('assets/work-sans.ttf') format('truetype');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('assets/ibm-plex-mono.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f2f4f6;
  --card: #ffffff;
  --ink: #14202c;
  --ink-2: #2a3642;
  --ink-3: #5c6a76;
  --line: #d7dde4;
  --rail: #c3cdd7;
  --panel: #0e1621;
  --panel-edge: #26333f;
  --panel-dim: #93a1ad;
  --panel-text: #dbe3ea;
  --accent: #1d5fd6;
  --focus: #85b5ff;
  --ease-out: cubic-bezier(.2, .85, .25, 1);

  --l-Art: #d84356;
  --l-Film: #7451cf;
  --l-Food: #e08a1c;
  --l-Literature: #cc4f9b;
  --l-Music: #2b8fc9;
  --l-Outdoors: #3a9e57;
  --l-Walks: #159e92;

  --font-ui: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Work Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scrollbar-color: #aeb9c4 transparent; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  caret-color: var(--ink);
}
body.noscroll { overflow: hidden; }
::selection { background: var(--accent); color: #fff; }

.mono { font-family: var(--font-mono); font-weight: 400; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

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

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px;
  font-family: var(--font-ui); font-weight: 600; transition: top .15s var(--ease-out);
}
.skip:focus { top: 12px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line, currentColor); display: inline-block; flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: clamp(280px, 23vw, 330px) 1fr; min-height: 100vh; }

/* ---------- wayfinding panel ---------- */
.panel {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--panel); color: var(--panel-text);
  padding: 30px 26px 24px;
  display: flex; flex-direction: column; gap: 30px;
  scrollbar-width: thin; scrollbar-color: #3a4753 transparent;
}
.brand { display: flex; flex-direction: column; gap: 7px; }
.brand-mark { margin: 0 0 2px; }
.wordmark {
  margin: 0; font-family: var(--font-ui); font-weight: 700; font-size: 27px;
  letter-spacing: .015em; line-height: 1.05; color: #fff; text-transform: uppercase;
}
.tagline { margin: 0; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--panel-dim); }
.date-plate {
  margin: 6px 0 0; font-size: 12px; letter-spacing: .06em; color: var(--panel-text);
  border: 1.5px solid #3a4753; border-radius: 8px; padding: 8px 11px; align-self: flex-start;
}

.controls { display: flex; flex-direction: column; gap: 16px; }
.ctl { display: flex; flex-direction: column; gap: 7px; }
.ctl-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--panel-dim); margin: 0; }
.field { position: relative; }
.field-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: #5c6a76; pointer-events: none;
}
.ctl-input, .ctl-select {
  width: 100%; appearance: none; -webkit-appearance: none;
  background: #f6f8fa; color: var(--ink);
  border: 1.5px solid #384551; border-radius: 8px;
  font-family: var(--font-body); font-size: 15px; line-height: 1.2;
  padding: 10px 12px;
}
.ctl-input { padding-left: 36px; }
.ctl-input::placeholder { color: #5c6a76; }
.ctl-input::-webkit-search-cancel-button { cursor: pointer; }
.ctl-select {
  padding-right: 36px; cursor: pointer;
  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='%2314202c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}

.saved-toggle {
  display: flex; align-items: center; gap: 9px;
  border: 1.5px solid #384551; border-radius: 8px; color: var(--panel-text);
  padding: 10px 13px; font-family: var(--font-ui); font-weight: 600; font-size: 15px;
  transition: background-color .18s var(--ease-out), border-color .18s var(--ease-out), color .18s var(--ease-out);
}
.saved-toggle:hover { border-color: #61707e; background: #16222f; }
.saved-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.saved-toggle-icon { flex: none; }
.saved-count {
  margin-left: auto; font-size: 11.5px; letter-spacing: .05em;
  border: 1px solid currentColor; border-radius: 99px; padding: 2px 8px;
}
.saved-count.bump { animation: bump .45s var(--ease-out); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.22); } 100% { transform: scale(1); } }

.status { margin: 0; font-size: 12px; letter-spacing: .04em; color: var(--panel-dim); }

.legend { display: flex; flex-direction: column; gap: 6px; }
.legend-title { margin: 0 0 4px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--panel-dim); }
.legend-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.legend-row { display: flex; align-items: center; gap: 11px; padding: 6px 8px; border-radius: 8px; }
.legend-name { font-family: var(--font-ui); font-weight: 500; font-size: 14px; color: var(--panel-text); }
.legend-count { margin-left: auto; font-size: 12px; color: var(--panel-dim); }

.panel-note { margin-top: auto; border-top: 1px solid #232f3a; padding-top: 14px; }
.panel-note p { margin: 0; font-size: 11px; line-height: 1.55; color: #7e8f9d; letter-spacing: .02em; }

/* ---------- board ---------- */
.board { padding: 38px 46px 90px; min-width: 0; }
.days { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 48px; align-items: start; }

/* one rail column once two would cramp the cards */
@media (max-width: 1279px) {
  .days { grid-template-columns: 1fr; }
}

.day-head {
  display: flex; align-items: baseline; gap: 12px;
  border-bottom: 2.5px solid var(--ink); padding-bottom: 9px; margin-bottom: 20px;
}
.day-title { margin: 0; font-family: var(--font-ui); font-weight: 700; font-size: 23px; letter-spacing: -.01em; }
.day-date { font-size: 12px; letter-spacing: .12em; color: var(--ink-3); margin-left: 4px; }
.day-count { margin: 0 0 0 auto; font-size: 12px; letter-spacing: .08em; color: var(--ink-3); }

.day-list {
  --when-w: 92px; --node-w: 28px; --col-gap: 14px;
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 15px;
  position: relative;
}
.day-list::before {
  content: ''; position: absolute; z-index: 0;
  left: calc(var(--when-w) + var(--col-gap) + var(--node-w) / 2 - 1px);
  top: 12px; bottom: 12px; width: 2px; border-radius: 1px; background: var(--rail);
}

.stop {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: var(--when-w) var(--node-w) 1fr;
  column-gap: var(--col-gap);
  animation: rise .5s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
/* the stagger is the page's first moment only, not a replay on every keystroke */
.days.settle .stop { animation: none; }

.stop-when { margin: 0; text-align: right; display: flex; flex-direction: column; gap: 2px; padding-top: 6px; }
.t-start { font-size: 13px; color: var(--ink); letter-spacing: .01em; }
.t-end { font-size: 11.5px; color: var(--ink-3); }

.stop-node { margin: 0; display: flex; justify-content: center; padding-top: 8px; }
.stop-dot {
  width: 14px; height: 14px; border-radius: 50%; background: var(--line);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4.5px rgba(20, 32, 44, .32);
  transition: box-shadow .2s var(--ease-out);
}
.stop.is-saved .stop-dot {
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--line);
}
.stop-dot.pop { animation: dot-pop .65s var(--ease-out); }
@keyframes dot-pop {
  0% { box-shadow: 0 0 0 3px var(--paper), 0 0 0 4.5px rgba(20, 32, 44, .32), 0 0 0 0 var(--line); }
  100% { box-shadow: 0 0 0 3px var(--paper), 0 0 0 4.5px rgba(20, 32, 44, .32), 0 0 0 15px transparent; }
}

.stop-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 17px 15px;
  box-shadow: 0 1px 2px rgba(16, 24, 36, .05), 0 5px 16px -8px rgba(16, 24, 36, .12);
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out), border-color .2s var(--ease-out);
}
.stop:hover .stop-card, .stop:focus-within .stop-card {
  transform: translateY(-2px);
  border-color: #aab7c3;
  box-shadow: 0 2px 3px rgba(16, 24, 36, .06), 0 14px 28px -12px rgba(16, 24, 36, .24);
}
.stop-top { margin: 0 0 7px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-2); }
.stop-line { display: flex; align-items: center; gap: 7px; }
.stop-line .dot { width: 8px; height: 8px; }
.stop-side { display: flex; align-items: center; gap: 8px; min-width: 0; }
.stop-meta { color: var(--ink-3); white-space: nowrap; }
.stop-badge {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  background: var(--ink); color: var(--paper); border-radius: 5px; padding: 2.5px 7px; white-space: nowrap;
}
.stop-title { margin: 0 0 3px; font-family: var(--font-ui); font-weight: 600; font-size: 18.5px; line-height: 1.22; letter-spacing: -.005em; text-wrap: balance; }
.stop-where { margin: 0; font-size: 13.5px; color: var(--ink-3); }

.stop-open {
  position: absolute; inset: 0; z-index: 2;
  border-radius: 12px; cursor: pointer;
  display: flex; align-items: flex-end; justify-content: flex-end;
}
.stop-open::after {
  content: 'View stop →';
  position: absolute; right: 15px; bottom: 12px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em;
  color: transparent; transition: color .18s var(--ease-out);
}
.stop:hover .stop-open::after, .stop-open:focus-visible::after { color: var(--ink-3); }
.stop-open:focus-visible { outline-offset: -3px; }

/* category line colors */
.cat-Art { --line: var(--l-Art); }
.cat-Film { --line: var(--l-Film); }
.cat-Food { --line: var(--l-Food); }
.cat-Literature { --line: var(--l-Literature); }
.cat-Music { --line: var(--l-Music); }
.cat-Outdoors { --line: var(--l-Outdoors); }
.cat-Walks { --line: var(--l-Walks); }

/* ---------- empty state ---------- */
.empty {
  max-width: 540px; margin: 10vh auto 0; text-align: center;
  border: 2px dashed #b9c4cf; border-radius: 18px;
  padding: 44px 36px 40px; background: rgba(255, 255, 255, .5);
  animation: rise .5s var(--ease-out) both;
}
.empty-title { margin: 16px 0 8px; font-family: var(--font-ui); font-weight: 700; font-size: 23px; }
.load-error { font-size: 15px; color: var(--ink-2); }
.empty-copy { margin: 0 auto 22px; font-size: 15px; color: var(--ink-2); max-width: 42ch; line-height: 1.55; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink); color: #fff; border-radius: 9px;
  font-family: var(--font-ui); font-weight: 600; font-size: 15px;
  padding: 12px 20px;
  box-shadow: 0 2px 4px rgba(16, 24, 36, .18);
  transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 14px -4px rgba(16, 24, 36, .35); }
.btn-primary:active { transform: none; box-shadow: 0 2px 4px rgba(16, 24, 36, .18); }

/* ---------- detail drawer ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(10, 17, 25, .52);
  opacity: 0; transition: opacity .3s ease;
}
.backdrop.open { opacity: 1; }

.detail {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 30;
  width: min(540px, 100vw);
  display: flex; flex-direction: column;
  background: #fbfcfd; border-left: 2px solid var(--ink);
  box-shadow: -28px 0 70px -28px rgba(8, 16, 26, .5);
  transform: translateX(103%);
  transition: transform .38s cubic-bezier(.22, .9, .28, 1);
}
.detail.open { transform: none; }

.detail-ribbon { height: 12px; flex: none; background: var(--line, var(--ink)); }
.detail-close {
  position: absolute; top: 24px; right: 22px; z-index: 3;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: #fff; border: 1.5px solid rgba(20, 32, 44, .3); color: var(--ink);
  box-shadow: 0 2px 6px rgba(16, 24, 36, .14);
  transition: background-color .18s var(--ease-out), color .18s var(--ease-out), transform .18s var(--ease-out);
}
.detail-close:hover { background: var(--ink); color: #fff; transform: rotate(90deg); }

.detail-scroll { flex: 1; overflow-y: auto; padding: 28px 32px 12px; scrollbar-width: thin; scrollbar-color: #b6c1cc transparent; }
.detail-linechip { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.detail-linechip .dot { width: 10px; height: 10px; }
.detail-when { margin: 8px 0 0; font-size: 12.5px; letter-spacing: .05em; color: var(--ink-3); }
.detail-title { margin: 12px 0 0; font-family: var(--font-ui); font-weight: 700; font-size: 31px; line-height: 1.1; letter-spacing: -.01em; text-wrap: balance; padding-right: 52px; }

.detail-meta {
  margin: 24px 0; padding: 6px 0;
  border-top: 1px solid #dfe5eb; border-bottom: 1px solid #dfe5eb;
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px;
}
.detail-meta > div { padding: 8px 0; }
.detail-meta dt { font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 3px; }
.detail-meta dd { margin: 0; font-size: 15px; color: var(--ink); }

.detail-body { max-width: 58ch; }
.detail-body p { margin: 0 0 15px; font-size: 16px; line-height: 1.65; color: var(--ink-2); }

.detail-foot {
  flex: none; border-top: 1px solid #dfe5eb; background: #fff;
  padding: 16px 32px 20px;
  box-shadow: 0 -6px 16px -12px rgba(16, 24, 36, .18);
}
.save-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--ink); color: #fff; border: 1.5px solid var(--ink); border-radius: 10px;
  font-family: var(--font-ui); font-weight: 600; font-size: 16px;
  padding: 13px 16px;
  transition: background-color .18s var(--ease-out), color .18s var(--ease-out), transform .18s var(--ease-out);
}
.save-btn:hover { transform: translateY(-1px); }
.save-btn:active { transform: none; }
.save-btn[aria-pressed="true"] { background: transparent; color: var(--ink); }
.save-btn .icon-check { display: none; }
.save-btn[aria-pressed="true"] .icon-check { display: block; }
.save-btn[aria-pressed="true"] .icon-bookmark { display: none; }
.save-hint { margin: 10px 0 0; text-align: center; font-size: 11.5px; letter-spacing: .05em; color: var(--ink-3); }

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .shell { display: block; }
  .panel { position: static; height: auto; padding: 22px 18px 20px; gap: 18px; border-bottom: 2px solid var(--ink); }
  .brand { flex-direction: row; align-items: center; flex-wrap: wrap; column-gap: 12px; row-gap: 6px; }
  .brand-mark { margin: 0; display: flex; }
  .wordmark { font-size: 20px; }
  .tagline { display: none; }
  .date-plate { margin: 0 0 0 auto; font-size: 11px; padding: 6px 9px; }
  .controls { flex-direction: column; gap: 12px; }
  .saved-toggle { width: 100%; }
  .legend { display: none; }
  .panel-note { display: none; }

  .board { padding: 24px 16px 70px; }
  .days { grid-template-columns: 1fr; gap: 30px; }
  .day-list { --when-w: 58px; --node-w: 20px; --col-gap: 10px; }
  .t-start { font-size: 11.5px; }
  .t-end { font-size: 10.5px; }
  .stop-card { padding: 12px 13px 13px; }
  .stop-title { font-size: 16.5px; }
  .stop-where { font-size: 12.5px; }
  .stop-top { font-size: 10px; letter-spacing: .07em; }
  .stop-open::after { display: none; }

  .detail { width: 100vw; border-left: 0; }
  .detail-scroll { padding: 22px 20px 12px; }
  .detail-title { font-size: 25px; padding-right: 48px; }
  .detail-foot { padding: 14px 20px 18px; }
  .detail-close { top: 20px; right: 16px; width: 38px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .detail { transform: none; }
}
