/*
 * Home layout - natural document scroll (see LAYOUT.md)
 * Edit --header-offset / --content-width on body.home only.
 * Breakpoint: CSS max-width 820px ↔ JS min-width 821px.
 */

/* ─── Header - scroll-driven floating shell (home only) ─── */
body.home .site-header-spacer {
  pointer-events: none;
  min-height: var(--logo-size);
}

body.home .site-header {
  position: fixed;
  z-index: 50;
  left: 50%;
  transform: translateX(-50%);
  top: calc(
    var(--page-pad-y) * (1 - var(--header-float)) +
    var(--header-float-top) * var(--header-float)
  );
  width: calc(
    (100% - 2 * var(--page-pad-x)) * (1 - var(--header-float)) +
    var(--home-content-width) * var(--header-float)
  );
  max-width: calc(
    100% * (1 - var(--header-float)) +
    var(--content-max-width) * var(--header-float)
  );
  padding:
    calc(var(--space-2) * var(--header-float))
    calc(var(--space-4) * var(--header-float));
  background: rgba(250, 252, 255, calc(0.96 * var(--header-float)));
  border: 1px solid rgba(213, 223, 229, calc(0.82 * var(--header-float)));
  border-radius: calc(var(--radius-lg) * var(--header-float));
  box-shadow:
    0 calc(8px * var(--header-float)) calc(32px * var(--header-float)) rgba(0, 0, 0, calc(0.08 * var(--header-float))),
    0 calc(2px * var(--header-float)) calc(8px * var(--header-float)) rgba(0, 0, 0, calc(0.04 * var(--header-float)));
}

/* ─── Landing hero - white + horizon-stacked wave lines ─── */
.landing-frame {
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
  min-height: 100svh;
  width: 100%;
  background: #ffffff;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(var(--space-8), 5vh, 4rem);
  padding: var(--page-pad-y) var(--page-pad-x);
}

.landing-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    url("../assets/hero-horizon-waves.svg?v=20260717az") center 42% / cover no-repeat;
  /* SVG mask fades ink 1→0; layer opacity 0.5 → effective 0.5 left / 0 right */
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

/* Soft fade into white content sections below */
.landing-frame::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: clamp(10rem, 36vh, 18rem);
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(255, 255, 255, 0.55) 48%,
    #ffffff 100%
  );
  pointer-events: none;
  z-index: 0;
}

.landing-frame > * {
  position: relative;
  z-index: 1;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(12rem, 0.95fr);
  align-items: center;
  gap: clamp(var(--space-6), 4vw, var(--space-10));
  width: 100%;
  max-width: var(--home-content-width);
  margin-inline: auto;
  text-align: left;
  min-height: 0;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
}

/* Tagline - much smaller than the display heading, tight under it */
.hero-tagline {
  margin: clamp(0.9rem, 1.8vh, 1.2rem) 0 0;
  max-width: 36ch;
  color: var(--text-secondary);
  font-size: clamp(1.125rem, 1.7vw, 1.375rem);
  font-weight: 400;
  letter-spacing: -0.011em;
  line-height: 1.4;
  white-space: normal;
  opacity: 0;
  animation: fadeIn 0.7s ease 0.55s forwards;
}

/* Display heading - large marketing text.
   Letter-spacing: -0.02em (top of spec range: -0.011em to -0.02em).
   Line-height: 1.15 at extreme display scale (spec: 1.25 for 28–32px;
   relaxed one step for marketing-size type above 40px). */
.hero-statement {
  max-width: none;
  margin: 0;
  color: var(--text-primary);
  font-size: clamp(1.8rem, 3.5vw, 3rem);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.02em;
  text-wrap: balance;
  opacity: 0;
  animation: rise 0.95s cubic-bezier(0.16, 1, 0.3, 1) 0.28s forwards;
}

.hero-statement em {
  font-style: normal;
  font-weight: 600;
  white-space: nowrap;
}

/* Spruce → Nordic Sky - horizontal display gradient text (matches logo ring) */
.hero-statement em,
.platform-title-accent {
  background-image: var(--gradient-spruce-nordic-sky-text);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* Right-side hero - isometric cube-of-cubes (Three.js) */
.hero-visual {
  justify-self: end;
  align-self: center;
  width: min(100%, 28rem);
  max-width: 100%;
  opacity: 0;
  animation: fadeIn 0.9s ease 0.4s forwards;
  overflow: visible;
}

.hero-cube-field {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: min(28rem, 52vh);
  overflow: visible;
}

.hero-cube-field canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ─── Footer scroll cue ─── */
.scroll-hint {
  justify-self: center;
  align-self: center;
  display: inline-flex;
  align-items: center;
  color: var(--color-spruce-green);
  line-height: 0;
  text-decoration: none;
  opacity: 0;
  animation: fadeIn 0.7s ease 1s forwards, scrollHintNudge 2.4s ease-in-out 1.4s infinite;
  transition: color 150ms ease-out;
}

.scroll-hint:hover,
.scroll-hint:focus-visible {
  color: var(--color-spruce-green-dark);
}

@keyframes scrollHintNudge {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(2px); }
}

/* ─── Page sections (screens 2+) - width matches floated header bar ─── */
.content-snap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-block: var(--section-pad-y);
  padding-inline: 0;
  background: #ffffff;
  scroll-margin-top: var(--header-offset);
  box-sizing: border-box;
}

.content-snap-inner {
  flex: none;
}

/* ─── Platform (screen 2) - shell width matches floated .site-header bar ─── */
.platform-snap {
  --concept-icon-size: var(--home-stroke-icon-size);
  --concept-label-size: clamp(1rem, 1.6vw, 1.125rem);
  --concept-cell-size: clamp(8.25rem, 16vw, 10.5rem);
  --concept-cell-gap: clamp(2.5rem, 4.5vw, 3.5rem);
}

.platform-snap .platform-shell {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: var(--home-feature-block-min-height);
  padding-block: clamp(var(--space-6), 4vh, var(--space-8));
  padding-inline: clamp(var(--space-10), 8vw, 3.5rem);
  background: var(--gradient-morning-frost-platform);
  border-radius: var(--radius-lg);
  box-sizing: border-box;
}

.platform-snap .platform-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  --home-net-line: rgba(213, 223, 229, 0.18);
  background-image: var(--home-net-pattern);
  mask-image: radial-gradient(ellipse 85% 75% at 50% 45%, #000 35%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 45%, #000 35%, transparent 100%);
}

.split-layout {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(var(--space-8), 4vw, var(--space-10));
  align-items: center;
  min-height: 0;
}

.split-copy {
  max-width: 34rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(var(--space-8), 4.5vh, 2.75rem);
}

.platform-title {
  display: flex;
  flex-direction: column;
  gap: clamp(var(--space-3), 1.75vh, var(--space-5));
  font-size: clamp(1.75rem, 3.2vw, 2.75rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.platform-title-line {
  color: var(--text-secondary);
  font-weight: 500;
}

.platform-lede-group {
  display: flex;
  flex-direction: column;
  gap: clamp(var(--space-5), 2.5vh, var(--space-6));
  max-width: 32rem;
}

.platform-lede {
  margin: 0;
  color: var(--text-muted);
  font-size: clamp(1.0625rem, 1.9vw, 1.125rem);
  font-weight: 400;
  line-height: 2;
  letter-spacing: -0.008em;
}

.concept-quad-wrap {
  display: flex;
  align-items: center;
  justify-content: end;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding-inline: clamp(var(--space-2), 1.5vw, var(--space-4));
}

.concept-quad {
  display: grid;
  grid-template-columns: repeat(2, var(--concept-cell-size));
  grid-template-rows: repeat(2, var(--concept-cell-size));
  gap: var(--concept-cell-gap);
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.concept-quad-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  width: var(--concept-cell-size);
  height: var(--concept-cell-size);
  min-width: 0;
  text-align: center;
}

/* Taiga-mist stroke icons - concept quad + foundation pillars */
.concept-quad-icon,
.foundation-pillar-icon {
  fill: none;
  overflow: visible;
}

.concept-quad-icon {
  flex: none;
  width: var(--concept-icon-size);
  height: var(--concept-icon-size);
}

.foundation-pillar-icon {
  width: var(--home-stroke-icon-size);
  height: var(--home-stroke-icon-size);
}

.concept-quad-icon path,
.concept-quad-icon circle {
  stroke: url(#concept-taiga-mist);
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.foundation-pillar-icon path,
.foundation-pillar-icon circle {
  stroke: #9eb4c3;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.foundation-pillar-icon path,
.foundation-pillar-icon circle {
  vector-effect: non-scaling-stroke;
}

.concept-quad-label {
  flex: none;
  max-width: 100%;
  color: var(--text-secondary);
  font-size: var(--concept-label-size);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

/* ─── Secured Foundation - power sentence + pillar cards ─── */
.foundation-snap.content-snap {
  padding-block: 0;
}

.foundation-power-sentence {
  --foundation-power-space-top: 0;
  --foundation-power-space-bottom: clamp(0.75rem, 1.5vh, 1.25rem);
  margin: var(--foundation-power-space-top) auto var(--foundation-power-space-bottom);
  max-width: 34ch;
  text-align: center;
  font-size: clamp(1.25rem, 2.4vw, 1.875rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.015em;
  background-image: var(--gradient-morning-frost-text);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ─── Section eyebrow - numeral + label above each content section h2 ─── */
.section-eyebrow {
  margin: 0 auto var(--space-3);
  text-align: center;
  font-size: clamp(1.25rem, 2.2vw, 1.625rem);
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.section-eyebrow-numeral {
  color: var(--color-primary-500);
}

.section-lede {
  text-align: center;
  max-width: 44rem;
  margin-inline: auto;
  margin-top: 0;
  margin-bottom: clamp(var(--space-8), 4vh, 2.5rem);
}

/* ─── Tone banding - alternate section backgrounds ─── */
#solutions.content-snap {
  background: var(--gradient-washed-fog-subtle);
}

.content-snap + .content-snap {
  position: relative;
}

.content-snap + .content-snap::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--home-content-width);
  max-width: var(--content-max-width);
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--border-subtle) 12%,
              var(--border-subtle) 88%, transparent 100%);
}

.foundation-pillar-grid {
  --foundation-pillar-columns: 3;
  --foundation-pillar-gap-x: clamp(var(--space-6), 3.5vw, var(--space-8));
  --foundation-pillar-gap-y: clamp(var(--space-8), 5vh, 3rem);
  --foundation-pillar-rise: 680ms;
  --foundation-pillar-stagger: 240ms;
  --foundation-pillar-delay: 120ms;
  --foundation-viz-height: min(10.5rem, 48vw);
  min-height: var(--foundation-pillar-min-height);
  margin-bottom: clamp(var(--space-8), 8vh, 5rem);
  display: grid;
  grid-template-columns: repeat(var(--foundation-pillar-columns), minmax(0, 1fr));
  column-gap: var(--foundation-pillar-gap-x);
  row-gap: var(--foundation-pillar-gap-y);
}

.foundation-pillar {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0;
  height: 100%;
  min-height: 0;
  min-width: 0;
  padding: var(--space-5);
  border: none;
  border-radius: var(--radius-lg);
  --foundation-pillar-bg: transparent;
  background: var(--foundation-pillar-bg);
  /* Visible by default - motion is progressive enhancement (desktop only). */
  opacity: 1;
  transform: none;
}

@media (min-width: 821px) {
  .foundation-pillar-grid:not(.is-inview) .foundation-pillar {
    opacity: 0;
    transform: translateY(12px);
  }

  .foundation-pillar-grid.is-inview .foundation-pillar {
    animation: foundationPillarRise var(--foundation-pillar-rise) cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: calc(var(--foundation-pillar-delay) + var(--pillar-i, 0) * var(--foundation-pillar-stagger));
  }
}

@keyframes foundationPillarRise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.foundation-pillar-title,
.foundation-pillar-viz,
.foundation-pillar-copy {
  flex-shrink: 0;
}

.foundation-pillar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: var(--home-net-pattern);
}

.foundation-pillar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, #d5dfe5 0%, #b8c7d1 52%, #8fa5b2 100%);
  pointer-events: none;
  z-index: 0;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

.foundation-pillar > * {
  position: relative;
  z-index: 1;
}

.foundation-pillar-title {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: -0.015em;
  line-height: 1.25;
  text-align: center;
}

.foundation-pillar-viz {
  flex: 0 0 var(--foundation-viz-height);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--foundation-viz-height);
  min-height: var(--foundation-viz-height);
  max-height: var(--foundation-viz-height);
}

/* ─── Foundation viz - isolate matrix + seal scene ─── */
.foundation-viz {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  overflow: visible;
}

.foundation-viz--isolate {
  aspect-ratio: 1;
}

.foundation-viz--seal {
  aspect-ratio: 118 / 102;
}

.foundation-viz--monitor {
  aspect-ratio: 1;
}

.foundation-viz-frame {
  fill: none;
  stroke: url(#foundation-isolate-frame);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.foundation-viz-icon {
  fill: none;
  overflow: visible;
  --fv-icon-stroke: 1;
  color: #9eb4c3;
}

.foundation-viz-icon--dense {
  --fv-icon-stroke: 0.875;
}

.foundation-viz-icon path,
.foundation-viz-icon circle {
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  vector-effect: non-scaling-stroke;
}

#foundation-icon-runtime path,
#foundation-icon-identity path {
  stroke: currentColor;
  stroke-width: var(--fv-icon-stroke, 1.25);
  fill: none;
  vector-effect: non-scaling-stroke;
}

#foundation-icon-secret path,
#foundation-icon-secret circle {
  stroke: currentColor;
  stroke-width: var(--fv-icon-stroke, 1);
}

#foundation-icon-integration path {
  stroke: currentColor;
  stroke-width: var(--fv-icon-stroke, 1);
  fill: none;
  vector-effect: non-scaling-stroke;
}

/* Seal - static final illustration state */
.seal-sandboxes {
  transform: translateX(-6px);
}

.seal-secrets {
  display: none;
}

.seal-connector {
  fill: none;
  stroke: url(#foundation-isolate-frame);
  stroke-width: 1;
  stroke-dasharray: 0.04 0.03;
  stroke-dashoffset: 0;
  vector-effect: non-scaling-stroke;
  opacity: 0.75;
}

.foundation-pillar-copy {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.65;
  letter-spacing: -0.011em;
}

/* ─── Workloads change (above metrics) - reuse pillar card chrome ─── */
.workloads-power-sentence {
  max-width: none;
}

.workload-pillar-grid {
  /* same height/gaps as .foundation-pillar-grid; keep space before metrics */
  margin-bottom: clamp(var(--space-8), 8vh, 5rem);
}

.foundation-viz--workload {
  aspect-ratio: 1;
}

.workload-loop-arrow,
.workload-loop-chevron,
.workload-ephemeral-trail,
.workload-sandbox-boundary,
.workload-reward-plus path {
  fill: none;
  stroke: url(#foundation-isolate-frame);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.workload-loop-arrow {
  opacity: 0.75;
}

.workload-loop-arrow--return {
  stroke-dasharray: 3 2.5;
  opacity: 0.65;
}

.workload-sandbox-boundary {
  stroke-dasharray: 3.5 2.5;
  opacity: 0.7;
}

.workload-ephemeral-trail {
  stroke-dasharray: 2.5 2;
  opacity: 0.45;
}

.workload-reward-plus path {
  stroke: #9eb4c3;
  stroke-width: 1.5;
}

/* ─── Short desktop viewports - shrink platform grid, never lock section height ─── */
@media (min-width: 821px) and (max-height: 820px) {
  .split-layout {
    gap: var(--space-6);
  }

  .split-copy {
    gap: var(--space-6);
  }

  .platform-lede {
    line-height: 1.75;
  }

  .concept-quad {
    --concept-cell-size: clamp(7rem, 13vw, 8.5rem);
    --concept-cell-gap: clamp(var(--space-6), 3vw, var(--space-8));
  }
}
