/* Fonts are self-hosted. Clash Grotesk: Indian Type Foundry via Fontshare (ITF Free Font License).
   Geist Serif: Vercel, SIL Open Font License (fonts/OFL-GeistSerif.txt). */
@font-face { font-family: "Clash Grotesk"; src: url(fonts/ClashGrotesk-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Clash Grotesk"; src: url(fonts/ClashGrotesk-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Clash Grotesk"; src: url(fonts/ClashGrotesk-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Geist Serif"; src: url(fonts/GeistSerif-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }

/* Monochrome + one signal red. Sharp corners everywhere (radius 0). */
:root {
  color-scheme: light dark;
  --bg: oklch(0.972 0 0);
  --ink: oklch(0.18 0 0);
  --muted: oklch(0.46 0 0);
  --faint: oklch(0.62 0 0);
  --line: oklch(0.86 0 0);
  --line-strong: oklch(0.62 0 0);
  --well: oklch(0.93 0 0);
  --accent: oklch(0.58 0.2 28);
  --outline: oklch(0 0 0 / 0.1);
  --display: "Clash Grotesk", ui-sans-serif, system-ui, sans-serif;
  --serif: "Geist Serif", ui-serif, Georgia, serif;
  --gutter: clamp(16px, 3.2vw, 48px);
  --ease: cubic-bezier(0.2, 0, 0, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.145 0 0);
    --ink: oklch(0.95 0 0);
    --muted: oklch(0.7 0 0);
    --faint: oklch(0.54 0 0);
    --line: oklch(0.27 0 0);
    --line-strong: oklch(0.5 0 0);
    --well: oklch(0.19 0 0);
    --accent: oklch(0.7 0.17 30);
    --outline: oklch(1 0 0 / 0.1);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.55 var(--serif); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ph { font-size: 18px; line-height: 1; }

/* ---------- masthead ---------- */
.mast {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 24px 48px; align-items: end;
  padding: clamp(40px, 7vw, 96px) var(--gutter) 32px;
}
h1 {
  margin: 0; font: 600 clamp(56px, 10.5vw, 156px)/0.86 var(--display); letter-spacing: -0.035em;
}
.lede { margin: 0 0 6px; max-width: 34ch; font-size: 19px; line-height: 1.45; color: var(--muted); text-wrap: pretty; }
.lede b { font-weight: 400; color: var(--ink); }

/* ---------- sticky bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 32px; align-items: center;
  height: 56px; padding: 0 var(--gutter);
  background: var(--bg); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line);
  font-family: var(--display);
}
.views { display: flex; gap: 24px; }
.views a, .years a {
  position: relative; text-decoration: none; color: var(--muted); font-weight: 500; font-size: 15px; padding: 16px 0;
  transition-property: color; transition-duration: 150ms; transition-timing-function: ease-out;
}
.views a[aria-current="page"] { color: var(--ink); }
.views a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 8px; height: 2px; background: var(--accent); }
.years { display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; font-variant-numeric: tabular-nums; }
.years::-webkit-scrollbar { display: none; }
.years a { flex: none; font-weight: 400; font-size: 14px; }
.years a[aria-current="true"] { color: var(--ink); }
.search { position: relative; display: flex; align-items: center; }
.search .ph { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.search input {
  width: 240px; height: 36px; padding: 0 10px 0 34px; border: 1px solid var(--line-strong); border-radius: 0;
  background: transparent; color: var(--ink); font: 400 15px var(--display);
  transition-property: border-color; transition-duration: 150ms; transition-timing-function: ease-out;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--ink); }

/* ---------- days ---------- */
main { padding: 0 var(--gutter) 120px; }
.year { padding-top: 56px; scroll-margin-top: 56px; }
.year-head { display: flex; align-items: baseline; gap: 20px; margin: 0 0 20px; }
.year-head h2 { margin: 0; font: 500 clamp(40px, 5vw, 64px)/1 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.year-head p { margin: 0; color: var(--muted); font-size: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 10px; grid-auto-flow: dense; }
.tile { display: block; width: 100%; text-align: left; align-self: start; }
.tile .img { position: relative; display: block; aspect-ratio: 1; background: var(--well); overflow: hidden; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity 300ms var(--ease); }
.tile img.ok { opacity: 1; }
.tile .img::after { content: ""; position: absolute; inset: 0; outline: 1px solid var(--outline); outline-offset: -1px; pointer-events: none; }
.tile .cap { display: flex; justify-content: space-between; gap: 8px; padding-top: 6px; font: 500 13px/1.3 var(--display); font-variant-numeric: tabular-nums; }
.tile .cap em { font-style: normal; color: var(--accent); }
.tile.empty { cursor: default; }
.tile.empty .img { background: none; box-shadow: inset 0 0 0 1px var(--line); }
.tile.empty .img::after { outline: none; }
.tile.empty .cap { color: var(--faint); font-weight: 400; }
/* the newest day gets a larger cell */
.tile.latest { grid-column: span 2; grid-row: span 2; }
.tile.latest .cap { font-size: 15px; }
.tile.latest .cap span::before { content: "Latest, "; color: var(--muted); font-weight: 400; }
.no-results { margin-top: 64px; color: var(--muted); }

/* ---------- check-ins ---------- */
.ci-head { padding-top: 56px; max-width: 52ch; }
.ci-head h2 { margin: 0 0 8px; font: 500 clamp(40px, 5vw, 64px)/1 var(--display); letter-spacing: -0.03em; }
.ci-head p { margin: 0; color: var(--muted); }
.ci-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 40px 16px; margin-top: 40px; }
.ci { display: block; width: 100%; text-align: left; align-self: start; }
.ci .img { position: relative; display: block; aspect-ratio: 4 / 5; background: var(--well); overflow: hidden; }
.ci img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ci .img::after { content: ""; position: absolute; inset: 0; outline: 1px solid var(--outline); outline-offset: -1px; pointer-events: none; }
.ci b { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; font: 500 22px/1.1 var(--display); letter-spacing: -0.01em; }
.ci b small { font: 400 13px var(--display); color: var(--muted); font-variant-numeric: tabular-nums; }
.ci time { display: block; margin-top: 2px; color: var(--muted); font-size: 15px; }
.ci p { margin: 8px 0 0; font-size: 15px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

@media (hover: hover) {
  .views a:not([aria-current="page"]):hover, .years a:hover { color: var(--ink); }
  .tile:not(.empty):hover .cap, .ci:hover b { color: var(--accent); }
  .v-links a:hover span, .v-nav button:not(:disabled):hover, .v-close:hover { color: var(--accent); }
}

/* ---------- viewer ---------- */
dialog {
  position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--bg); color: var(--ink);
  display: none; grid-template-columns: minmax(0, 1fr) 400px;
}
dialog[open] { display: grid; }
dialog::backdrop { background: var(--bg); }
dialog:focus-visible { outline: none; }
.v-media { position: relative; display: grid; place-items: center; min-height: 0; background: oklch(0.1 0 0); overflow: hidden; }
.v-media video, .v-media img { max-width: 100%; max-height: 100dvh; display: block; }
.v-media .strip { display: flex; width: 100%; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior: contain; }
.v-media .strip > * { flex: none; width: 100%; height: 100%; object-fit: contain; scroll-snap-align: center; }
.v-media .none { color: oklch(0.7 0 0); font: 400 17px var(--serif); padding: 40px; text-align: center; }
.v-info { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 32px 24px; border-left: 1px solid var(--line); }
.v-close { align-self: flex-end; display: inline-flex; align-items: center; gap: 6px; padding: 8px 0; font: 500 14px var(--display); color: var(--muted); transition-property: color; transition-duration: 150ms; transition-timing-function: ease-out; }
.v-info h2 { margin: 24px 0 0; font: 600 clamp(48px, 5vw, 76px)/0.95 var(--display); letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.v-date { margin: 10px 0 0; color: var(--muted); font-size: 16px; }
.v-cap { margin: 24px 0 0; font-size: 19px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; text-wrap: pretty; }
.v-links { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); font-family: var(--display); }
.v-links .label { margin: 18px 0 6px; font-size: 13px; color: var(--muted); }
.v-links .label:first-child { margin-top: 0; }
.v-links a { display: flex; align-items: center; gap: 10px; padding: 6px 0; text-decoration: none; font-size: 15px; font-weight: 500; }
.v-links a span { transition-property: color; transition-duration: 150ms; transition-timing-function: ease-out; }
.v-links a small { margin-left: auto; font-weight: 400; color: var(--muted); font-size: 13px; }
.v-links .ph { color: var(--muted); }
.v-nav { display: grid; grid-template-columns: 1fr 1fr; margin-top: auto; padding-top: 24px; border-top: 1px solid var(--line); font-family: var(--display); }
.v-nav button { display: inline-flex; align-items: center; gap: 8px; padding: 12px 0; font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; transition-property: color, scale; transition-duration: 150ms; transition-timing-function: ease-out; }
.v-nav button + button { justify-self: end; }
.v-nav button:disabled { color: var(--faint); cursor: default; }
.v-nav button:not(:disabled):active, .v-close:active { scale: 0.96; }

/* ---------- motion (entrances only, gated) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .mast h1, .mast .lede { animation: rise 300ms ease-out both; }
  .mast .lede { animation-delay: 100ms; }
  dialog[open] .v-info > * { animation: rise 300ms ease-out both; }
  dialog[open] .v-info > :nth-child(2) { animation-delay: 60ms; }
  dialog[open] .v-info > :nth-child(n+3) { animation-delay: 120ms; }
  dialog[open] .v-media { animation: fade 300ms ease-out both; }
  @keyframes rise { from { opacity: 0; translate: 0 12px; filter: blur(4px); } }
  @keyframes fade { from { opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) {
  dialog[open] { animation: fade 200ms ease-out both; }
  @keyframes fade { from { opacity: 0; } }
  .v-nav button:active, .v-close:active { scale: 1; }
}

/* ---------- small screens ---------- */
@media (max-width: 767px) {
  .mast { grid-template-columns: 1fr; padding-top: 32px; padding-bottom: 24px; }
  .lede { font-size: 17px; }
  .bar { grid-template-columns: auto minmax(0, 1fr); gap: 16px; height: auto; padding-top: 0; padding-bottom: 10px; row-gap: 0; }
  .years { grid-column: 1 / -1; grid-row: 2; padding-bottom: 2px; }
  .years a { padding: 8px 0; }
  .search { justify-self: end; }
  .search input { width: 100%; min-width: 0; max-width: 200px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 6px; }
  .year { scroll-margin-top: 110px; padding-top: 40px; }
  .ci-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 10px; }
  .ci b { font-size: 18px; }
  dialog { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .v-media { max-height: 56dvh; }
  .v-media video, .v-media img { max-height: 56dvh; }
  .v-info { border-left: 0; padding: 4px 16px 16px; }
  .v-close { position: absolute; top: 8px; right: 12px; z-index: 1; padding: 6px 10px; color: oklch(0.95 0 0); background: oklch(0 0 0 / 0.5); }
  .v-info h2 { margin-top: 16px; }
}
