:root {
  color-scheme: light dark;

  /* Type */
  --serif: ui-serif, "New York", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --tag-letter-spacing: 0.04em;

  /* Palette — page */
  --bg-top: #fdfdfb;
  --bg-bot: #ecece6;
  --ink: #1c1c1e;
  --ink-strong: #111;
  --ink-soft: #2c2c2e;
  --ink-mid: #4a4a4e;
  --ink-faint: #8a8a8e;
  --rule: rgba(0, 0, 0, 0.1);
  --image-edge: rgba(0, 0, 0, 0.1);
  --hairline: 1px;
  --placeholder: #d8d6cf;
  --accent: #d23a2c;
  --hover-bg: rgba(0, 0, 0, 0.05);

  /* Palette — toolbar */
  --toolbar-rule: rgba(0, 0, 0, 0.1);
  --toolbar-highlight: rgba(255, 255, 255, 0.5);
  --toolbar-shadow: rgba(0, 0, 0, 0.05);
  --seg-bg: #d9d6cd;
  --seg-shadow: rgba(0, 0, 0, 0.12);
  --seg-active-bg: var(--ink);
  --seg-active-top: #fcfcfa;
  --seg-active-bot: #e7e5dd;
  --seg-active-highlight: rgba(255, 255, 255, 0.8);
  --seg-hover: rgba(255, 255, 255, 0.35);
  --seg-inactive-fg: var(--ink-soft);

  /* Palette — column headers */
  --logo-red: #c83a2c;
  --logo-blue: #2c6cb0;
  --logo-muted: #5a5a5e;

  /* Misc */
  --seg-active-fg: #ffffff;
  --placeholder-ink: rgba(0, 0, 0, 0.18);
  --page-dot: rgba(0, 0, 0, 0.22);

  /* Layout */
  --container: 1180px;
  --gutter: 16px;
  --col-gap: 28px;
  --cell-radius: 10px;
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
  :root { --hairline: 0.5px; }
}
@media (-webkit-min-device-pixel-ratio: 3), (min-resolution: 3dppx) {
  :root { --hairline: 0.333px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Palette — page */
    --bg-top: #16161a;
    --bg-bot: #121214;
    --ink: #ececea;
    --ink-strong: #fafaf8;
    --ink-soft: #d4d4d2;
    --ink-mid: #a4a4a2;
    --ink-faint: #76767a;
    --rule: rgba(255, 255, 255, 0.12);
    --image-edge: rgba(255, 255, 255, 0.15);
    --placeholder: #2a2a2c;
    --accent: #e85a4c;
    --hover-bg: rgba(255, 255, 255, 0.06);

    /* Palette — toolbar */
    --toolbar-rule: rgba(255, 255, 255, 0.08);
    --toolbar-highlight: rgba(255, 255, 255, 0.04);
    --toolbar-shadow: rgba(0, 0, 0, 0.4);
    --seg-bg: #26262a;
    --seg-shadow: rgba(0, 0, 0, 0.5);
    --seg-active-bg: #5e5e62;
    --seg-active-top: #4a4a4e;
    --seg-active-bot: #3a3a3e;
    --seg-active-highlight: rgba(255, 255, 255, 0.06);
    --seg-active-fg: #ffffff;
    --seg-hover: rgba(255, 255, 255, 0.08);
    --seg-inactive-fg: #c8c8c6;

    /* Palette — column headers */
    --logo-red: #e85a4c;
    --logo-blue: #4f93d8;
    --logo-muted: #8a8a8e;

    /* Misc */
    --placeholder-ink: rgba(255, 255, 255, 0.14);
    --page-dot: rgba(255, 255, 255, 0.28);
  }

}

/* Photos and thumbs read better with a hairline edge over the image —
 * keeps them from bleeding into the page background in either mode.
 * `outline` (not `border`) paints over the image content; the negative
 * offset pulls it inside so it reads as an inside border. Modern browsers
 * honor border-radius on outlines. */
.lead-image, .compact-thumb, .photo-image {
  outline: var(--hairline) solid var(--image-edge);
  outline-offset: calc(-1 * var(--hairline));
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.5 var(--sans);
  color: var(--ink);
  background: linear-gradient(var(--bg-top), var(--bg-bot) 50%) var(--bg-bot) fixed;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

/* Cells: whole row/card is one link. Background appears only on hover. */
.cell {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: var(--cell-radius);
  transition: background-color 120ms ease;
}
.cell:hover {
  background-color: var(--hover-bg);
  text-decoration: none;
}

/* ---------------- Toolbar ---------------- */

.toolbar {
  flex-shrink: 0;
  z-index: 10;
  background: var(--bg-bot);
  box-shadow:
    0 calc(-1 * var(--hairline)) 0 var(--toolbar-rule),
    0 -1px 2px var(--toolbar-shadow),
    inset 0 var(--hairline) 0 var(--toolbar-highlight);
  padding-bottom: env(safe-area-inset-bottom);
}
.toolbar-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 10px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 44px;
}

.segmented {
  display: inline-flex;
  background: var(--seg-bg);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--cell-radius);
  padding: 3px;
  gap: 3px;
  box-shadow: inset 0 1px 2px var(--seg-shadow);
}
@media (prefers-color-scheme: dark) {
  .segmented { box-shadow: none; }
}
.seg-btn {
  appearance: none;
  border: var(--hairline) solid transparent;
  background: transparent;
  color: var(--seg-inactive-fg);
  padding: 6px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  position: relative;
  transition: background-color 120ms ease, color 120ms ease;
}
.seg-btn:not(.active):hover {
  background: var(--seg-hover);
  color: var(--ink);
}
.seg-btn.active {
  background: var(--seg-active-bg);
  color: var(--seg-active-fg);
  border: var(--hairline) solid var(--rule);
  box-shadow: 0 1px 1px var(--seg-shadow);
}
.page-control {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.page-control-name {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.page-control-dots {
  display: inline-flex;
  gap: 8px;
}
.page-dot {
  appearance: none;
  border: none;
  background: var(--page-dot);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  transition: background-color 120ms ease;
}
.page-dot.active {
  background: var(--ink);
}

.seg-badge {
  display: inline-block;
  margin-left: 6px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  vertical-align: 1px;
}

/* ---------------- Pages (carousel) ---------------- */

.pages {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.pages::-webkit-scrollbar { display: none; }

.page {
  flex: 0 0 100%;
  height: 100%;
  overflow-y: auto;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.page-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 20px var(--gutter) 32px;
}

.status {
  flex-shrink: 0;
  color: var(--ink-faint);
  text-align: center;
  padding: 6px 0;
  margin: 0;
  font-size: 13px;
}
.status:empty { display: none; }

.footer {
  text-align: center;
  padding: 40px 0 0;
  color: var(--ink-faint);
  font-size: 13px;
}
.footer p {
  margin: 0;
}
.tagline {
  margin-top: 2px;
  font-family: var(--serif);
  font-style: italic;
}

/* ---------------- Columns ---------------- */

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--col-gap);
  align-items: start;
}

.col {
  min-width: 0;
}

.col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.col-logo {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--logo-red);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15px;
}
.col-logo.alt { background: var(--logo-blue); }
.col-logo.muted { background: var(--logo-muted); }
.col-icon {
  width: 22px;
  height: 22px;
  display: inline-block;
  background-color: var(--ink);
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}
.col-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--ink);
}

/* ---------------- Column 1 (lead) ---------------- */

.lead-cell {
  padding: var(--cell-radius);
  margin: calc(-1 * var(--cell-radius));
  margin-bottom: 4px;
}
.lead-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.005em;
  margin: 0 0 12px;
  color: var(--ink-strong);
}
.lead-title .read-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: 4px;
  margin-left: 4px;
  white-space: nowrap;
}
.lead-image {
  display: block;
  width: 100%;
  border-radius: 4px;
  background: var(--placeholder);
  margin-bottom: 12px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.lead-subtitle {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.45;
}
.lead-subtitle .source {
  display: block;
  color: var(--ink-faint);
  font-size: 12px;
  margin-top: 6px;
  letter-spacing: var(--tag-letter-spacing);
  text-transform: uppercase;
}

.headline-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.headline-list li {
  border-top: var(--hairline) solid var(--rule);
}
.headline-list li:last-child {
  border-bottom: var(--hairline) solid var(--rule);
}
.headline-list li:has(.cell:hover),
.headline-list li:has(.cell:hover) + li {
  border-top-color: transparent;
}
.headline-list li:has(.cell:hover):last-child {
  border-bottom-color: transparent;
}
.headline-cell {
  padding: var(--cell-radius);
  margin: 0 calc(-1 * var(--cell-radius));
}
.headline-cell .headline {
  display: block;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.3;
  color: var(--ink);
}
.headline-cell .source {
  display: block;
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 11px;
  margin-top: 3px;
  letter-spacing: var(--tag-letter-spacing);
  text-transform: uppercase;
}

/* ---------------- Column 2 (compact) ---------------- */

.compact-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.compact-list li {
  border-top: var(--hairline) solid var(--rule);
}
.compact-list li:first-child {
  border-top: none;
}
.compact-list li:has(.cell:hover),
.compact-list li:has(.cell:hover) + li {
  border-top-color: transparent;
}
.compact-cell {
  display: flex;
  gap: 10px;
  padding: 12px;
  margin: 0 -12px;
}
.compact-thumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 3px;
  background: var(--placeholder);
  object-fit: cover;
  display: block;
}
.compact-body {
  min-width: 0;
  flex: 1;
}
.compact-title {
  display: block;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.25;
  margin: 0 0 4px;
  color: var(--ink);
}
.compact-subtitle {
  margin: 0;
  color: var(--ink-mid);
  font-size: 12.5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.compact-source {
  color: var(--ink-faint);
  font-size: 10.5px;
  margin-top: 4px;
  letter-spacing: var(--tag-letter-spacing);
  text-transform: uppercase;
}

/* ---------------- Column 3 (photo gallery) ---------------- */

.photo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.photo-cell {
  padding: 8px;
  margin: 0 -8px;
}
.photo-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--placeholder);
  border-radius: 4px;
}
div.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--placeholder-ink);
  text-transform: uppercase;
  user-select: none;
}
div.lead-image.placeholder { font-size: 96px; }
div.photo-image.placeholder { font-size: 72px; }
div.compact-thumb.placeholder { font-size: 32px; }

.photo-caption {
  text-align: center;
  font-family: var(--serif);
  font-size: 14px;
  padding: 10px 4px 4px;
  color: var(--ink);
}
.photo-title {
  display: block;
}
.photo-caption .source {
  display: block;
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 10.5px;
  margin-top: 3px;
  letter-spacing: var(--tag-letter-spacing);
  text-transform: uppercase;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
  .columns {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .col-narrow { grid-column: span 2; }
}
@media (max-width: 640px) {
  .segmented { display: none; }
  .page-control { display: flex; }
}
@media (max-width: 600px) {
  .columns { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .col-narrow { grid-column: auto; }
  .lead-title { font-size: 26px; }
}

/* ---------------- 404 ---------------- */

.not-found-body {
  height: 100dvh;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.not-found {
  width: 100%;
  max-width: var(--container);
  padding: 40px var(--gutter);
}
.not-found-inner {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}
.not-found-code {
  font-family: var(--serif);
  font-size: 72px;
  line-height: 1;
  margin: 0 0 12px;
  color: var(--ink-faint);
  letter-spacing: -0.02em;
}
.not-found-title {
  font-family: var(--serif);
  font-size: 28px;
  margin: 0 0 12px;
  color: var(--ink-strong);
  letter-spacing: -0.01em;
}
.not-found-blurb {
  margin: 0 0 24px;
  color: var(--ink-mid);
}
.not-found-home {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--seg-active-fg);
  font-weight: 500;
  transition: opacity 120ms ease;
}
.not-found-home:hover {
  opacity: 0.85;
}

/* ---------------- No-JS fallback ----------------
 * When JavaScript is unavailable we drop the carousel: pages stack
 * vertically, the toolbar is hidden, and the document scrolls normally.
 */
html.no-js body {
  height: auto;
  overflow: visible;
  display: block;
}
html.no-js .pages {
  display: block;
  overflow: visible;
  scroll-snap-type: none;
}
html.no-js .page {
  flex: none;
  height: auto;
  overflow: visible;
  scroll-snap-align: none;
  border-bottom: var(--hairline) solid var(--rule);
}
html.no-js .page:last-child {
  border-bottom: none;
}
html.no-js .toolbar { display: none; }
