/* ==========================================================================
   Sea of Dance — design tokens
   Display: Fraunces (fluid, watery curves) · Body: Manrope · Utility: JetBrains Mono
   ========================================================================== */

:root {
  --font-display: "Fraunces", serif;
  --font-body: "Manrope", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;

  --ease-glass: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  --bg: #071019;
  --bg-deep: #04090f;
  --text: #eaf6f6;
  --text-dim: #9fb6bb;
  --text-faint: #6b8388;

  --glass-fill: rgba(255, 255, 255, 0.055);
  --glass-fill-strong: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.5);

  --accent: #59d9c9;
  --accent-strong: #7de8da;
  --accent-coral: #ff93ad;
  --accent-ink: #04211f;

  --blob-1: rgba(89, 217, 201, 0.16);
  --blob-2: rgba(255, 147, 173, 0.10);
  --blob-3: rgba(94, 140, 255, 0.10);

  --shadow-glass: 0 20px 60px -20px rgba(0, 0, 0, 0.65);
}

html[data-theme="light"] {
  --bg: #eef6f6;
  --bg-deep: #dcedec;
  --text: #0c2226;
  --text-dim: #47656a;
  --text-faint: #7d9599;

  --glass-fill: rgba(255, 255, 255, 0.5);
  --glass-fill-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(11, 40, 45, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.9);

  --accent: #0f9b8e;
  --accent-strong: #0c8478;
  --accent-coral: #e0527a;
  --accent-ink: #ffffff;

  --blob-1: rgba(15, 155, 142, 0.14);
  --blob-2: rgba(224, 82, 122, 0.08);
  --blob-3: rgba(76, 130, 220, 0.10);

  --shadow-glass: 0 20px 50px -24px rgba(11, 40, 45, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  transition: background 0.5s var(--ease-glass), color 0.5s var(--ease-glass);
  overflow-x: hidden;
  position: relative;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- ambient caustic background ---------- */

.caustics {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.9;
}
.blob-a {
  width: 42vw; height: 42vw;
  background: var(--blob-1);
  top: -10%; left: -8%;
  animation: drift-a 26s ease-in-out infinite;
}
.blob-b {
  width: 36vw; height: 36vw;
  background: var(--blob-2);
  bottom: -12%; right: -6%;
  animation: drift-b 32s ease-in-out infinite;
}
.blob-c {
  width: 30vw; height: 30vw;
  background: var(--blob-3);
  top: 40%; left: 60%;
  animation: drift-c 22s ease-in-out infinite;
}
@keyframes drift-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6vw, 8vh) scale(1.12); }
}
@keyframes drift-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-5vw, -6vh) scale(1.08); }
}
@keyframes drift-c {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-4vw, 5vh) scale(0.94); }
}

/* ---------- glass panel base ---------- */

.glass-panel {
  position: relative;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--shadow-glass);
}
.glass-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(155deg, var(--glass-highlight), transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.5;
  pointer-events: none;
}

/* ---------- topbar ---------- */

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 28px 0;
}

.wordmark {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 0.01em;
}
.wordmark-glyph {
  color: var(--accent);
  font-size: 22px;
  font-weight: 400;
}

.theme-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.theme-toggle-track {
  display: flex;
  align-items: center;
  width: 56px;
  height: 30px;
  border-radius: 999px;
  background: var(--glass-fill-strong);
  border: 1px solid var(--glass-border);
  padding: 3px;
  transition: background 0.4s var(--ease-glass);
}
.theme-toggle-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-ink);
  transform: translateX(0);
  transition: transform 0.45s var(--ease-glass), background 0.4s;
}
html[data-theme="light"] .theme-toggle-thumb {
  transform: translateX(26px);
}
.theme-toggle .icon { width: 15px; height: 15px; }
.icon-sun { display: none; }
html[data-theme="light"] .icon-sun { display: block; }
html[data-theme="light"] .icon-moon { display: none; }

/* ---------- stage / hero ---------- */

.stage {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 64px 28px 40px;
}

.hero {
  max-width: 620px;
  margin-bottom: 56px;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 18px;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(34px, 5.2vw, 54px);
  line-height: 1.06;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
}
.hero-sub {
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--text-dim);
  margin: 0;
  max-width: 52ch;
}

/* ---------- workbench layout ---------- */

.workbench {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 780px) {
  .workbench { grid-template-columns: 1fr; }
}

/* ---------- porthole upload ---------- */

.porthole-panel {
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.porthole {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  background:
    radial-gradient(circle at 32% 28%, var(--glass-highlight), transparent 45%),
    var(--glass-fill-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.3s, transform 0.3s var(--ease-glass);
}
.porthole:hover, .porthole:focus-visible {
  border-color: var(--accent);
  transform: scale(1.015);
  outline: none;
}
.porthole.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 6px rgba(89, 217, 201, 0.12);
}

.porthole-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.porthole-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  padding: 0 24px;
}
.porthole-icon { width: 26px; height: 26px; color: var(--text-faint); }

.porthole-clear {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.porthole-caption {
  font-size: 12px;
  color: var(--text-faint);
  margin: 0;
}

/* ---------- controls panel ---------- */

.controls-panel {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.prompt-field {
  width: 100%;
  resize: vertical;
  min-height: 96px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass-fill-strong);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.55;
  outline: none;
  transition: border-color 0.25s;
}
.prompt-field::placeholder { color: var(--text-faint); }
.prompt-field:focus { border-color: var(--accent); }

.control-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 480px) {
  .control-row { grid-template-columns: 1fr; }
}

.select-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.select-field label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.select-field select {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass-fill-strong);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
  outline: none;
  cursor: pointer;
}

.generate-btn {
  margin-top: 6px;
  padding: 14px 22px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--accent-ink);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.2s var(--ease-glass), box-shadow 0.3s;
  box-shadow: 0 12px 28px -12px rgba(89, 217, 201, 0.55);
}
.generate-btn:hover { transform: translateY(-1px); }
.generate-btn:active { transform: translateY(0); }
.generate-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.generate-spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.25);
  border-top-color: currentColor;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status-line {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-faint);
  min-height: 16px;
  margin: 2px 0 0;
}
.status-line[data-state="error"] { color: var(--accent-coral); }
.status-line[data-state="ok"] { color: var(--accent); }

/* ---------- gallery ---------- */

.gallery-section {
  margin-top: 48px;
}
.gallery-section h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  margin: 0 0 18px;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.gallery-card {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
}
.gallery-card video {
  width: 100%;
  border-radius: var(--radius-sm);
  display: block;
  background: #000;
}
.gallery-card p {
  font-size: 12.5px;
  color: var(--text-dim);
  margin: 10px 2px 0;
  line-height: 1.4;
}

/* ---------- footer ---------- */

.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 30px 20px 44px;
  font-size: 12px;
  color: var(--text-faint);
}
.site-footer code {
  font-family: var(--font-mono);
  background: var(--glass-fill-strong);
  padding: 2px 6px;
  border-radius: 5px;
}
