/* ==========================================================================
   Coastwide Earthworx - Main global stylesheet
   Foundations ONLY: self-hosted fonts, design tokens, surface-contract
   defaults, element reset, keyframes. Component CSS lives in per-class
   style records (Selector Manager), never here.
   ========================================================================== */

/* ---- Fonts (self-hosted variable woff2, latin subset) ---- */
@font-face {
  font-family: 'Big Shoulders Display';
  src: url('../assets/big-shoulders-display-var.woff2') format('woff2');
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Archivo';
  src: url('../assets/archivo-var.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ---- Design tokens ---- */
:root {
  /* Brand palette (lifted from the logo) */
  --cw-charcoal: #1c1c1c;
  --cw-ink: #141414;
  --cw-teal: #18d3d3;
  --cw-teal-hover: #8ff0ec;
  --cw-teal-ink: #086f6f;          /* teal as text/icon on light grounds, 4.8:1 on sand */
  --cw-sand: #ece6d8;
  --cw-paper: #fffdf8;
  --cw-bone: #f4f1ea;              /* headings on dark */
  --cw-stone: #c9c4b8;             /* body on dark, 9.8:1 */
  --cw-stone-muted: #b8b2a5;       /* secondary on dark, 8.1:1 */
  --cw-ash: #9a958a;               /* footer text on ink, 6.2:1 */
  --cw-earth: #3a362c;             /* body on sand, 9.7:1 */
  --cw-earth-muted: #5f5949;       /* secondary on sand, 5.6:1 */
  --cw-field-line: #cfc7b6;
  --cw-placeholder: #6b6559;       /* 5.7:1 on paper */

  /* Type */
  --cw-font-display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --cw-font-body: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --cw-text-display: clamp(4rem, 2.886rem + 4.571vw, 7rem);     /* 64 -> 112 */
  --cw-text-h2: clamp(3rem, 2.164rem + 3.429vw, 5.25rem);        /* 48 -> 84 */
  --cw-text-h2-sm: clamp(2.25rem, 1.786rem + 1.905vw, 3.5rem);   /* 36 -> 56 */
  --cw-text-h3: clamp(1.5rem, 1.268rem + 0.952vw, 2.125rem);     /* 24 -> 34 */
  --cw-text-h4: clamp(1.375rem, 1.189rem + 0.762vw, 1.875rem);   /* 22 -> 30 */
  --cw-text-quote: clamp(1.875rem, 1.643rem + 0.952vw, 2.5rem);  /* 30 -> 40 */
  --cw-text-lead: clamp(1rem, 0.907rem + 0.381vw, 1.25rem);      /* 16 -> 20 */
  --cw-text-md: clamp(1rem, 0.953rem + 0.19vw, 1.125rem);        /* 16 -> 18 */
  --cw-text-body: 1rem;
  --cw-text-sm: 0.9375rem;
  --cw-text-xs: 0.8125rem;
  --cw-text-btn: clamp(1.25rem, 1.179rem + 0.286vw, 1.5rem);     /* 20 -> 24 */
  --cw-text-btn-sm: 1.25rem;
  --cw-text-label: clamp(1.0625rem, 0.911rem + 0.619vw, 1.375rem); /* 17 -> 22 */
  --cw-lh-display: 0.92;
  --cw-lh-tight: 1.05;
  --cw-lh-body: 1.55;
  --cw-track-label: 0.06em;
  --cw-track-caps: 0.08em;

  /* Spacing */
  --cw-space-1: 0.25rem;
  --cw-space-2: 0.5rem;
  --cw-space-3: 0.75rem;
  --cw-space-4: 1rem;
  --cw-space-5: 1.25rem;
  --cw-space-6: 1.5rem;
  --cw-space-7: 1.75rem;
  --cw-space-8: 2rem;
  --cw-space-9: 2.5rem;
  --cw-space-10: 3rem;
  --cw-space-11: 4rem;
  --cw-space-12: 5rem;
  --cw-space-13: 6rem;
  --cw-section-y: clamp(4rem, 2.886rem + 4.571vw, 7rem);          /* 64 -> 112 */
  --cw-section-y-compact: clamp(1.75rem, 1.471rem + 1.143vw, 2.5rem); /* 28 -> 40 */
  --cw-gutter: clamp(1.25rem, 0.229rem + 4.19vw, 4rem);           /* 20 -> 64 */
  --cw-container: 82rem;                                          /* 1312px content */
  --cw-flow: var(--cw-space-6);

  /* Shape, depth, motion */
  --cw-radius: 4px;
  --cw-radius-lg: 6px;
  --cw-hairline: 1px;
  --cw-rule: 4px;
  --cw-tap: 44px;
  --cw-shadow-card: 0 18px 40px -20px rgba(28, 28, 28, 0.35);
  --cw-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --cw-dur: 0.2s;
  --cw-header-h: 96px;

  /* Surface contract defaults = the charcoal ground, so chrome outside any
     section still resolves every --sf-* token (playbook s33.3). */
  --sf-bg: var(--cw-charcoal);
  --sf-fg: var(--cw-stone);
  --sf-heading: var(--cw-bone);
  --sf-muted: var(--cw-stone-muted);
  --sf-accent: var(--cw-teal);
  --sf-line: rgba(244, 241, 234, 0.14);
  --sf-btn-bg: var(--cw-teal);
  --sf-btn-fg: var(--cw-charcoal);
  --sf-btn-hover: var(--cw-teal-hover);
  --sf-ghost-fg: var(--cw-bone);
  --sf-ghost-line: rgba(244, 241, 234, 0.7);
  --sf-link: var(--cw-teal);
  --sf-link-hover: var(--cw-teal-hover);
  --sf-card: var(--cw-paper);
}

/* ---- Element reset (zero specificity so every record wins) ---- */
:where(*, *::before, *::after) { box-sizing: border-box; }
:where(html) {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
  scrollbar-color: var(--cw-teal) var(--cw-ink);
  scroll-padding-top: var(--cw-header-h);
}
:where(body) {
  margin: 0;
  background: var(--cw-charcoal);
  color: var(--sf-fg);
  font-family: var(--cw-font-body);
  font-size: var(--cw-text-body);
  line-height: var(--cw-lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:where(h1, h2, h3, h4, h5, h6, p, blockquote, figure, ul, ol) { margin: 0; }
:where(ul, ol) { padding: 0; }
:where(img, svg, video) { display: block; max-width: 100%; }
:where(img) { height: auto; }
[hidden] { display: none !important; }
:where(a) { color: var(--sf-link); text-decoration: none; transition: color var(--cw-dur) var(--cw-ease); }
:where(a:hover) { color: var(--sf-link-hover); }
:where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(:focus-visible) { outline: 3px solid var(--cw-teal); outline-offset: 3px; }
::selection { background: var(--cw-teal); color: var(--cw-charcoal); }

/* FSE template-part wrappers must not become containing blocks (sticky header) */
header.wp-block-template-part, footer.wp-block-template-part { display: contents; }

/* ---- Keyframes (cannot live in a style record) ---- */
@keyframes cw-ticker { to { transform: translateX(-50%); } }

@media (prefers-reduced-motion: reduce) {
  :where(html) { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* WordPress core: wp-img-auto-sizes-contain (live inline style) */
img:is([sizes=auto i],[sizes^="auto," i]){contain-intrinsic-size:3000px 1500px}
