/* ===================== TOKENS ===================== */
:root {
  --sky: #8FDCF7;
  --mint: #A8F0C6;
  --pink: #FFAECD;
  --ink: #1A1A1A;
  --paper: #FDFDF9;
  --paper-dim: #F2F1E9;
  --navy: #0F1B22;
  --navy-card: #16262F;
  --navy-line: #EAF6FB;

  --bg: var(--paper);
  --bg-soft: var(--paper-dim);
  --surface: #FFFFFF;
  --text: var(--ink);
  --text-soft: #55584f;
  --line: var(--ink);
  --shadow-color: rgba(26,26,26,0.18);

  --radius-lg: 28px;
  --radius-md: 18px;
  --border-w: 3px;
}

[data-theme="dark"] {
  --bg: var(--navy);
  --bg-soft: #0B1418;
  --surface: var(--navy-card);
  --text: var(--navy-line);
  --text-soft: #9FB4BC;
  --line: var(--navy-line);
  --shadow-color: rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  transition: background 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

h1, h2, h3 { font-family: 'Fredoka', sans-serif; margin: 0; }

.eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--text-soft);
  margin: 0 0 0.75rem;
  text-transform: uppercase;
}

/* ===================== THEME TOGGLE ===================== */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: var(--border-w) solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 3px 3px 0 var(--shadow-color);
  transition: transform 0.15s ease, background 0.4s ease, box-shadow 0.4s ease;
}
.theme-toggle:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--shadow-color); }
.theme-toggle:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--shadow-color); }
.theme-toggle:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }

/* ===================== HERO ===================== */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  padding: 6rem 6vw 4rem;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky) 0%, var(--bg) 100%);
}
[data-theme="dark"] .hero {
  background: linear-gradient(180deg, #16323d 0%, var(--bg) 100%);
}

.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(0px);
  opacity: 0.6;
  z-index: 0;
}
.blob-1 { width: 220px; height: 220px; background: var(--pink); top: 8%; left: 6%; animation: float 7s ease-in-out infinite; }
.blob-2 { width: 140px; height: 140px; background: var(--mint); bottom: 12%; left: 12%; animation: float 9s ease-in-out infinite reverse; }
.blob-3 { width: 90px; height: 90px; background: var(--paper); border: var(--border-w) solid var(--line); top: 18%; right: 10%; animation: float 6s ease-in-out infinite; }
[data-theme="dark"] .blob-3 { background: var(--navy-card); }

@keyframes float {
  0%, 100% { transform: translateY(0px) translateX(0px); }
  50% { transform: translateY(-24px) translateX(10px); }
}

.hero-content { position: relative; z-index: 2; max-width: 520px; }
.hero-title { font-size: clamp(2.6rem, 6vw, 4.2rem); line-height: 1.05; font-weight: 700; color: var(--text); }
.hero-title .highlight {
  color: var(--pink);
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
}
[data-theme="dark"] .hero-title .highlight { -webkit-text-stroke: 2px var(--navy-line); }

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-soft);
  line-height: 1.6;
  margin: 1.25rem 0 2rem;
}

.scroll-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.5rem;
  background: var(--pink);
  color: var(--ink);
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  text-decoration: none;
  border: var(--border-w) solid var(--line);
  border-radius: 999px;
  box-shadow: 4px 4px 0 var(--shadow-color);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.scroll-cta:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--shadow-color); }
.scroll-cta:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--shadow-color); }
.scroll-arrow { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(4px);} }

.hero-figure { position: relative; z-index: 2; }
.figure-card {
  position: relative;
  width: min(340px, 78vw);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 14px;
  box-shadow: 8px 8px 0 var(--shadow-color);
  transform: rotate(-3deg);
  transition: transform 0.3s ease, box-shadow 0.4s ease;
}
.figure-card:hover { transform: rotate(0deg) translateY(-4px); }
.hero-img { width: 100%; display: block; border-radius: calc(var(--radius-lg) - 10px); }
.figure-tag {
  position: absolute;
  bottom: -14px;
  right: 20px;
  background: var(--mint);
  color: var(--ink);
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  padding: 5px 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
}

/* ===================== GALLERY ===================== */
.gallery { padding: 5rem 6vw 6rem; background: var(--bg); }
.gallery-header { text-align: center; max-width: 620px; margin: 0 auto 3rem; }
.gallery-title { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 0.5rem; }
.gallery-sub { color: var(--text-soft); margin: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  grid-auto-rows: 8px; /* small unit row — JS spans each card across the right number of rows */
  gap: 1.75rem;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 5px 5px 0 var(--shadow-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translate(-3px,-3px) rotate(-1deg); box-shadow: 8px 8px 0 var(--shadow-color); }
.card:active { transform: translate(1px,1px); box-shadow: 2px 2px 0 var(--shadow-color); }
.card:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }

.card-media {
  width: 100%;
  display: block;
  border-bottom: var(--border-w) solid var(--line);
  position: relative;
  overflow: hidden;
  background: var(--bg-soft);
}
/* Real images keep their natural aspect ratio — no cropping */
.card-media img { width: 100%; height: auto; display: block; }
/* Color placeholders (no image yet) get an assigned ratio so the demo shows mixed sizes */
.card-media .placeholder-fill { width: 100%; display: block; }

.card-body { padding: 0.9rem 1rem 1.1rem; }
.card-num { font-family: 'Space Mono', monospace; font-size: 0.7rem; color: var(--text-soft); }
.card-artist { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 1.05rem; margin: 0.15rem 0 0.15rem; }
.card-x {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-soft);
  text-decoration: none;
  margin-top: 0.2rem;
}
.card-x:hover { color: var(--text); }
.card-x .x-icon { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }

/* ===================== MODAL ===================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,27,34,0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vw;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }

.modal-card {
  position: relative;
  background: var(--surface);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  box-shadow: 10px 10px 0 rgba(0,0,0,0.35);
  transform: scale(0.92) translateY(10px);
  transition: transform 0.25s ease;
}
.modal-backdrop.open .modal-card { transform: scale(1) translateY(0); }

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--pink);
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
  z-index: 5;
}

.modal-media { background: var(--bg-soft); display: flex; align-items: center; justify-content: center; }
.modal-media img { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 260px; }

.modal-info { padding: 2.2rem 2rem; display: flex; flex-direction: column; gap: 0.6rem; }
.modal-num { font-family: 'Space Mono', monospace; font-size: 0.75rem; color: var(--text-soft); }
.modal-info h3 { font-size: 1.6rem; }
.modal-x {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  background: var(--mint);
  color: var(--ink);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
  border: 2px solid var(--line);
  width: fit-content;
  margin: 0.2rem 0 0.6rem;
  transition: transform 0.15s ease;
}
.modal-x:hover { transform: translateY(-2px); }
.modal-x .x-icon { width: 13px; height: 13px; fill: currentColor; }
.modal-desc { color: var(--text-soft); line-height: 1.65; margin: 0; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 720px) {
  .hero { padding: 6rem 6vw 3rem; flex-direction: column-reverse; text-align: center; }
  .hero-content { max-width: 100%; }
  .hero-sub { margin-left: auto; margin-right: auto; }
  .modal-card { grid-template-columns: 1fr; }
  .modal-media img { min-height: 220px; }
}

.collage-btn {
  position: fixed;
  top: 20px;
  right: 84px;
  z-index: 200;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid var(--line, #1A1A1A);
  background: var(--pink, #FFAECD);
  color: var(--ink, #1A1A1A);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.collage-btn:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 rgba(0,0,0,0.18); }
.collage-btn:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 rgba(0,0,0,0.18); }

@media (max-width: 480px) {
  .collage-btn { right: 20px; top: 80px; }
}

.collage-card {
  position: relative;
  background: var(--surface, #fff);
  border: 3px solid var(--line, #1A1A1A);
  border-radius: 28px;
  max-width: 720px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 10px 10px 0 rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.collage-preview-wrap { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.collage-status {
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-soft, #666);
  margin: 0;
}
.collage-canvas {
  width: 100%;
  height: auto;
  border-radius: 18px;
  border: 2px solid var(--line, #1A1A1A);
  display: none;
}
.collage-canvas.ready { display: block; }

.collage-actions { width: 100%; display: flex; justify-content: center; }
.collage-download { pointer-events: none; opacity: 0.5; }
.collage-download.enabled { pointer-events: auto; opacity: 1; }