/* ==========================================================================
   Redloop — base + shared components (v3 "line grid")
   Every section builds from these pieces; see DESIGN.md.
   ========================================================================== */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; scroll-padding-top: var(--nav-h); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  letter-spacing: -0.01em;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 1.5px solid rgba(237,237,237,.7); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* programmatic focus targets (sections after anchor jumps) never show a ring */
[tabindex="-1"]:focus { outline: none; }
.skip-link {
  position: fixed; top: 10px; left: 10px; z-index: 200; height: 40px; padding: 0 16px;
  display: inline-flex; align-items: center; border-radius: var(--r-sm);
  background: var(--text); color: #0a0a0a; font-size: 14px; font-weight: 500;
  transform: translateY(-160%); transition: transform .3s var(--ease-out);
}
.skip-link:focus, .skip-link:focus-visible { transform: none; outline: 1.5px solid rgba(237,237,237,.7); outline-offset: 3px; }

/* ---------- smooth scroll (Lenis; see main.js) ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ---------- page chrome: rails + starfield ---------- */
.page-rails { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
.page-rails::before, .page-rails::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line);
}
.page-rails::before { left: var(--gutter); }
.page-rails::after { right: var(--gutter); }

.page-stars {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 8%, #fff6 50%, transparent 51%),
    radial-gradient(1px 1px at 38% 62%, #fff5 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 44%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 56% 86%, #fff4 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 78%, #fff5 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 94% 92%, #ffffff55 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 24% 36%, #ffffff40 50%, transparent 51%);
  background-size: 520px 520px;
}
main, .site-footer { position: relative; z-index: 2; }

/* ---------- layout ---------- */
.shell { width: var(--shell); margin-inline: auto; position: relative; }
.sec { position: relative; }

/* Section bar: full-bleed hairlines with [ 02 / 13 ] … [ LABEL ] (Qore) */
.sec-bar { position: relative; height: 44px; }
.sec-bar::before, .sec-bar::after {
  content: ""; position: absolute; left: 0; right: 0; height: 1px; background: var(--line);
  transform-origin: left center; transform: scaleX(var(--bar-p, 1));
}
.sec-bar::before { top: 0; }
.sec-bar::after { bottom: 0; transform-origin: right center; }
.sec-bar .shell {
  display: flex; justify-content: space-between; align-items: center; height: 100%;
  font-family: var(--font-mono); font-size: var(--fs-mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3);
}
.sec-bar .shell > span { padding-inline: 14px; line-height: 14px; }
.sec-bar .shell > span:first-of-type { border-left: 2px solid var(--text-2); }
.sec-bar .shell > span:last-of-type { border-right: 2px solid var(--text-2); }
/* "+" crosses where the bar meets the rails */
.x-mark { position: absolute; width: 9px; height: 9px; pointer-events: none; z-index: 3; margin: -4px 0 0 -4px; }
.x-mark::before, .x-mark::after { content: ""; position: absolute; background: var(--line-3); }
.x-mark::before { left: 4px; top: 0; width: 1px; height: 9px; }
.x-mark::after { top: 4px; left: 0; height: 1px; width: 9px; }
.x-mark.l { left: 0; } .x-mark.r { left: 100%; }
.x-mark.t { top: 0; }  .x-mark.b { top: 100%; }

.sec-body { padding-block: var(--sec-y) var(--sec-y-end); }

/* Section header (centered by default, .split = title left / lead right) */
/* padding-inline: heads align with cell content (inset by --pad), never sit on the rails */
.sec-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; justify-items: center; text-align: center; max-width: 860px; margin-inline: auto; padding-inline: var(--pad); }
.sec-head .lead { max-width: 560px; }
.sec-head.split {
  max-width: none; justify-items: start; text-align: left;
  grid-template-columns: 1.5fr 1fr; align-items: end; column-gap: 48px;
}
.sec-head.split .eyebrow { grid-column: 1 / -1; }
.sec-head.split .lead { justify-self: end; max-width: 400px; }
.sec-head + * { margin-top: clamp(48px, 5.5vw, 88px); }

/* ---------- type ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-size: var(--fs-mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-2);
}
.eyebrow::before, .eyebrow::after {
  content: ""; width: 8px; height: 10px; flex: none; opacity: .55;
  background: linear-gradient(90deg, currentColor 1px, transparent 1px) 0 0 / 3px 100%;
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }

.display, .h2, .h3 { font-weight: 450; color: var(--text); text-wrap: balance; }
/* Vercel/Geist tracking: -0.06em on display sizes, -0.03em on h3 */
.display { font-size: var(--fs-display); line-height: 1; letter-spacing: -0.06em; }
.h2 { font-size: var(--fs-h2); line-height: 1.06; letter-spacing: -0.06em; }
.h3 { font-size: var(--fs-h3); line-height: 1.25; letter-spacing: -0.03em; }
.h4 { font-size: var(--fs-h4); line-height: 1.3; letter-spacing: -0.02em; font-weight: 500; }
/* accent phrase: same Geist face, dimmed to the secondary gray (Vercel-style two-tone heading) */
.display em, .h2 em, .h3 em, .display em *, .h2 em *, .h3 em * { font-style: normal; color: var(--text-2); }
.lead { font-size: var(--fs-lead); line-height: 1.6; color: var(--text-2); letter-spacing: 0; text-wrap: pretty; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: var(--fs-small); }
.mono { font-family: var(--font-mono); font-size: var(--fs-mono); letter-spacing: .06em; text-transform: uppercase; }
.mono.lc { text-transform: none; letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- lined grid (Vercel-style hairline cells) ---------- */
.grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.grid > * { background: var(--bg); position: relative; min-width: 0; }
.cell { padding: var(--pad); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* corner "+" marks — add <i class="cm tl"></i><i class="cm tr"></i><i class="cm bl"></i><i class="cm br"></i> */
.cm { position: absolute; width: 9px; height: 9px; pointer-events: none; z-index: 4; }
.cm::before, .cm::after { content: ""; position: absolute; background: var(--text-3); }
.cm::before { left: 4px; top: 0; width: 1px; height: 9px; }
.cm::after { top: 4px; left: 0; height: 1px; width: 9px; }
.cm.tl { left: -5px; top: -5px; }  .cm.tr { right: -5px; top: -5px; }
.cm.bl { left: -5px; bottom: -5px; } .cm.br { right: -5px; bottom: -5px; }

/* corner brackets (short L marks on each corner) */
.brackets { position: relative; }
.brackets::before {
  content: ""; position: absolute; inset: -4px; pointer-events: none;
  background:
    linear-gradient(var(--line-3), var(--line-3)) 0 0 / 8px 1px,
    linear-gradient(var(--line-3), var(--line-3)) 0 0 / 1px 8px,
    linear-gradient(var(--line-3), var(--line-3)) 100% 0 / 8px 1px,
    linear-gradient(var(--line-3), var(--line-3)) 100% 0 / 1px 8px,
    linear-gradient(var(--line-3), var(--line-3)) 0 100% / 8px 1px,
    linear-gradient(var(--line-3), var(--line-3)) 0 100% / 1px 8px,
    linear-gradient(var(--line-3), var(--line-3)) 100% 100% / 8px 1px,
    linear-gradient(var(--line-3), var(--line-3)) 100% 100% / 1px 8px;
  background-repeat: no-repeat;
}

/* icon tile */
.icon-tile {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-sm); flex: none;
  background: linear-gradient(180deg, var(--bg-4), var(--bg-3));
  border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 8px 24px -12px rgba(0,0,0,.6);
  color: var(--text);
}
.icon-tile svg { width: 20px; height: 20px; }

/* dithered pixel icons (assets/js/dither.js). Inks: .s solid · .g outlined · .d dither · .a always-red
   .k = outline ghost while resolving · .x = hidden. Hovering the host turns the icon red. */
.dz {
  --dz-fill: #e4e4e4; --dz-line: #85858a; --dz-dot: #a4a4a8; --dz-ghost: #333338;
  display: inline-block; flex: none; justify-self: start; line-height: 0; color: var(--text);
}
.dz svg { display: block; overflow: visible; }
.dz rect { vector-effect: non-scaling-stroke; transition: fill .28s var(--ease-out), stroke .28s var(--ease-out); }
.dz .s { fill: var(--dz-fill); }
.dz .g { fill: none; stroke: var(--dz-line); stroke-width: 1px; }
.dz .d { fill: var(--dz-dot); }
.dz .a { fill: var(--accent); }
.dz .k { fill: none; stroke: var(--dz-ghost); stroke-width: 1px; }
.dz .x { visibility: hidden; }
.dz-host:hover .dz, .dz-host:focus-within .dz, .dz.is-on {
  --dz-fill: var(--accent); --dz-line: #c2402d; --dz-dot: #e0503a; --dz-ghost: #4a1a13;
}

/* ---------- buttons (Vercel / Geist) ----------
   primary: #ededed pill, black label, hover #ccc · secondary: #0a0a0a + 1px #2e2e2e ring, hover #1f1f1f
   .btn--sm is the 32px nav size with a 6px radius. Labels only, no icons. */
.btn {
  --btn-h: 40px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--btn-h); padding: 0 16px; border-radius: 9999px;
  font-family: var(--font-sans); font-size: 15px; font-weight: 500; line-height: 1; letter-spacing: -0.01em; white-space: nowrap;
  background: #ededed; color: #0a0a0a;
  transition: background .15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow .15s cubic-bezier(0.4, 0, 0.2, 1), color .15s;
}
.btn:hover { background: #cccccc; }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px rgba(237,237,237,.6); }
.btn-label { display: inline-flex; align-items: center; }
.btn-ico { display: none; }
.btn--ghost { background: #0a0a0a; color: #ededed; box-shadow: 0 0 0 1px #2e2e2e; }
.btn--ghost:hover { background: #1f1f1f; }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { background: #d2331f; }
.btn--lg { --btn-h: 48px; padding: 0 20px; font-size: 16px; }
.btn--sm { --btn-h: 32px; padding: 0 10px; font-size: 14px; border-radius: 6px; }
.btn--block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { background: #1f1f1f; color: #8f8f8f; box-shadow: 0 0 0 1px #2e2e2e; cursor: not-allowed; }

.link-arrow { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.link-arrow svg { width: 14px; height: 14px; transition: transform .4s var(--ease-out); }
.link-arrow:hover svg { transform: translateX(4px); }

/* ---------- pills & tags ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 10px; height: 32px; padding: 0 12px 0 5px;
  border-radius: var(--r-pill); background: rgba(255,255,255,.03); box-shadow: inset 0 0 0 1px var(--line-2);
  font-size: 13px; color: var(--text-2);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.pill-tag {
  height: 22px; padding: 0 9px; border-radius: var(--r-pill); display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.07); color: var(--text);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
}
.pill svg { width: 14px; height: 14px; color: var(--text-3); }
.tag {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--r-xs);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line-2); background: rgba(255,255,255,.02);
}
.tag.accent { color: var(--accent-light); background: var(--accent-soft); box-shadow: none; }
.tag.red { color: var(--accent-light); background: var(--red-soft); box-shadow: none; }
.tag.green { color: #7cf0b5; background: rgba(62,224,143,.12); box-shadow: none; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); animation: live 1.6s ease-in-out infinite; }
.ok-dot, .warn-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: none; display: inline-block; }
.warn-dot { background: #ffb84d; }
@keyframes live { 50% { box-shadow: 0 0 0 6px transparent; } }

/* ---------- visuals: images that dissolve into the canvas ---------- */
.visual { position: relative; overflow: hidden; }
.visual img { width: 100%; height: 100%; object-fit: cover; }
.glow {
  position: absolute; pointer-events: none; border-radius: 50%; filter: blur(60px);
  background: radial-gradient(circle, var(--violet-glow), transparent 70%);
}
/* dotted surface (Axiora dot grid) */
.dots { background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.08) 1px, transparent 0); background-size: 22px 22px; }

/* marquee: <div class="marquee"><div class="marquee-track">items ×2</div></div> */
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track { display: flex; width: max-content; animation: marquee var(--marquee-d, 40s) linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee.reverse .marquee-track { animation-direction: reverse; }
@keyframes marquee { to { transform: translateX(-50%); } }

.scramble { display: inline-block; white-space: nowrap; }

/* ---------- navbar ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: var(--nav-h);
  transition: background .4s, transform .6s var(--ease-out);
}
.nav::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--line); opacity: 0; transition: opacity .4s; }
.nav.is-scrolled { background: rgba(5, 5, 6, .74); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); }
.nav.is-scrolled::after { opacity: 1; }
.nav.is-hidden { transform: translateY(-100%); }
.nav .shell { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-inline: var(--pad); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -0.035em; }
.brand .logo-mark { width: 28px; height: auto; color: var(--text); }
.nav-links {
  display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: var(--r-sm);
  background: rgba(10,10,11,.55); box-shadow: inset 0 0 0 1px var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  position: absolute; left: 50%; transform: translateX(-50%);
}
.nav-links a {
  height: 30px; padding: 0 13px; display: inline-flex; align-items: center; border-radius: var(--r-xs);
  font-size: 13.5px; color: var(--text-2); transition: color .25s, background .25s;
}
.nav-links a:hover, .nav-links a.is-active { color: var(--text); background: rgba(255,255,255,.06); }
.nav-cta { display: flex; align-items: center; gap: 6px; }
.nav-cta .nav-login { font-size: 13.5px; color: var(--text-2); padding: 0 12px; }
.nav-cta .nav-login:hover { color: var(--text); }
.menu-toggle { display: none; width: 40px; height: 40px; border-radius: var(--r-sm); box-shadow: inset 0 0 0 1px var(--line-2); place-content: center; }
.menu-toggle i { display: block; width: 16px; height: 1.5px; background: var(--text); transition: transform .4s var(--ease-out); }
.menu-toggle i + i { margin-top: 5px; }
.menu-open .menu-toggle i:first-child { transform: translateY(3.25px) rotate(45deg); }
.menu-open .menu-toggle i:last-child { transform: translateY(-3.25px) rotate(-45deg); }

.mobile-menu {
  position: fixed; inset: 0; z-index: 99; background: var(--bg); overflow-y: auto; overscroll-behavior: contain;
  padding: calc(var(--nav-h) + 16px) 16px 28px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  clip-path: inset(0 0 100% 0); transition: clip-path .7s var(--ease-out), visibility 0s .7s; visibility: hidden;
}
.menu-open { overflow: hidden; }
.menu-open .mobile-menu { clip-path: inset(0 0 0 0); visibility: visible; transition: clip-path .7s var(--ease-out); }
.menu-open .nav { background: transparent; backdrop-filter: none; transform: none; }
.mobile-menu nav a {
  display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line);
  font-size: 28px; letter-spacing: -0.045em;
}
.mobile-menu nav a span { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); letter-spacing: .06em; }
.mobile-menu .mm-foot { display: grid; gap: 16px; }

@media (max-width: 991px) {
  .nav-links, .nav-cta .nav-login { display: none; }
  .menu-toggle { display: grid; }
  .sec-head.split { grid-template-columns: 1fr; row-gap: 20px; }
  .sec-head.split .lead { justify-self: start; }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
  .nav-cta .btn { display: none; }
  .nav .shell { padding-inline: 4px; }  /* phones: brand + toggle sit just inside the rails */
  .sec-bar .shell > span { padding-inline: 10px; }
}
@media (min-width: 992px) { .mobile-menu { display: none; } }

/* ---------- motion: initial states (only while JS + GSAP run; see main.js) ---------- */
.js-anim [data-fade], .js-anim [data-stagger]:not(.grid) > *, .js-anim .grid[data-stagger] > * > *, .js-anim [data-split] { opacity: 0; }
.split-line { overflow: hidden; padding-bottom: .1em; margin-bottom: -.1em; }

@media (prefers-reduced-motion: reduce) {
  .marquee-track, .live-dot { animation: none; }
}
