/* ============================================================================
   base.css — THE FIXED SPINE (FOUNDATION-SPEC.md Part B)
   Shared byte-for-byte across every template. Holds: grid, rhythm, section
   anatomy (v1.3.0), motion (v1.3.1), type scale. Carries NO look values —
   palette/font/radius/shadow come from the look token-file (look-*.css).
   ============================================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* --- Spine tokens (FIXED; structural only) ---------------------------------
   The look-file overrides --color-*, --font-*, --radius, --shadow-* and the
   chosen --section-y. Everything below is the house grammar and never varies. */
:root {
  /* Grid */
  --container: 1280px;
  --container-wide: 1400px;
  --gutter: 60px;

  /* Rhythm — 8px base; section-y scale (look picks one as default) */
  --space-1: 8px;  --space-2: 16px; --space-3: 24px;
  --space-4: 32px; --space-6: 48px; --space-8: 64px;
  --section-y-tight: 40px;
  --section-y-base:  56px;
  --section-y-airy:  72px;
  --section-y: var(--section-y-base); /* look-file may re-point this */

  /* Type scale (FIXED steps; look picks the family + exact display size) */
  --t-label:   13px;
  --t-label-s: 12px;
  --t-body:    16px;
  --t-body-s:  14px;
  --t-h3:      22px;
  --t-h2:      28px;
  --t-h1:      32px;
  --t-display: 44px; /* look may push 36–52 */

  /* Motion (v1.3.1, FIXED) */
  --lift: -3px;
  --zoom: 1.03;
  --press: 0.98;
  --motion-fast: 150ms;
  --motion: 200ms;
  --motion-slow: 400ms;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1); /* ease-out */

  /* Look-file MUST define these; spine ships inert fallbacks so base alone
     still renders something legible (never used once a look-file loads). */
  --color-bg: #fff;
  --color-surface: #fafafa;
  --color-text: #161922;
  --color-text-muted: #666;
  --color-line: #e6e6e6;
  --color-accent: #444;
  --color-accent-ink: #fff;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-rest: 0 1px 2px rgba(0,0,0,.04);
  --shadow-hover: 0 8px 24px rgba(0,0,0,.10);
  --font-head: system-ui, sans-serif;
  --font-body: system-ui, sans-serif;
  --head-weight: 700;
  --head-tracking: -0.01em;
}

html { -webkit-font-smoothing: antialiased; }
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* --- Containment: 1280 container, 60px gutter ------------------------------ */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--gutter);
  width: 100%;
}

/* --- Section anatomy (v1.3.0 FIXED RULE) -----------------------------------
   every content section = optional eyebrow-label + heading (+ optional
   show-all), then body. Headerless only where the archetype omits it. */
.section { padding-block: var(--section-y); }
.section--tight { --section-y: var(--section-y-tight); }
.section--airy  { --section-y: var(--section-y-airy); }

.section-eyebrow {
  font-family: var(--font-body);
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-1);
}
.section-heading {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  letter-spacing: var(--head-tracking);
  font-size: var(--t-h2);
  line-height: 1.15;
  margin-bottom: var(--space-3);
}
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.section-header .section-heading { margin-bottom: 0; }
.section-header .show-all {
  font-size: var(--t-body-s);
  font-weight: 600;
  color: var(--color-accent);
  white-space: nowrap;
  transition: opacity var(--motion) var(--ease);
}
.section-header .show-all:hover { opacity: 0.6; }
.lede { color: var(--color-text-muted); max-width: 52ch; }

/* --- Buttons (press + focus-visible, FIXED) -------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  font: inherit;
  font-weight: 600;
  font-size: var(--t-body-s);
  padding: 12px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  transition: transform var(--motion-fast) var(--ease),
              box-shadow var(--motion) var(--ease),
              background var(--motion) var(--ease);
}
.btn:hover { box-shadow: var(--shadow-hover); }
.btn:active { scale: var(--press); }
.btn--ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-line);
}
.btn--ghost:hover { border-color: var(--color-accent); }

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

/* --- Card motion primitive (v1.3.1: lift + shadow + zoom) ------------------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-rest);
  transition: transform var(--motion) var(--ease),
              box-shadow var(--motion) var(--ease);
}
.card:hover {
  translate: 0 var(--lift);
  box-shadow: var(--shadow-hover);
}
.card__media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--color-line);
}
.card__media > * {
  width: 100%; height: 100%;
  transition: scale var(--motion-slow) var(--ease);
}
.card:hover .card__media > * { scale: var(--zoom); }
.card__body { padding: var(--space-3); }

/* --- Grid primitives (FIXED): 4-col product · 3-col feature · 2-col split --- */
.grid { display: grid; gap: var(--space-3); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); gap: var(--space-6); align-items: center; }

/* --- Bands / surfaces ------------------------------------------------------ */
.band { background: var(--color-surface); }
.band--accent { background: var(--color-accent); color: var(--color-accent-ink); }
.band--accent .section-eyebrow,
.band--accent .show-all { color: var(--color-accent-ink); opacity: 0.75; }
.full-bleed { width: 100%; } /* intentional edge-to-edge bands */

/* --- Motion HARD gate (v1.3.1) --------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
  .card:hover { translate: none !important; }
  .card:hover .card__media > * { scale: none !important; }
  .btn:active { scale: none !important; }
}

/* --- Responsive (single breakpoint; preview target is 1440) ---------------- */
@media (max-width: 980px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .grid--2 { grid-template-columns: 1fr; }
}

/* --- Responsive gutter (C-110) --------------------------------------------
   The 60px desktop gutter eats 32% of a 375px phone (120px both sides) →
   cramped containers + grids that hug the edge where padding differs.
   Step the gutter DOWN on smaller viewports so every .wrap / .container keeps
   a consistent, breathing side-padding that still reads as intentional margin.
     desktop   60px  (default above)
     <=768px   28px
     <=480px   18px
   Floor stays >=14px so the min-side-padding E2E CP never trips. */
@media (max-width: 768px) {
  :root {
    --gutter: 28px;
    /* Display headings are desktop-tuned (44px); on tablet they start to wrap
       awkwardly. Step the largest steps down so headings read as one or two
       clean lines, not a ragged stack. Body/label steps stay put. */
    --t-display: 36px;
    --t-h1: 28px;
  }
}
@media (max-width: 480px) {
  :root {
    --gutter: 18px;
    /* Phone: the 375px column is ~339px wide. Pull the big steps down again so
       page/hero titles wrap to 2 tidy lines instead of 3–4 broken ones. */
    --t-display: 30px;
    --t-h1: 24px;
    --t-h2: 24px;
  }
}
