/* ==========================================================================
   ELEVATE WITH SHREY — design system
   Onest · #181818 / #FFFFFF / #77D1FE · dark theme
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  /* Brand */
  --black: #181818;
  --white: #ffffff;
  --blue: #77d1fe;

  /* Surfaces — derived from brand black for depth layering */
  --bg-deep: #0e0e0e;
  --bg-base: #181818;
  --bg-raised: #1f1f1f;
  --bg-elevated: #272727;

  /* Ink */
  --ink: #ffffff;
  --ink-dim: rgba(255, 255, 255, 0.64);
  --ink-faint: rgba(255, 255, 255, 0.4);
  --ink-ghost: rgba(255, 255, 255, 0.22);

  /* Lines */
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);

  /* Accent derivatives */
  --blue-dim: rgba(119, 209, 254, 0.6);
  --blue-faint: rgba(119, 209, 254, 0.16);
  --blue-ghost: rgba(119, 209, 254, 0.07);
  --blue-glow: rgba(119, 209, 254, 0.28);

  /* Type */
  --font: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Fluid type scale — 360px → 1600px viewport */
  --fs-display: clamp(3.25rem, 1.2rem + 9.1vw, 9.5rem);
  --fs-h1: clamp(2.5rem, 1.1rem + 6.2vw, 6.5rem);
  --fs-h2: clamp(2rem, 1.15rem + 3.8vw, 4.25rem);
  --fs-h3: clamp(1.5rem, 1.1rem + 1.8vw, 2.375rem);
  --fs-h4: clamp(1.25rem, 1.05rem + 0.9vw, 1.625rem);
  --fs-lead: clamp(1.0625rem, 0.98rem + 0.44vw, 1.375rem);
  --fs-body: clamp(1rem, 0.96rem + 0.18vw, 1.125rem);
  --fs-small: clamp(0.875rem, 0.85rem + 0.11vw, 0.9375rem);
  --fs-micro: clamp(0.6875rem, 0.67rem + 0.09vw, 0.75rem);

  /* Spacing — fluid section rhythm */
  --section-y: clamp(5rem, 3rem + 9vw, 11rem);
  --section-y-tight: clamp(3.5rem, 2.4rem + 5vw, 7rem);
  --gutter: clamp(1.25rem, 0.6rem + 2.8vw, 4rem);
  --maxw: 1360px;
  --maxw-text: 62ch;
  --maxw-narrow: 940px;

  /* Radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 32px;
  --r-pill: 999px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 0.25s;
  --dur: 0.55s;
  --dur-slow: 0.9s;

  /* Chrome */
  --nav-h: 72px;
}

/* On a large monitor a hard 1360px cap leaves roughly 400px of dead space each
   side, which reads as a lopsided margin rather than a deliberate column.
   Widen in steps. Reading measure is protected separately by --maxw-text, so
   paragraphs never get uncomfortably long. */
@media (min-width: 1560px) {
  :root {
    --maxw: 1500px;
  }
}

@media (min-width: 1860px) {
  :root {
    --maxw: 1660px;
  }
}

@media (min-width: 2200px) {
  :root {
    --maxw: 1820px;
  }
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  /* Clip sideways overflow at the true viewport level.
     `overflow-x: hidden` on <body> alone does NOT do this: when <html> is
     `visible`, the body's overflow value is propagated up to the viewport and
     body itself computes back to `visible`, so nothing actually gets clipped —
     which is why the page could still be dragged sideways.
     `clip` is used rather than `hidden` because it does not create a scroll
     container, so position:sticky inside the page keeps working. */
  overflow-x: clip;
}

@supports not (overflow: clip) {
  html {
    overflow-x: hidden;
  }
}

body {
  background: var(--bg-base);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  max-width: 100%;
  text-rendering: optimizeLegibility;
}

/* Belt and braces: clip at every top-level landmark too, so a decorative
   element that escapes its section can never widen the document. */
main,
.footer {
  overflow-x: clip;
}

@supports not (overflow: clip) {
  body,
  main,
  .footer {
    overflow-x: hidden;
  }
}

body.is-locked {
  overflow: hidden;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* Browsers give <fieldset> a default border and padding */
fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

legend {
  padding: 0;
}

/* The UA rule for [hidden] is display:none at the lowest specificity, so any
   class that sets display (.btn is inline-flex) silently overrides it. Without
   this, the submit button shows on every step. */
[hidden] {
  display: none !important;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

::selection {
  background: var(--blue);
  color: var(--black);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   3. Typography primitives
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.display {
  font-size: var(--fs-display);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: -0.045em;
}

.h1 {
  font-size: var(--fs-h1);
}
.h2 {
  font-size: var(--fs-h2);
}
.h3 {
  font-size: var(--fs-h3);
  line-height: 1.1;
}
.h4 {
  font-size: var(--fs-h4);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--ink-dim);
  letter-spacing: -0.01em;
  max-width: var(--maxw-text);
}

.body-text {
  color: var(--ink-dim);
  max-width: var(--maxw-text);
}

.body-text + .body-text {
  margin-top: 1.15em;
}

.small {
  font-size: var(--fs-small);
  color: var(--ink-faint);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--blue);
  line-height: 1;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
  flex: none;
}

.eyebrow--center::before {
  display: none;
}

.accent {
  color: var(--blue);
}

.dim {
  color: var(--ink-faint);
}

/* Emphasis inside long-form copy */
.body-text strong,
.lead strong {
  color: var(--ink);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--narrow {
  max-width: var(--maxw-narrow);
}

.section {
  position: relative;
  padding-block: var(--section-y);
}

.section--tight {
  padding-block: var(--section-y-tight);
}

.section--deep {
  background: var(--bg-deep);
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: clamp(2.75rem, 1.5rem + 4vw, 5rem);
}

.section-head--center {
  align-items: center;
  text-align: center;
}

.section-head--center .lead {
  margin-inline: auto;
}

.section-head--split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(1.5rem, 1rem + 3vw, 4rem);
  align-items: end;
}

@media (max-width: 860px) {
  .section-head--split {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

.rule {
  height: 1px;
  background: var(--line);
  border: 0;
}

/* Section index number, editorial detail */
.section-index {
  position: absolute;
  top: clamp(1.5rem, 3vw, 3rem);
  right: var(--gutter);
  font-size: var(--fs-micro);
  letter-spacing: 0.2em;
  color: var(--ink-ghost);
  font-weight: 500;
}

@media (max-width: 720px) {
  .section-index {
    display: none;
  }
}

/* Screen-reader only */
.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;
}

/* Placeholder shown until real assets land */
.asset-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  text-align: center;
  background: repeating-linear-gradient(
      135deg,
      rgba(119, 209, 254, 0.045) 0px,
      rgba(119, 209, 254, 0.045) 2px,
      transparent 2px,
      transparent 11px
    ),
    var(--bg-elevated);
  border: 1px dashed var(--line-strong);
  border-radius: inherit;
}

/* In flow rather than absolute when it's a direct grid/flow child */
.msg .asset-placeholder,
.tcard .asset-placeholder {
  position: relative;
  aspect-ratio: 3 / 4;
}

.msg .asset-placeholder {
  aspect-ratio: 4 / 5;
}

.asset-placeholder__label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  max-width: 30ch;
}

.asset-placeholder__kind {
  font-size: var(--fs-micro);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue);
  opacity: 0.55;
  font-weight: 600;
}

.asset-placeholder__path {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.7rem;
  letter-spacing: 0;
  color: var(--ink-ghost);
  line-height: 1.5;
  word-break: break-all;
}

/* --------------------------------------------------------------------------
   5. Texture + ambient light
   -------------------------------------------------------------------------- */

.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.028;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 320 320' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(90px);
  opacity: 0.5;
  z-index: 0;
}

.glow--blue {
  background: radial-gradient(circle, var(--blue-glow) 0%, transparent 68%);
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */

.btn {
  --btn-bg: var(--blue);
  --btn-fg: var(--black);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65em;
  padding: 1.05em 2.1em;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border-radius: var(--r-pill);
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur) var(--ease-out);
  box-shadow: 0 0 0 rgba(119, 209, 254, 0);
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--white);
  transform: translateY(101%);
  transition: transform var(--dur) var(--ease-out);
}

.btn:hover::after,
.btn:focus-visible::after {
  transform: translateY(0);
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px -12px var(--blue-glow);
}

.btn:active {
  transform: translateY(0) scale(0.985);
}

.btn__arrow {
  transition: transform var(--dur) var(--ease-out);
}

.btn:hover .btn__arrow {
  transform: translateX(4px);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--white);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.btn--ghost::after {
  background: var(--white);
}

.btn--ghost:hover {
  --btn-fg: var(--black);
}

.btn--lg {
  padding: 1.2em 2.6em;
  font-size: var(--fs-lead);
}

.btn--block {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.cta-note {
  font-size: var(--fs-small);
  color: var(--ink-faint);
  margin-top: 1.1rem;
  letter-spacing: -0.005em;
}

.cta-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.cta-group--center {
  align-items: center;
  text-align: center;
}

/* --------------------------------------------------------------------------
   7. Nav
   -------------------------------------------------------------------------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  transition: background var(--dur) var(--ease-out),
    backdrop-filter var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
  border-bottom: 1px solid transparent;
}

.nav.is-stuck {
  background: rgba(15, 15, 15, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom-color: var(--line);
}

.nav.is-hidden {
  transform: translateY(-100%);
}

.nav__inner {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.nav__logo img {
  height: 30px;
  width: auto;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.nav__logo:hover img {
  opacity: 0.75;
}

@media (max-width: 480px) {
  .nav__logo img {
    height: 25px;
  }
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2vw, 2.25rem);
}

.nav__link {
  font-size: var(--fs-small);
  color: var(--ink-dim);
  letter-spacing: -0.005em;
  transition: color var(--dur-fast) var(--ease-out);
  position: relative;
}

.nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 1px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--dur) var(--ease-out);
}

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

.nav__link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav__cta {
  padding: 0.75em 1.5em;
  font-size: var(--fs-small);
}

@media (max-width: 900px) {
  .nav__links {
    display: none;
  }
}

/* Scroll progress bar */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  z-index: 101;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--blue-dim), var(--blue));
  will-change: transform;
}

/* --------------------------------------------------------------------------
   8. Scroll reveal primitives
   -------------------------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.95s var(--ease-out), transform 0.95s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
  will-change: opacity, transform;
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

[data-reveal="fade"] {
  transform: none;
}

[data-reveal="left"] {
  transform: translateX(-34px);
}

[data-reveal="right"] {
  transform: translateX(34px);
}

[data-reveal="scale"] {
  transform: scale(0.94);
}

[data-reveal="clip"] {
  opacity: 1;
  transform: none;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.1s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

[data-reveal="clip"].is-in {
  clip-path: inset(0 0 0 0);
}

/* Line-by-line masked text reveal */
/* The overflow mask that hides each line before it animates in will also clip
   descenders (the tail of a "y", "g", "p"). Pad the bottom to give them room,
   then pull it back with an equal negative margin so layout is unchanged. */
.reveal-lines .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.24em;
  margin-bottom: -0.24em;
}

.reveal-lines .line > span {
  display: block;
  transform: translateY(105%);
  transition: transform 1s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 0.085s);
}

.reveal-lines.is-in .line > span {
  transform: translateY(0);
}

@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;
    scroll-behavior: auto !important;
  }
  [data-reveal],
  .reveal-lines .line > span {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }
  .parallax-media {
    transform: none !important;
  }
}
