/* Ordinary Hours — a magazine of the city day */

@font-face {
  font-family: "Oswald";
  src: url("../assets/oswald.ttf") format("truetype");
  font-weight: 200 700;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("../assets/literata.ttf") format("truetype");
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("../assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: #EDEFEA;
  --card: #F7F8F4;
  --ink: #1E3230;
  --ink-soft: #4A5C58;
  --rail: #B9C2B8;
  --edge: #C9CFC4;
  --signal: #F0B429;
  --c-places: #35693F;
  --c-food: #B4531F;
  --c-movement: #2E6E8E;
  --c-people: #A63A50;
  --c-culture: #8C5DA0;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Literata", Georgia, serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.locked { overflow: hidden; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  border-radius: 4px;
}
.detail :focus-visible,
.veil :focus-visible { outline-color: var(--signal); }

/* ---------- Masthead ---------- */

.masthead {
  padding: 26px clamp(16px, 4vw, 56px) 10px;
  max-width: 1172px;
  margin: 0 auto;
  border-bottom: 2px solid var(--ink);
}

.masthead-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.name {
  margin: 0;
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  font-size: clamp(38px, 4.5vw, 58px);
  line-height: 1;
  letter-spacing: -0.015em;
}

.tagline {
  margin: 8px 0 4px;
  font-size: 14.5px;
  color: var(--ink-soft);
  max-width: 46ch;
}

.now {
  text-align: right;
  font-family: "Plex Mono", monospace;
  white-space: nowrap;
}

.now-label {
  display: block;
  font-size: 11px;
  color: var(--ink-soft);
}

.now-clock {
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 600;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

/* ---------- Day dial ---------- */

.dial-wrap { margin: 22px 0 4px; }

.dial {
  position: relative;
  height: 58px;
}

.dial-track {
  position: absolute;
  left: 0; right: 0; top: 34px;
  height: 2px;
  background: var(--ink);
}

.dial-hours {
  position: absolute;
  inset: 0 0 auto 0;
  top: 42px;
  height: 16px;
}
.dial-hours span {
  position: absolute;
  transform: translateX(-50%);
  font-family: "Plex Mono", monospace;
  font-size: 10px;
  color: var(--ink-soft);
}
.dial-hours span::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -12px;
  width: 1px;
  height: 6px;
  background: var(--ink);
}

.dial-stories {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 30px;
}
.dial-dot {
  position: absolute;
  top: 16px;
  transform: translate(-50%, -50%);
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--dot, var(--ink));
  padding: 0;
}
@media (hover: hover) {
  .dial-dot:hover { top: 13px; }
}

.dial-now {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  text-align: center;
}
.dial-now-dot {
  display: block;
  width: 13px;
  height: 13px;
  margin: 21px auto 0;
  border-radius: 50%;
  background: var(--signal);
  border: 2px solid var(--ink);
}
.dial-now-label {
  display: block;
  margin-top: 2px;
  font-family: "Plex Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  background: var(--signal);
  color: var(--ink);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ---------- Controls ---------- */

.controls {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  margin: 18px 0 8px;
}

.control { display: flex; flex-direction: column; gap: 4px; }

.control-label {
  font-family: "Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-soft);
}

.search, .filter {
  font-family: "Literata", Georgia, serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 0;
}
.search { width: min(320px, 100%); }
.filter { width: auto; padding-right: 30px; }

.saved-toggle {
  font-family: "Literata", Georgia, serif;
  font-size: 15px;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  padding: 8px 14px;
}
.saved-toggle[aria-pressed="true"] {
  background: var(--signal);
  font-weight: 600;
}

/* ---------- The day rail ---------- */

.main {
  padding: 30px clamp(16px, 4vw, 56px) 46px;
  max-width: 1172px;
  margin: 0 auto;
}

.day {
  list-style: none;
  margin: 0;
  padding: 0;
}

.stop {
  position: relative;
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 0 20px;
  padding-bottom: 26px;
}
.stop:last-child { padding-bottom: 54px; }
/* continuous rail line down the left of the time column */
.stop::before {
  content: "";
  position: absolute;
  left: 54px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--rail);
}
.stop:first-child::before { top: 26px; }
.stop:last-child::before { bottom: 0; }

.when-col {
  position: relative;
  text-align: left;
}
.when-col .time {
  display: block;
  margin-left: 66px;
  font-family: "Plex Mono", monospace;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  padding-top: 18px;
}
.when-col .ambient {
  display: block;
  margin-left: 66px;
  margin-top: 4px;
  font-family: "Plex Mono", monospace;
  font-size: 10px;
  line-height: 1.35;
  color: var(--ink-soft);
  max-width: 9ch;
}
/* node dot on the rail, colored by the story's line */
.when-col::after {
  content: "";
  position: absolute;
  left: 49px;
  top: 24px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--line, var(--ink));
  border: 2px solid var(--ink);
}

/* ---------- Cards ---------- */

.card {
  background: var(--card);
  border: 1.5px solid var(--edge);
  border-radius: var(--radius);
  padding: 18px 22px 16px;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.line-tag {
  font-family: "Plex Mono", monospace;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--line, var(--ink));
  padding: 2px 10px;
  border-radius: 999px;
}

.saved-mark {
  font-family: "Plex Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  background: var(--signal);
  padding: 2px 9px;
  border-radius: 999px;
}

.card h3 { margin: 0; }

.open-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  font-family: "Oswald", sans-serif;
  font-weight: 500;
  font-size: clamp(21px, 2.2vw, 26px);
  line-height: 1.2;
  letter-spacing: 0.005em;
}
.open-item:hover { text-decoration: underline; text-decoration-thickness: 2px; }

.summary {
  margin: 8px 0 12px;
  font-size: 15.5px;
  color: var(--ink);
  max-width: 62ch;
}

.card-meta {
  margin: 0;
  font-family: "Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.card.pulse { animation: pulse 1.2s ease; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 4px var(--signal); }
  100% { box-shadow: 0 0 0 4px transparent; }
}

/* ---------- Empty state ---------- */

.empty {
  border: 1.5px dashed var(--ink-soft);
  border-radius: var(--radius);
  padding: 30px 28px;
  max-width: 520px;
  margin-top: 8px;
}
.empty-title {
  margin: 0 0 6px;
  font-family: "Oswald", sans-serif;
  font-weight: 500;
  font-size: 24px;
}
.empty-copy { margin: 0 0 16px; color: var(--ink-soft); font-size: 15px; }

.reset {
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 15px;
}
.reset:hover { background: #2C4440; }

/* ---------- Footer ---------- */

.foot {
  border-top: 2px solid var(--ink);
  max-width: 1172px;
  margin: 0 auto;
  padding: 16px clamp(16px, 4vw, 56px) 34px;
  font-family: "Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
}
.foot p { margin: 0 0 4px; max-width: 78ch; }

/* ---------- Detail view ---------- */

.veil {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(20, 36, 34, 0.55);
}

.detail {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  background: #1E3230;
  color: #EDEFEA;
  padding: 30px clamp(18px, 6vw, 90px) 60px;
}

.d-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(237, 239, 234, 0.25);
}

.d-when {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.d-time {
  font-family: "Plex Mono", monospace;
  font-size: 15px;
  font-weight: 700;
  background: var(--signal);
  color: var(--ink);
  padding: 3px 10px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

.d-tag {
  font-family: "Plex Mono", monospace;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  background: var(--line, var(--ink));
  padding: 3px 12px;
  border-radius: 999px;
}

.d-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.save-btn, .close-btn {
  font-family: "Literata", Georgia, serif;
  font-size: 15px;
  border-radius: 8px;
  padding: 9px 16px;
}
.save-btn {
  background: transparent;
  color: var(--signal);
  border: 1.5px solid var(--signal);
}
.save-btn[aria-pressed="true"] {
  background: var(--signal);
  color: var(--ink);
  font-weight: 600;
}
.close-btn {
  background: transparent;
  color: #EDEFEA;
  border: 1.5px solid rgba(237, 239, 234, 0.5);
}
.close-btn:hover, .save-btn:hover { border-color: var(--signal); }

.d-title {
  margin: 30px 0 10px;
  font-family: "Oswald", sans-serif;
  font-weight: 500;
  font-size: clamp(32px, 4.6vw, 54px);
  line-height: 1.12;
  max-width: 22ch;
}

.d-byline {
  margin: 0 0 30px;
  font-family: "Plex Mono", monospace;
  font-size: 12.5px;
  color: rgba(237, 239, 234, 0.72);
}

.d-body p {
  margin: 0 0 1.35em;
  font-size: 18.5px;
  line-height: 1.72;
  max-width: 62ch;
}
.d-body p:first-child { font-size: 20.5px; line-height: 1.66; }

/* ---------- Motion & a11y ---------- */

@media (prefers-reduced-motion: no-preference) {
  .detail { animation: rise 0.28s ease; }
  @keyframes rise {
    from { transform: translateY(18px); opacity: 0; }
    to { transform: none; opacity: 1; }
  }
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card.pulse { animation: none; }
}

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

/* ---------- Small screens ---------- */

@media (max-width: 700px) {
  .masthead { padding-top: 20px; }
  .now { text-align: left; }
  .dial { height: 52px; }
  .dial-hours span:nth-child(even) { display: none; }
  .dial-hours span:nth-child(odd)::before { top: -10px; }

  .controls { gap: 12px; }
  .search { width: 100%; }
  .control.search-wrap { width: 100%; }

  .main { padding-top: 18px; }

  .stop { grid-template-columns: 62px 1fr; gap: 0 12px; padding-bottom: 22px; }
  .stop:last-child { padding-bottom: 40px; }
  .when-col .time { margin-left: 32px; font-size: 12px; padding-top: 16px; }
  .when-col .ambient { display: none; }
  .when-col::after { left: 17px; top: 22px; }

  .card { padding: 15px 16px 14px; }
  .open-item { font-size: 20px; }
  .summary { font-size: 14.5px; }

  .detail { padding: 20px 18px 44px; }
  .d-title { margin-top: 22px; }
  .d-body p { font-size: 17px; }
  .d-body p:first-child { font-size: 18.5px; }
}
