/* ============================================
   Flow Studies Gallery — Kestrel, 2026
   Copper Horizon on warm dark
   ============================================ */

:root {
  --bg-deep: #14100c;
  --bg-card: #1c1812;
  --bg-elevated: #241e16;
  --ink: #e8ddd0;
  --ink-soft: #a89a87;
  --ink-faint: #5c4f3e;
  --copper: #c08552;
  --copper-bright: #e2a06d;
  --copper-glow: rgba(192, 133, 82, 0.15);
  --border: #2a2218;
  --border-bright: #3d3122;
  --serif: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ============================================
   Hero
   ============================================ */

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4rem 2rem;
  position: relative;
  background: radial-gradient(ellipse at center, var(--bg-elevated) 0%, var(--bg-deep) 70%);
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(circle at 30% 40%, rgba(192, 133, 82, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(192, 133, 82, 0.04) 0%, transparent 40%);
  pointer-events: none;
}

.hero-mark {
  font-family: var(--serif);
  font-size: 0.85rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--copper);
  margin-bottom: 2rem;
  position: relative;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  position: relative;
}

.hero h1 em {
  font-style: italic;
  color: var(--copper-bright);
}

.hero-statement {
  max-width: 520px;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink-soft);
  margin-bottom: 3rem;
  position: relative;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 2rem;
  border: 1px solid var(--copper);
  color: var(--copper-bright);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  transition: all 0.3s ease;
  position: relative;
}

.hero-cta:hover {
  background: var(--copper);
  color: var(--bg-deep);
}

/* ============================================
   Series Navigation
   ============================================ */

.series-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(20, 16, 12, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.series-nav a {
  color: var(--ink-faint);
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.2s;
  white-space: nowrap;
}

.series-nav a:hover,
.series-nav a.active {
  color: var(--copper-bright);
}

.series-nav a span {
  color: var(--ink-faint);
  margin-right: 0.4rem;
}

/* ============================================
   Series Section
   ============================================ */

.series-section {
  padding: 5rem 2rem 3rem;
  max-width: 1400px;
  margin: 0 auto;
}

.series-header {
  margin-bottom: 3rem;
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.series-number {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--copper);
  letter-spacing: 0.2em;
}

.series-title {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--ink);
}

.series-desc {
  font-size: 0.9rem;
  color: var(--ink-soft);
  max-width: 600px;
  margin-top: 0.5rem;
  line-height: 1.6;
}

/* ============================================
   Gallery Grid
   ============================================ */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2rem;
}

.gallery-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.gallery-item:hover {
  border-color: var(--copper);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4), 0 0 0 1px var(--copper-glow);
}

.gallery-item-frame {
  background: var(--bg-elevated);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.gallery-item-frame svg {
  width: 92%;
  height: 92%;
}

/* Dark-background pieces need full frame coverage */
.gallery-item-frame[data-bg="dark"] svg {
  width: 100%;
  height: 100%;
}

.gallery-item-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 80%, rgba(0,0,0,0.3) 100%);
  pointer-events: none;
}

.gallery-item-info {
  padding: 1.2rem 1.4rem;
}

.gallery-item-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ink);
  margin-bottom: 0.3rem;
}

.gallery-item-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.gallery-item-meta .rating {
  color: var(--copper);
  font-family: var(--mono);
}

.gallery-item-meta .seed {
  font-family: var(--mono);
}

/* ============================================
   Lightbox
   ============================================ */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 8, 6, 0.96);
  backdrop-filter: blur(8px);
}

.lightbox.active {
  display: flex;
}

.lightbox-inner {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 380px;
  overflow: hidden;
}

.lightbox-view {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.lightbox-view svg {
  max-width: 100%;
  max-height: 100%;
}

.lightbox-panel {
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  padding: 3rem 2rem 2rem;
  overflow-y: auto;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.lightbox-close:hover { color: var(--copper-bright); }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 2rem;
  cursor: pointer;
  padding: 1rem 0.5rem;
  transition: color 0.2s;
  z-index: 5;
}

.lightbox-nav:hover { color: var(--copper-bright); }
.lightbox-nav.prev { left: 0; }
.lightbox-nav.next { right: 0; }

.lightbox-series {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--copper);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.lightbox-title {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.lightbox-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem 1.2rem;
  font-size: 0.85rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.lightbox-meta dt {
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.lightbox-meta dd {
  color: var(--ink);
}

.lightbox-desc {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}

.lightbox-desc strong {
  color: var(--ink);
  font-weight: 500;
}

/* ============================================
   About Section
   ============================================ */

.about {
  max-width: 720px;
  margin: 0 auto;
  padding: 6rem 2rem 4rem;
}

.about h2 {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
  color: var(--ink);
}

.about p {
  margin-bottom: 1.2rem;
  color: var(--ink-soft);
  line-height: 1.8;
}

.about .principle {
  border-left: 2px solid var(--copper);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--ink);
  line-height: 1.6;
}

.about-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--ink-faint);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 900px) {
  .lightbox-inner {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .lightbox-panel {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 40vh;
    padding: 2rem 1.5rem 1.5rem;
  }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
  }
}

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  .hero h1 { font-size: 2.5rem; }
  .series-nav { gap: 1rem; padding: 0.8rem 1rem; }
  .series-nav a { font-size: 0.7rem; }
}

/* ============================================
   Fade-in animation
   ============================================ */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.gallery-item {
  animation: fadeIn 0.5s ease forwards;
  opacity: 0;
}

.gallery-item:nth-child(1) { animation-delay: 0.05s; }
.gallery-item:nth-child(2) { animation-delay: 0.1s; }
.gallery-item:nth-child(3) { animation-delay: 0.15s; }
.gallery-item:nth-child(4) { animation-delay: 0.2s; }
.gallery-item:nth-child(5) { animation-delay: 0.25s; }
.gallery-item:nth-child(6) { animation-delay: 0.3s; }
