/* Palette + fonts lifted directly from noirmak.com/css/style.css so this reads as the
   same site family, not a one-off page. */

:root {
  --full-spectrum-blue: #304ffe;
  --neon-pink:          #ff1d89;
  --sunbeam-yellow:     #ffec00;
  --chartreuse:         #bcf804;
  --black:              #000000;
  --white:              #f5f5f5;
}

html { box-sizing: border-box; scroll-behavior: smooth; }
*, *:before, *:after { box-sizing: inherit; }

body {
  background-color: var(--black);
  color: var(--white);
  font-family: 'Rajdhani', sans-serif;
  font-weight: 400;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, .hero-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* HEADER */

.site-header {
  padding: 90px 0 50px;
  border-bottom: 1px solid var(--neon-pink);
}

.eyebrow {
  display: block;
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--chartreuse);
  margin-bottom: 18px;
}

.hero-title {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  margin: 0 0 14px;
  line-height: 1.05;
}

.hero-sub {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.03em;
  opacity: 0.8;
  max-width: 560px;
  margin: 0;
}

/* GRID */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 28px;
  padding: 60px 0 100px;
}

.card-wrapper {
  animation: card-glitch-in 0.45s ease-out both;
  animation-delay: var(--card-delay, 0s);
}

@keyframes card-glitch-in {
  0%   { opacity: 0; transform: translateX(-8px); filter: saturate(2) hue-rotate(20deg) blur(1px); }
  20%  { opacity: 1; transform: translateX(5px);  filter: saturate(3) hue-rotate(-15deg); }
  45%  { transform: translateX(-3px); filter: saturate(1.5) hue-rotate(8deg); }
  70%  { transform: translateX(1px);  filter: none; }
  100% { opacity: 1; transform: translateX(0);    filter: none; }
}

.sketch-card {
  position: relative;
  background-color: var(--black);
  border: 1px solid var(--white);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  aspect-ratio: 4 / 5;
}

.sketch-card:focus-visible { outline: 2px solid var(--chartreuse); outline-offset: 2px; }

.accent-1 { border-color: var(--chartreuse); }
.accent-2 { border-color: var(--neon-pink); }
.accent-3 { border-color: var(--full-spectrum-blue); }
.accent-4 { border-color: var(--sunbeam-yellow); }

.accent-1:hover, .accent-1:focus-visible { transform: translateY(-6px); animation: neon-pulse 2s ease-in-out infinite; }
.accent-2:hover, .accent-2:focus-visible { transform: translateY(-6px); animation: neon-pulse 2s ease-in-out infinite; }
.accent-3:hover, .accent-3:focus-visible { transform: translateY(-6px); animation: neon-pulse 2s ease-in-out infinite; }
.accent-4:hover, .accent-4:focus-visible { transform: translateY(-6px); animation: neon-pulse 2s ease-in-out infinite; }

@keyframes neon-pulse {
  0%,  100% { box-shadow: 0 0 12px rgba(255, 29, 137, 0.9),  0 0 30px rgba(255, 29, 137, 0.4); }
  25%       { box-shadow: 0 0 12px rgba(48, 79, 254, 0.9),   0 0 30px rgba(48, 79, 254, 0.4); }
  50%       { box-shadow: 0 0 12px rgba(188, 248, 4, 0.9),   0 0 30px rgba(188, 248, 4, 0.4); }
  75%       { box-shadow: 0 0 12px rgba(255, 236, 0, 0.9),   0 0 30px rgba(255, 236, 0, 0.4); }
}

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

.card-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 14px 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}

.card-day {
  display: block;
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--chartreuse);
  margin-bottom: 4px;
}

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--white);
  margin: 0;
}

/* FOOTER */

.site-footer {
  border-top: 1px solid rgba(245, 245, 245, 0.15);
  padding: 30px 0 60px;
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
}

.footer-link { color: var(--white); text-decoration: none; opacity: 0.7; }
.footer-link:hover { color: var(--chartreuse); opacity: 1; }
.footer-sep { margin: 0 10px; opacity: 0.3; }

/* LIGHTBOX */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.lightbox.open { display: flex; }
body.lightbox-locked { overflow: hidden; }

.lightbox-panel {
  display: flex;
  max-width: 1100px;
  width: 100%;
  max-height: 86vh;
  border: 1px solid var(--chartreuse);
  background: var(--black);
}

.lightbox-media {
  flex: 1 1 60%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050505;
  overflow: hidden;
}

/* max-width/max-height as caps with width/height: auto — not a fixed width — so a portrait
   (9:16) video is contained the same as day 1's landscape (16:9) one, instead of being
   forced to 100% width and overflowing vertically. */
.lightbox-video {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 86vh;
  display: block;
}

/* The live canvas renders landscape internally (see js/hydra-runner.js — these sketches
   were authored/recorded in 16:9 for screen-capture convenience, portrait is the intended
   final orientation) and is CSS-rotated +90deg to present that intended orientation. Box
   size (preferring each sketch's native 464x832 video resolution, shrinking only if that
   doesn't fit) is computed in JS (gallery.js:layoutLiveCanvas) — the canvas is absolutely
   positioned (out of normal flow) so its own landscape intrinsic size can't feed back into
   .live-stage's sizing, which a plain flex/auto-height child would otherwise do. */
.live-stage {
  display: none;
  position: relative;
  max-height: 86vh;
  margin: 0 auto;
  overflow: hidden;
}

.live-stage.open { display: block; }

.lightbox-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  background: #050505;
  transform: translate(-50%, -50%) rotate(90deg);
}

.lightbox-side {
  flex: 1 1 40%;
  min-width: 300px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lightbox-day {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--chartreuse);
}

.lightbox-close {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.lightbox-close:hover { color: var(--neon-pink); }

.lightbox-title {
  font-size: 1.8rem;
  margin: 10px 0 20px;
}

.code-toggle-btn {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--chartreuse);
  color: var(--white);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  margin-bottom: 16px;
}

.code-toggle-btn:hover { background-color: var(--chartreuse); color: var(--black); }
.code-toggle-btn:disabled { opacity: 0.5; cursor: default; }

.lightbox-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.lightbox-actions .code-toggle-btn { margin-bottom: 0; }

.live-toggle-btn { border-color: var(--neon-pink); }
.live-toggle-btn:hover { background-color: var(--neon-pink); color: var(--black); }

.live-controls {
  display: none;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.live-controls.open { display: flex; }

.audio-toggle-btn {
  background: transparent;
  border: 1px solid var(--full-spectrum-blue);
  color: var(--white);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 14px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.audio-toggle-btn:hover { background-color: var(--full-spectrum-blue); color: var(--black); }
.audio-toggle-btn:disabled { opacity: 0.5; cursor: default; }

.live-status {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  opacity: 0.55;
}

.code-pane {
  display: none;
  max-height: 260px;
  overflow: auto;
  border: 1px solid rgba(245, 245, 245, 0.15);
  margin-bottom: 20px;
}

.code-pane.open { display: block; }

.code-block {
  display: block;
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--chartreuse);
  white-space: pre;
  padding: 14px;
}

.lightbox-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid rgba(245, 245, 245, 0.15);
  padding-top: 18px;
}

.lightbox-nav-btn {
  background: transparent;
  border: 1px solid var(--chartreuse);
  color: var(--white);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.lightbox-nav-btn:hover { background-color: var(--chartreuse); color: var(--black); }

@media (max-width: 768px) {
  .lightbox-panel { flex-direction: column; max-height: 92vh; }
  .lightbox-video, .live-stage { max-height: 42vh; }
}

/* PRIMITIVES */

.section-heading {
  padding: 40px 0 0;
  border-top: 1px solid rgba(245, 245, 245, 0.15);
}

.section-heading h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 10px;
}

.section-sub {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  opacity: 0.75;
  max-width: 560px;
  margin: 0;
}

.primitives-grid { padding-top: 36px; }

.primitive-card {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(245,245,245,0.08) 0%, rgba(0,0,0,0) 70%);
}

.primitive-glyph {
  font-size: 3.4rem;
  opacity: 0.35;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.primitive-card:hover .primitive-glyph,
.primitive-card:focus-visible .primitive-glyph {
  opacity: 0.8;
  transform: rotate(25deg) scale(1.08);
}

/* Rendered via scripts/generate-thumbnails.sh (see js/primitives.js) — the glyph is a
   fallback for a day that doesn't have one yet, hidden automatically once a thumbnail is
   actually present (its onerror handler removes the <img> on a load failure, which drops
   it from this :has() match too). */
.primitive-card:has(.primitive-thumb) .primitive-glyph { display: none; }

.primitive-thumb {
  position: absolute;
  /* inset alone doesn't size a replaced element (img) — width/height default to the image's
     intrinsic size (640x640) regardless, and just get clipped by the card's overflow:hidden.
     width/height here is what actually constrains it; inset only positions it. */
  inset: 8%;
  width: 84%;
  height: 84%;
  object-fit: contain;
  pointer-events: none;
  transition: transform 0.3s ease;
}

.primitive-card:hover .primitive-thumb,
.primitive-card:focus-visible .primitive-thumb {
  transform: scale(1.06);
}

#primitive-lightbox .lightbox-media { height: 70vh; }

.primitive-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

.primitive-canvas:active { cursor: grabbing; }

@media (max-width: 768px) {
  #primitive-lightbox .lightbox-media { height: 42vh; }
}
