/* Open Hours — the weekend read as a clock */

:root {
  --mist: #e9ece5;      /* page */
  --panel: #f7f8f4;     /* block fill */
  --ink: #24281f;       /* deep green-black */
  --rule: #c9cec2;      /* hairlines */
  --dim: #565d52;       /* secondary text */

  --music: #7a5fb5;
  --film: #3d5fa8;
  --food: #c6482f;
  --literature: #8a4a6b;
  --art: #b3831a;
  --outdoors: #5b8c3e;
  --walks: #58707f;

  --disp: "Oswald", "Arial Narrow", sans-serif;
  --body: "Work Sans", system-ui, sans-serif;

  --start: 8;   /* ruler window, hours */
  --end: 22;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--mist);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
}

body.locked { overflow: hidden; }

.skip {
  position: absolute;
  left: -9999px;
  background: var(--ink);
  color: var(--mist);
  padding: 0.6em 1em;
  z-index: 60;
}
.skip:focus { left: 12px; top: 12px; }

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

/* ---------- masthead ---------- */

.masthead { padding: clamp(1.2rem, 3vw, 2.6rem) 0 0.4rem; }
.masthead-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(0.9rem, 3vw, 2.5rem);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem clamp(1rem, 4vw, 3rem);
}

.wordmark {
  margin: 0;
  font-family: var(--disp);
  font-weight: 500;
  font-size: clamp(2.6rem, 5.5vw, 4.6rem);
  line-height: 1;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 0.22em;
}

.dial {
  width: 0.72em;
  height: 0.72em;
  flex: none;
  transform: translateY(0.04em);
}
.dial-face { fill: none; stroke: var(--ink); stroke-width: 3.5; }
.dial-min  { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.dial-hour { stroke: var(--food); stroke-width: 3.5; stroke-linecap: round; }
.dial-pin  { fill: var(--ink); }

.standfirst {
  margin: 0;
  max-width: 42ch;
  font-size: clamp(0.95rem, 1.4vw, 1.08rem);
  color: var(--dim);
}

/* ---------- control bar ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--mist);
  border-bottom: 1px solid var(--rule);
  padding: 0.55rem 0 0.65rem;
}
.bar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(0.9rem, 3vw, 2.5rem);
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.6rem clamp(0.8rem, 2.5vw, 1.6rem);
}

.field { display: flex; flex-direction: column; gap: 0.15rem; }
.field label {
  font-family: var(--disp);
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  color: var(--dim);
}

.field input,
.field select {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.42em 0.6em;
  min-width: 0;
}
.search-field input { width: clamp(11rem, 24vw, 17rem); }
.field select { min-width: 9.5rem; }

.toggle {
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.42em 0.85em;
  cursor: pointer;
}
.toggle[aria-pressed="true"] {
  background: var(--ink);
  color: var(--mist);
  border-color: var(--ink);
}

.saved-field { flex-direction: row; align-items: center; gap: 0.7rem; }
.tally { margin: 0; font-size: 0.85rem; color: var(--dim); min-height: 1em; }

/* ---------- rulers ---------- */

.rulers {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 2rem) clamp(0.9rem, 3vw, 2.5rem) 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.2rem, 3vw, 2.6rem);
}

.day h2 {
  margin: 0 0 0.45rem;
  font-family: var(--disp);
  font-weight: 500;
  font-size: clamp(1.3rem, 2.2vw, 1.7rem);
  line-height: 1.1;
}
.day h2 .day-date {
  display: block;
  font-weight: 400;
  font-size: 0.62em;
  color: var(--dim);
}

.ruler {
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  border-top: 2px solid var(--ink);
}

.hours {
  position: relative;
  border-right: 1px solid var(--rule);
  margin-right: 0.5rem;
}
.hour-label {
  position: absolute;
  right: 0.45rem;
  transform: translateY(-50%);
  font-family: var(--disp);
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.track {
  position: relative;
  min-height: 660px;
}
.hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--rule);
}
.track-empty {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  color: var(--dim);
  font-size: 0.9rem;
  margin: 0;
}

/* ---------- event blocks ---------- */

.block {
  position: absolute;
  min-height: 42px;
  border-left: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 13%, var(--panel));
  border-radius: 0 3px 3px 0;
  padding: 0.28rem 0.45rem 0.3rem 0.55rem;
  overflow: hidden;
}
.block.is-saved {
  border-left-width: 6px;
  padding-left: 0.4rem;
  box-shadow: inset 0 0 0 1px var(--c);
}

.block-open {
  display: block;
  width: 100%;
  height: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.block-open:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.b-time {
  display: block;
  font-family: var(--disp);
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--c-deep);
  font-variant-numeric: tabular-nums;
}
.b-title {
  display: block;
  font-weight: 600;
  font-size: 0.93rem;
  line-height: 1.25;
  margin-top: 0.05rem;
}
.b-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--dim);
  line-height: 1.3;
}
.b-price { color: var(--c-deep); font-weight: 600; }

.b-cat {
  pointer-events: none;
  position: absolute;
  top: 0.3rem;
  right: 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--c-deep);
  opacity: 0.85;
}
.b-saved-tag {
  pointer-events: none;
  position: absolute;
  bottom: 0.25rem;
  right: 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink);
}

/* ---------- empty state ---------- */

.empty {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem) clamp(0.9rem, 3vw, 2.5rem);
  text-align: center;
}
.empty-head {
  margin: 0;
  font-family: var(--disp);
  font-weight: 500;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}
.empty-hint { margin: 0.5rem auto 1.2rem; max-width: 38ch; color: var(--dim); }
.empty button {
  font: inherit;
  font-weight: 600;
  background: var(--ink);
  color: var(--mist);
  border: 0;
  border-radius: 3px;
  padding: 0.55em 1.1em;
  cursor: pointer;
}

/* ---------- detail dialog ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--ink) 38%, transparent);
  z-index: 40;
}

.detail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(30rem, 94vw);
  background: var(--mist);
  border-left: 2px solid var(--ink);
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.detail[hidden] { display: none; }

.detail-chrome {
  padding: 0.55rem clamp(0.8rem, 2vw, 1.3rem);
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: flex-start;
}
.close {
  font: inherit;
  font-weight: 600;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.35em 0.9em;
  cursor: pointer;
}

.detail-scroll {
  overflow-y: auto;
  padding: clamp(1rem, 2.5vw, 1.6rem) clamp(0.8rem, 2vw, 1.3rem) 2.5rem;
}

.d-cat {
  margin: 0 0 0.4rem;
  font-family: var(--disp);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--c-deep);
}
.d-title {
  margin: 0 0 0.9rem;
  font-family: var(--disp);
  font-weight: 500;
  font-size: clamp(1.6rem, 3.5vw, 2rem);
  line-height: 1.12;
}

.facts {
  margin: 0 0 1rem;
  border-top: 2px solid var(--ink);
}
.facts > div {
  display: grid;
  grid-template-columns: 5.2rem 1fr;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--rule);
}
.facts dt {
  font-family: var(--disp);
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--dim);
  padding-top: 0.15rem;
}
.facts dd { margin: 0; font-size: 0.93rem; }

.save {
  width: 100%;
  font: inherit;
  font-weight: 600;
  border-radius: 3px;
  padding: 0.6em 1em;
  cursor: pointer;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--mist);
}
.save[aria-pressed="true"] {
  background: color-mix(in srgb, var(--c) 16%, var(--panel));
  color: var(--ink);
  border-color: var(--c-deep);
}

.d-body { margin-top: 1.3rem; }
.d-body p { margin: 0 0 0.9rem; max-width: 60ch; }

.d-access { margin-top: 1.6rem; }
.d-access h3 {
  margin: 0 0 0.35rem;
  font-family: var(--disp);
  font-weight: 500;
  font-size: 0.95rem;
  border-top: 2px solid var(--ink);
  padding-top: 0.5rem;
}
.d-access p { margin: 0; color: var(--dim); font-size: 0.92rem; max-width: 60ch; }

.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;
}

/* ---------- colophon ---------- */

.colophon {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.4rem clamp(0.9rem, 3vw, 2.5rem) 2.4rem;
  border-top: 1px solid var(--rule);
  color: var(--dim);
  font-size: 0.82rem;
}
.colophon p { margin: 0 0 0.3rem; max-width: 70ch; }

/* ---------- motion ---------- */

@keyframes settle {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes draw {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}
.rulers.first-render .hour-line,
.rulers.first-render .hour-label { animation: draw 0.5s ease both; transform-origin: top; }
.rulers.first-render .block { animation: settle 0.45s ease both; animation-delay: var(--d, 0s); }

@media (prefers-reduced-motion: reduce) {
  .rulers.first-render .hour-line,
  .rulers.first-render .hour-label,
  .rulers.first-render .block { animation: none; }
  * { transition: none !important; }
}

/* ---------- mobile ---------- */

@media (max-width: 720px) {
  .rulers { grid-template-columns: 1fr; gap: 2rem; }
  .track { min-height: 560px; }
  .bar-inner { align-items: stretch; flex-direction: column; gap: 0.5rem; }
  .search-field input { width: 100%; }
  .field select { width: 100%; min-width: 0; }
  .saved-field { flex-direction: column; align-items: stretch; gap: 0.25rem; }
  .saved-field .toggle { width: 100%; }

  .detail {
    top: auto;
    left: 0;
    width: 100vw;
    height: 94vh;
    border-left: 0;
    border-top: 2px solid var(--ink);
    border-radius: 10px 10px 0 0;
  }
  .detail-chrome {
    position: sticky;
    top: 0;
    background: var(--mist);
    z-index: 2;
  }
}
