/* ============================================================
   MATTERA · FirstLook — v2 "Ocean" theme (blue preview)
   Deep navy canvas · cool off-white ink · thin-line / hatched diagrams
   Reuses v1 class hooks so mattera.js works unchanged.
   ============================================================ */

:root {
  /* Deep navy blues */
  --green:       #1A2F4A;   /* primary canvas */
  --green-deep:  #142438;   /* recessed panels */
  --green-soft:  #213A5A;   /* raised / hover */
  --green-line:  #263D60;

  /* Cool off-white ink */
  --cream:       #DDE8F8;   /* primary text + light fills */
  --cream-2:     #B8CCEA;   /* secondary text */
  --sage:        #7EA4C8;   /* muted body */
  --sage-dim:    #5D84A8;   /* faint labels */

  /* Lines (cool white at low alpha) */
  --line:        rgba(221,232,248,.16);
  --line-soft:   rgba(221,232,248,.09);
  --line-strong: rgba(221,232,248,.30);

  /* single warm tick used very sparingly for emphasis */
  --ember:       #4A9E5A;
  /* brighter sibling of --ember — same hue family, higher chroma; for the
     rare highlight that should pop (e.g. the radial MEAL wedge outline) */
  --ember-bright: #45C66F;

  /* outer-court azure (rgb triplet) — tints the rails outside the
     frame lines, like the brighter apron around a blue hard court */
  --court:       62, 139, 205;

  --serif: "Source Serif 4", Georgia, serif; /* kept for rare italic emphasis */
  --sans:  "Hanken Grotesk", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:  "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;

  /* Responsive gutter system, two regimes joined continuously (no snap):
     - Phone -> ~1589px: the clamp ramp wins. Slim, content holds ~90%.
     - Above ~1589px: the (100vw - 1500)/2 term wins. The framed block
       (rail-to-rail) caps at 1500px, so CONTENT stops growing (~1412px)
       and the gutters/rails absorb all extra width — the reference's
       "centered column on wide monitors" behavior. Reproduces the old
       chunky external-monitor look (~254px gutters at 1920) while the
       14" laptop (1512) stays on the slim ramp, untouched.
     --frame: edge -> hairline rail. --edge-offset: hairline -> content
     (capped at 44, so the rail-to-content gap stays constant on wide). */
  --frame:       max(clamp(16px, 2.8vw, 56px), calc((100vw - 1500px) / 2));
  --edge-offset: clamp(12px, 2.2vw, 44px);
  --gutter:      calc(var(--frame) + var(--edge-offset));
  --section-y:   clamp(76px, 10vw, 150px);

  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--green);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
  z-index: 0;
}

#paper-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--green);
  transform: translateZ(0);
  will-change: transform;
}
#paper-bg > * {
  width: 100%; height: 100%; display: block;
  animation: paper-fade-in 1.1s ease-out both;
  will-change: opacity;
  transform: translateZ(0);
}
@keyframes paper-fade-in { from { opacity: 0; } to { opacity: 1; } }
/* subtle paper grain over the whole canvas */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .04; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--cream); color: var(--green); }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--green-deep); }
::-webkit-scrollbar-thumb { background: #2A4A6A; border-radius: 5px; }

/* ---------- Outer court rails (fixed) ----------
   Tennis-court read: the zone outside the frame lines is the brighter
   "outer court" apron — one flat tone, like a real court. The boundary
   hairline is the rail's inner border, so the line position is identical
   to the old 1px rules (at var(--frame)). */
.frame { position: fixed; inset: 0; z-index: 101; pointer-events: none; }
.frame::before, .frame::after {
  content: ""; position: absolute; top: 0; bottom: 0;
  width: calc(var(--frame) + 1px);
  background: rgba(var(--court), .18);
  /* amplify the PaperTexture shader behind the rail (no second texture
     source) — the fiber grain reads a pinch stronger here, same character */
  backdrop-filter: contrast(1.18) brightness(1.05);
  -webkit-backdrop-filter: contrast(1.18) brightness(1.05);
}
.frame::before { left: 0;  border-right: 1px solid var(--line-strong); }
.frame::after  { right: 0; border-left:  1px solid var(--line-strong); }

/* ---------- Layout ---------- */
.container { width: 100%; padding-inline: var(--gutter); position: relative; }
.section { padding-block: var(--section-y); position: relative; z-index: 1; }
.section + .section { border-top: 1px solid var(--line); }

/* vertical center rule helper */
.vrule { position: relative; }
.vrule::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%;
  width: 1px; background: var(--line); transform: translateX(-50%);
}

/* ---------- Typography ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--sage); display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: currentColor; opacity: .7; }
.eyebrow.center::before { display: none; }

.display {
  font-family: var(--sans);
  font-weight: 500; line-height: 1.04;
  letter-spacing: -0.018em; margin: 0;
  color: var(--cream); text-wrap: balance;
}
h1.display { font-size: clamp(44px, 4.7vw, 74px); font-weight: 500; letter-spacing: -0.03em; }
h2.display { font-size: clamp(34px, 4.4vw, 62px); }
h3.display { font-size: clamp(22px, 2.4vw, 32px); }

.lead {
  font-size: clamp(16px, 1.3vw, 20px); line-height: 1.62;
  color: var(--cream-2); font-weight: 400; text-wrap: pretty;
}
.serif-em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--cream); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 13px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 14px 22px; border-radius: 0; border: 1px solid transparent;
  transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease), transform .4s var(--ease-out);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn .arr { transition: transform .4s var(--ease-out); }
.btn:hover .arr { transform: translateX(4px); }

.btn-primary, .btn-paper { background: var(--cream); color: var(--green); border-color: var(--cream); }
.btn-primary:hover, .btn-paper:hover { background: #fff; }

.btn-ghost, .btn-ghost-dark {
  background: transparent; color: var(--cream); border-color: var(--line-strong);
}
.btn-ghost:hover, .btn-ghost-dark:hover { background: rgba(221,232,248,.07); border-color: var(--cream); }

.btn-sm { padding: 10px 16px; font-size: 12px; }

/* ---------- Reveal (base visible; animate only when JS+motion live) ---------- */
.reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: no-preference) {
  html.js-fx .reveal {
    opacity: 0;
    transform: translate3d(0, 24px, 0);
    transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
    will-change: opacity, transform;
    backface-visibility: hidden;
  }
  html.js-fx .reveal.in { opacity: 1; transform: translate3d(0, 0, 0); }
  html.js-fx .reveal[data-d="1"] { transition-delay: .08s; }
  html.js-fx .reveal[data-d="2"] { transition-delay: .16s; }
  html.js-fx .reveal[data-d="3"] { transition-delay: .24s; }
  html.js-fx .reveal[data-d="4"] { transition-delay: .32s; }
  html.js-fx .reveal[data-d="5"] { transition-delay: .40s; }

  /* Heading and sub-text: generic reveal + a soft blur-to-focus.
     Blur is GPU-accelerated and runs smoothly now that animations
     trigger after the 250ms browser warmup. */
  html.js-fx .hero h1.reveal,
  html.js-fx .hero-sub.reveal {
    filter: blur(8px);
    transition: opacity .9s var(--ease-out), transform .9s var(--ease-out), filter 1.0s var(--ease-out);
    will-change: opacity, transform, filter;
  }
  html.js-fx .hero h1.reveal.in,
  html.js-fx .hero-sub.reveal.in { filter: blur(0); }
}

/* Always: ensure heading lines stack as blocks */
.hero h1 .hl { display: block; }

/* ---------- Nav ---------- */
.nav { position: fixed; inset: 0 0 auto 0; z-index: 100; transition: background .4s var(--ease), border-color .4s var(--ease); border-bottom: 1px solid var(--line); }
.nav-inner { height: 74px; display: flex; align-items: center; gap: 22px; max-width: 100%; margin-inline: auto; padding-inline: var(--gutter); }
.nav.scrolled { background: rgba(20,36,58,.96); backdrop-filter: blur(14px) saturate(1.1); }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-symbol { width: 36px; height: 18px; overflow: visible; flex-shrink: 0; display: inline-block; }
.brand-logo { width: 131px; height: 18px; overflow: visible; flex-shrink: 0; display: inline-block; }
/* Nav: text-only wordmark uses a cropped viewBox; size to match its aspect (~5.10:1). */
.nav .brand-logo { width: 92px; fill: #ffffff; }
/* Whisper-soft cream fade rising STRAIGHT UP from the nav divider into
   the logo area. Concentrated near the divider, dissolves seamlessly.
   bottom: 0 keeps the rectangle strictly inside the nav — no bleed
   below the divider line. */
.nav::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: calc(var(--gutter) + 46px);
  width: 160px;
  height: 22px;
  transform: translateX(-50%);
  background: linear-gradient(
    to top,
    rgba(221, 232, 248, 0.08) 0%,
    rgba(221, 232, 248, 0.035) 50%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.6) 35%, rgba(0,0,0,0.6) 65%, transparent 100%);
          mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.6) 35%, rgba(0,0,0,0.6) 65%, transparent 100%);
  pointer-events: none;
  z-index: -1;
}
.brand-mark { font-family: var(--sans); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--cream); }
.brand-sub { font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--sage); padding-bottom: 1px; }

.nav-links { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav-link { font-family: var(--mono); font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--cream-2); padding: 8px 12px; border-radius: 0; white-space: nowrap; transition: color .25s, background .25s; }
.nav-link:hover { color: var(--cream); background: rgba(221,232,248,.06); }

.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-signin { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--cream-2); padding: 10px 16px; border: 1px solid var(--line); border-radius: 0; white-space: nowrap; transition: border-color .25s, color .25s; }
.nav-signin:hover { color: var(--cream); border-color: var(--cream); }
/* the GET STARTED cell that runs to the top edge in the reference */
.nav-cta-cell { display: flex; align-items: center; align-self: stretch; }

.nav-burger { display: none; background: none; border: none; padding: 8px; }
.nav-burger span { display: block; width: 22px; height: 1.5px; background: var(--cream); margin: 5px 0; transition: .3s var(--ease); }

/* mobile drawer */
.mnav { position: fixed; inset: 0; z-index: 99; background: rgba(20,36,58,.97); backdrop-filter: blur(14px); display: none; flex-direction: column; padding: 96px var(--gutter) 40px; }
.mnav.open { display: flex; }
.mnav a { font-family: var(--sans); font-size: 30px; font-weight: 500; color: var(--cream); padding: 16px 0; border-bottom: 1px solid var(--line); }
/* Override .mnav a (which sets cream text / 30px sans / underline) so the
   CTA renders as a proper button — green text on cream, mono, no underline. */
.mnav .btn { margin-top: 28px; justify-content: center; color: var(--green); font-family: var(--mono); font-size: 13px; font-weight: 500; padding: 16px 22px; border-bottom: none; }

/* ---------- Footer ---------- */
.footer { background: transparent; color: var(--sage); padding-block: clamp(54px, 6vw, 78px) 0; border-top: 1px solid var(--line); position: relative; z-index: 1; }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; }
.foot-brand .brand-mark { color: var(--cream); }
/* Footer: M logomark only — viewBox is 170.89 × 86.05 (~1.99:1). At 18px tall, natural width ≈ 36px (matches the same physical pixel size the M had when it sat at the left of the combined wordmark). */
.foot-brand .brand-logo { width: 36px; height: 18px; overflow: visible; }
.foot-brand p { margin: 18px 0 0; font-size: 13.5px; line-height: 1.6; max-width: 30ch; color: var(--sage-dim); }
.foot-brand .foot-contact { display: inline-block; margin-top: 22px; font-family: var(--mono); font-size: 12.5px; letter-spacing: .04em; color: var(--cream-2); border-bottom: 1px solid rgba(221,232,248,.20); padding-bottom: 2px; transition: color .25s, border-color .25s; }
.foot-brand .foot-contact:hover { color: var(--cream); border-bottom-color: var(--cream); }
.foot-col h5 { font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--sage-dim); margin: 0 0 18px; }
.foot-col a { display: block; font-size: 14px; color: var(--cream-2); padding: 6px 0; transition: color .25s; }
.foot-col a:hover { color: var(--cream); }
.foot-bot { margin-top: clamp(44px, 5vw, 60px); padding-block: 30px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-inline: calc(-1 * var(--edge-offset)); padding-inline: var(--edge-offset); }
.foot-bot .fine { font-family: var(--mono); font-size: 11px; letter-spacing: .03em; color: var(--sage-dim); }
.foot-bot .fine b { color: var(--cream-2); font-weight: 500; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .nav-links, .nav-signin { display: none; }
  .nav-burger { display: block; }
  /* .nav-links carried the margin-left:auto that right-aligns the bar;
     it's hidden here, so move the push onto .nav-right instead. */
  .nav-right { margin-left: auto; }
  .nav-cta-cell { border-left: none; padding-left: 0; }
  .vrule::before { display: none; }
}
@media (max-width: 760px) {
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
  .foot-brand { grid-column: span 2; }
}
@media (max-width: 480px) { .foot-grid { grid-template-columns: 1fr; } .foot-brand { grid-column: auto; } }
