/* Grokforge motion-landing — boutique cinematic, not SaaS boilerplate */
/* Hot animations: transform + opacity only */

:root {
  --bg: #050508;
  --bg-elevated: #0c0c12;
  --fg: #f3efe6;
  --fg-muted: rgba(243, 239, 230, 0.62);
  --accent: #c4a574;
  --accent-soft: rgba(196, 165, 116, 0.18);
  --line: rgba(243, 239, 230, 0.1);
  --glass: rgba(18, 18, 26, 0.55);
  --glass-border: rgba(243, 239, 230, 0.12);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --font-display: "Instrument Serif", "Times New Roman", serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --section-pad: clamp(4.5rem, 12vw, 8.5rem);
  --content: min(1120px, calc(100% - 2.5rem));
  --header-h: 4.25rem;

  /* Per-section tint hooks (overridden by [data-theme]) */
  --tint: transparent;
  --tint-glow: transparent;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto; /* Lenis owns smooth scroll when enabled */
}

html.lenis,
html.lenis body {
  height: auto;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.0625rem);
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
video,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

code {
  font-size: 0.9em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
}

/* —— Polish overlays —— */
.grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 39;
  pointer-events: none;
  background: radial-gradient(
    ellipse 75% 65% at 50% 40%,
    transparent 40%,
    rgba(0, 0, 0, 0.55) 100%
  );
}

/* —— A11y —— */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--fg);
  color: var(--bg);
  border-radius: 6px;
  font-weight: 600;
}

.skip-link:focus {
  top: 1rem;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* —— Header —— */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1rem, 3vw, 2rem);
  background: linear-gradient(to bottom, rgba(5, 5, 8, 0.85), transparent);
  backdrop-filter: blur(8px);
}

.logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  font-size: 0.875rem;
  font-weight: 500;
}

.site-nav a {
  text-decoration: none;
  color: var(--fg-muted);
  transition: color 0.25s var(--ease-out);
}

.site-nav a:hover {
  color: var(--fg);
}

@media (max-width: 640px) {
  .site-nav {
    display: none;
  }
}

/* —— Hero —— */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: end start;
  padding: calc(var(--header-h) + 2rem) 0 4rem;
  overflow: hidden;
  --tint-glow: rgba(196, 165, 116, 0.15);
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* Absolute layering: poster under video so play shows over still */
.hero__poster,
.hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Layer: poster (0) → video (1) → shade (2); content sits above media stack */
.hero__poster {
  z-index: 0;
}

.hero__video {
  z-index: 1;
}

.hero__svg {
  width: 100%;
  height: 100%;
}

.hero__orb {
  transform-origin: center;
  animation: orb-float 12s ease-in-out infinite alternate;
}

@keyframes orb-float {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(-40px, 30px, 0) scale(1.08);
  }
}

.hero__shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(to top, var(--bg) 0%, transparent 45%),
    linear-gradient(to right, rgba(5, 5, 8, 0.75) 0%, transparent 55%);
}

.hero__content {
  position: relative;
  z-index: 3;
  width: var(--content);
  margin-inline: auto;
  max-width: 42rem;
}

.eyebrow {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero__title {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 6vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.hero__title .line {
  display: block;
}

.hero__title em {
  font-style: italic;
  color: var(--accent);
}

.hero__sub {
  margin: 0 0 2rem;
  max-width: 34rem;
  color: var(--fg-muted);
  font-size: 1.0625rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.scroll-hint {
  position: absolute;
  bottom: 1.75rem;
  right: clamp(1rem, 3vw, 2rem);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.scroll-hint__bar {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  transform-origin: top;
  animation: hint-pulse 2.4s var(--ease-out) infinite;
}

@keyframes hint-pulse {
  0%,
  100% {
    transform: scaleY(0.4);
    opacity: 0.4;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition:
    transform 0.3s var(--ease-out),
    background 0.3s var(--ease-out),
    border-color 0.3s var(--ease-out),
    color 0.3s var(--ease-out);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--fg);
  color: var(--bg);
}

.btn--primary:hover {
  background: #fff;
}

.btn--ghost {
  border-color: var(--line);
  color: var(--fg);
  background: transparent;
}

.btn--ghost:hover {
  border-color: var(--fg-muted);
  background: rgba(255, 255, 255, 0.04);
}

/* —— Sections —— */
/* Fixed header: hash / Lenis anchors land below nav */
.scroll-section,
[data-scroll-section],
.section,
.cta-band,
.hero {
  scroll-margin-top: var(--header-h);
}

.section {
  position: relative;
  padding: var(--section-pad) 0;
  overflow: clip;
}

.section::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 80% 20%, var(--tint-glow), transparent 70%),
    linear-gradient(180deg, var(--tint), transparent 40%);
}

.section__inner {
  position: relative;
  z-index: 1;
  width: var(--content);
  margin-inline: auto;
}

.section__inner--narrow {
  max-width: 720px;
  margin-inline: auto;
}

.section__title {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.section__title .muted,
.muted {
  color: var(--fg-muted);
}

.section__body {
  margin: 0 0 2.5rem;
  max-width: 36rem;
  color: var(--fg-muted);
  font-size: 1.0625rem;
}

/* Section themes */
.section--problem {
  --tint: rgba(91, 124, 250, 0.06);
  --tint-glow: rgba(91, 124, 250, 0.12);
}

.section--craft {
  --tint: rgba(196, 165, 116, 0.05);
  --tint-glow: rgba(196, 165, 116, 0.14);
}

.section--proof {
  --tint: rgba(120, 200, 160, 0.04);
  --tint-glow: rgba(120, 200, 160, 0.1);
}

/* —— Glass —— */
.glass-card {
  position: relative;
  padding: 1.35rem 1.4rem;
  border-radius: 1rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-card {
    background: #12121a;
  }
}

.glass-card h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
}

.glass-card p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.card-index {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-weight: 600;
}

/* —— Scroll-scrub interactive video (Apple / Higgsfield-class) —— */
/* Stage gets --scrub 0..1 from initMotion; video currentTime = p * duration */
.scrub-video-stage {
  --scrub: 0;
  position: relative;
  min-height: 100svh;
  overflow: clip;
  background: #020205;
}

.scrub-video-stage__frame {
  position: relative;
  width: 100%;
  min-height: 100svh;
  display: grid;
  place-items: center;
}

.scrub-video-stage__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.scrub-video-stage__media video,
.scrub-video-stage__poster,
.scrub-video-stage__demo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* CSS-only demo field when no video asset is wired yet */
.scrub-video-stage__demo {
  background:
    radial-gradient(
      ellipse 50% 45% at calc(30% + var(--scrub) * 40%) calc(40% + var(--scrub) * 10%),
      rgba(196, 165, 116, 0.45),
      transparent 55%
    ),
    radial-gradient(
      ellipse 40% 50% at calc(70% - var(--scrub) * 25%) calc(60% - var(--scrub) * 15%),
      rgba(91, 124, 250, 0.35),
      transparent 50%
    ),
    linear-gradient(160deg, #0a0810 0%, #050508 50%, #0c1018 100%);
  transform: scale(calc(1 + var(--scrub) * 0.12))
    translate3d(0, calc(var(--scrub) * -4%), 0);
  transform-origin: center center;
  will-change: transform;
}

.scrub-video-stage__shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, transparent 30%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(to top, rgba(5, 5, 8, 0.85) 0%, transparent 40%);
}

.scrub-video-stage__captions {
  position: relative;
  z-index: 2;
  width: var(--content);
  margin-inline: auto;
  max-width: 36rem;
  min-height: 100svh;
  display: grid;
  align-content: end;
  padding: calc(var(--header-h) + 2rem) 0 4rem;
  pointer-events: none;
}

.scrub-video-stage__captions [data-scrub-caption] {
  grid-area: 1 / 1;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease-out);
  pointer-events: none;
}

.scrub-video-stage__captions [data-scrub-caption].is-active {
  opacity: 1;
  visibility: visible;
}

.scrub-video-stage__captions .eyebrow {
  margin-bottom: 0.75rem;
}

.scrub-video-stage__captions h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.1;
}

.scrub-video-stage__captions p.lead {
  margin: 0;
  color: var(--fg-muted);
  font-size: 1.05rem;
  max-width: 28rem;
}

.scrub-video-stage__progress {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  z-index: 3;
  width: min(200px, 40vw);
  height: 2px;
  transform: translateX(-50%);
  background: rgba(243, 239, 230, 0.15);
  border-radius: 2px;
  overflow: hidden;
  pointer-events: none;
}

.scrub-video-stage__progress > span {
  display: block;
  height: 100%;
  width: calc(var(--scrub) * 100%);
  background: var(--accent);
  transform-origin: left center;
}

@media (prefers-reduced-motion: reduce) {
  .scrub-video-stage__demo {
    transform: none;
    will-change: auto;
  }
}

/* Pin stage (problem beat) */
.pin-stage {
  margin-top: 1rem;
}

.pin-stage__track {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .pin-stage__track {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Card grid */
.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Particles canvas */
.particles {
  position: absolute;
  inset: auto 0 0;
  width: 100%;
  height: min(50%, 320px);
  pointer-events: none;
  opacity: 0.45;
  z-index: 0;
  mix-blend-mode: screen;
}

.section--craft .section__inner {
  position: relative;
}

/* Proof list */
.proof-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.proof-item {
  display: grid;
  gap: 0.35rem;
}

.proof-item strong {
  font-weight: 600;
}

.proof-item span {
  color: var(--fg-muted);
  font-size: 0.95rem;
}

/* —— CTA band —— */
.cta-band {
  position: relative;
  padding: clamp(5rem, 14vw, 9rem) 0;
  background:
    radial-gradient(ellipse 70% 80% at 50% 100%, rgba(196, 165, 116, 0.16), transparent 60%),
    linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.02));
  border-top: 1px solid var(--line);
}

.cta-band__inner {
  width: var(--content);
  margin-inline: auto;
  text-align: center;
  max-width: 40rem;
}

.cta-band__title {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 1.1;
}

.cta-band__sub {
  margin: 0 auto 2rem;
  color: var(--fg-muted);
  max-width: 28rem;
}

.cta-band__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

/* —— Footer —— */
.site-footer {
  padding: 2rem 1.25rem 3rem;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0 auto;
  max-width: 36rem;
}

/*
 * Reveals progressive enhancement:
 * - No body.js-ready → fully visible (no-JS or scripts failed before init)
 * - body.js-ready hides unrevealed nodes until is-visible / reduced path
 * - html.js-fallback (head timeout) forces visible if boot stalls
 * - js-motion: GSAP owns transform/opacity; no CSS transition fight
 */
html.js body.js-ready .reveal:not(.is-visible),
html.js body.js-ready [data-reveal]:not(.is-visible) {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
}

html.js-fallback .reveal,
html.js-fallback [data-reveal],
html.js-fallback body.js-ready .reveal:not(.is-visible),
html.js-fallback body.js-ready [data-reveal]:not(.is-visible) {
  opacity: 1 !important;
  transform: none !important;
}

html.js-motion .reveal,
html.js-motion [data-reveal] {
  transition: none;
}

/* —— Reduced motion: kill hijack-adjacent polish, keep layout —— */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero__orb,
  .scroll-hint__bar {
    animation: none !important;
  }

  html.js .reveal,
  html.js [data-reveal],
  html.js .reveal:not(.is-visible),
  html.js [data-reveal]:not(.is-visible) {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .particles {
    display: none;
  }

  .grain {
    opacity: 0.04;
  }
}

/* —— rick3.dev portfolio extensions —— */
.logo-dim {
  color: var(--fg-muted);
  font-weight: 400;
}

.project-grid {
  position: relative;
  z-index: 1;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.35s var(--ease-out),
    border-color 0.35s var(--ease-out),
    background 0.35s var(--ease-out);
  min-height: 100%;
}

.project-card:hover {
  transform: translate3d(0, -4px, 0);
  border-color: rgba(196, 165, 116, 0.35);
  background: rgba(28, 28, 38, 0.72);
}

.project-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.project-card .card-index {
  margin-bottom: 0;
}

.project-tag {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  white-space: nowrap;
}

.project-card h3 {
  margin: 0 0 0.55rem;
}

.project-card p {
  flex: 1;
  margin: 0 0 1.1rem;
}

.project-link {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.project-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .project-card:hover {
    transform: none;
  }
}
