/* ==========================================================================
   Obala — obala.cloud landing page
   Brand tokens sourced from Obala_Brand_Kit/04_Brand_Tokens/obala-brand.css
   ========================================================================== */

:root {
  --obala-orange: #FF6A00;
  --obala-charcoal: #111317;
  --obala-off-white: #F6F6F4;
  --obala-warm-grey: #E2DED9;
  --obala-white: #FFFFFF;
  --obala-muted: #8D95A3;
  --obala-surface: #1a1e24;   /* raised panels / chips on charcoal */
  --obala-line: #2a303b;      /* hairline borders / idle flow lines */
  --obala-font-family: "Outfit", Arial, sans-serif;
}

/* Self-hosted Outfit variable font (latin subset, weight axis covers 400 & 600) */
@font-face {
  font-family: "Outfit";
  src: url("/assets/fonts/outfit-latin-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

html { scroll-behavior: smooth; }

body {
  background: var(--obala-charcoal);
  color: var(--obala-off-white);
  font-family: var(--obala-font-family);
  font-weight: 400;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Very subtle radial vignette over the whole viewport */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 120% at 50% 38%,
              rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.45) 100%);
  z-index: 1;
}

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

.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;
}

/* --- Header ----------------------------------------------------------- */

.site-header {
  position: absolute;
  top: 0; left: 0;
  padding: clamp(1.5rem, 3vw, 2.75rem) clamp(1.5rem, 4vw, 3.5rem);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem clamp(1.75rem, 4vw, 3.25rem);
}

.site-header a { display: inline-block; }

/* Minimal anchor nav next to the logo — transparent, no bar */
.site-nav {
  display: flex;
  gap: clamp(1rem, 2.5vw, 2rem);
}

.site-nav a {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--obala-muted);
  transition: color 0.2s ease;
  /* comfortable touch target without changing the visual weight */
  padding: 0.65rem 0.25rem;
  margin: -0.65rem -0.25rem;
}

.site-nav a:hover { color: var(--obala-off-white); }

.logo {
  display: block;
  width: clamp(150px, 12vw, 180px);
  height: auto;
}

/* --- Hero layout ------------------------------------------------------- */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 45fr) minmax(0, 55fr);
  align-items: center;
  z-index: 2;
}

.copy {
  padding: 0 clamp(1rem, 2vw, 2rem) 0 clamp(1.5rem, 6vw, 6rem);
}

.copy h1 {
  margin: 0;
  font-weight: 600;
  font-size: clamp(3rem, 6vw, 5.5rem);
  line-height: 1.04;
  letter-spacing: -0.015em;
  color: var(--obala-off-white);
}

.copy h1 .accent { color: var(--obala-orange); }

/* Thin orange rule echoing the OG composition */
.rule {
  width: 72px;
  height: 2px;
  background: var(--obala-orange);
  margin: 1.75rem 0 1.5rem;
}

.tagline {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--obala-warm-grey);
}

/* Positioning line under the tagline */
.positioning {
  margin: 1.4rem 0 0;
  max-width: 55ch;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--obala-warm-grey);
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2rem;
}

/* --- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-block;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 0.95rem 1.6rem;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background: var(--obala-orange);
  color: var(--obala-charcoal);
}

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

.btn-ghost {
  padding: calc(0.95rem - 1px) calc(1.6rem - 1px);
  border: 1px solid rgba(141, 149, 163, 0.45);
  color: var(--obala-warm-grey);
}

.btn-ghost:hover {
  color: var(--obala-off-white);
  border-color: var(--obala-muted);
}

/* --- Robot stage ------------------------------------------------------- */

.stage {
  position: relative;
  height: 70vh;
  min-height: 380px;
  width: 100%;
}

.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 3;
}

/* Soft orange glow behind the robot */
.glow {
  position: absolute;
  left: 50%; top: 52%;
  width: 68%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(255, 106, 0, 0.16), rgba(255, 106, 0, 0) 72%);
  filter: blur(48px);
  z-index: 0;
}

/* Soft elliptical ground shadow under the bot */
.ground-shadow {
  position: absolute;
  left: 50%; bottom: 7%;
  width: 46%;
  height: 6%;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0) 70%);
  filter: blur(10px);
  z-index: 2;
}

/* Static fallback render (no WebGL / load error / noscript) */
.fallback {
  display: none;
  position: absolute;
  inset: 4% 6% 5%;
  width: 88%;
  height: 91%;
  object-fit: contain;
  z-index: 3;
}

.fallback.show { display: block; }

/* --- Sections (shared) --------------------------------------------------- */

.section {
  position: relative;
  z-index: 2;
  padding: clamp(4rem, 10vh, 7rem) clamp(1.5rem, 6vw, 6rem);
}

.section-head {
  max-width: 1200px;
  margin: 0 auto;
}

.kicker {
  margin: 0 0 1.1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--obala-orange);
}

.section h2 {
  margin: 0 0 1.25rem;
  font-weight: 600;
  font-size: clamp(2rem, 3.6vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--obala-off-white);
}

.section-intro,
.section-sub {
  margin: 0;
  max-width: 70ch;
  font-size: 1.05rem;
  line-height: 1.6;
}

.section-intro { color: var(--obala-warm-grey); }
.section-sub   { color: var(--obala-muted); }

/* --- Technical overview / 3D pipeline world ------------------------------ */

.pipeline {
  display: grid;
  grid-template-columns: minmax(140px, 190px) minmax(0, 1fr) minmax(140px, 190px);
  gap: clamp(1rem, 2vw, 2rem);
  align-items: stretch;
  height: min(78vh, 820px);
  max-width: 1680px;
  margin: clamp(2.5rem, 6vh, 4rem) auto 0;
}

.pipeline-centre {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pipeline-canvas {
  position: relative;
  flex: 1;
  min-height: 0;
}

.pipeline-canvas canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Source / output capsule chips (real, focusable list items) */
.chips {
  list-style: none;
  margin: 0;
  padding: 0 0 68px;         /* keep chip spread aligned with the canvas, not the captions */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
}

.chips li {
  background: var(--obala-surface);
  border: 1px solid var(--obala-line);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--obala-warm-grey);
  text-align: center;
  white-space: nowrap;
  cursor: default;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.chips li:hover,
.chips li:focus-visible {
  color: var(--obala-off-white);
  border-color: rgba(255, 106, 0, 0.6);
}

/* Stage captions under the canvas; pipeline.js aligns them to the projected
   gate positions (.is-projected). The flex fallback keeps them tidy without JS. */
.pipeline-captions {
  position: relative;
  height: 56px;
  margin-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.stage-caption {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-align: center;
}

.pipeline-captions.is-projected { display: block; }

.pipeline-captions.is-projected .stage-caption {
  position: absolute;
  top: 0;
  flex: none;
  transform: translateX(-50%);
}

.stage-name {
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--obala-off-white);
}

.stage-sub {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--obala-muted);
}

/* WebGL unavailable: hide the canvas, keep chips + captions as a static grid */
.pipeline.pipeline-fallback { height: auto; }
.pipeline.pipeline-fallback .pipeline-canvas { display: none; }
.pipeline.pipeline-fallback .chips { padding-bottom: 0; }

.pipeline-desc {
  max-width: 1200px;
  margin: clamp(2rem, 5vh, 3rem) auto 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--obala-warm-grey);
}

/* --- Stats (KPI row) ------------------------------------------------------ */

.stat-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1.5rem, 3vw, 3rem);
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* The thin orange rule carries the accent — numerals stay in text tokens */
.stat-tile::before {
  content: "";
  width: 40px;
  height: 2px;
  background: var(--obala-orange);
  margin-bottom: 0.4rem;
}

.stat-value {
  font-weight: 600;
  font-size: clamp(3rem, 3.8vw, 3.65rem);  /* >= 48px */
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--obala-off-white);
  font-variant-numeric: normal;            /* proportional figures at display size */
}

.stat-label {
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: var(--obala-muted);
}

/* --- Core capabilities ----------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1.25rem, 2vw, 2rem);
  max-width: 1200px;
  margin: clamp(2.5rem, 6vh, 3.5rem) auto 0;
}

.card {
  background: var(--obala-surface);
  border: 1px solid var(--obala-line);
  border-radius: 16px;
  padding: clamp(1.5rem, 2.5vw, 2.25rem);
}

.card::before {
  content: "";
  display: block;
  width: 40px;
  height: 2px;
  background: var(--obala-orange);
  margin-bottom: 1.25rem;
}

.card h3 {
  margin: 0 0 0.75rem;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--obala-off-white);
}

.card p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--obala-warm-grey);
}

/* --- Deployment ------------------------------------------------------------ */

.deployment .kicker {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.deploy-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(2rem, 4vw, 4rem);
  max-width: 1200px;
  margin: 1.5rem auto 0;
}

.deploy-col h3 {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--obala-off-white);
}

.check-list {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.check-list li {
  position: relative;
  padding-left: 2rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--obala-warm-grey);
}

/* Small orange tick, drawn with borders */
.check-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.4em;
  width: 11px;
  height: 6px;
  border-left: 2px solid var(--obala-orange);
  border-bottom: 2px solid var(--obala-orange);
  transform: rotate(-45deg);
}

/* --- Closing CTA band ------------------------------------------------------ */

.cta-band {
  text-align: center;
  padding-top: clamp(5rem, 14vh, 9rem);
  padding-bottom: clamp(5rem, 14vh, 9rem);
}

.cta-band h2 {
  margin: 0 0 2rem;
  font-size: clamp(2.5rem, 5vw, 4rem);
}

.cta-band h2 .accent { color: var(--obala-orange); }

/* --- Footer ------------------------------------------------------------ */

/* In-flow now that the page scrolls (was fixed on the single-screen hero) */
.site-footer {
  position: relative;
  padding: 1.1rem clamp(1.5rem, 4vw, 3.5rem) 1.4rem;
  z-index: 5;
}

.site-footer p {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--obala-muted);
}

/* --- Loading overlay ---------------------------------------------------- */

#loader {
  position: fixed;
  inset: 0;
  background: var(--obala-charcoal);
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.1rem;
  z-index: 20;
  transition: opacity 0.4s ease;
}

#loader.done {
  opacity: 0;
  pointer-events: none;
}

#loader img {
  width: 64px;
  height: 64px;
  animation: loader-pulse 1.6s ease-in-out infinite;
}

#loader-progress {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--obala-warm-grey);
  font-variant-numeric: tabular-nums;
}

@keyframes loader-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.07); }
}

/* --- 404 page ----------------------------------------------------------- */

.lost {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.25rem;
  text-align: center;
  position: relative;
  z-index: 2;
  padding: 2rem;
}

.lost img { width: 72px; height: 72px; }

.lost h1 {
  margin: 0;
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3.25rem);
  color: var(--obala-off-white);
}

.lost a {
  color: var(--obala-orange);
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}

.lost a:hover { color: var(--obala-off-white); }

/* --- Mobile (stacked) ---------------------------------------------------- */

@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    align-items: start;
    padding-top: clamp(6.5rem, 20vw, 8rem); /* clear the absolute header */
  }

  .copy {
    padding: 0 1.5rem;
  }

  .stage {
    height: auto;
    min-height: 48vh;
    align-self: stretch;
    margin-bottom: 1rem;
  }

  /* Pipeline stacks: source chips above the canvas, output chips below */
  .pipeline {
    display: flex;
    flex-direction: column;
    height: auto;
    gap: 1.25rem;
  }

  .chips {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding-bottom: 0;
  }

  /* flex-basis auto: keep the 52vh height inside the auto-height column */
  .pipeline-canvas {
    flex: 0 0 auto;
    height: 52vh;
  }

  .stage-name { font-size: 0.68rem; letter-spacing: 0.12em; }
  .stage-sub  { font-size: 0.62rem; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  .card-grid,
  .deploy-grid { grid-template-columns: 1fr; }
}

/* --- Reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #loader img { animation: none; }
  #loader { transition: none; }
}
