/* ─────────────────────────────────────────────────────────────
   ONE A DAY — Stylesheet
   Palette from kennethmayr.com
   ───────────────────────────────────────────────────────────── */

:root {
  --bg: #000000;
  --bg-elev: #282828;
  --ink: #FFFFFF;
  --ink-dim: #F3F3F3;
  --ink-muted: rgba(243, 243, 243, 0.5);
  --rule: #282828;
  --accent: #FF5E1A;

  --radius: 10px;
  --gap: clamp(8px, 0.9vw, 14px);
  --aspect: 2 / 1;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'PT Sans', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle film grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Display font helper */
.display {
  font-family: 'futura-pt', 'Futura PT', 'Futura', 'Jost', sans-serif;
}

/* ── Masthead ─────────────────────────────────────────── */
.masthead {
  padding: clamp(20px, 3vw, 36px) clamp(20px, 4vw, 48px) clamp(16px, 2vw, 24px);
  border-bottom: 1px solid var(--rule);
}
.masthead__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.masthead__logo {
  justify-self: start;
  display: inline-flex;
  width: clamp(22px, 2.2vw, 28px);
  color: var(--ink);
  transition: color 0.25s var(--ease);
}
.masthead__logo svg {
  width: 100%;
  height: auto;
  fill: currentColor;
  display: block;
}
.masthead__logo:hover { color: var(--accent); }

.masthead__title {
  margin: 0;
  justify-self: center;
  text-align: center;
  font-family: 'futura-pt', 'Futura PT', 'Futura', 'Jost', sans-serif;
  font-weight: 500;
  font-size: clamp(28px, 3.5vw, 44px);
  line-height: 0.95;
  letter-spacing: -0.01em;
}
.masthead__title a {
  color: inherit;
  text-decoration: none;
}
.masthead__title em {
  font-style: normal;
  font-weight: 300;
  color: var(--accent);
}

.masthead__meta {
  margin: 0;
  justify-self: end;
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.dot { margin: 0 10px; opacity: 0.45; }

/* Stack on narrow viewports — three centered rows */
@media (max-width: 640px) {
  .masthead__inner {
    grid-template-columns: 1fr;
    grid-template-areas:
      "logo"
      "title"
      "meta";
    row-gap: 14px;
    text-align: center;
  }
  .masthead__logo  {
    grid-area: logo;
    justify-self: center;
  }
  .masthead__title {
    grid-area: title;
    justify-self: center;
  }
  .masthead__meta  {
    grid-area: meta;
    justify-self: center;
    text-align: center;
  }
}

/* ── Grid ─────────────────────────────────────────────── */
main {
  padding: clamp(20px, 3vw, 40px) clamp(20px, 4vw, 48px) 80px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

@media (min-width: 600px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 820px)  { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1320px) { .grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1560px) { .grid { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 1900px) {
  .grid {
    grid-template-columns: repeat(7, 1fr);
    max-width: 2200px;
    margin: 0 auto;
  }
}

/* ── Tile ─────────────────────────────────────────────── */
.tile {
  position: relative;
  aspect-ratio: var(--aspect);
  background: var(--bg-elev);
  overflow: hidden;
  border-radius: var(--radius);
  cursor: pointer;
  isolation: isolate;
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.03) inset,
    0 10px 30px -15px rgba(0,0,0,0.6);
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
}

.tile:hover,
.tile:focus-visible {
  transform: translateY(-3px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 30px 60px -20px rgba(0,0,0,0.9);
  z-index: 2;
  outline: none;
}

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

.tile__poster,
.tile__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile__video {
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}
.tile.is-playing .tile__video { opacity: 1; }

/* Index in top-left, hover only */
.tile__index {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 4;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}
.tile:hover .tile__index,
.tile:focus-visible .tile__index { opacity: 1; }

/* Date overlay, hover only */
.tile__overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px 14px;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.85) 0%,
    rgba(0,0,0,0.45) 40%,
    rgba(0,0,0,0) 70%
  );
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}
.tile:hover .tile__overlay,
.tile:focus-visible .tile__overlay { opacity: 1; }

.tile__date {
  font-family: 'futura-pt', 'Futura PT', 'Futura', 'Jost', sans-serif;
  font-weight: 500;
  font-size: clamp(13px, 1vw, 17px);
  line-height: 1.1;
}
.tile__day {
  margin-top: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Loading state */
.tile.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255,255,255,0.04) 50%,
    transparent 60%
  );
  animation: shimmer 2s infinite;
  z-index: 1;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Empty / error ────────────────────────────────────── */
.empty {
  text-align: center;
  color: var(--ink-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 80px 20px;
}

/* ── Lightbox ─────────────────────────────────────────── */
.lightbox[hidden] { display: none; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.95);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
  animation: fade 0.25s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.lightbox__inner {
  width: min(1400px, 100%);
}
.lightbox__player {
  aspect-ratio: var(--aspect);
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,0.8);
}
.lightbox__player iframe,
.lightbox__player video {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.lightbox__caption {
  margin-top: 20px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.lightbox__close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: 0;
  color: var(--ink);
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  padding: 8px 12px;
  opacity: 0.6;
  transition: opacity 0.2s, color 0.2s;
}
.lightbox__close:hover {
  opacity: 1;
  color: var(--accent);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .tile.is-loading::after { display: none; }
}
