/* Prototype B: content over a fixed WebGL facade of pivoting slats. */

:root {
  --bg: #000;
  --text: #f2f2f2;
  --muted: #a0a0a0;
  --faint: #767676;  /* the lightest grey that keeps small text at 4.5:1 on black */
  --rule: #2a2a2a;
  --accent: #f5e642;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --gutter: clamp(20px, 5vw, 72px);
  --top: 76px;
  /* Notches and home indicators, with viewport-fit=cover. */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); color-scheme: dark; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html.rm { scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 max(var(--gutter), var(--safe-r)) 0 max(var(--gutter), var(--safe-l));
}

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 20;
  background: var(--text); color: #000;
  padding: 8px 12px; font-size: 14px; font-weight: 500; text-decoration: none;
}
.skip:focus { top: 12px; }

/* The facade sits under everything and never takes input; the large viewport height keeps it
   from resizing while a phone's address bar shows and hides. */
.facade {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: 0;
  pointer-events: none;
  display: block;
}
/* With reduced motion the still frame scrolls away with the hero instead of staying fixed. */
html.rm .facade { position: absolute; }

/* Browsers without WebGL get a rendered still of the facade at rest. */
.facade-still { display: none; }
html.no-gl .facade { display: none; }
html.no-gl .facade-still {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: 0;
  pointer-events: none;
  background-image: url('still.webp?v=3');
  background-size: cover;
  background-position: 60% 50%;
}

.top, main, .foot { position: relative; z-index: 1; }

/* Top bar */
.top { position: absolute; left: 0; right: 0; top: 0; z-index: 2; padding-top: var(--safe-t); }
.top-in { display: flex; align-items: center; gap: 32px; height: var(--top); }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  min-height: 44px;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.brand-mark { width: 6px; height: 6px; background: var(--accent); }

/* Hero: the copy sits in the upper middle on the left, beside the shaft of light on the right.
   The small viewport height keeps it clear of a phone's toolbars. */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: flex-start;
  padding: max(calc(var(--top) + var(--safe-t) + 48px), 26vh) 0 calc(clamp(64px, 12vh, 132px) + var(--safe-b));
  padding-top: max(calc(var(--top) + var(--safe-t) + 48px), 26svh);
}
/* Wide screens set the copy a little lower. Before the phone and tablet rules, which override it. */
@media (min-width: 1024px) {
  .hero { padding-top: max(calc(var(--top) + 48px), 36vh); padding-top: max(calc(var(--top) + 48px), 36svh); }
  /* Room for the headline to break after its comma. */
  .hero-in > h1 { max-width: 11.5em; }
}
.hero-in { width: 100%; }
.hero-in > * { max-width: 760px; }
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 22px;
}
h1 {
  font-size: clamp(2.5rem, 5.4vw, 4.75rem);
  line-height: 1.03;
  font-weight: 500;
  letter-spacing: -0.032em;
  margin: 0 0 26px;
  text-wrap: balance;
}
.sub { color: var(--muted); font-size: clamp(1.05rem, 1.35vw, 1.2rem); margin: 0 0 18px; max-width: 32em; text-wrap: balance; }
/* Capabilities: a quiet list under the sub. Each item stays whole and the line wraps only between
   items; every item carries its dot before it, and the list is shifted left by one dot slot and
   clipped there, so the dot that would start a line is never shown. */
.caps {
  --dot: 1.6em;
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0 0 40px calc(-1 * var(--dot));
  clip-path: inset(0 0 0 var(--dot));
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.9;
  letter-spacing: 0.02em;
  color: var(--faint);
}
.caps li { white-space: nowrap; }
.caps li::before { content: "·"; content: "·" / ""; display: inline-block; width: var(--dot); text-align: center; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-block;
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--text);
  line-height: 1.2;
  transition: background-color 0.2s, border-color 0.2s;
}
.btn-primary { background: var(--text); color: #000; }
.btn-primary:hover { background: #fff; border-color: #fff; }
.btn-secondary { border-color: #444; color: var(--text); background: #000; }
.btn-secondary:hover { border-color: var(--muted); }

/* Services: three columns divided by hairlines, echoing the slats. */
.services { padding: clamp(140px, 22vh, 220px) 0 clamp(120px, 18vh, 200px); }
.section-head { max-width: 780px; margin-bottom: 80px; }
h2 {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
.offers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
}
.offer { padding: 32px 36px 8px 0; }
.offer + .offer { border-left: 1px solid var(--rule); padding-left: 32px; }
.offer-n { display: block; font-family: var(--mono); font-size: 13px; color: var(--faint); margin-bottom: 56px; }
.offer h3 { margin: 0 0 14px; font-size: 1.35rem; font-weight: 500; letter-spacing: -0.01em; line-height: 1.3; }
.offer p { margin: 0; color: var(--muted); text-wrap: pretty; }

/* Contact: the heading on the left and the form on the right; one column below 960 px. */
.contact { min-height: 72vh; min-height: 72svh; display: flex; align-items: center; padding: 120px 0; }
.contact-in {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 48px clamp(48px, 7vw, 120px);
  align-items: start;
}
.contact-line { color: var(--muted); margin: 20px 0 0; max-width: 32em; text-wrap: pretty; }

/* The Contact button opens the form; contact.js hides the form until then, so it shows without JS. */
.contact-open { margin-top: 36px; }
.contact-open:has(> [hidden]) { display: none; }
.contact-form {
  position: relative;
  max-width: 640px;
  transition: opacity 0.35s cubic-bezier(0.33, 0, 0.2, 1), transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.contact-form.is-opening { opacity: 0; transform: translateY(8px); }
html.rm .contact-form { transition: none; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 20px; }
.field { min-width: 0; margin-bottom: 24px; }
.field label {
  display: block;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
/* 16 px input text, so iOS does not zoom in on focus. */
.field input, .field textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid #444;
  border-radius: 0;
  background: #000;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s;
}
.field textarea { min-height: 168px; resize: vertical; }
.field :is(input, textarea):hover { border-color: var(--faint); }
.field :is(input, textarea):focus-visible { outline-offset: 0; border-color: var(--faint); }
.field [aria-invalid="true"] { border-color: var(--text); }
.field-error { display: flex; align-items: baseline; gap: 10px; margin: 10px 0 0; color: var(--text); font-size: 14px; line-height: 1.4; }
/* The brand's small yellow square marks each error. */
.field-error::before { content: ""; flex: none; width: 6px; height: 6px; background: var(--accent); transform: translateY(-2px); }
.field-error:empty { display: none; }
/* Honeypot: off-screen for people, still present for bots that fill every field. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* Cloudflare Turnstile renders here; contact.js adds .has-check so the space is held before it loads. */
.contact-form.has-check .turnstile { min-height: 65px; margin-bottom: 24px; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; }
button.btn { font-family: inherit; cursor: pointer; border-radius: 0; -webkit-appearance: none; appearance: none; }
.btn:disabled { opacity: 0.55; cursor: default; }
.form-status { margin: 0; color: var(--text); font-size: 15px; }
/* Result of a plain form post: the service redirects to one of these fragments. */
.status {
  display: none;
  margin: 0 0 24px;
  padding: 12px 16px;
  border: 1px solid var(--rule);
  border-left: 2px solid var(--accent);
  color: var(--text);
  font-size: 15px;
  scroll-margin-top: 96px;
}
.status:target { display: block; }

.foot { border-top: 1px solid var(--rule); background: #000; }
/* Three columns so the saiba.dev link sits at the true centre whatever the © line's width. */
.foot-in {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px 32px;
  padding-top: 28px;
  padding-bottom: calc(36px + var(--safe-b));
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}
.foot-mark {
  grid-column: 2;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
  /* A 44 px tap target without moving the line. */
  padding: 12px 6px;
  margin: -12px -6px;
}
.foot-mark:hover, .foot-mark:focus-visible { color: var(--accent); }
.foot-in .end { grid-column: 3; justify-self: end; }

/* Reveal: hidden only once boot.js has opted in, so content never stays hidden without JS. */
html.reveal [data-reveal] {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s cubic-bezier(0.33, 0, 0.2, 1), transform 1.2s cubic-bezier(0.22, 0.61, 0.36, 1);
}
html.reveal [data-reveal].in { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .offers { grid-template-columns: 1fr; border-top: 0; }
  .offer, .offer + .offer { border-left: 0; border-top: 1px solid var(--rule); padding: 28px 0 32px; }
  .offer:last-child { border-bottom: 1px solid var(--rule); }
  .offer-n { margin-bottom: 18px; }
}

@media (max-width: 959px) {
  .contact-in { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .contact-form { max-width: none; }
}

/* Phones and portrait tablets: the facade's band of light runs across the top (main.js makes the
   same choice), so the copy sits below it. Keep this query in step with makeLayout's `narrow`. */
@media (max-width: 699px), (max-aspect-ratio: 5/6) {
  .hero {
    align-items: flex-end;
    padding-top: calc(var(--top) + var(--safe-t) + 48px);
    /* Taller screens lift the copy closer to the band; short ones keep it clear of the band. */
    padding-bottom: calc(clamp(64px, 24vh - 70px, 190px) + var(--safe-b));
    padding-bottom: calc(clamp(64px, 24svh - 70px, 190px) + var(--safe-b));
  }
}
@media (min-width: 700px) and (max-aspect-ratio: 5/6) {
  .hero { padding-bottom: calc(18vh + var(--safe-b)); padding-bottom: calc(18svh + var(--safe-b)); }
}

@media (max-width: 760px) {
  :root { --top: 64px; }
  body { font-size: 16px; }
  /* Three lines on every phone width, the widest of them filling the column. */
  h1 { font-size: min(2.5rem, 10.2vw); margin-bottom: 22px; }
  .sub { font-size: 1rem; margin-bottom: 14px; }
  /* Two items to a line on every phone width. */
  .caps { --dot: 1.5em; line-height: 1.8; letter-spacing: 0; margin-bottom: 30px; }
  .contact { padding: 96px 0; }
  .section-head { margin-bottom: 48px; }
  .foot-in { grid-template-columns: 1fr; justify-items: center; }
  .foot-mark, .foot-in .end { grid-column: 1; justify-self: center; }
}

/* Short phones: a tighter hero keeps the kicker clear of the band (main.js raises it below 720 px). */
@media (max-width: 699px) and (max-height: 719px) {
  .hero { padding-bottom: calc(48px + var(--safe-b)); }
  .hero .eyebrow { margin-bottom: 16px; }
  .hero h1 { margin-bottom: 18px; }
  .hero .sub { margin-bottom: 12px; }
  .hero .caps { margin-bottom: 22px; }
}

@media (max-width: 560px) {
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .form-foot .btn { width: 100%; text-align: center; }
}

/* Landscape phones: the whole hero fits the short screen, left of the shaft of light. */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --top: 52px; }
  .hero {
    align-items: center;
    padding: calc(var(--top) + var(--safe-t) + 8px) 0 calc(16px + var(--safe-b));
  }
  .hero .eyebrow { margin-bottom: 10px; }
  .hero h1 { font-size: clamp(1.6rem, 7.6vh, 2.5rem); max-width: 15em; margin-bottom: 12px; }
  .hero .sub { font-size: 1rem; max-width: 28em; margin-bottom: 10px; }
  /* Wraps before the shaft of light on the right. */
  .hero .caps { line-height: 1.7; margin-bottom: 18px; max-width: calc(46vw + var(--dot)); }
  .contact { padding: 72px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html.reveal [data-reveal] { opacity: 1; transform: none; transition: none; }
  .btn, .foot-mark, .field input, .field textarea, .contact-form { transition: none; }
}
