/* =========================================================
   MarifeX — cinematic brand teaser
   ========================================================= */

:root {
  --bg-0: #000000;
  --bg-1: #050507;
  --bg-2: #0a0c10;

  --ink: #f4f5f7;
  --ink-dim: #9aa1ab;
  --ink-faint: #565b63;

  --cyan: #4fe0f2;
  --blue: #2f6fd6;
  --orange: #ff8f3d;

  --glass-bg: rgba(255, 255, 255, 0.035);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-highlight: rgba(255, 255, 255, 0.06);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-snap: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --font-display: 'Bahnschrift', 'Century Gothic', 'Segoe UI Variable Display', 'Segoe UI',
    -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;

  color-scheme: dark;
}

* { box-sizing: border-box; }

::selection {
  background: rgba(79, 224, 242, 0.22);
  color: var(--ink);
}

html {
  scroll-behavior: smooth;
  background: var(--bg-0);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  cursor: default;
}

.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;
}

/* ---------------------------------------------------------
   Ambient background — layered, slow-drifting glow
   --------------------------------------------------------- */

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -20vh -20vw;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(38vw 38vw at 22% 28%, rgba(47, 111, 214, 0.16), transparent 60%),
    radial-gradient(30vw 30vw at 78% 68%, rgba(79, 224, 242, 0.08), transparent 62%),
    radial-gradient(26vw 26vw at 60% 12%, rgba(255, 143, 61, 0.05), transparent 65%);
  animation: drift 42s ease-in-out infinite alternate;
  will-change: transform;
}

body::after {
  background:
    radial-gradient(24vw 24vw at 82% 20%, rgba(47, 111, 214, 0.10), transparent 60%),
    radial-gradient(34vw 34vw at 15% 78%, rgba(79, 224, 242, 0.06), transparent 62%);
  animation-duration: 58s;
  animation-direction: alternate-reverse;
}

@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(2%, -3%, 0) scale(1.04); }
  100% { transform: translate3d(-3%, 2%, 0) scale(1.02); }
}

#field {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: screen;
}

.cursor-glow {
  position: fixed;
  top: 0; left: 0;
  width: 480px; height: 480px;
  margin: -240px 0 0 -240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 224, 242, 0.10) 0%, rgba(47, 111, 214, 0.05) 40%, transparent 72%);
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
  will-change: transform;
}

.cursor-glow.active { opacity: 1; }

.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: var(--ink);
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  --cx: 0px;
  --cy: 0px;
  --cs: 1;
  transform: translate3d(var(--cx), var(--cy), 0) scale(var(--cs));
  transition: opacity 0.3s var(--ease-snap), transform 0.18s var(--ease-snap);
  will-change: transform;
}

.cursor-dot.active { opacity: 0.85; }
.cursor-dot.pointer { --cs: 2.6; }

body.custom-cursor, body.custom-cursor a, body.custom-cursor button, body.custom-cursor input {
  cursor: none;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 180px 180px;
}

/* ---------------------------------------------------------
   Layout
   --------------------------------------------------------- */

main {
  position: relative;
  z-index: 3;
  scroll-snap-type: y proximity;
}

.screen {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8vh 6vw;
  scroll-snap-align: start;
  position: relative;
}

[data-reveal]::before {
  content: attr(data-chapter);
  position: absolute;
  top: 6vh;
  left: 6vw;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.5s var(--ease-snap), transform 0.5s var(--ease-snap);
}

[data-reveal].in-view::before {
  opacity: 0.55;
  transform: translateY(0);
}

/* ---------------------------------------------------------
   Reticle frame — corner accents per screen
   --------------------------------------------------------- */

.reticle {
  position: absolute;
  inset: 7vh 6vw;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s var(--ease-snap);
}

[data-reveal].in-view .reticle {
  opacity: 1;
}

.reticle i {
  position: absolute;
  width: 15px;
  height: 15px;
  border: 0 solid transparent;
  opacity: 0.32;
}

.reticle i:nth-child(1) { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; border-color: var(--cyan); }
.reticle i:nth-child(2) { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; border-color: var(--ink); }
.reticle i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; border-color: var(--ink); }
.reticle i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; border-color: var(--orange); }

.rail {
  position: fixed;
  right: clamp(14px, 2.4vw, 32px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.rail::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(-50%);
  z-index: -1;
}

.rail-fill {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 0%;
  background: linear-gradient(var(--cyan), var(--blue), var(--orange));
  transform: translateX(-50%);
  transition: height 0.2s linear;
  z-index: -1;
}

.rail-dot {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-faint);
  opacity: 0.4;
  cursor: pointer;
  transition: opacity 0.35s var(--ease-snap), transform 0.35s var(--ease-spring), background 0.35s var(--ease-snap);
}

.rail-dot:hover { opacity: 0.8; }

.rail-dot.active {
  opacity: 1;
  transform: scale(1.7);
  background: linear-gradient(135deg, var(--cyan), var(--orange));
}

@media (max-width: 780px) {
  .rail { display: none; }
  [data-reveal]::before { top: 4.5vh; left: 5.5vw; font-size: 0.66rem; }
}

/* ---------------------------------------------------------
   Intro / mark
   --------------------------------------------------------- */

.intro-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.1rem, 3vw, 1.8rem);
  perspective: 900px;
}

.mark {
  width: clamp(190px, 30vw, 360px);
  transform: translateY(6px) scale(0.95);
  opacity: 0;
  filter: blur(6px);
  transition: opacity 1.05s var(--ease-snap), filter 1.05s var(--ease-snap), transform 1.05s var(--ease-snap);
  transform-style: preserve-3d;
  will-change: transform, opacity, filter;
}

.mark.in {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0) scale(1);
}

.mark-icon {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 26px rgba(79, 224, 242, 0.20)) drop-shadow(0 0 60px rgba(47, 111, 214, 0.12));
  transition: filter 0.4s var(--ease-soft);
}

.whisper {
  position: absolute;
  bottom: 14vh;
  left: 50%;
  transform: translate(-50%, 8px);
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  font-style: italic;
  opacity: 0;
  transition: opacity 0.5s var(--ease-snap), transform 0.5s var(--ease-spring);
  white-space: nowrap;
}

.whisper.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.scroll-cue {
  position: absolute;
  bottom: 6vh;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.8s var(--ease-snap);
}

.scroll-cue.in { opacity: 0.6; }

.scroll-line {
  display: block;
  width: 1px;
  height: 54px;
  background: linear-gradient(to bottom, transparent, var(--ink-dim) 40%, transparent);
  animation: cue-pulse 2.6s ease-in-out infinite;
}

@keyframes cue-pulse {
  0%, 100% { opacity: 0.25; transform: scaleY(0.7); transform-origin: top; }
  50% { opacity: 1; transform: scaleY(1); transform-origin: top; }
}

/* ---------------------------------------------------------
   Statement + thoughts
   --------------------------------------------------------- */

.statement-text {
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 4.6rem);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.01em;
  color: var(--ink);
  max-width: 20ch;
}

.thought-text {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.6rem);
  font-weight: 300;
  line-height: 1.3;
  letter-spacing: 0.01em;
  color: var(--ink-dim);
  max-width: 16ch;
}

.word {
  display: inline-block;
  opacity: 0;
  transform: translateY(22px);
  filter: blur(3px);
  transition: opacity 0.5s var(--ease-spring), transform 0.5s var(--ease-spring), filter 0.35s var(--ease-out);
}

[data-reveal].in-view .word {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

[data-reveal].in-view .statement-text .word {
  animation: word-glitch 0.32s steps(3) both;
}

@keyframes word-glitch {
  0%   { text-shadow: 0 0 0 transparent; }
  22%  { text-shadow: -2px 0 rgba(255, 90, 90, 0.65), 2px 0 rgba(79, 224, 242, 0.65); }
  44%  { text-shadow: 2px 0 rgba(255, 90, 90, 0.6), -2px 0 rgba(79, 224, 242, 0.6); }
  66%  { text-shadow: -1px 0 rgba(255, 143, 61, 0.4), 1px 0 rgba(47, 111, 214, 0.4); }
  100% { text-shadow: 0 0 0 transparent; }
}

/* ---------------------------------------------------------
   Connect
   --------------------------------------------------------- */

.connect-card {
  width: min(420px, 88vw);
  padding: clamp(2rem, 4vw, 2.8rem) clamp(1.6rem, 4vw, 2.4rem);
  border-radius: 20px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 30px 60px -20px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  transition: opacity 0.6s var(--ease-snap), transform 0.6s var(--ease-spring);
}

[data-reveal].in-view .connect-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.notify-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

#emailInput {
  width: 100%;
  padding: 0.95rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.98rem;
  letter-spacing: 0.03em;
  outline: none;
  transition: border-color 0.4s var(--ease-soft), background 0.4s var(--ease-soft), box-shadow 0.4s var(--ease-soft);
}

#emailInput::placeholder {
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}

#emailInput:focus {
  border-color: rgba(79, 224, 242, 0.45);
  background: rgba(79, 224, 242, 0.045);
  box-shadow: 0 0 0 4px rgba(79, 224, 242, 0.08);
}

#notifyBtn {
  position: relative;
  padding: 0.95rem 1.1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(135deg, rgba(79, 224, 242, 0.14), rgba(47, 111, 214, 0.14));
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s var(--ease-snap), box-shadow 0.2s var(--ease-snap), border-color 0.2s var(--ease-snap);
}

#notifyBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -12px rgba(79, 224, 242, 0.35);
  border-color: rgba(79, 224, 242, 0.35);
}

#notifyBtn:active { transform: translateY(0) scale(0.97); }

.btn-check {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
}

#notifyBtn.sent .btn-label { opacity: 0; transform: scale(0.8); transition: opacity 0.2s var(--ease-snap), transform 0.2s var(--ease-snap); }
#notifyBtn.sent .btn-check { animation: pop-in 0.45s var(--ease-spring) forwards; }

@keyframes pop-in {
  0%   { opacity: 0; transform: scale(0.4); }
  60%  { opacity: 1; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

.btn-label {
  display: inline-block;
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}

.notify-success {
  margin: 0.9rem 0 0;
  height: 1em;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s var(--ease-snap), transform 0.4s var(--ease-spring);
}

.notify-success.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---------------------------------------------------------
   Footer
   --------------------------------------------------------- */

.site-footer {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 3.2rem 0 3.6rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

.footer-dot { opacity: 0.5; }

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 640px) {
  .screen { padding: 6vh 7vw; }
  main { scroll-snap-type: y mandatory; }
  .whisper { bottom: 11vh; font-size: 0.74rem; }
}

@media (hover: none) {
  .cursor-glow, .cursor-dot { display: none; }
}

/* ---------------------------------------------------------
   Reduced motion
   --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::before, body::after, .scroll-line, [data-reveal].in-view .statement-text .word {
    animation: none;
  }
  .mark, .whisper, .scroll-cue, .word, .connect-card, .btn-check,
  [data-reveal]::before, .rail-dot, .reticle, .cursor-dot {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
