/* ═══════════════════════════════════════════════════════
   Think With AI — styles.css
   CSS owns all visuals: transitions, animations, colors, layout.
   JS only toggles classes / data-attributes.
   ═══════════════════════════════════════════════════════ */

/* ─── Custom Properties ─── */
:root {
  /* Canvas */
  --canvas:       hsl(30, 10%, 94%);
  --canvas-mid:   hsl(28, 15%, 90%);
  --canvas-edge:  hsl(25, 20%, 88%);

  /* Typography */
  --ink:          hsl(20, 10%, 10%);
  --subtitle:     hsl(28, 18%, 55%);
  --muted:        hsl(20, 8%, 45%);

  /* Accents */
  --accent-glow:   hsl(25, 95%, 55%);
  --accent-stroke: hsl(25, 80%, 55%);
  --accent-muted:  hsl(26, 55%, 58%);

  /* Ring colors */
  --ring-1: hsl(30, 6%, 80%);
  --ring-2: hsl(30, 8%, 78%);
  --ring-3: hsl(28, 12%, 73%);
  --ring-4: hsl(28, 20%, 68%);
  --ring-5: hsl(27, 35%, 63%);
  --ring-6: hsl(26, 55%, 58%);
  --ring-7: hsl(25, 80%, 55%);

  /* Radial bg shorthand */
  --bg-radial: radial-gradient(
    circle at center,
    var(--canvas) 0%,
    var(--canvas-mid) 50%,
    var(--canvas-edge) 100%
  );
}

/* ─── Reset & Base ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Satoshi', sans-serif;
  color: var(--ink);
  background: var(--canvas);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Visually hidden — accessible labels */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Scroll Container ─── */
#scroll-container {
  height: 100vh; /* fallback */
  height: 100dvh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  position: relative;
}

#scroll-container.snap-off {
  scroll-snap-type: none;
}

/* ─── Sections ─── */
section {
  min-height: 100vh;
  min-height: 100svh;
  height: 100dvh;
  scroll-snap-align: start;
  position: relative;
  overflow: hidden;
  background: var(--bg-radial);
}

/* ─── Center Wrap ─── */
.center-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.center-wrap-s2 {
  transform: translateY(-10vh);
}

/* ─── Headings ─── */
.heading {
  position: relative;
  z-index: 10;
  font-weight: 900;
  font-size: max(24px, 7.333vmin);
  line-height: 1;
  letter-spacing: -0.04em;
  text-align: center;
  color: var(--ink);
  user-select: none;
  text-transform: lowercase;
}

.char-span {
  display: inline-block;
  opacity: 0;
}

.char-space {
  min-width: 0.3em;
}

.placeholder-char-space {
  min-width: 0.5em;
}

/* ─── Subtitles ─── */
.subtitle {
  position: relative;
  z-index: 10;
  margin-top: max(10px, 1.667vmin);
  font-size: max(8px, 1vmin);
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--subtitle);
  opacity: 0;
  transition: opacity 0.8s ease;
}

.subtitle.visible {
  opacity: 1;
}

/* ─── Glow Blob (4-layer nesting) ─── */
.glow-blob {
  position: absolute;
  z-index: 1;
  /* JS sets transform for parallax */
  will-change: transform;
}

.glow-blob-s1 {
  width: 420px;
  height: 420px;
}

.glow-blob-s2 {
  width: 55vmin;
  height: 55vmin;
}

.glow-entrance {
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: scale(0);
  /* Activated by .blob-active class */
}

.glow-entrance.blob-active {
  animation: blob-entrance 2s ease-out forwards;
}

.glow-morph {
  width: 100%;
  height: 100%;
  border-radius: 40% 60% 60% 40% / 60% 30% 70% 40%;
  animation: morph 12s ease-in-out infinite;
}

.glow-inner {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-glow);
  opacity: 0.10;
  filter: blur(100px);
}

/* ─── SVG Rings ─── */
.rings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.ring-circle {
  fill: none;
  stroke-dashoffset: var(--circ); /* set by JS */
  stroke-dasharray: var(--circ);  /* set by JS */
}

.ring-circle.ring-active {
  animation: dash 2s var(--ring-delay, 0s) ease-out forwards;
}

.ring-7.ring-active {
  animation: dash 2s var(--ring-delay, 0s) ease-out forwards,
             pulse-ring 3s calc(var(--ring-delay, 0s) + 2s) ease-in-out infinite;
}

/* ─── Scroll Arrow ─── */
.scroll-arrow {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  margin-left: -24px; /* half of 48px icon */
  z-index: 10;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--subtitle);
  opacity: 0;
  pointer-events: none;
  transition: color 0.15s, opacity 0.5s ease;
  padding: 0;
}

.scroll-arrow.visible {
  opacity: 1;
  pointer-events: auto;
  animation: bounce-arrow 2s ease-in-out infinite;
}

.scroll-arrow:hover {
  color: var(--ink);
}

/* ─── Input Line Wrap (Section 2) ─── */
.input-line-wrap {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Position: vertically below rings center. 
     calc(50% + 37.42vmin) matches (365/1200)*100 + 7 = ~37.42 vmin offset from center */
  top: calc(50% + 37.42vmin);
  transform: translateY(-10vh);
  padding: 0 1.5rem;
  opacity: 0;
  pointer-events: none;
  scroll-margin-top: 40px;
  cursor: pointer;
}

.input-line-wrap.visible {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.3s ease;
}

/* Inner container for input + underline + placeholder */
.input-line-inner {
  position: relative;
  width: 73vmin;
}

/* The actual input */
.line-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'Satoshi', sans-serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.15em;
  color: var(--ink);
  text-align: center;
  padding: 20px 32px;
  position: relative;
  z-index: 2;
}

#section2 .line-input::placeholder {
  color: transparent; /* We use the custom placeholder overlay */
}

.line-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
  transition: color 0.15s;
}

.line-input:hover::placeholder {
  color: var(--ink);
}

/* The underline that draws in */
.input-underline {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  transform: scaleX(0);
  transform-origin: left;
  height: 1.5px;
  background: var(--accent-stroke);
}

.input-underline.draw {
  animation: draw-line 1.2s ease-out forwards;
}

/* Placeholder text overlay (typed char-by-char) */
.placeholder-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  font-family: 'Satoshi', sans-serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.15em;
  color: var(--muted);
  opacity: 0.7;
  text-align: center;
  pointer-events: none;
  padding: 20px 32px;
  display: flex;
  justify-content: center;
}

.placeholder-text .char-span {
  display: inline-block;
  opacity: 0;
}

/* Hide placeholder text once input has real value or is focused */
.input-line-wrap.input-focused .placeholder-text,
.input-line-wrap.has-value .placeholder-text {
  display: none;
}

/* ─── Form Overlay ─── */
.form-overlay {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  display: flex;
  justify-content: center;
}

[data-form-state="revealed"] .form-overlay {
  opacity: 1;
  pointer-events: auto;
}

.form-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ─── Form Line Inputs ─── */
.form-line-input {
  width: 100%;
  max-width: none;
  border-bottom: 1.5px solid var(--accent-stroke);
}

.form-field-wrap {
  width: clamp(280px, 42vw, 520px);
  opacity: 0;
  transform: scale(0.9);
}

/* ─── Connector Lines ─── */
.connector-line {
  width: 1.5px;
  height: 0;
  opacity: 0;
  background: linear-gradient(to bottom, transparent, var(--accent-stroke), transparent);
  margin: 24px 0;
}

/* ─── Pill Button ─── */
.pill-button {
  height: 56px;
  width: clamp(180px, 28vw, 320px);
  border-radius: 9999px;
  border: 1.5px solid var(--accent-stroke);
  background: transparent;
  color: var(--ink);
  font-family: 'Satoshi', sans-serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 12px hsla(25, 80%, 55%, 0.25);
  margin-top: 8px;
  opacity: 0;
  transition: color 0.15s, background-color 0.15s;
}

.pill-button:hover {
  background: var(--accent-stroke);
  color: white;
}

/* ─── Form Reveal Stagger (CSS-driven, keyed off data-form-state) ─── */
[data-form-state="revealed"] .connector-1 {
  animation: grow-connector 1.8s 0.2s ease-out forwards;
}

[data-form-state="revealed"] .email-field {
  animation: scale-fade-in 0.7s 0.8s ease-out forwards;
}

[data-form-state="revealed"] .connector-2 {
  animation: grow-connector 1.8s 1.0s ease-out forwards;
}

[data-form-state="revealed"] .name-field {
  animation: scale-fade-in 0.7s 1.6s ease-out forwards;
}

[data-form-state="revealed"] .connector-3 {
  animation: grow-connector 1.8s 1.8s ease-out forwards;
}

[data-form-state="revealed"] .pill-button {
  animation: fade-in 0.8s 2.4s ease forwards;
}

/* ─── Spacer ─── */
.spacer {
  height: 200vh;
  background: var(--bg-radial);
}

/* ─── Responsive ─── */
@media (min-width: 768px) {
  .glow-blob-s1 {
    width: 600px;
    height: 600px;
  }
}

/* ═══════════════════════════════════════════════════════
   KEYFRAMES
   ═══════════════════════════════════════════════════════ */

/* Blob morph (border-radius) — 12s infinite */
@keyframes morph {
  0%   { border-radius: 40% 60% 60% 40% / 60% 30% 70% 40%; }
  25%  { border-radius: 60% 40% 30% 70% / 40% 60% 40% 60%; }
  50%  { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
  75%  { border-radius: 50% 40% 50% 60% / 35% 50% 70% 30%; }
  100% { border-radius: 40% 60% 60% 40% / 60% 30% 70% 40%; }
}

/* Blob entrance — scale(0) → scale(1) */
@keyframes blob-entrance {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Ring draw-in — dashoffset to 0 */
@keyframes dash {
  to { stroke-dashoffset: 0; }
}

/* Ring 7 pulse */
@keyframes pulse-ring {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* Arrow bounce */
@keyframes bounce-arrow {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(8px); }
}

/* Generic fade-in */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Input underline draw from left */
@keyframes draw-line {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* Form field scale + fade */
@keyframes scale-fade-in {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

/* Connector line grow */
@keyframes grow-connector {
  0%   { height: 0;     opacity: 0; }
  30%  { height: 33px;  opacity: 0.8; }
  60%  { height: 66px;  opacity: 0.7; }
  100% { height: 110px; opacity: 0.4; }
}

/* ═══════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════ */

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

  /* Rings: show fully drawn */
  .ring-circle {
    stroke-dashoffset: 0 !important;
  }

  /* Headings: show full text */
  .char-span {
    opacity: 1 !important;
  }

  /* Blob: visible, static */
  .glow-entrance {
    opacity: 1 !important;
    transform: scale(1) !important;
  }

  /* Subtitle: visible */
  .subtitle {
    opacity: 1 !important;
  }

  /* Arrow: visible, static, interactive */
  .scroll-arrow {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Input wrap: visible, interactive */
  .input-line-wrap {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Underline: visible */
  .input-underline {
    transform: scaleX(1) !important;
  }

  /* Placeholder chars: visible */
  .placeholder-text .char-span {
    opacity: 1 !important;
  }

  /* Form fields: visible */
  .form-field-wrap {
    opacity: 1 !important;
    transform: scale(1) !important;
  }

  .connector-line {
    height: 110px !important;
    opacity: 0.4 !important;
  }

  .pill-button {
    opacity: 1 !important;
  }

  /* Scroll behavior */
  #scroll-container {
    scroll-behavior: auto;
  }
}
