/* Lateral — a journal of everyday city life */

@font-face {
  font-family: "Literata";
  src: url("assets/literata.ttf") format("truetype");
  font-weight: 300 900;
  font-display: swap;
  font-style: normal;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-weight: 300 700;
  font-display: swap;
  font-style: normal;
}

:root {
  --paper: #e7e9dc;
  --paper-deep: #d8dbc8;
  --paper-soft: #eef0e4;
  --ink: #1e241b;
  --ink-soft: #51594a;
  --ink-faint: #8a927f;
  --accent: #a9741c;
  --accent-ink: #7a5212;
  --accent-soft: #e4d7b0;
  --line: #c5c9b4;
  --line-soft: #d2d6c0;

  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Space Grotesk", "Segoe UI", system-ui, sans-serif;

  --max: 1180px;
  --gut: clamp(20px, 4vw, 56px);

  --shadow: 0 1px 0 rgba(30, 36, 27, 0.04);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  font-feature-settings: "kern", "liga", "onum";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-soft); color: var(--ink); }

a { color: var(--accent-ink); }

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

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  font-family: var(--sans);
  font-size: 14px;
  z-index: 100;
}
.skip:focus { left: 12px; top: 12px; }

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

.masthead { padding: clamp(28px, 5vw, 52px) var(--gut) 0; }

.masthead__inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.masthead__mark { display: flex; flex-direction: column; gap: 10px; }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: var(--ink);
  text-decoration: none;
}
.wordmark__glyph { width: clamp(26px, 3.4vw, 38px); height: auto; color: var(--ink); }
.wordmark__text {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(46px, 8.2vw, 92px);
  line-height: 0.9;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 120;
}

.masthead__tag {
  margin: 0;
  font-family: var(--sans);
  font-size: clamp(14px, 1.4vw, 16px);
  color: var(--ink-soft);
  font-weight: 500;
  letter-spacing: 0.01em;
  padding-left: 2px;
}

.masthead__issue {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--sans);
  text-align: right;
  gap: 2px;
  padding-bottom: 6px;
}
.masthead__issue-no { font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: 0.02em; }
.masthead__issue-date { font-size: 12px; color: var(--ink-faint); }

.rule {
  max-width: var(--max);
  margin: clamp(20px, 3vw, 30px) auto 0;
  height: 1px;
  background: var(--ink);
  margin-left: auto;
  margin-right: auto;
}
.rule::after { /* tiny accent tick on the rule */
  content: "";
  display: block;
  width: 64px;
  height: 1px;
  background: var(--accent);
  transform: translateY(-1px);
}

/* ---------- Page / controls ---------- */

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(28px, 4vw, 44px) var(--gut) clamp(40px, 6vw, 72px);
}

.controls__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: clamp(14px, 2vw, 28px);
}

.field { display: flex; flex-direction: column; gap: 7px; }
.field--search { flex: 1 1 280px; }
.field--filter { flex: 0 1 auto; }

.field__label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}

.field__control {
  position: relative;
  display: flex;
  align-items: center;
}

.field__icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--ink-faint);
  pointer-events: none;
}

#search {
  width: 100%;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  padding: 11px 14px 11px 42px;
  appearance: none;
  transition: border-color 0.15s ease;
}
#search::placeholder { color: var(--ink-faint); font-style: italic; }
#search:focus { outline: none; border-color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }

.field__control--select { position: relative; }
#filter {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  padding: 9px 30px 9px 2px;
  appearance: none;
  cursor: pointer;
  min-width: 150px;
}
#filter:focus { outline: none; box-shadow: inset 0 -2px 0 var(--accent); }
.field__chevron {
  position: absolute;
  right: 6px;
  width: 12px;
  height: 12px;
  color: var(--ink);
  pointer-events: none;
}

/* saved toggle */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 9px 16px 9px 12px;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, color 0.15s ease;
}
.toggle__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.toggle:hover { background: var(--paper-deep); }
.toggle[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}
.toggle[aria-pressed="true"] .toggle__dot {
  background: var(--accent);
  border-color: var(--accent);
}

.status {
  margin: 18px 0 0;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
.status strong { color: var(--ink); font-weight: 600; }

/* ---------- Story list ---------- */

.stories { margin-top: clamp(28px, 4vw, 44px); }

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.entry {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: clamp(16px, 2.4vw, 36px);
  padding: clamp(26px, 3.4vw, 40px) 0;
  border-top: 1px solid var(--line-soft);
  position: relative;
}
.entry:first-child { border-top: 1px solid var(--ink); }
.entry:last-child { border-bottom: 1px solid var(--ink); }

.entry__no {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  padding-top: 6px;
}
.entry__no span { display: block; }

.entry__cat {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-ink);
  letter-spacing: 0.02em;
  margin: 0 0 8px;
}

.entry__title { margin: 0 0 10px; font-size: clamp(22px, 2.5vw, 30px); line-height: 1.12; }
.entry__title button {
  font: inherit;
  color: var(--ink);
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  letter-spacing: -0.01em;
  font-weight: 500;
  font-variation-settings: "opsz" 36;
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.18s ease, color 0.15s ease;
}
.entry__title button:hover { color: var(--accent-ink); background-size: 100% 2px; }
.entry__title button:focus-visible { outline-offset: 4px; }

.entry__sum {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.5;
  max-width: 62ch;
}

.entry__meta {
  margin: 0;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-faint);
  letter-spacing: 0.01em;
}
.entry__meta .sep { color: var(--line); padding: 0 4px; }
.entry__meta .author { color: var(--ink-soft); font-weight: 600; }

.entry__saved-tag {
  display: none;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-ink);
  letter-spacing: 0.03em;
  margin-left: 10px;
  vertical-align: 2px;
}
.entry[data-saved="true"] .entry__saved-tag { display: inline; }

/* lead entry */
.entry--lead {
  grid-template-columns: 72px 1fr;
  padding-top: clamp(8px, 1.4vw, 14px);
}
.entry--lead .entry__title { font-size: clamp(34px, 4.6vw, 56px); line-height: 1.02; max-width: 14ch; }
.entry--lead .entry__title button { font-variation-settings: "opsz" 72; letter-spacing: -0.018em; }
.entry--lead .entry__sum { font-size: clamp(18px, 1.6vw, 20px); max-width: 52ch; }
.entry--lead .entry__no { font-size: 14px; color: var(--ink); }

.entry__media {
  margin: clamp(20px, 3vw, 32px) 0 0;
  grid-column: 2 / 3;
  max-width: 640px;
}
.entry__media figcaption {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  margin-top: 8px;
}

/* duotone image treatment — stylised, clearly not documentary */
.duotone {
  background: var(--accent-soft);
  overflow: hidden;
  position: relative;
}
.duotone img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05) brightness(0.92);
  mix-blend-mode: multiply;
}
.duotone::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(30,36,27,0.0), rgba(30,36,27,0.18));
  pointer-events: none;
}
.entry__media .duotone { aspect-ratio: 16 / 9; }

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

.empty {
  padding: clamp(40px, 6vw, 72px) 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  text-align: left;
}
.empty__title {
  font-family: var(--serif);
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 500;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.empty__body { margin: 0 0 18px; color: var(--ink-soft); max-width: 50ch; }

.link-btn {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--paper);
  background: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  cursor: pointer;
}
.link-btn:hover { background: var(--accent-ink); }

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

.colophon {
  border-top: 1px solid var(--line);
  margin-top: clamp(40px, 6vw, 72px);
  padding: clamp(28px, 4vw, 40px) var(--gut);
  background: var(--paper-soft);
}
.colophon__inner { max-width: var(--max); margin: 0 auto; }
.colophon__line {
  margin: 0 0 6px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 64ch;
}
.colophon__line:last-child { margin-bottom: 0; }
.colophon__word { color: var(--ink); font-weight: 600; }

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

.detail {
  margin: 0;
  inset: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  width: 100vw;
  max-width: none;
  max-height: none;
  height: 100vh;
  overflow: hidden;
}
.detail::backdrop { background: rgba(20, 24, 18, 0.55); backdrop-filter: blur(2px); }

.detail[open] { animation: fade-in 0.22s ease both; }
.detail__article {
  height: 100%;
  overflow-y: auto;
  background: var(--paper);
  margin: 0 auto;
  max-width: 860px;
  padding: clamp(20px, 4vw, 48px) var(--gut) clamp(48px, 8vw, 96px);
  scrollbar-gutter: stable;
}
.detail[open] .detail__article { animation: rise 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

.detail__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(32px, 5vw, 56px);
}

.close-detail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px 8px 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.close-detail svg { width: 15px; height: 15px; }
.close-detail:hover { background: var(--paper-deep); border-color: var(--ink-soft); }

.save-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 8px 18px 8px 12px;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, color 0.15s ease;
}
.save-item__mark {
  width: 14px;
  height: 16px;
  position: relative;
  display: block;
}
.save-item__mark::before {
  content: "";
  position: absolute;
  inset: 0 0 0 0;
  border: 1.5px solid var(--ink);
  border-bottom: none;
  border-radius: 2px 2px 0 0;
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.save-item__mark::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 14px;
  height: 7px;
  background:
    linear-gradient(135deg, transparent 0 49%, var(--ink) 49% 51%, transparent 51%) 0 0 / 7px 7px no-repeat,
    linear-gradient(45deg, transparent 0 49%, var(--ink) 49% 51%, transparent 51%) 7px 0 / 7px 7px no-repeat;
  transition: background 0.15s ease;
}
.save-item:hover { background: var(--paper-deep); }
.save-item[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.save-item[aria-pressed="true"] .save-item__mark::before {
  border-color: var(--paper);
  background: var(--accent);
}
.save-item[aria-pressed="true"] .save-item__mark::after {
  background:
    linear-gradient(135deg, transparent 0 49%, var(--paper) 49% 51%, transparent 51%) 0 0 / 7px 7px no-repeat,
    linear-gradient(45deg, transparent 0 49%, var(--paper) 49% 51%, transparent 51%) 7px 0 / 7px 7px no-repeat;
}

.detail__cat {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-ink);
  letter-spacing: 0.02em;
  margin: 0 0 14px;
}
.detail__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.04;
  letter-spacing: -0.018em;
  font-variation-settings: "opsz" 72;
  margin: 0 0 18px;
  max-width: 18ch;
}
.detail__meta {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
  margin: 0;
}
.detail__meta .sep { color: var(--line); padding: 0 6px; }
.detail__meta .author { color: var(--ink); font-weight: 600; }

.detail__media {
  margin: clamp(28px, 4vw, 44px) 0 0;
}
.duotone--wide { aspect-ratio: 16 / 8; }
.detail__media figcaption {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  margin-top: 10px;
}

.prose { margin-top: clamp(28px, 4vw, 44px); max-width: 64ch; }
.prose p {
  font-size: 19px;
  line-height: 1.68;
  margin: 0 0 1.1em;
}

.detail__foot {
  margin-top: clamp(40px, 6vw, 64px);
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.detail__done {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--paper);
  background: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  cursor: pointer;
}
.detail__done:hover { background: var(--accent-ink); }

/* ---------- animations / reduced motion ---------- */

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

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

/* ---------- responsive ---------- */

@media (max-width: 820px) {
  .entry { grid-template-columns: 44px 1fr; gap: 14px; }
  .entry--lead { grid-template-columns: 44px 1fr; }
  .entry__media { grid-column: 1 / -1; }
  .entry--lead .entry__title { max-width: none; }
}

@media (max-width: 560px) {
  body { font-size: 17px; }
  .masthead__inner { flex-direction: column; align-items: flex-start; gap: 18px; }
  .masthead__issue { align-items: flex-start; text-align: left; flex-direction: row; gap: 14px; }
  .masthead__issue-date { font-size: 13px; }

  .controls__row { gap: 18px; }
  .field--search, .field--filter { flex: 1 1 100%; }
  #filter { width: 100%; min-width: 0; }
  .field__control--select { width: 100%; }
  .toggle { width: 100%; justify-content: center; }

  .entry { grid-template-columns: 1fr; gap: 4px; }
  .entry__no { padding-top: 0; }
  .entry__no span::before { content: "Dispatch "; color: var(--ink-faint); font-weight: 500; }
  .entry__media { grid-column: 1; max-width: none; }

  .detail__topbar { flex-wrap: wrap; }
  .save-item { width: 100%; justify-content: center; }
  .detail__done { width: 100%; }
}
