/* =========================================================
   Slate Fire Studio — main.css
   Tokens → base → layout → components → sections → motion
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* Palette matched to slatefire.com — deep navy + royal/cyan blue */
  --obsidian: #030711;  /* page background */
  --charcoal: #111827;  /* raised surfaces, cards */
  --slate:    #232C3D;  /* borders, dividers, inactive states */
  --ash:      #94A3B8;  /* secondary text */
  --bone:     #E9EEF6;  /* primary text — cool off-white */
  --ember:    #3B82F6;  /* primary accent — royal blue */
  --amber:    #38BDF8;  /* secondary accent — cyan-blue (seam / glow partner) */

  --font-display: "Audiowide", "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --shell-max: 1280px;
  --gutter: 24px;
  --radius: 4px;

  --rhythm: clamp(80px, 12vw, 172px);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* obsidian on the root too, so there's never a white flash before body paints */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; background: var(--obsidian); }

body {
  margin: 0;
  background: var(--obsidian);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  line-height: 1.65;
  font-weight: 400;
  font-synthesis: none; /* Audiowide ships a single weight — don't fake bold */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* fade the whole page in cohesively instead of piecemeal (CSS-only, no JS wait) */
  animation: pageIn .55s var(--ease) both;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.01em;
  margin: 0;
}

p { margin: 0; }

a { color: inherit; text-decoration: none; }

img, svg, canvas { display: block; max-width: 100%; }

button { font-family: inherit; cursor: pointer; }

::selection { background: var(--ember); color: var(--obsidian); }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 2px;
}

.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;
}

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 200;
  background: var(--ember); color: var(--obsidian);
  padding: 10px 16px; border-radius: var(--radius); font-weight: 600;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 16px; }

/* ---------- Rising embers (fixed background, behind all content) ---------- */
.embers {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* ---------- Layout ---------- */
.shell {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--rhythm); }

.section__head { margin-bottom: clamp(40px, 5vw, 72px); max-width: 46ch; }

.section__title {
  font-size: clamp(2rem, 1.4rem + 3vw, 3.5rem);
  margin-top: 18px;
}

/* ---------- Eyebrow / utility type ---------- */
.eyebrow {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(0.62rem, 0.58rem + 0.14vw, 0.72rem);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ash);
  margin: 0;
}
.eyebrow__x { color: var(--ember); padding-inline: 0.15em; }

.tagrow {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ash);
  margin-top: 18px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  transition: transform .25s var(--ease), background-color .25s var(--ease),
              border-color .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease);
  will-change: transform;
}
.btn--sm { padding: 9px 16px; font-size: 0.8rem; }

.btn--ember {
  background: var(--ember);
  color: var(--obsidian);
}
.btn--ember:hover {
  background: var(--amber);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -12px rgba(59, 130, 246, 0.55);
}

.btn--ghost {
  background: transparent;
  color: var(--bone);
  border-color: var(--slate);
}
.btn--ghost:hover {
  border-color: rgba(59, 130, 246, 0.5);
  color: var(--bone);
  transform: translateY(-2px);
}

/* ---------- Wordmark ---------- */
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  color: var(--bone);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.wordmark__fire { color: var(--ember); }
.wordmark--sm { font-size: 1rem; }
.wordmark__logo {
  width: 30px; height: 30px;
  object-fit: contain;
  flex: none;
}
.wordmark--sm .wordmark__logo { width: 26px; height: 26px; }

/* =========================================================
   NAV
   ========================================================= */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  transition: background-color .3s var(--ease), border-color .3s var(--ease), backdrop-filter .3s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav[data-scrolled] {
  background: rgba(3, 7, 17, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--slate);
}
.nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
}
.nav__links {
  display: flex; align-items: center; gap: clamp(16px, 1.8vw, 30px);
}
.nav__links > a:not(.btn) {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--ash);
  transition: color .2s var(--ease);
}
.nav__links > a:not(.btn):hover { color: var(--bone); }

.nav__toggle {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  width: 44px; height: 44px;
  background: none; border: 1px solid var(--slate); border-radius: var(--radius);
}
.nav__toggle span {
  display: block; height: 1.5px; width: 20px; margin-inline: auto;
  background: var(--bone); transition: transform .3s var(--ease), opacity .2s var(--ease);
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Mobile overlay */
.mobile-menu {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(3, 7, 17, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center;
}
.mobile-menu[hidden] { display: none; }
.mobile-menu__nav {
  display: flex; flex-direction: column; align-items: center; gap: 26px;
  text-align: center;
}
.mobile-menu__nav > a:not(.btn) {
  font-family: var(--font-display);
  font-size: 1.6rem; font-weight: 600; color: var(--bone);
}
.mobile-menu__nav > a:not(.btn):hover { color: var(--ember); }
.mobile-menu__nav .btn { margin-top: 8px; }

/* =========================================================
   HERO
   ========================================================= */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: center;
  padding-top: 72px;
  overflow: hidden;
}
.hero__inner { position: relative; z-index: 2; max-width: 62rem; padding-block: clamp(60px, 10vh, 120px); }

.hero__scene { position: absolute; inset: 0; z-index: 0; }

.hero__contours { position: absolute; inset: 0; width: 100%; height: 100%; }

/* molten light low behind a ridge */
.hero__glow {
  position: absolute;
  left: 50%; bottom: -30%;
  width: min(1200px, 120%); height: 720px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center,
    rgba(59, 130, 246, 0.24) 0%,
    rgba(56, 189, 248, 0.11) 28%,
    rgba(59, 130, 246, 0.045) 50%,
    transparent 68%);
  filter: blur(6px);
}
.hero__ridge {
  position: absolute; left: 0; right: 0; bottom: 0; height: 42%;
  background: linear-gradient(to top, var(--obsidian) 22%, rgba(3,7,17,0.6) 55%, transparent 100%);
  clip-path: polygon(0 44%, 14% 40%, 30% 47%, 46% 38%, 60% 46%, 74% 36%, 88% 45%, 100% 39%, 100% 100%, 0 100%);
}
.hero__vignette {
  position: absolute; inset: 0;
  background: radial-gradient(130% 100% at 50% 42%, transparent 52%, rgba(3,7,17,0.55) 100%);
}

.hero__title {
  font-size: clamp(2.4rem, 1rem + 5.6vw, 6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  max-width: 18ch;
  overflow-wrap: break-word;
}
.hero__pulse { color: var(--bone); position: relative; }

.hero__sub {
  color: var(--ash);
  max-width: 54ch;
  margin-top: 30px;
  font-size: clamp(1rem, 0.95rem + 0.35vw, 1.2rem);
}
.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 38px; }

/* =========================================================
   SEAM / WAVEFORM
   ========================================================= */
.seam { position: relative; }
.seam--hero {
  margin-top: 30px;
  width: min(440px, 80%);
  height: 40px;
}
.seam--hero canvas { width: 100%; height: 100%; }

/* static gradient divider line */
.seam--divider {
  height: 2px;
  margin-block: clamp(20px, 6vw, 60px);
  background: linear-gradient(90deg,
    transparent 0%,
    var(--ember) 22%,
    var(--amber) 50%,
    var(--ember) 78%,
    transparent 100%);
  opacity: 0.85;
}
.seam--contact { margin-top: 0; margin-bottom: clamp(40px, 6vw, 72px); }

.seam--card {
  margin-top: 24px;
  height: 34px;
}
.seam--card canvas { width: 100%; height: 100%; }

/* =========================================================
   CARDS / GRIDS
   ========================================================= */
.grid { display: grid; gap: clamp(16px, 1.8vw, 24px); }

.grid--engines { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--charcoal);
  border: 1px solid var(--slate);
  border-radius: var(--radius);
  padding: clamp(24px, 2.4vw, 34px);
  transition: border-color .3s var(--ease), transform .3s var(--ease);
}
.card--engine:hover,
.card--cap:hover {
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-3px);
}

.card__title { font-size: 1.4rem; margin-top: 20px; }
.card--engine .card__title { margin-top: 22px; }
.card__body { color: var(--ash); margin-top: 12px; font-size: 0.98rem; }
.card__index {
  font-family: var(--font-display);
  font-weight: 600; font-size: 0.85rem;
  color: var(--slate);
  letter-spacing: 0.05em;
}
.card--cap .card__title { margin-top: 10px; }

/* render slot — intentional plan-set placeholder */
.render-slot {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(115deg, transparent 0 22px, rgba(155,160,168,0.05) 22px 23px),
    linear-gradient(160deg, #101116, #0d0e11);
  border: 1px solid var(--slate);
  overflow: hidden;
  display: flex; align-items: flex-end;
}
.render-slot::before {
  /* faint contour lines */
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(120% 80% at 30% 120%, rgba(155,160,168,0.10), transparent 60%),
    repeating-radial-gradient(circle at 30% 130%, transparent 0 26px, rgba(155,160,168,0.055) 26px 27px);
  -webkit-mask-image: linear-gradient(to top, black, transparent 90%);
          mask-image: linear-gradient(to top, black, transparent 90%);
}
.render-slot__caption {
  position: relative; z-index: 2;
  margin: 14px;
  font-family: var(--font-display);
  font-size: 0.55rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ash);
}

/* filled render slot — real render image */
.render-slot__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
}
.render-slot--img::after {
  /* bottom scrim so the caption stays readable over the image */
  content: "";
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, rgba(3,7,17,0.85) 0%, rgba(3,7,17,0.15) 34%, transparent 60%);
}
.render-slot--img .render-slot__caption { color: var(--bone); }

/* Capabilities asymmetric grid — mobile-first.
   base: 1 col · >620: 2 cols · >1024: 6-col asymmetric (2 wide over 3) */
.grid--cap { grid-template-columns: 1fr; }
.card--cap { display: flex; flex-direction: column; }

.card--audio { position: relative; cursor: default; }
.card--audio .card__body { margin-bottom: auto; }

/* =========================================================
   ECOSYSTEM
   ========================================================= */
.section--ecosystem { text-align: center; }
.section--ecosystem .section__head { margin-inline: auto; text-align: center; }

.wordmarks {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: clamp(20px, 4vw, 56px);
}
.wordmarks li {
  font-family: var(--font-display);
  font-weight: 400; font-size: clamp(0.64rem, 0.58rem + 0.28vw, 0.8rem);
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ash);
  transition: color .25s var(--ease);
  cursor: default;
}
.wordmarks li:hover { color: var(--bone); }

/* =========================================================
   CONTACT
   ========================================================= */
/* semi-transparent so the rising embers glow through behind the CTA */
.section--contact { background: rgba(17, 24, 39, 0.82); }
.section--contact .section__head { max-width: none; }

.contact-cta { margin-top: 4px; text-align: center; }

/* Glowing-edge CTA — opens the Calendly booking link */
.btn--glow {
  background: rgba(59, 130, 246, 0.06);
  color: var(--bone);
  border: 1px solid var(--ember);
  padding: 18px 42px;
  font-size: 1rem;
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.35),
    0 0 22px -2px rgba(59, 130, 246, 0.55),
    inset 0 0 16px -6px rgba(56, 189, 248, 0.6);
  animation: glowPulse 3s var(--ease) infinite;
}
.btn--glow:hover {
  background: rgba(59, 130, 246, 0.14);
  border-color: var(--amber);
  transform: translateY(-2px);
  animation: none;
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.65),
    0 0 34px 0 rgba(59, 130, 246, 0.7),
    inset 0 0 22px -6px rgba(56, 189, 248, 0.85);
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(59, 130, 246, 0.30),
      0 0 18px -3px rgba(59, 130, 246, 0.45),
      inset 0 0 14px -6px rgba(56, 189, 248, 0.5);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(59, 130, 246, 0.55),
      0 0 32px 0 rgba(59, 130, 246, 0.68),
      inset 0 0 20px -6px rgba(56, 189, 248, 0.75);
  }
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer { border-top: 1px solid var(--slate); padding-block: 34px; }
.footer__inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 18px;
}
.footer__legal { font-family: var(--font-display); color: var(--ash); font-size: 0.78rem; letter-spacing: 0.02em; }
.footer__nav { display: flex; gap: 24px; }
.footer__nav a { font-family: var(--font-display); color: var(--ash); font-size: 0.82rem; letter-spacing: 0.02em; transition: color .2s var(--ease); }
.footer__nav a:hover { color: var(--bone); }

/* =========================================================
   BACK-TO-TOP BUTTON
   ========================================================= */
.to-top {
  position: fixed;
  right: clamp(16px, 3vw, 34px);
  bottom: clamp(16px, 3vw, 34px);
  z-index: 80;
  width: 50px; height: 50px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.12);
  color: var(--bone);
  border: 1px solid var(--ember);
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.3),
    0 0 20px -4px rgba(59, 130, 246, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.9);
  transition: opacity .3s var(--ease), transform .3s var(--ease),
              visibility .3s var(--ease), background-color .25s var(--ease),
              border-color .25s var(--ease);
}
.to-top[data-visible] { opacity: 1; visibility: visible; transform: none; }
.to-top:hover {
  background: rgba(59, 130, 246, 0.22);
  border-color: var(--amber);
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.55),
    0 0 28px -2px rgba(59, 130, 246, 0.65);
}
.to-top svg { width: 20px; height: 20px; }

/* =========================================================
   MOTION — page-load sequence + scroll reveals
   ========================================================= */
/* Hero intro auto-plays on load (pure CSS, no JS gate) so the content
   rises in together with the page fade — no blank-hero flash. */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: rise .7s var(--ease) both;
  animation-delay: calc(var(--seq, 0) * 0.1s + 0.15s);
}

.reveal-up { opacity: 0; transform: translateY(12px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.reveal-up.is-visible { opacity: 1; transform: none; }

@keyframes rise {
  to { opacity: 1; transform: none; }
}
@keyframes pageIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
/* Capabilities: 2-up on tablet, 6-col asymmetric on desktop */
@media (min-width: 621px) {
  .grid--cap { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1025px) {
  .grid--cap { grid-template-columns: repeat(6, 1fr); }
  .card--cap { grid-column: span 2; }
  .cap--wide { grid-column: span 3; }
}

@media (max-width: 1024px) {
  .grid--engines { grid-template-columns: 1fr; max-width: 560px; }
}

@media (max-width: 768px) {
  .nav__links { display: none; }
  .nav__toggle { display: flex; }
}

@media (max-width: 620px) {
  .contact-form { grid-template-columns: 1fr; }
  .hero__title { font-size: clamp(1.8rem, 7.6vw, 2.7rem); letter-spacing: -0.015em; }
  .footer__inner { flex-direction: column; align-items: flex-start; }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal, .reveal-up { opacity: 1 !important; transform: none !important; }
}
