/* ==========================================================================
   Kerb — a magazine of everyday city life
   Type: Oswald (condensed display, city signage) + Literata (reading serif)
   Palette: limestone paper, soft ink, dusk navy, sodium-lamp amber
   ========================================================================== */

/* ---------- Fonts (local, variable) ---------- */
@font-face {
  font-family: 'Oswald';
  src: url('assets/oswald.ttf') format('truetype');
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Literata';
  src: url('assets/literata.ttf') format('truetype');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --paper: #e9eae5;
  --paper-dim: #dfe1d9;
  --ink: #24272d;
  --ink-soft: #565a61;
  --ink-faint: #6d7078;
  --rule: #c9ccc2;
  --night: #232e3d;
  --night-deep: #1b2430;
  --on-night: #ecede7;
  --on-night-dim: #aeb6c2;
  --lamp: #e0a33b;
  --lamp-deep: #7a5410;
  --places: #4a6b47;
  --movement: #3a6080;
  --food: #8f6914;
  --people: #924650;
  --culture: #6b4575;
  --gutter: clamp(20px, 4vw, 40px);
  --measure: 46rem;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Literata', Georgia, 'Times New Roman', serif;
  font-optical-sizing: auto;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .oswald {
  font-family: 'Oswald', 'Arial Narrow', Arial, sans-serif;
  margin: 0;
}

p { margin: 0; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
ol { list-style: none; margin: 0; padding: 0; }

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

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--night);
  outline-offset: 3px;
}
.on-night :focus-visible,
:focus-visible.lamp-focus {
  outline-color: var(--lamp);
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -60px;
  z-index: 20;
  background: var(--night);
  color: var(--on-night);
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-size: 15px;
  padding: 10px 16px;
  border-radius: 0 0 4px 4px;
  text-decoration: none;
  transition: top .15s ease-out;
}
.skip:focus { top: 0; }

/* ---------- The dropped-kerb rule (recurring device) ---------- */
.kerb-rule {
  display: block;
  width: 100%;
  height: 14px;
  color: var(--ink);
}
.kerb-rule-masthead { margin-top: 26px; }
.kerb-rule-footer {
  height: 10px;
  color: var(--rule);
  margin-bottom: 22px;
}

/* ---------- Masthead ---------- */
.masthead {
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(40px, 7vw, 78px) var(--gutter) 0;
}
.masthead-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
  flex-wrap: wrap;
}
.wordmark {
  font-weight: 600;
  font-size: clamp(76px, 11vw, 148px);
  line-height: 0.86;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.masthead-side { text-align: right; padding-bottom: 8px; }
.tagline {
  font-size: clamp(17px, 1.6vw, 20px);
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.35;
}
.issue {
  margin-top: 6px;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-size: 13.5px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

/* Page-load moment: the wordmark settles, the kerb rule draws itself once. */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes kerb-draw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.masthead .masthead-row { animation: rise-in .5s ease-out both; }
.kerb-rule-masthead {
  transform-origin: left center;
  animation: kerb-draw .8s cubic-bezier(.22,.8,.3,1) .15s both;
}

/* ---------- Controls rail ---------- */
.controls {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 22px;
  max-width: 76rem;
  margin: 26px auto 0;
  padding: 16px var(--gutter) 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.controls input[type="search"] {
  flex: 2 1 280px;
  font-family: 'Literata', Georgia, serif;
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  padding: 9px 2px;
}
.controls input[type="search"]::placeholder { color: var(--ink-faint); }
.controls input[type="search"]:focus { border-bottom-color: var(--lamp); }
.controls input[type="search"]:focus-visible { outline-offset: 4px; }

.controls select {
  flex: 0 1 auto;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2324272d' stroke-width='2'/%3E%3C/svg%3E")
    no-repeat right 4px center;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  padding: 9px 26px 9px 2px;
}
.controls select:focus { border-bottom-color: var(--lamp); }
.controls select:focus-visible { outline-offset: 4px; }

.saved-toggle {
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 9px 14px;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.saved-toggle:hover { background: rgba(35, 46, 61, 0.07); }
.saved-toggle[aria-pressed="true"] {
  background: var(--night);
  border-color: var(--night);
  color: var(--on-night);
}
.saved-toggle[aria-pressed="true"]:focus-visible {
  outline-color: var(--lamp);
}

.result-count {
  flex: 1 0 100%;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}
@media (min-width: 900px) {
  .result-count { flex: 0 1 auto; margin-left: auto; }
}

/* ---------- Topic chips (colour encodes the topic) ---------- */
.chip {
  display: inline-block;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 3px 9px 4px;
  border-radius: 2px;
  border: 1px solid var(--c, var(--ink-soft));
  color: var(--c, var(--ink-soft));
  background: color-mix(in oklab, var(--c, var(--ink-soft)) 8%, transparent);
}
.chip[data-cat="Places"]   { --c: var(--places); }
.chip[data-cat="Movement"] { --c: var(--movement); }
.chip[data-cat="Food"]     { --c: var(--food); }
.chip[data-cat="People"]   { --c: var(--people); }
.chip[data-cat="Culture"]  { --c: var(--culture); }

/* ---------- Story index ---------- */
.story-list {
  max-width: 76rem;
  margin: 0 auto;
  padding: 8px var(--gutter) 30px;
}
.entry { border-top: 1px solid var(--rule); }
.entry-lead { border-top: 0; }

.entry-open {
  display: grid;
  width: 100%;
  text-align: left;
  grid-template-columns: 230px 1fr;
  column-gap: 34px;
  align-items: start;
  padding: 26px 10px;
  border-radius: 4px;
  transition: background-color .16s ease;
}
.entry-lead .entry-open {
  grid-template-columns: minmax(0, 460px) 1fr;
  column-gap: 44px;
  padding: 14px 10px 34px;
  align-items: center;
}
.entry-open:hover { background: rgba(35, 46, 61, 0.045); }

.thumb {
  display: block;
  overflow: hidden;
  border-radius: 4px;
  background: var(--paper-dim);
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 3 / 2;
}
.entry-lead .thumb img { aspect-ratio: 16 / 10; }

.entry-body { display: block; min-width: 0; }
.entry-lead .entry-body { padding-top: 4px; }

.entry-title {
  display: block;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 500;
  font-size: clamp(22px, 2.1vw, 26px);
  line-height: 1.12;
  letter-spacing: 0.002em;
  color: var(--ink);
  margin-top: 12px;
  transition: color .16s ease;
}
.entry-lead .entry-title {
  font-size: clamp(30px, 3.4vw, 42px);
  line-height: 1.05;
}
.entry-open:hover .entry-title,
.entry-open:focus-visible .entry-title {
  text-decoration: underline;
  text-decoration-color: var(--lamp);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.standfirst {
  display: block;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-top: 9px;
  max-width: 62ch;
}
.entry-lead .standfirst { font-size: 18px; }

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}
.meta span + span { position: relative; padding-left: 12px; }
.meta span + span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 10px;
  background: var(--rule);
}

.saved-flag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--lamp-deep);
}
.saved-flag::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--lamp);
}

/* ---------- Empty state ---------- */
.empty {
  max-width: 34rem;
  margin: 0 auto;
  padding: 70px var(--gutter) 90px;
  text-align: center;
}
.empty-title {
  font-size: clamp(26px, 3vw, 32px);
  font-weight: 500;
  line-height: 1.1;
}
.empty-text { margin: 14px 0 26px; color: var(--ink-soft); font-size: 17px; }

.btn {
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 10px 16px;
  transition: background-color .15s ease;
}
.btn:hover { background: rgba(35, 46, 61, 0.07); }

/* ---------- Footer ---------- */
.site-footer {
  max-width: 76rem;
  margin: 0 auto;
  padding: 30px var(--gutter) 60px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-faint);
}
.site-footer p + p { margin-top: 10px; }

/* ---------- Article view ---------- */
#article {
  max-width: 70rem;
  margin: 0 auto;
  padding: 0 var(--gutter) 90px;
}

.article-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding: 13px 0;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--night);
}
.back svg { width: 13px; height: 10px; flex: none; }
.back:hover { text-decoration: underline; text-decoration-color: var(--lamp); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.article-mark {
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-faint);
}

/* The memorable spend: the story opens at dusk. */
.article-head {
  margin-top: 26px;
  background: linear-gradient(160deg, var(--night-deep), var(--night) 62%);
  color: var(--on-night);
  border-radius: 6px;
  padding: clamp(30px, 5vw, 56px) clamp(22px, 5vw, 54px);
}
.article-head .chip {
  border-color: rgba(224, 163, 59, 0.65);
  color: var(--lamp);
  background: rgba(224, 163, 59, 0.08);
}
.article-title {
  margin-top: 18px;
  font-weight: 600;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.04;
  letter-spacing: 0;
  max-width: 20ch;
}
.article-standfirst {
  margin-top: 16px;
  font-size: clamp(18px, 2vw, 20px);
  line-height: 1.5;
  color: #c4ccd8;
  max-width: 58ch;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--on-night-dim);
}
.article-meta span + span { position: relative; padding-left: 12px; }
.article-meta span + span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 10px;
  background: rgba(236, 237, 231, 0.28);
}

/* One orchestrated reveal as the story opens. */
.article-head > * { animation: rise-in .4s ease-out both; }
.article-head > *:nth-child(1) { animation-delay: 0s; }
.article-head > *:nth-child(2) { animation-delay: .06s; }
.article-head > *:nth-child(3) { animation-delay: .12s; }
.article-head > *:nth-child(4) { animation-delay: .18s; }
.article-head > *:nth-child(5) { animation-delay: .24s; }

.save {
  margin-top: 24px;
  display: inline-block;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--lamp);
  border: 1px solid rgba(224, 163, 59, 0.65);
  border-radius: 3px;
  padding: 10px 16px;
  transition: background-color .15s ease, color .15s ease;
}
.save:hover { background: rgba(224, 163, 59, 0.14); }
.save[aria-pressed="true"] {
  background: var(--lamp);
  border-color: var(--lamp);
  color: #262009;
}
.save:focus-visible { outline-color: var(--on-night); }

.article-figure { margin: 30px 0 0; }
.article-figure img {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--paper-dim);
}
.article-figure figcaption {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--ink-faint);
}

.article-body {
  max-width: var(--measure);
  margin: 52px auto 0;
  font-size: 19px;
  line-height: 1.68;
  color: #2a2d33;
}
.article-body p + p { margin-top: 1.35em; }
.article-body > p:first-child::first-letter {
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 600;
  font-size: 3.15em;
  line-height: 0.78;
  float: left;
  padding: 8px 12px 0 0;
  color: var(--night);
}

.article-end {
  max-width: var(--measure);
  margin: 60px auto 0;
}
.article-end .kerb-rule { height: 12px; margin-bottom: 22px; }
.article-end .kerb-rule path { stroke: var(--night); }
.colophon {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-faint);
}
.article-end .back { margin-top: 26px; }

/* ---------- Wide screens: let the photo breathe ---------- */
@media (min-width: 1000px) {
  .article-figure { max-width: 60rem; margin-left: auto; margin-right: auto; }
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .masthead { padding-top: 42px; }
  .masthead-side { text-align: left; padding-bottom: 2px; }

  /* the rail takes three rows here; let it scroll away instead of pinning */
  .controls { position: static; gap: 12px; }
  .controls input[type="search"] { flex-basis: 100%; }
  .controls select { flex: 1 1 auto; min-width: 0; }
  .saved-toggle { flex: 1 1 auto; }

  .story-list { padding-top: 2px; }
  .entry-open {
    grid-template-columns: 96px 1fr;
    column-gap: 18px;
    padding: 20px 4px;
  }
  .entry-open .thumb img { aspect-ratio: 1 / 1; }
  .entry-lead .entry-open { grid-template-columns: 1fr; padding: 8px 4px 26px; }
  .entry-lead .thumb img { aspect-ratio: 16 / 10; }
  .entry-title { margin-top: 10px; font-size: 21px; }
  .entry-lead .entry-title { font-size: 30px; margin-top: 14px; }
  .standfirst { font-size: 15.5px; margin-top: 7px; }
  .meta { font-size: 12.5px; margin-top: 10px; }

  .article-head { margin-top: 14px; }
  .article-figure img { max-height: 320px; }
  .article-body { font-size: 18px; margin-top: 40px; }
  .article-top { padding: 11px 0; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
