/* ==========================================================================
   Frontier Edge — landing page
   ========================================================================== */

body { font-size: var(--base-size); line-height: var(--base-leading); }
.site-header, main, .site-footer { position: relative; z-index: 1; }

/* Lenis smooth scrolling (required base styles) */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- Nav bar ---------- */
.site-header .wrap {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding-block: var(--nav-pad);
}

/* ---------- Hero corner mesh ----------
   Overlapping soft colour points that drift on their own cycles, fading to black toward the text side.
   Hovering the gradient swirls the colours (js/home.js); on touch screens they swirl on their own. */
.aura { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; background: var(--color-bg); }
.aura .field-wrap { position: absolute; inset: 0; }
.aura .mesh {
  position: absolute; top: -12%; right: -6%; width: 50vw; height: 124%;
  background: var(--hero-base);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 45%);
          mask-image: linear-gradient(90deg, transparent 0%, #000 45%);
  transform: translateZ(0);
}
.aura .mesh span {
  position: absolute; inset: -25%; display: block; will-change: transform;
  animation: heroFlow var(--t, 14s) ease-in-out infinite alternate;
  transition: translate var(--mesh-swirl-duration) var(--ease-overshoot);
}
.mesh .m1 { background: radial-gradient(closest-side at 82% 22%, var(--hero-1), transparent); --t: 13s; }
.mesh .m2 { background: radial-gradient(closest-side at 62% 50%, var(--hero-2), transparent); --t: 16s; }
.mesh .m3 { background: radial-gradient(closest-side at 50% 18%, var(--hero-3), transparent); --t: 12s; }
.mesh .m4 { background: radial-gradient(closest-side at 88% 70%, var(--hero-4), transparent); --t: 18s; }
.mesh .m5 { background: radial-gradient(closest-side at 30% 62%, var(--hero-5), transparent); --t: 15s; }
.mesh .m6 { background: radial-gradient(closest-side at 70% 88%, var(--hero-6), transparent); --t: 19s; }
.mesh .m7 { background: radial-gradient(closest-side at 95% 45%, var(--hero-7), transparent); --t: 17s; }
@keyframes heroFlow {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-11%, 8%) scale(1.14); }
  100% { transform: translate(9%, -7%) scale(.92); }
}
.aura.hover .mesh .m1 { translate: -9% 8%; }
.aura.hover .mesh .m2 { translate: 9% -8%; }
.aura.hover .mesh .m3 { translate: 8% 9%; }
.aura.hover .mesh .m4 { translate: -9% -6%; }
.aura.hover .mesh .m5 { translate: 8% -6%; }
.aura.hover .mesh .m6 { translate: -6% -9%; }
.aura.hover .mesh .m7 { translate: -8% 8%; }
/* film grain over the colour */
.aura .grain {
  position: absolute; inset: -50%; opacity: .22; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
/* keep the text side dark */
.aura .field-wrap::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--color-bg) 52%, rgba(6, 6, 7, .5) 62%, transparent 72%), linear-gradient(to bottom, transparent 40%, rgba(6, 6, 7, .5) 100%);
}

/* ---------- Hero ---------- */
.hero .wrap { display: grid; gap: 0; justify-items: start; padding-block: var(--hero-pad-top) var(--hero-pad-bottom); }
.hero h1 {
  margin: 0; font-weight: var(--weight-regular);
  font-size: var(--h1-size); line-height: var(--h1-leading); letter-spacing: var(--h1-tracking);
  max-width: 22ch; text-wrap: wrap;
}
/* the lead's width is matched to the headline's longest line (js/home.js) */
.hero .headline-group { display: grid; width: fit-content; max-width: 100%; }
.hero .lede {
  display: grid; gap: 12px;
  width: 0; min-width: 100%; max-width: none; text-wrap: wrap;
  margin: 20px 0 0; color: var(--color-fg-2); font-size: var(--lead-size); line-height: var(--lead-leading);
}
.hero .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 36px; }

/* ---------- Shared heading and prose ---------- */
h2 {
  margin: 0; font-weight: var(--weight-regular);
  font-size: var(--h2-size); line-height: var(--h2-leading); letter-spacing: var(--h2-tracking);
  max-width: 22ch; text-wrap: balance;
}
.prose { display: grid; gap: 18px; max-width: 38em; color: var(--color-fg-2); }
.prose p { margin: 0; }
.prose, .services p, .closing-text { font-size: var(--body-size); line-height: var(--body-leading); }

/* ---------- Showcase: "Shifting the industry" ----------
   A tall scroll track with a pinned full-screen green panel. Scrolling types the heading, then the paragraphs appear.
   Sections are layered for the curtain reveal into the next section (js/home.js). */
main > section { position: relative; background: var(--color-bg); }
.hero { background: transparent !important; }
.showcase {
  position: relative; height: 260vh; /* the pinned stretch the frame and typing play across */
  /* let the hero glow carry a little past the top of the green section, then fade to black */
  background: linear-gradient(to bottom, transparent 0, rgba(6, 6, 7, .6) 22vh, var(--color-bg) 48vh, var(--color-bg) calc(100% - 100vh), transparent calc(100% - 100vh)) !important;
}
.reveal-inner { will-change: transform; }
.showcase .pin { position: sticky; top: 0; height: 100vh; overflow: hidden; }
.showcase .panel {
  position: relative; overflow: hidden; border-radius: var(--radius);
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  clip-path: inset(0 var(--inset, 48px) 0 var(--inset, 48px));
  will-change: clip-path;
}
/* light green field with a fine white grid */
.showcase .field {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-color: var(--color-field-green);
  background-image:
    linear-gradient(var(--color-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-grid-line) 1px, transparent 1px);
  background-size: 20px 20px; background-position: -1px -1px;
}
/* green mesh frame that grows out from behind the black box as you scroll */
.grid-card {
  position: absolute; z-index: 1; pointer-events: none; border-radius: var(--radius); overflow: hidden;
  clip-path: inset(var(--gc, 0px)); will-change: clip-path;
  background-color: var(--green-base);
  box-shadow: 0 30px 80px rgba(0, 30, 20, .3);
}
.window {
  position: relative; z-index: 1;
  width: min(820px, calc(100% - 192px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface-window); border: 1px solid var(--border-window);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(20, 40, 20, .22);
}
.window-body { display: flex; flex-direction: column; gap: 28px; padding: var(--window-pad); }
.window-body h2, .window-body .prose { max-width: none; }
/* Typing: the whole heading is always laid out and untyped letters are only hidden, so words never move.
   The caret is a border on the typed span, so it can never cause a line break. */
.typed .rest { visibility: hidden; }
.typed .t { border-right: 0.06em solid currentColor; margin-right: -0.06em; animation: caret 1s steps(1) infinite; }
.typed.done .t { border-right-color: transparent; animation: none; }
@keyframes caret { 50% { border-right-color: transparent; } }
.prose-view { position: relative; overflow: hidden; flex: none; }
.prose-view .prose { padding-block: 12px; opacity: 0; transform: translateY(12px); transition: opacity .8s ease, transform .8s ease; }
.showcase.text-in .prose-view .prose, .showcase.static .prose-view .prose { opacity: 1; transform: none; }
/* no pinning or typing for visitors who prefer reduced motion */
.showcase.static { height: auto; }
.showcase.static .pin { position: relative; height: auto; padding-block: 48px; }
.showcase.static .prose-view { height: auto !important; }

/* ---------- Capabilities ---------- */
section.block { border-top: 1px solid var(--color-line); }
section.block .wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); gap: 24px 64px;
  padding-block: var(--section-pad);
}
.showcase + section.block { border-top: 0; }
.showcase + section.block .wrap { padding-top: 56px; padding-bottom: 0; }
.block-body { min-width: 0; display: grid; gap: 28px; }
.block-head { display: grid; gap: 16px; align-content: start; min-width: 0; }
.block-head h2 { max-width: 9ch; }

.services { list-style: none; margin: 0; padding: 0; }
.services li {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 8px 32px;
  padding-block: 24px; border-bottom: 1px solid var(--color-line);
}
.services li:last-child { border-bottom: 0; } /* dividers only between services */
.services h3 {
  margin: 0; display: flex; align-items: center; gap: 14px;
  font-weight: var(--weight-regular); font-size: var(--h3-size); line-height: var(--h3-leading); letter-spacing: var(--h3-tracking);
}
.services .svc-icon { width: 1.1em; height: 1.1em; flex: none; color: var(--color-fg); }
.services p { margin: 0; color: var(--color-fg-2); max-width: 36em; }
/* divider spotlight: near the cursor the line lights up in the spotlight mesh */
.services li:not(:last-child)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, var(--spot-1) 0%, var(--spot-2) 30%, var(--spot-3) 55%, var(--spot-4) 78%, var(--spot-5) 100%);
  opacity: 0; transition: opacity .4s ease-out;
  -webkit-mask-image: radial-gradient(ellipse 200px 56px at var(--mx, 50%) var(--my, 0px), #000 0%, #000 35%, transparent 100%);
          mask-image: radial-gradient(ellipse 200px 56px at var(--mx, 50%) var(--my, 0px), #000 0%, #000 35%, transparent 100%);
}
.services.lit li:not(:last-child)::after { opacity: 1; }
/* desktop: the first service sits on the same baseline as "What we're building"; rows get an even 32px rhythm */
@media (min-width: 761px) {
  section.block .services { margin-top: 19px; }
  section.block .services li { padding-block: 32px; align-items: start; }
}

/* ---------- Closing ---------- */
section.block.closing { border-top: 0; }
section.block.closing .wrap { display: block; padding-block: var(--closing-pad); }
.closing-body { max-width: 760px; margin-inline: auto; text-align: center; display: grid; justify-items: center; }
.closing h2 { max-width: 20ch; margin: 0; }
.closing-text { margin: 28px 0 0; color: var(--color-fg-2); max-width: 40em; text-wrap: pretty; }
.closing .cta { margin-top: 32px; }

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  .aura .mesh { width: 55vw; right: -12%; }
  .aura .field-wrap::after { background: linear-gradient(90deg, var(--color-bg) 70%, rgba(6, 6, 7, .5) 79%, transparent 88%), linear-gradient(to bottom, transparent 40%, rgba(6, 6, 7, .5) 100%); }
  /* the green panel is full width from the start, and the box sits near the top with even green margins */
  .showcase .panel { clip-path: none !important; align-items: flex-start; padding-top: 24px; box-sizing: border-box; }
  .grid-card { display: none; }
  .showcase + section.block .wrap { padding-top: 32px; }
  section.block .wrap { column-gap: 24px; grid-template-columns: minmax(0, 1fr); }
  .window { width: calc(100% - 48px); }
  .window-body { padding: 24px 22px; gap: 16px; }
  .window-body .prose { font-size: var(--body-size); line-height: 1.5; gap: 12px; }
  .prose-view .prose { padding-block: 4px; }
  /* the paragraphs can scroll inside the box on phones; no scrollbar shows */
  .prose-view { scrollbar-width: none; }
  .prose-view::-webkit-scrollbar { display: none; }
  .services li { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Touch screens and phones: the hover effects play on their own ---------- */
@media (hover: none), (max-width: 760px) {
  /* service dividers: a band of colour sweeps across one line at a time */
  .services li:not(:last-child)::after {
    opacity: 1;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 50%, transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0%, #000 50%, transparent 100%);
    -webkit-mask-size: 45% 100%; mask-size: 45% 100%;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: -100% 0; mask-position: -100% 0;
    animation: lineSweep 6.4s ease-in-out infinite backwards;
  }
  .services li:nth-child(2)::after { animation-delay: 1.6s; }
  .services li:nth-child(3)::after { animation-delay: 3.2s; }
  .services li:nth-child(4)::after { animation-delay: 4.8s; }
}
@keyframes lineSweep {
  0%   { -webkit-mask-position: -100% 0; mask-position: -100% 0; }
  25%  { -webkit-mask-position: 200% 0; mask-position: 200% 0; }
  100% { -webkit-mask-position: 200% 0; mask-position: 200% 0; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .aura .mesh span, .aura .grain { animation: none !important; transition: none; }
  .aura.hover .mesh span { translate: none; }
  .services li:not(:last-child)::after { animation: none; opacity: 0; }
}
