/*
 * 3D Berry — shared stylesheet.
 *
 * Single source of truth for design tokens, base styles, layout containers,
 * typography scale and the common components. Every page under backend/site/
 * links this file from its <head>:
 *
 *   <link rel="stylesheet" href="/assets/site.css">
 *
 * Before this file existed each page carried its own :root block, its own body
 * background and its own idea of how wide the content should be — home alone
 * rendered three different content widths (1425 / 760 / 820px) in one view.
 * The visual language here is the one quote.html and machining.html already
 * used, because it was the newest and the most finished of the two that had
 * grown on the site.
 *
 * Page-specific CSS stays in the page. Put a rule here only when two or more
 * pages need it.
 */

/* ── Tokens ───────────────────────────────────────────────────────────────── */

:root{
  /* Surfaces, darkest to lightest. --panel is the card fill, --surface the
     slightly lifted variant used for interactive tiles. */
  --bg:#1a1917;
  --bg-2:#221f1d;
  --panel:#232322;
  --surface:#2b2d2b;
  --surface-2:#34322f;
  --input:#201f1e;

  --border:rgba(255,255,255,.08);
  --border-2:rgba(255,255,255,.16);
  --border-3:rgba(255,255,255,.24);

  --text:#f4f2ef;
  --text-dim:#b4afa8;
  --text-faint:rgba(255,255,255,.34);

  --primary:#2f80ff;
  --primary-600:#1f6bf0;
  --primary-700:#155ad6;
  --primary-soft:#5aa0ff;
  --accent:#1db6c9;
  --accent-soft:#7fe0ec;

  --radius-sm:10px;
  --radius:16px;
  --radius-lg:22px;
  --radius-pill:999px;

  --shadow-sm:0 4px 16px rgba(0,0,0,.28);
  --shadow:0 18px 40px rgba(0,0,0,.38);
  --shadow-primary:0 12px 28px rgba(47,128,255,.32);
  --ring:0 0 0 3px rgba(47,128,255,.35);
  --trans:.2s ease;

  /* One content width for the whole site. --container-wide is only for grids
     that genuinely need the extra room (the materials table, part galleries). */
  --container:1180px;
  --container-wide:1320px;
  --container-narrow:820px;
  --gutter:20px;

  --font:'Inter', system-ui, -apple-system, sans-serif;

  /* Vertical rhythm. Sections use --section-y so every page breathes the same. */
  --section-y:clamp(32px,5vw,72px);
  --section-y-lg:clamp(48px,7vw,96px);
  --stack:clamp(16px,2.4vw,28px);

  --header-h:64px;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */

*{ box-sizing:border-box; }

html{
  min-height:100%;
  background:var(--bg);
  scroll-behavior:smooth;
}

body{
  position:relative;
  margin:0;
  min-height:100vh;
  font-family:var(--font);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  background:var(--bg);
}

/* The blue/cyan wash. It used to be four gradients painted straight onto
   <body> with background-attachment:fixed, which forces the compositor to
   repaint the whole stack on every scroll. Here each hue is its own fixed
   layer behind the content, drifting with a transform — transforms are
   composited on the GPU, so the animation costs nothing per frame.
   The layers are oversized and blurred so their edges never enter the
   viewport as they move. */
body::before,
body::after{
  content:"";
  position:fixed;
  inset:-30%;
  z-index:-1;
  pointer-events:none;
  will-change:transform;
}
body::before{
  background:
    radial-gradient(42% 38% at 74% 16%, rgba(47,128,255,.26), rgba(47,128,255,0) 70%),
    radial-gradient(38% 34% at 18% 78%, rgba(47,128,255,.16), rgba(47,128,255,0) 72%);
  animation:hueDriftA 34s ease-in-out infinite alternate;
}
body::after{
  background:
    radial-gradient(40% 36% at 12% 20%, rgba(29,182,201,.20), rgba(29,182,201,0) 72%),
    radial-gradient(44% 40% at 84% 88%, rgba(29,182,201,.16), rgba(29,182,201,0) 72%);
  animation:hueDriftB 46s ease-in-out infinite alternate;
}

@keyframes hueDriftA{
  0%  { transform:translate3d(0,0,0) scale(1); }
  50% { transform:translate3d(3.5%,-2.5%,0) scale(1.08); }
  100%{ transform:translate3d(-2.5%,3%,0) scale(1.03); }
}
@keyframes hueDriftB{
  0%  { transform:translate3d(0,0,0) scale(1.05); }
  50% { transform:translate3d(-3%,3.5%,0) scale(1); }
  100%{ transform:translate3d(2.5%,-2%,0) scale(1.09); }
}

a{ color:var(--primary-soft); text-decoration:none; transition:color var(--trans); }
a:hover{ color:#8dbdff; }

img{ max-width:100%; }

::placeholder{ color:var(--text-faint); }

input,textarea,select{ font-family:inherit; }
input:focus,textarea:focus,select:focus{
  outline:none;
  border-color:var(--primary) !important;
  box-shadow:var(--ring);
}

/* Keyboard focus stays visible even where a component paints its own states. */
:focus-visible{ outline:2px solid var(--primary-soft); outline-offset:2px; }

summary::-webkit-details-marker{ display:none; }

.material-symbols-outlined{ font-variation-settings:'FILL' 0,'wght' 400,'GRAD' 0,'opsz' 24; }

/* Anchors sit under the sticky header without this. */
[id]{ scroll-margin-top:calc(var(--header-h) + 24px); }

/* ── Layout ───────────────────────────────────────────────────────────────── */

.container{
  width:100%;
  max-width:var(--container);
  margin-inline:auto;
  padding-inline:var(--gutter);
}
.container--wide{ max-width:var(--container-wide); }
.container--narrow{ max-width:var(--container-narrow); }

/* A .section owns its vertical rhythm; a .container inside owns the width.
   Keeping the two jobs apart is what stopped pages from each inventing their
   own padding. */
.section{ padding-block:var(--section-y); }
.section--lg{ padding-block:var(--section-y-lg); }
.section--flush-top{ padding-block-start:0; }

.stack{ display:flex; flex-direction:column; gap:var(--stack); }
.cluster{ display:flex; flex-wrap:wrap; align-items:center; gap:12px; }

.grid-auto{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(260px,100%),1fr));
  gap:clamp(16px,2.4vw,24px);
}

/* ── Typography ───────────────────────────────────────────────────────────── */

h1,h2,h3,h4{ margin:0; font-weight:700; letter-spacing:-.02em; text-wrap:balance; }

.h-display{
  font-size:clamp(34px,5.2vw,58px);
  line-height:1.04;
  letter-spacing:-.03em;
  font-weight:800;
}
.h-section{
  font-size:clamp(26px,3.4vw,38px);
  line-height:1.15;
  font-weight:700;
}
.h-card{ font-size:19px; line-height:1.3; font-weight:700; }

/* The eyebrow belongs above the heading it labels. */
.eyebrow{
  display:inline-flex; align-items:center; gap:8px;
  padding:7px 14px;
  border-radius:var(--radius-pill);
  border:1px solid rgba(29,182,201,.35);
  background:rgba(29,182,201,.10);
  color:var(--accent-soft);
  font-size:13px; font-weight:600;
  letter-spacing:.06em; text-transform:uppercase;
}

.lede{
  margin:0;
  max-width:56ch;
  font-size:clamp(16px,1.6vw,19px);
  line-height:1.6;
  color:var(--text-dim);
  text-wrap:pretty;
}

.section-sub{
  margin:10px 0 0;
  max-width:64ch;
  font-size:17px;
  line-height:1.6;
  color:var(--text-dim);
  text-wrap:pretty;
}

.text-gradient{
  background:linear-gradient(90deg,var(--primary-soft),var(--accent));
  -webkit-background-clip:text; background-clip:text;
  color:transparent;
}

.text-dim{ color:var(--text-dim); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:10px;
  padding:15px 26px;
  border:0; border-radius:12px;
  font-family:var(--font); font-size:16px; font-weight:700;
  line-height:1;
  cursor:pointer;
  text-decoration:none;
  transition:filter var(--trans), background var(--trans), transform var(--trans), box-shadow var(--trans);
}
.btn:active{ transform:translateY(1px); }

.btn-primary{
  background:linear-gradient(180deg,var(--primary),var(--primary-600));
  color:#fff;
  box-shadow:var(--shadow-primary);
}
.btn-primary:hover{ color:#fff; filter:brightness(1.08); }

.btn-secondary{
  padding:15px 24px;
  border:1px solid var(--border-2);
  background:rgba(255,255,255,.04);
  color:var(--text);
  font-weight:600;
}
.btn-secondary:hover{ color:var(--text); background:rgba(255,255,255,.09); }

.btn-ghost{
  padding:12px 18px;
  border:1px solid var(--border);
  background:none;
  color:var(--text-dim);
  font-weight:600;
}
.btn-ghost:hover{ color:var(--text); background:rgba(255,255,255,.05); }

.btn[disabled],.btn[aria-disabled="true"]{
  opacity:.5; cursor:not-allowed; filter:none; transform:none;
}

/* ── Cards & panels ───────────────────────────────────────────────────────── */

.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:22px 24px;
}
.card--lift{
  box-shadow:var(--shadow-sm);
  transition:transform var(--trans), box-shadow var(--trans), border-color var(--trans);
}
.card--lift:hover{
  transform:translateY(-3px);
  border-color:var(--border-2);
  box-shadow:var(--shadow);
}

/* Hairline-separated figures. The 1px gap over a border-coloured background is
   what draws the dividers, so the children must be opaque. */
.stat-band{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(200px,100%),1fr));
  gap:1px;
  background:var(--border);
  border:1px solid var(--border);
  border-radius:var(--radius);
  overflow:hidden;
}
.stat-band > *{ background:var(--panel); padding:22px 24px; }
.stat-value{ font-size:26px; font-weight:800; letter-spacing:-.02em; }
.stat-label{ margin-top:4px; color:var(--text-dim); font-size:14px; }

.check-list{
  display:flex; flex-wrap:wrap; gap:22px;
  margin:0; padding:0; list-style:none;
  color:var(--text-dim); font-size:14px;
}
.check-list li,.check-item{ display:inline-flex; align-items:center; gap:7px; }
.check-list .material-symbols-outlined,.check-item .material-symbols-outlined{
  font-size:18px; color:var(--accent);
}

/* ── dc runtime interop ───────────────────────────────────────────────────── */

/* quote.html and machining.html are dc artifacts. At boot the runtime injects
   its FULL_PAGE_CSS — `html,body{height:100%}` plus
   `#dc-root,#dc-root>.sc-host{height:100%}` — which assumes the artifact owns
   the whole viewport and that nothing follows it. Both pages are far taller
   than the viewport, so #dc-root clamps to ~one screen and the rest of the
   page overflows it. That was invisible until these pages got a footer: the
   footer is a sibling of #dc-root, so it laid out right after the clamped box
   and landed in the middle of the content.
   The runtime injects a <style> at boot, so it wins on order against this
   linked sheet — hence !important. Scoped with :has() so no other page pays
   for it. */
html:has(#dc-root),
body:has(#dc-root){ height:auto !important; }
#dc-root,
#dc-root > .sc-host{ height:auto !important; min-height:100vh; }

/* ── Header ───────────────────────────────────────────────────────────────── */

/* The markup is generated by deployment/sync-header.js; only the styling lives
   here. Edit the markup there, not in a page. */
.site-header{
  position:sticky; top:0; z-index:5000;
  display:flex; align-items:center; justify-content:space-between;
  gap:16px;
  /* width:100%, not 100vw. 100vw counts the scrollbar, which pushed the old
     #topBar about 15px past the viewport and gave every classic page a
     horizontal scrollbar on desktop. */
  width:100%;
  padding:12px var(--gutter);
  background:rgba(26,25,23,.78);
  backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px);
  border-bottom:1px solid var(--border);
}
.site-logo{ display:flex; align-items:center; height:38px; flex:0 0 auto; }
.site-logo img{ width:132px; height:auto; max-height:38px; object-fit:contain; display:block; }
.site-nav{ display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.site-nav a, .site-nav .site-current{
  color:var(--text); font-weight:600; font-size:15px;
  padding:10px 14px; border-radius:var(--radius-sm);
  text-decoration:none; white-space:nowrap;
}
.site-nav a:hover{ background:rgba(255,255,255,.07); color:var(--text); }
.site-nav .site-current{
  color:var(--accent-soft); padding:9px 14px;
  background:rgba(29,182,201,.10);
  border:1px solid rgba(29,182,201,.30);
}
.site-nav .site-cta{
  color:#fff; padding:10px 18px;
  background:linear-gradient(180deg,var(--primary),var(--primary-600));
  box-shadow:0 8px 18px rgba(47,128,255,.28);
}
.site-nav .site-cta:hover{
  color:#fff; filter:brightness(1.07);
  background:linear-gradient(180deg,var(--primary),var(--primary-600));
}
.site-burger{ display:none; }

@media (max-width:860px){
  /* Flat nav wrapped onto three rows at 375px — 208px of sticky chrome.
     Collapse behind the burger instead. */
  .site-header{ flex-wrap:nowrap; gap:10px; padding:10px 14px; }
  .site-burger{
    display:flex; align-items:center; justify-content:center;
    width:44px; height:44px; flex:0 0 auto;
    padding:0; margin:0;
    background:none; border:0; border-radius:var(--radius-sm);
    color:var(--text); cursor:pointer;
  }
  .site-nav{
    display:none;
    position:absolute; left:0; right:0; top:100%;
    flex-direction:column; align-items:stretch; gap:0;
    background:var(--input);
    border-bottom:1px solid var(--border);
  }
  .site-header.nav-open .site-nav{ display:flex; }
  /* .site-cta has to be named explicitly: as two classes it scores (0,2,0)
     and would outrank a bare ".site-nav a" (0,1,1), keeping its 10px desktop
     padding and sitting 12px shorter than every other row in the panel. */
  .site-nav a, .site-nav .site-current, .site-nav .site-cta{
    padding:16px 20px; font-size:17px; text-align:center;
    border-radius:0; border:0;
    border-top:1px solid var(--border);
    background:none; box-shadow:none;
  }
  .site-nav .site-current{ color:var(--accent-soft); }
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

/* Static, not fixed. home.html used to pin its bar and pay for it with a
   padding-bottom:70px on <body>. */
.site-footer{
  margin-top:var(--section-y-lg);
  border-top:1px solid var(--border);
  background:rgba(26,25,23,.6);
}
.site-footer-inner{
  display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between;
  gap:20px;
  max-width:var(--container);
  margin-inline:auto;
  padding:28px var(--gutter);
}
.site-footer-links{ display:flex; flex-wrap:wrap; gap:6px 18px; }
.site-footer-links a{ color:var(--text-dim); font-size:14px; font-weight:600; }
.site-footer-links a:hover{ color:var(--text); }
.site-footer-social{ display:flex; align-items:center; gap:14px; }
.site-footer-social a{ display:inline-flex; color:var(--text-dim); }
.site-footer-social a:hover{ color:var(--text); }
.site-footer-copy{ color:var(--text-dim); font-size:14px; }

@media (max-width:640px){
  .site-footer-inner{ flex-direction:column; align-items:flex-start; }
}

/* ── Motion ───────────────────────────────────────────────────────────────── */

@keyframes floaty{ 0%,100%{ transform:translateY(0) } 50%{ transform:translateY(-10px) } }
@keyframes pulseRing{
  0%{ box-shadow:0 0 0 0 rgba(47,128,255,.35) }
  70%{ box-shadow:0 0 0 14px rgba(47,128,255,0) }
  100%{ box-shadow:0 0 0 0 rgba(47,128,255,0) }
}

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