@font-face {
  font-family: "Cutive Mono";
  src: url("/fonts/CutiveMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f5f5f0;
  --text: #111111;
  --muted: #8a8a85;
  --placeholder: #dededa;
  --accent: #ff4b4b;
}

:root[data-theme="dark"] {
  --bg: #111111;
  --text: #f5f5f0;
  --muted: #7a7a76;
  --placeholder: #2a2a28;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Cutive Mono", monospace;
  font-synthesis: none;
  transition: background-color 200ms ease, color 200ms ease;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header ---------- */

.site-header {
  text-align: center;
  padding: 5rem 1.5rem 3.5rem;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.75rem, 4.5vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.03em;
}

.byline {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.byline a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--muted) 40%, transparent);
  text-underline-offset: 0.35em;
  transition: color 200ms ease, text-decoration-color 200ms ease;
}

.byline a:hover,
.byline a:focus-visible {
  color: var(--accent);
  text-decoration-color: currentColor;
}

/* ---------- Theme toggle ---------- */

.theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 200ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--text);
}

:root[data-theme="light"] .icon-sun,
:root[data-theme="dark"] .icon-moon {
  display: none;
}

/* ---------- Grid ---------- */

main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 2rem 6rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.5rem 1.25rem;
}

@media (max-width: 60rem) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 40rem) {
  main {
    padding: 0 1.25rem 4rem;
  }
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem 1rem;
  }
}

.card {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.card-thumb {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 10px;
  overflow: hidden;
  background: var(--placeholder);
  transition: transform 400ms ease, box-shadow 400ms ease,
    background-color 200ms ease;
}

.card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Slightly dark overlay on unplayed videos, slightly light on played ones;
   both lift on hover so the preview shows true colors. */
.card-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  opacity: 1;
  transition: opacity 200ms ease, background-color 200ms ease;
  pointer-events: none;
}

.card.watched .card-thumb::after {
  background: rgba(245, 245, 240, 0.25);
}

.card:hover .card-thumb::after,
.card:focus-visible .card-thumb::after {
  opacity: 0;
}

.card:hover .card-thumb,
.card:focus-visible .card-thumb {
  transform: scale(1.04);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

.card:focus-visible {
  outline: none;
}

.card:focus-visible .card-thumb {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

.caption {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  transition: color 200ms ease;
}

.watched-dot {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.status {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

/* ---------- Modal ---------- */

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
}

.modal-video {
  width: min(calc((100vh - 5rem) * 9 / 16), calc(100vw - 2.5rem));
  aspect-ratio: 9 / 16;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

.modal-video iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
}

.modal-close {
  position: absolute;
  top: -0.6rem;
  right: -2.6rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #f5f5f0;
  font-family: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 40rem) {
  .modal-close {
    top: -2.6rem;
    right: 0;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
  .card:hover .card-thumb,
  .card:focus-visible .card-thumb {
    transform: none;
  }
}
