/* ==========================================================================
   Better Apps Lab — corporate site styling.

   ALL styling lives here: the served CSP is `style-src 'self'` with no
   'unsafe-inline', so an inline <style> block or a style="" attribute would be
   dropped by the browser and the page would render unstyled. No CSS framework
   and no external subresources of any kind — system fonts, inline SVG, and a
   single same-origin stylesheet, so the site issues zero third-party requests
   (the Privacy Policy asserts exactly this).

   Colour follows the visitor's OS setting via prefers-color-scheme, with DARK
   as the base palette and the LIGHT palette applied under
   `prefers-color-scheme: light`. There is no manual theme toggle: across six
   separate pages a CSS-only toggle would reset on every navigation, and
   persisting it would need JavaScript / storage, which this site does not use.

   The responsive bar (375 / 768 / 1280px): no horizontal scrolling, nothing
   clipped or overlapping, interactive targets >= 44x44px (--target-min), and
   navigation that ADAPTS (the hamburger menu below) rather than merely shrinks.
   ========================================================================== */

:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --max: 1180px;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --radius: 14px;
  /* Minimum size of any interactive target — the 44px platform bar, kept as a token. */
  --target-min: 44px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

/* ---------- palettes: DARK is the base ---------- */
body {
  --bg:        #0a0a0c;
  --bg-elev:   #101014;
  --bg-sunk:   #08080a;
  --ink:       #f4f2ee;
  --ink-soft:  #a8a5a0;
  --ink-faint: #6c6a67;
  --line:      #232329;
  --line-soft: #18181d;
  --accent:    #ff6a3d;
  --glow-a:    #ff6a3d;
  --glow-b:    #6e5cff;
  --glow-c:    #17c9b0;
  --grain:     .045;
  --shadow:    0 1px 2px rgba(0,0,0,.5), 0 12px 40px -12px rgba(0,0,0,.7);
}

/* ---------- light palette applied under the OS light setting ---------- */
@media (prefers-color-scheme: light) {
  body {
    --bg:        #fbfaf8;
    --bg-elev:   #ffffff;
    --bg-sunk:   #f3f1ed;
    --ink:       #14131a;
    --ink-soft:  #5d5a63;
    --ink-faint: #85828b;
    --line:      #e3e0da;
    --line-soft: #eeece7;
    --accent:    #d1430f;
    --glow-a:    #ff9b6a;
    --glow-b:    #a99bff;
    --glow-c:    #6fe0d0;
    --grain:     .03;
    --shadow:    0 1px 2px rgba(20,19,26,.06), 0 12px 40px -14px rgba(20,19,26,.18);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .5s var(--ease), color .5s var(--ease);
  /* A long URL/token in copy must wrap, never widen the page past the viewport. */
  overflow-x: hidden;
  overflow-wrap: break-word;
}

/* film grain — inline SVG data URI (CSP img-src permits data:) */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9999;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='140' height='140' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

.vh {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- type ---------- */
h1, h2, h3, h4 { margin: 0; font-weight: 560; letter-spacing: -0.032em; line-height: 1.06; }
em.ser { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
p { margin: 0 0 1.1em; }
a { color: inherit; }

.eyebrow {
  font-size: .75rem; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint);
  display: flex; align-items: center; gap: .7rem; margin-bottom: 1.6rem;
}
.eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--accent); flex: none; }

.lede { font-size: clamp(1.06rem, 1.7vw, 1.22rem); color: var(--ink-soft); max-width: 62ch; }

/* ---------- header ---------- */
header {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--line-soft);
  transition: background .5s var(--ease);
}

.nav { display: flex; align-items: center; gap: .75rem; min-height: 68px; }

.brand {
  display: flex; align-items: center; gap: .62rem;
  text-decoration: none; font-weight: 580; letter-spacing: -0.025em;
  font-size: 1.02rem; margin-right: auto; white-space: nowrap;
  min-height: var(--target-min); padding-right: .5rem;
}
.mark { width: 24px; height: 24px; flex: none; display: block; }
/* The logo's accent arc, styled from CSS (not a var() presentation attribute) so it tracks the palette. */
.mark-arc { stroke: var(--accent); }

.nav-links { display: flex; gap: .15rem; align-items: center; }
.nav-links a {
  text-decoration: none; color: var(--ink-soft);
  font-size: .89rem; font-weight: 500;
  padding: 0 .8rem; border-radius: 9px;
  min-height: var(--target-min);
  display: inline-flex; align-items: center;
  position: relative;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.nav-links a:hover { color: var(--ink); background: var(--line-soft); }
.nav-links a::after {
  content: ""; position: absolute; left: .8rem; right: .8rem; bottom: 9px;
  height: 2px; border-radius: 2px; background: transparent;
}

/* Active-page indicator — driven by aria-current="page" so it survives across real pages and is
   announced to assistive tech (the mockup's :target mechanism is gone with the single-document layout). */
.nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links a[aria-current="page"]::after { background: var(--accent); }

/* icon buttons — real 44px targets */
.iconbtn {
  width: var(--target-min); height: var(--target-min); flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 11px;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.iconbtn:hover { color: var(--ink); border-color: var(--ink-faint); }
#menu:focus-visible ~ header .burger { outline: 2px solid var(--accent); outline-offset: 2px; }

.burger { display: none; }

/* ---------- hero ---------- */
.hero { position: relative; padding: clamp(4.5rem, 12vw, 9rem) 0 clamp(3.5rem, 8vw, 6rem); overflow: hidden; }

.aurora {
  position: absolute; z-index: 0; pointer-events: none;
  width: min(1000px, 130vw); aspect-ratio: 1;
  top: -46%; left: 50%; translate: -50% 0;
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--glow-a) 42%, transparent), transparent 72%) 32% 40% / 62% 62% no-repeat,
    radial-gradient(closest-side, color-mix(in srgb, var(--glow-b) 40%, transparent), transparent 72%) 68% 34% / 58% 58% no-repeat,
    radial-gradient(closest-side, color-mix(in srgb, var(--glow-c) 32%, transparent), transparent 72%) 50% 70% / 54% 54% no-repeat;
  filter: blur(58px);
  opacity: .55;
  animation: drift 22s ease-in-out infinite alternate;
}
@keyframes drift {
  0%   { transform: translate3d(-2%, 0, 0) scale(1); }
  50%  { transform: translate3d(3%, 2%, 0) scale(1.07); }
  100% { transform: translate3d(-1%, -2%, 0) scale(1.02); }
}

.grid-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, var(--line-soft) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px);
  background-size: 82px 82px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 22%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 22%, #000 30%, transparent 78%);
  opacity: .8;
}

.hero .wrap { position: relative; z-index: 1; }

h1.display {
  font-size: clamp(2.7rem, 8.2vw, 6.2rem);
  letter-spacing: -0.045em;
  max-width: 16ch;
  margin-bottom: 1.7rem;
}

.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2.4rem; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: 0 1.4rem; min-height: var(--target-min);
  border-radius: 100px;
  font-size: .93rem; font-weight: 550; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease), color .22s var(--ease);
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-ghost { border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--ink-faint); color: var(--ink); }

/* ---------- sections ---------- */
section.band { padding: clamp(3.5rem, 8vw, 6.5rem) 0; border-top: 1px solid var(--line-soft); }
.sec-head { max-width: 64ch; margin-bottom: 3.2rem; }
.sec-head h2 { font-size: clamp(1.85rem, 3.6vw, 2.7rem); margin-bottom: 1rem; }

.cols { display: grid; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
@media (min-width: 760px) {
  .cols.three { grid-template-columns: repeat(3, 1fr); }
  .cols.two   { grid-template-columns: repeat(2, 1fr); }
}

.cell { background: var(--bg); padding: clamp(1.5rem, 3vw, 2.1rem); transition: background .3s var(--ease); }
.cell:hover { background: var(--bg-elev); }
.cell .n { font-family: var(--font-mono); font-size: .72rem; color: var(--accent); letter-spacing: .1em; margin-bottom: 1.1rem; display: block; }
.cell h3 { font-size: 1.12rem; margin-bottom: .6rem; letter-spacing: -0.02em; }
.cell p { font-size: .945rem; color: var(--ink-soft); margin: 0; }
.cell a { color: var(--accent); text-decoration: none; }
.cell a:hover { text-decoration: underline; text-underline-offset: 3px; }

.rows { border-top: 1px solid var(--line-soft); }
.row { display: grid; gap: .4rem 2.5rem; padding: 1.7rem 0; border-bottom: 1px solid var(--line-soft); }
@media (min-width: 760px) { .row { grid-template-columns: minmax(0,.42fr) minmax(0,.58fr); align-items: start; } }
.row h3 { font-size: 1.15rem; letter-spacing: -0.022em; }
.row p { margin: 0; color: var(--ink-soft); font-size: .96rem; }

/* ---------- prose ---------- */
.prose { max-width: 68ch; }
.prose h2 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); margin: 2.6rem 0 1rem; }
.prose h2:first-of-type { margin-top: 0; }
.prose p, .prose li { color: var(--ink-soft); font-size: .98rem; }
.prose strong { color: var(--ink); font-weight: 560; }
.prose ul { padding-left: 1.15rem; margin: 0 0 1.1em; }
.prose li { margin-bottom: .45em; }
.prose a { color: var(--accent); text-underline-offset: 3px; }

.page-head { padding: clamp(3rem, 7vw, 5rem) 0 clamp(1.6rem, 3vw, 2.4rem); }
.page-head h1 { font-size: clamp(2.1rem, 5.4vw, 3.6rem); margin-bottom: .9rem; }
.page-head .meta { font-family: var(--font-mono); font-size: .76rem; color: var(--ink-faint); letter-spacing: .06em; }

/* Inner-page content column (replaces the mockup's inline padding-bottom). */
.page-body { padding-bottom: clamp(3rem, 7vw, 5.5rem); }

.contact-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.8rem, 4vw, 2.8rem); background: var(--bg-elev);
  box-shadow: var(--shadow);
}
.card-eyebrow {
  font-size: .78rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; margin-bottom: .7rem;
}
.card-note { margin: .9rem 0 0; color: var(--ink-soft); font-size: .94rem; max-width: 52ch; }
.mailto {
  font-size: clamp(1.15rem, 3.4vw, 2rem); font-weight: 560; letter-spacing: -0.03em;
  text-decoration: none; display: inline-flex; align-items: center; gap: .6rem;
  color: var(--ink); min-height: var(--target-min); word-break: break-word;
}
.mailto:hover { color: var(--accent); }

/* Small spacing helpers that replace one-off inline margins from the mockup. */
.mt-lg { margin-top: 2.6rem; }
.mb-lg { margin-bottom: 2.6rem; }
.fine-print { font-size: .9rem; color: var(--ink-faint); }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--line-soft); padding: 3.2rem 0 2.4rem; background: var(--bg-sunk); }
.foot { display: grid; gap: 2.4rem; }
@media (min-width: 760px) { .foot { grid-template-columns: 1.4fr 1fr 1fr; } }
.foot .brand { margin-bottom: .4rem; }
.foot-tagline { color: var(--ink-soft); font-size: .92rem; max-width: 34ch; margin: 0; }
.foot h4 { font-size: .74rem; text-transform: uppercase; letter-spacing: .13em; color: var(--ink-faint); font-weight: 600; margin-bottom: .6rem; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { display: block; }
.foot ul a {
  color: var(--ink-soft); text-decoration: none; font-size: .92rem;
  display: inline-flex; align-items: center;
  /* Both axes meet the 44px bar — a short footer word ("Home") is only ~43px wide otherwise. */
  min-height: var(--target-min); min-width: var(--target-min);
}
.foot ul a:hover { color: var(--ink); }
.legal {
  margin-top: 2.4rem; padding-top: 1.6rem; border-top: 1px solid var(--line-soft);
  display: flex; flex-wrap: wrap; gap: .5rem 1.6rem; align-items: center;
  font-size: .84rem; color: var(--ink-faint);
}
.legal .dot { opacity: .5; }

/* ---------- mobile: the hamburger menu is the "navigation adapts" case ---------- */
@media (max-width: 820px) {
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-elev); border-bottom: 1px solid var(--line);
    padding: .4rem var(--gutter) .9rem;
  }
  #menu:checked ~ header .nav-links { display: flex; }
  .nav-links a { font-size: 1rem; padding: 0 .2rem; border-radius: 0; }
  .nav-links a::after { display: none; }
  .burger { display: grid; }
  header { position: relative; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
