/* ==========================================================================
   NAKULA STUDIO — CUSTOM STYLES
   --------------------------------------------------------------------------
   This file layers on top of the Tailwind CDN.
   It defines:
     • design tokens (CSS variables)
     • scroll reveal + marquee animations
     • component classes that are cleaner as CSS than as Tailwind utilities
   Tailwind still handles layout, colors, and spacing inline in markup.
   ========================================================================== */

/* ==========================================================================
   @FONT-FACE — local project fonts
   ========================================================================== */

/* Caslon Antique family */
@font-face {
  font-family: "Caslon Antique";
  src: url("fonts/CaslonAntique.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Caslon Antique";
  src: url("fonts/CaslonAntique-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Caslon Antique";
  src: url("fonts/CaslonAntique-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Caslon Antique";
  src: url("fonts/CaslonAntique-BoldItalic.ttf") format("truetype");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* Plus Jakarta Sans — variable font (weight axis) */
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("fonts/PlusJakartaSans-Variable.ttf") format("truetype");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #080a10;
  --text: #ffffff;
  --muted: #888888;
  --line: #1f1f1f;
  --ink-soft: #111111;
  --ink-elev: #161616;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Base ---------- */
html {
  scroll-behavior: smooth;
  background: var(--bg);
}
body {
  overscroll-behavior-y: none;
}

/* Hide native cursor everywhere */
.has-custom-cursor,
.has-custom-cursor * {
  cursor: none !important;
}

/* Custom cursor dot */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(180, 180, 180, 0.3);
  pointer-events: none;
  z-index: 99999;
  will-change: transform;
  transition: width 0.15s var(--ease), height 0.15s var(--ease), background 0.15s var(--ease);
}
.custom-cursor.is-hovering {
  width: 25px;
  height: 25px;
  background: rgba(255, 255, 255, 0.35);
}

/* Hide custom cursor on touch devices */
@media (hover: none) {
  .has-custom-cursor, .has-custom-cursor * { cursor: auto !important; }
  .custom-cursor { display: none !important; }
}

/* Hide elements until Alpine has hydrated */
[x-cloak] {
  display: none !important;
}

/* ==========================================================================
   SCROLL REVEAL
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.9s var(--ease),
    transform 0.9s var(--ease);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal[data-delay="1"] {
  transition-delay: 0.08s;
}
.reveal[data-delay="2"] {
  transition-delay: 0.16s;
}
.reveal[data-delay="3"] {
  transition-delay: 0.24s;
}
.reveal[data-delay="4"] {
  transition-delay: 0.32s;
}
.reveal[data-delay="5"] {
  transition-delay: 0.4s;
}
.reveal[data-delay="6"] {
  transition-delay: 0.48s;
}

/* ==========================================================================
   TEXT REVEAL — word-by-word ramp up + fade in
   ========================================================================== */
.text-reveal .word-wrap {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}
.text-reveal .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(110%);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
  will-change: opacity, transform;
}
.text-reveal.is-visible .word {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   3D TILT CARDS
   ========================================================================== */
.work-card {
  perspective: 800px;
}
.work-card .tilt-inner {
  transition: transform 0.15s ease-out;
  transform-style: preserve-3d;
  will-change: transform;
}
.work-card .tilt-shine {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.3s ease-out;
  background: radial-gradient(
    circle at var(--tilt-x, 50%) var(--tilt-y, 50%),
    rgba(255,255,255,0.12) 0%,
    transparent 60%
  );
}
.work-card:hover .tilt-shine {
  opacity: 1;
}

/* ==========================================================================
   MARQUEE
   ========================================================================== */
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 40s linear infinite;
}
.marquee-track.is-fast {
  animation-duration: 28s;
}
@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}
.marquee-mask {
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 8%,
    black 92%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 8%,
    black 92%,
    transparent 100%
  );
}

/* ==========================================================================
   WORK CARD — liquid glass video cards
   ========================================================================== */
.work-card {
  display: block;
  border-radius: 20px;
  background: transparent;
}
.work-card .tilt-inner {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  isolation: isolate;

  /* Glass tokens */
  --card-glass-bg: rgba(255, 255, 255, 0.04);
  --card-glass-border: rgba(255, 255, 255, 0.1);
  --card-glass-blur: 18px;
}

/* Glass surface layer */
.work-card .tilt-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;
  background: var(--card-glass-bg);
  -webkit-backdrop-filter: blur(var(--card-glass-blur)) saturate(1.4);
  backdrop-filter: url(#liquid-glass-distort) blur(var(--card-glass-blur)) saturate(1.4);
  border: 1px solid var(--card-glass-border);

  /* Fresnel rim + chromatic edges */
  box-shadow:
    inset 0  1px 1px rgba(255, 255, 255, 0.12),
    inset 0 -1px 1px rgba(255, 255, 255, 0.04),
    inset  1px 0 0 rgba(255, 120, 140, 0.03),
    inset -1px 0 0 rgba(120, 140, 255, 0.03);

  transition:
    background 0.35s var(--ease),
    border-color 0.35s var(--ease),
    box-shadow 0.35s var(--ease);
}

/* Outer glow */
.work-card .tilt-inner {
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.2),
    -0.5px 0 1px rgba(255, 120, 140, 0.03),
     0.5px 0 1px rgba(120, 140, 255, 0.03);
  transition: transform 0.15s ease-out, box-shadow 0.35s var(--ease);
}

/* Hover: brighter glass */
.work-card:hover .tilt-inner::before {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow:
    inset 0  1px 2px rgba(255, 255, 255, 0.2),
    inset 0 -1px 1px rgba(255, 255, 255, 0.06),
    inset  1px 0 0 rgba(255, 120, 140, 0.05),
    inset -1px 0 0 rgba(120, 140, 255, 0.05);
}
.work-card:hover .tilt-inner {
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    -0.5px 0 2px rgba(255, 120, 140, 0.05),
     0.5px 0 2px rgba(120, 140, 255, 0.05);
}

.work-card .work-media-wrap {
  overflow: hidden;
  border-radius: 20px 20px 0 0;
}


/* Video thumbnail */
.video-thumb {
  background-size: cover;
  background-position: center;
  background-color: var(--ink-elev);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.4s var(--ease);
}
.video-thumb:hover {
  filter: brightness(0.7);
}

/* Vimeo placeholder gradient (before thumbnail loads) */
.video-thumb.vimeo-placeholder {
  background-image: linear-gradient(
    135deg,
    var(--ink-elev) 0%,
    #1a1a2e 50%,
    var(--ink-soft) 100%
  ) !important;
}

/* Play button */
.video-play-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.4s var(--ease),
    background 0.4s var(--ease);
}
.video-thumb:hover .video-play-btn {
  transform: scale(1.12);
  background: rgba(255, 255, 255, 0.2);
}

/* Iframe resets */
.work-card iframe {
  border: 0;
  border-radius: 20px;
}

/* ==========================================================================
   LIQUID GLASS BUTTONS
   --------------------------------------------------------------------------
   Rendering layers (back → front):
     1. ::before  — backdrop distortion + blur + frosted tint + Fresnel
     2. ::after   — dynamic specular highlight (driven by --shine-* vars)
     3. content   — label text
   SVG feDisplacementMap provides real optical distortion in Chrome/FF.
   Safari gracefully falls back to backdrop-filter: blur().
   ========================================================================== */
.btn {
  /* ---- layout ---- */
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 1rem 2rem;
  border-radius: 9999px;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  line-height: 1;
  color: #ffffff;
  background: transparent;
  border: none;
  overflow: hidden;
  isolation: isolate;            /* new stacking ctx for z-index -1/-2 */

  /* ---- glass tokens (overridden per variant) ---- */
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-blur: 18px;
  --glass-sat: 1.4;

  /* ---- shine (written by JS each frame) ---- */
  --shine-x: 50%;
  --shine-y: 50%;
  --shine-intensity: 0;

  /* ---- transitions ---- */
  transition:
    transform 0.35s var(--ease),
    box-shadow 0.35s var(--ease);
  will-change: transform;

  /* Outer glow + chromatic aberration fringe */
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.2),
    -0.5px 0 1px rgba(255, 120, 140, 0.04),
     0.5px 0 1px rgba(120, 140, 255, 0.04);
}

/* ---- Glass surface (::before) ---- */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -2;
  background: var(--glass-bg);

  /* Safari: blur-only fallback */
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  /* Chrome / FF: distortion + blur */
  backdrop-filter: url(#liquid-glass-distort) blur(var(--glass-blur)) saturate(var(--glass-sat));

  /* Fresnel rim light + chromatic edges */
  box-shadow:
    inset 0  1px 1px rgba(255, 255, 255, 0.18),
    inset 0 -1px 1px rgba(255, 255, 255, 0.05),
    inset  1px 0 0 rgba(255, 120, 140, 0.05),
    inset -1px 0 0 rgba(120, 140, 255, 0.05);

  /* Border drawn on this layer to be seamless with glass */
  border: 1px solid var(--glass-border);

  transition:
    background 0.35s var(--ease),
    box-shadow 0.35s var(--ease),
    border-color 0.35s var(--ease);
}

/* ---- Fresnel edge glow (radial gradient) ---- */
.btn .glass-fresnel {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    ellipse 90% 80% at 50% 50%,
    transparent 40%,
    rgba(255, 255, 255, 0.07) 100%
  );
}

/* ---- Specular highlight (::after) ---- */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;
  pointer-events: none;
  opacity: var(--shine-intensity);
  background: radial-gradient(
    ellipse 130% 90% at var(--shine-x) var(--shine-y),
    rgba(255, 255, 255, 0.45) 0%,
    rgba(255, 255, 255, 0.12) 30%,
    transparent 60%
  );
  transition: opacity 0.05s linear;
}

/* ========================== Hover ========================== */
.btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.25),
    -0.5px 0 2px rgba(255, 120, 140, 0.06),
     0.5px 0 2px rgba(120, 140, 255, 0.06);
}
.btn:hover::before {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow:
    inset 0  1px 2px rgba(255, 255, 255, 0.25),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08),
    inset  1px 0 0 rgba(255, 120, 140, 0.08),
    inset -1px 0 0 rgba(120, 140, 255, 0.08);
}

/* ========================== Active / Click ========================== */
.btn:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}
.btn:active::before {
  background: rgba(255, 255, 255, 0.03);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: url(#liquid-glass-distort) blur(12px) saturate(1.2);
}

/* ========================== Variants ========================== */
.btn-primary {
  --glass-bg: rgba(255, 255, 255, 0.13);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-blur: 22px;
  text-shadow: 0 0 24px rgba(255, 255, 255, 0.2);
}
.btn-secondary {
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.1);
}
.btn-dark {
  --glass-bg: rgba(0, 10, 20, 0.35);
  --glass-border: rgba(255, 255, 255, 0.08);
}
.btn-sm {
  padding: 0.75rem 1.25rem;
  font-size: 0.6875rem;
}

/* ==========================================================================
   TYPOGRAPHY HELPERS
   ========================================================================== */

/* Base body — Plus Jakarta Sans Light (weight 300) */
body {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-weight: 300;
}

/* All headings — Caslon Antique Bold Italic */
h1, h2, h3, h4, h5, h6 {
  font-family: "Caslon Antique", Georgia, serif;
  font-weight: 700;
  font-style: italic;
}

.eyebrow {
  display: inline-block;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--muted);
  font-weight: 500;
}
.section-title {
  font-family: "Caslon Antique", Georgia, serif;
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 0.95;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  font-weight: 700;
  font-style: italic;
}
.display-huge {
  font-family: "Caslon Antique", Georgia, serif;
  font-size: clamp(3rem, 11vw, 11.5rem);
  line-height: 0.85;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  font-weight: 700;
  font-style: italic;
}

/* ==========================================================================
   BACK TO TOP
   ========================================================================== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 0.4s var(--ease),
    transform 0.4s var(--ease),
    border-color 0.3s var(--ease);
}
.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover {
  border-color: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   CAROUSEL DOTS
   ========================================================================== */
.dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--muted);
  transition:
    background 0.3s var(--ease),
    transform 0.3s var(--ease);
}
.dot.is-active {
  background: #ffffff;
  transform: scale(1.6);
}

/* ==========================================================================
   FAQ
   ========================================================================== */
.faq-row {
  border-top: 1px solid var(--line);
}
.faq-row:last-child {
  border-bottom: 1px solid var(--line);
}

/* ==========================================================================
   CONTACT FORM
   ========================================================================== */
.form-label {
  display: block;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.form-input {
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  color: #ffffff;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 300;
  line-height: 1.5;
  transition:
    border-color 0.3s var(--ease),
    background 0.3s var(--ease);
}
.form-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}
.form-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.25);
  background: var(--ink-elev);
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23888888'><path d='M4 6l4 4 4-4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
  cursor: pointer;
}
.form-select option {
  background: var(--bg);
  color: #ffffff;
}

/* ==========================================================================
   ANIMATED FILM GRAIN — canvas-based, rendered in script.js
   ========================================================================== */
.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.02;
}
.grain-overlay canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   MOTION PREFERENCES
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .reveal, .text-reveal .word {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .tilt-inner {
    transform: none !important;
    transition: none !important;
  }
  .marquee-track {
    animation: none !important;
  }
  html {
    scroll-behavior: auto;
  }
}
