/* The Fantoccini LLC — tfc.studio
   Palette:
     --blue   Dark Blue   (canvas)
     --pink   Bright Pink (accent)
     --green  Neon Green  (accent)
*/
:root {
  --blue: #0a0e2a;
  --blue-2: #111634;
  --pink: #ff1f8e;
  --green: #39ff14;
  --ink: #eef0ff;
  --muted: #8b90c0;
  --max: 1080px;
}

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

html, body { height: 100%; }

body {
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--blue);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Live generative background (rendered by engine.js, off the main thread). */
.bg-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
  pointer-events: none;
}

/* Left scrim so hero text stays legible over the animation. */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(10, 14, 42, 0.78) 0%,
    rgba(10, 14, 42, 0.45) 38%,
    rgba(10, 14, 42, 0.05) 68%,
    rgba(10, 14, 42, 0) 100%
  );
}

/* Caption naming the current model, lower-right. */
.bg-caption {
  position: fixed;
  right: 22px;
  bottom: 72px;
  z-index: 2;
  pointer-events: none;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--green);
  opacity: 0;
  transition: opacity 0.9s ease;
  text-shadow: 0 0 14px rgba(57, 255, 20, 0.5);
}
.bg-caption.show { opacity: 0.6; }

/* subtle film-grain overlay */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.bar, .hero, .foot { position: relative; z-index: 2; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px;
}

.wordmark { font-weight: 700; letter-spacing: -0.02em; font-size: 1.1rem; }
.wordmark .dot { color: var(--green); }

.tag {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 8vh 24px 6vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  color: var(--pink);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.82rem;
  margin-bottom: 22px;
}

h1 {
  font-size: clamp(2.8rem, 9vw, 6.5rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-weight: 700;
  max-width: 14ch;
  text-shadow: 0 2px 40px rgba(10, 14, 42, 0.8);
}
h1 .pink { color: var(--pink); }
h1 .green { color: var(--green); }

.lede {
  margin-top: 28px;
  max-width: 46ch;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  line-height: 1.55;
  color: var(--muted);
  text-shadow: 0 1px 20px rgba(10, 14, 42, 0.9);
}

.cta {
  margin-top: 40px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  text-decoration: none;
  font-weight: 700;
  color: var(--blue);
  background: var(--green);
  padding: 14px 26px;
  border-radius: 999px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 0 0 0 rgba(57,255,20,0.5);
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -8px rgba(57,255,20,0.6);
}

.btn-ghost {
  color: var(--ink);
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--pink);
}
.btn-ghost:hover {
  box-shadow: inset 0 0 0 1.5px var(--pink), 0 10px 30px -8px rgba(255, 31, 142, 0.5);
}

.soon {
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

.foot {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--ink);
  border-top: 1px solid rgba(255,255,255,0.07);
}
.foot .muted { color: var(--muted); }

@media (max-width: 560px) {
  .tag { display: none; }
}

/* ============================================================
   The Atelier — marionette creator (puppet.html)
   ============================================================ */
.atelier { height: 100%; overflow: hidden; }

.bg-canvas.dim { opacity: 0.45; }
.scrim-soft {
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(10,14,42,0) 35%, rgba(10,14,42,0.55) 100%);
}

.stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 2;
  touch-action: none;
  cursor: grab;
}
.stage:active { cursor: grabbing; }

.atelier .wordmark { text-decoration: none; color: var(--ink); }

.hint {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 3;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.hint.gone { opacity: 0; }

/* Glass control panel */
.panel {
  position: fixed;
  top: 84px;
  right: 22px;
  z-index: 4;
  width: 280px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding: 20px;
  border-radius: 16px;
  background: rgba(14, 18, 48, 0.66);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
}
.panel-title {
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}
.panel-sub {
  margin: 18px 0 10px;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.field > span em { color: var(--green); font-style: normal; opacity: 0.8; }
.field.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.field.row > span { margin-bottom: 0; }

.field input[type="text"] {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 14, 42, 0.6);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
}
.field input[type="text"]:focus {
  outline: none;
  border-color: var(--pink);
}

input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.7);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border: none; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.7);
  cursor: pointer;
}
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--pink); }

.swatches, .seg { display: flex; gap: 8px; }
.swatch {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease;
}
.swatch:hover { transform: scale(1.1); }
.swatch.on { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(10,14,42,0.8), 0 0 12px currentColor; }

.seg { width: 100%; }
.hat-opt {
  flex: 1;
  padding: 8px 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 14, 42, 0.5);
  color: rgba(238, 240, 255, 0.7);
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.hat-opt.on { color: var(--blue); border-color: var(--blue); }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
.mini {
  padding: 10px 0;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 14, 42, 0.5);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.mini:hover { transform: translateY(-1px); border-color: var(--pink); }
.mini.accent { background: var(--green); color: var(--blue); border-color: var(--green); font-weight: 700; }

.gallery { display: flex; flex-direction: column; gap: 7px; }
.hint-sm { color: var(--muted); font-size: 0.8rem; }
.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 9px;
  background: rgba(10, 14, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.chip .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.chip-name { flex: 1; font-size: 0.85rem; cursor: pointer; }
.chip-name:hover { color: var(--green); }
.chip-x {
  background: none; border: none; color: var(--muted);
  font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 2px;
}
.chip-x:hover { color: var(--pink); }

@media (max-width: 640px) {
  .panel {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 46vh;
    border-radius: 16px 16px 0 0;
  }
  .hint { bottom: calc(46vh + 14px); }
}

/* ============================================================
   Atelier side-door (landing) + expanded creator controls
   ============================================================ */

/* Hidden side-door into the workshop — understated, gently pulsing. */
.atelier-tab {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0;
  height: 46px;
  padding: 0 12px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
  background: rgba(14, 18, 48, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 31, 142, 0.35);
  box-shadow: 0 0 0 0 rgba(255, 31, 142, 0.4);
  animation: atelierPulse 3.6s ease-in-out infinite;
  transition: gap 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  overflow: hidden;
}
.atelier-tab-icon { display: flex; color: var(--green); flex: none; }
.atelier-tab-label {
  max-width: 0;
  opacity: 0;
  white-space: nowrap;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: max-width 0.3s ease, opacity 0.3s ease;
}
.atelier-tab:hover {
  gap: 10px;
  border-color: var(--green);
  background: rgba(14, 18, 48, 0.8);
}
.atelier-tab:hover .atelier-tab-label { max-width: 160px; opacity: 0.85; }
.atelier-tab:hover .atelier-tab-icon { color: var(--pink); }

@keyframes atelierPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 31, 142, 0.0); }
  50% { box-shadow: 0 0 18px 2px rgba(255, 31, 142, 0.28); }
}
@media (prefers-reduced-motion: reduce) {
  .atelier-tab { animation: none; }
}

/* Creator: segmented option buttons (wrap so many fit) */
.panel-mark { color: var(--green); font-size: 0.9em; opacity: 0.8; }
.seg { flex-wrap: wrap; }
.seg-opt {
  flex: 1 1 auto;
  min-width: 54px;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 14, 42, 0.5);
  color: rgba(238, 240, 255, 0.7);
  font-family: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.12s ease, color 0.12s ease;
}
.seg-opt:hover { transform: translateY(-1px); border-color: rgba(255, 31, 142, 0.6); }
.seg-opt.on {
  color: var(--blue);
  border-color: var(--blue);
  box-shadow: inset 0 0 10px rgba(86, 156, 255, 0.18);
}
