:root {
  color-scheme: light;
  --paper: #f3efe6;
  --ink: #1c1915;
  --muted: #5e574e;
  --line: #e3dcd0;
  --card: #fffdf8;
  --pin: #9f2b18;
  --pin-deep: #7a1f10;
  --pin-text: #fff7f5;
  --accent: #9f2b18;
  --shadow: 0 1px 2px rgba(28, 25, 21, 0.06), 0 12px 28px rgba(28, 25, 21, 0.07);
  --shadow-hover: 0 2px 6px rgba(28, 25, 21, 0.08), 0 16px 36px rgba(28, 25, 21, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #12110f;
    --ink: #f4f0e8;
    --muted: #c8bfb4;
    --line: #3a342c;
    --card: #26221e;
    --accent: #ff7a62;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 14px 34px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 2px 8px rgba(0, 0, 0, 0.4), 0 18px 40px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

html {
  overflow-x: clip;
  scroll-padding-top: 6rem;
}

@media (pointer: fine) {
  html { overscroll-behavior: none; }
}

html, button, a { touch-action: manipulation; }

button, a { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Outfit, ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  background:
    radial-gradient(1100px 420px at 8% -12%, rgba(159, 43, 24, 0.09), transparent 55%),
    var(--paper);
  color: var(--ink);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

img, video { max-width: 100%; }

button, a { font: inherit; cursor: pointer; }

::selection {
  background: color-mix(in srgb, var(--pin) 28%, white);
  color: var(--ink);
}

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

:focus:not(:focus-visible) { outline: none; }

h1, h2 { scroll-margin-top: 6rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip:focus {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 50;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.65rem 1rem;
  overflow: visible;
  clip: auto;
  white-space: nowrap;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-weight: 600;
}

.wrap {
  width: min(1320px, calc(100% - 2rem));
  margin-inline: auto;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 3px 0 var(--pin);
}

.header-inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-block: 1rem 1.05rem;
}

.display {
  margin: 0;
  font-family: Fraunces, Georgia, "Iowan Old Style", Palatino, serif;
  font-weight: 560;
  font-size: clamp(2rem, 5vw, 3.35rem);
  letter-spacing: -0.035em;
  line-height: 0.95;
  text-wrap: balance;
}

.accent { color: var(--accent); }

.lede {
  max-width: 40rem;
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  text-wrap: pretty;
}

.stats { display: flex; gap: 0.6rem; }

.stat {
  margin: 0;
  min-width: 7.25rem;
  padding: 0.65rem 0.85rem 0.7rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
}

.stat b {
  display: block;
  font-family: Fraunces, Georgia, serif;
  font-weight: 560;
  font-size: 1.65rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

main { padding-bottom: max(2.5rem, env(safe-area-inset-bottom)); }

.feature { margin: 1.25rem 0 1.6rem; }

.feature h2 {
  margin: 0 0 0.8rem;
  font-family: Fraunces, Georgia, serif;
  font-weight: 560;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.panel {
  padding: 0.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  box-shadow: var(--shadow);
}

.stage {
  position: relative;
  width: min(100%, 860px);
  margin-inline: auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 1rem;
  background: #0c0b0a;
}

.stage video,
.stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0c0b0a;
}

.stage video { animation: fade 280ms ease; }

.nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  transform: translateY(-50%);
  transition: transform 160ms ease;
}

.nav:hover { background: rgba(0, 0, 0, 0.72); }
.nav:active { transform: translateY(-50%) scale(0.98); }
.nav.prev { left: 0.75rem; }
.nav.next { right: 0.75rem; }
.nav svg { width: 1.45rem; height: 1.45rem; }

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  width: min(100%, 860px);
  margin: 0.85rem auto 0;
}

.who-wrap { min-width: 0; flex: 1; }

.who {
  margin: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 999px;
  background: var(--pin);
  color: var(--pin-text);
  font-weight: 600;
  transition: transform 160ms ease;
}

.btn:hover { background: var(--pin-deep); }
.btn:active { transform: scale(0.98); }
.btn svg { width: 1.05rem; height: 1.05rem; }

.btn-quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.btn-quiet:hover {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.masonry { columns: 2; column-gap: 0.75rem; margin-top: 1.15rem; }

/* ponytail: content-visibility windows the masonry instead of a virtualizer.
   Ceiling: off-screen column cards can mis-measure. Upgrade path: a virtualized grid past a few hundred cards. */
.card {
  display: block;
  width: 100%;
  margin: 0 0 0.75rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  line-height: 0;
  text-align: left;
  break-inside: avoid;
  border-radius: 1.15rem;
  content-visibility: auto;
  contain-intrinsic-size: auto 280px;
  animation: rise 420ms ease both;
  transition: transform 180ms ease;
}

.card:hover { transform: translateY(-2px); }
.card:active { transform: translateY(0) scale(0.992); }

.frame {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 1.15rem;
  background: var(--line);
  border: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
  box-shadow: var(--shadow);
}

.card:hover .frame { box-shadow: var(--shadow-hover); }

.card[aria-pressed="true"] .frame,
.card[aria-pressed="true"]:hover .frame {
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 5px var(--pin);
}

.frame img {
  display: block;
  width: 100%;
  height: auto;
}

.frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scrim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46%;
  background: linear-gradient(to top, rgba(12, 10, 8, 0.78), rgba(12, 10, 8, 0));
  pointer-events: none;
}

.pin {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.94);
  color: #1c1915;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 6px 16px rgba(0, 0, 0, 0.14);
}

.card[aria-pressed="true"] .pin {
  background: var(--pin);
  color: var(--pin-text);
}

.pin svg { width: 1.2rem; height: 1.2rem; }

.badge {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.28rem 0.55rem 0.28rem 0.45rem;
  border-radius: 999px;
  background: rgba(12, 10, 8, 0.66);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.badge svg { width: 0.65rem; height: 0.65rem; }

.by {
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  bottom: 0.75rem;
  z-index: 1;
  overflow: hidden;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.fallback {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 8rem;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: center;
}

.skel {
  position: relative;
  overflow: hidden;
  margin: 0 0 0.8rem;
  border-radius: 1.15rem;
  background: var(--line);
  break-inside: avoid;
}

.skel-bar {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--card) 75%, transparent), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.15s ease-in-out infinite;
}

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 1.15rem 0 0.2rem;
  color: var(--muted);
  font-weight: 500;
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--line);
  border-top-color: var(--pin);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.notice {
  max-width: 26rem;
  margin: 2.5rem auto;
  padding: 1.5rem 1.35rem;
  overflow-wrap: anywhere;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  box-shadow: var(--shadow);
}

.notice p { margin: 0 0 0.55rem; }
.notice p + p { color: var(--muted); }
.notice .btn { margin-top: 0.45rem; }

.end {
  margin: 1.5rem 0;
  color: var(--muted);
  text-align: center;
}

.sentinel { height: 1px; }

@keyframes rise {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (min-width: 720px) {
  .masonry { columns: 3; column-gap: 1rem; }
  .card { margin-bottom: 1rem; }
}

@media (min-width: 860px) {
  .wrap { width: min(1320px, calc(100% - 3rem)); }
  .header-inner {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    padding-block: 1.15rem 1.2rem;
  }
}

@media (min-width: 1100px) {
  .masonry { columns: 4; }
}

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