/* ══════════════════════════════════════════════════════════════════════════
   app.css — Layer 2, celermedia.com v1
     1. self-hosted fonts (@font-face)
     2. Pico variable bindings → celer tokens (dark pinned)
     3. minimal page layout
   No literal hex here — every color comes through a token from brand.css.
   Load order: pico.min.css → brand.css → app.css
   ══════════════════════════════════════════════════════════════════════════ */

/* ══ 1. self-hosted fonts — woff2 only, latin subset, no CDN ═════════════ */
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 300;          /* wordmark: "Media" */
  font-display: swap;
  src: url('../fonts/poppins-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/poppins-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;          /* wordmark: "celer" + headings */
  font-display: swap;
  src: url('../fonts/poppins-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;          /* hero headline only */
  font-display: swap;
  src: url('../fonts/poppins-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/roboto-400.woff2') format('woff2');
}

/* ══ 2. Pico bindings — derive from tokens, never restate a hex ══════════
   Pico's own dark values live in [data-theme=dark] (specificity 0,1,0).
   This :root block matches that specificity and loads later, so it wins.
   Essential set only; further overrides get added as friction shows up. ══ */
:root {
  /* base */
  --pico-background-color:      var(--surface-0);
  --pico-color:                 var(--text);
  --pico-muted-color:           var(--text-dim);
  --pico-muted-border-color:    var(--border);
  --pico-text-selection-color:  var(--accent-dim);

  /* primary — the working green */
  --pico-primary:                   var(--accent);
  --pico-primary-background:        var(--accent);
  --pico-primary-border:            var(--accent);
  --pico-primary-underline:         var(--accent-dim);
  --pico-primary-hover:             var(--accent-hi);
  --pico-primary-hover-background:  var(--accent-hi);
  --pico-primary-hover-border:      var(--accent-hi);
  --pico-primary-hover-underline:   var(--accent-hi);
  --pico-primary-focus:             var(--accent-dim);
  --pico-primary-inverse:           var(--surface-0);  /* text on a green fill */

  /* headings — grey, never white */
  --pico-h1-color: var(--text);
  --pico-h2-color: var(--text);
  --pico-h3-color: var(--text);
  --pico-h4-color: var(--text);
  --pico-h5-color: var(--text);
  --pico-h6-color: var(--text);

  /* sectioning surfaces */
  --pico-card-background-color:            var(--surface-1);
  --pico-card-border-color:                var(--border);
  --pico-card-sectioning-background-color: var(--surface-2);
  --pico-blockquote-border-color:          var(--border-hi);

  /* code */
  --pico-code-background-color: var(--surface-2);
  --pico-code-color:            var(--text-dim);

  /* form elements — v1 has no form, kept coherent for later */
  --pico-form-element-background-color:  var(--surface-1);
  --pico-form-element-border-color:      var(--border);
  --pico-form-element-color:             var(--text);
  --pico-form-element-placeholder-color: var(--text-faint);
  --pico-form-element-active-border-color: var(--accent);
  --pico-form-element-focus-color:         var(--accent);

  /* type + shape */
  --pico-font-family:   var(--font-body);
  --pico-border-radius: var(--radius);
}

/* ══ 3. page layout — structure, not polish ═════════════════════════════ */
body {
  margin: 0;
  /* the ground: dark diagonal gradient, charcoal not black */
  background: linear-gradient(135deg,
    var(--surface-ink) 0%, var(--surface-0) 45%, var(--surface-hi) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-2);
  min-height: 100vh;
  overflow-x: hidden;
}

/* grain — one fixed fractal-noise tile over the whole page. Static: no
   animation, ever. Content is lifted above it by the z-index rules below. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.055;
  /* Pico's reset sets background-repeat:no-repeat on *, ::before and ::after —
     without this the noise paints exactly one 120px tile in the top-left
     corner and nowhere else. See FRICTION.md. */
  background-repeat: repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--text);
}
h1 { font-size: var(--fs-6); }
h2 { font-size: var(--fs-5); }
h3 { font-size: var(--fs-4); }

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

/* horizontal rhythm — one wrapper, used by every band.
   position/z-index lift content above the grain layer (body::before, z-index 0). */
.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--sp-3);
}

/* ── header ───────────────────────────────────────────────────────────── */
/* transparent — the header sits on the same ground as the hero, no surface
   of its own and no rule under it. Not sticky: a transparent bar with content
   sliding under it reads as a mistake. */
.site-header {
  position: relative;
  z-index: 3;
  background: transparent;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-block: var(--sp-2);
  flex-wrap: wrap;
}

/* logo lockup — "Logo Text Outside": icon left, wordmark right */
.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  text-decoration: none;
  color: var(--text);
}
.logo-mark {
  width: 2rem;
  height: 2rem;
  display: block;
  /* the poly C mark is a raster asset — it carries its own brand colours */
}

/* LOGOTYPE RULE (non-negotiable): celerMedia — lower camelCase,
   "celer" Poppins 600, "Media" Poppins 300. Never all-caps, never
   all-lowercase, never Titlecase. */
.wordmark {
  font-family: var(--font-head);
  font-size: var(--fs-3);
  line-height: 1;
  letter-spacing: 0.01em;
}
.wordmark-celer { font-weight: 600; }
.wordmark-media { font-weight: 300; }

.site-nav {
  display: flex;
  gap: var(--sp-3);
  font-size: var(--fs-1);
}
.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
}
.site-nav a:hover { color: var(--accent-hi); }

/* ── sections ─────────────────────────────────────────────────────────── */
main section { padding-block: var(--sp-6); }
main section + section { border-top: 1px solid var(--border); }

main section > .wrap > :first-child { margin-top: 0; }
main section p { max-width: 60ch; color: var(--text); }

/* ── hero treatment ───────────────────────────────────────────────────
   Ground + grain live on <body>. The hero adds: a bottom-right facet field,
   a feathered scrim under the text, and the emphasised headline. Everything
   here is static — there is no animation anywhere in this section. */
.hero {
  position: relative;
  padding-block: var(--sp-3) var(--sp-4);
}
.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 820px;
}

/* scrim — a soft radial pool of deeper ground under the text, so the copy
   never has to compete with the facet. Feathered to nothing by 88% and
   blurred, so it has no edge: the facet stays a plain rectangle and this
   does the work. Colour is --surface-ink at decreasing alpha. */
.hero-inner::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -8%;
  left: -10%;
  right: -14%;
  bottom: -8%;
  background: radial-gradient(135% 130% at 34% 46%,
    color-mix(in srgb, var(--surface-ink) 58%, transparent)  0%,
    color-mix(in srgb, var(--surface-ink) 50%, transparent) 30%,
    color-mix(in srgb, var(--surface-ink) 30%, transparent) 55%,
    color-mix(in srgb, var(--surface-ink) 12%, transparent) 72%,
    color-mix(in srgb, var(--surface-ink)  0%, transparent) 88%);
  filter: blur(6px);
}

.hero .eyebrow {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--fs-1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-2);
  max-width: none;
}
/* margin-top:0 is load-bearing — Pico gives any heading that follows a <p> a
   3rem top margin, which silently overrode the eyebrow's own margin-bottom. */
.hero h1 {
  margin-top: 0;
  font-weight: 700;
  font-size: clamp(1.75rem, 3.2vw, 2.1rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-3);
}
/* word-level emphasis — the MUTED working accents, never the vivid brand
   colours. Those appear only inside the facet. */
.hero h1 .em-green { color: var(--accent-hi); }
.hero h1 .em-blue  { color: var(--accent-blue-hi); }

.hero .lead {
  font-size: var(--fs-3);
  color: var(--text-dim);
  max-width: 540px;
  margin-bottom: var(--sp-4);
}

/* facet field — anchored bottom-right, generated once at load. Two-edge mask
   fades it out toward the TOP (clears the header) and toward the LEFT (clears
   the text). mask-composite needs both spellings or the second edge is
   silently ignored. */
#facet {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 60%;
  height: 94%;
  z-index: 0;
  pointer-events: none;
  -webkit-mask-image:
    linear-gradient(to top,  black 26%, transparent 94%),
    linear-gradient(to left, black 40%, transparent 90%);
  -webkit-mask-composite: source-in;
          mask-image:
    linear-gradient(to top,  black 26%, transparent 94%),
    linear-gradient(to left, black 40%, transparent 90%);
          mask-composite: intersect;
}
#facet svg { display: block; width: 100%; height: 100%; }

@media (max-width: 900px) {
  #facet { width: 90%; height: 60%; opacity: 0.5; }
}

/* statement line — the geo + service H2 stands alone, no body under it */
.statement {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: var(--fs-4);
  font-weight: 300;
  max-width: 34ch;
}

/* ── contact form — UI only, no backend ───────────────────────────────── */
.contact-form {
  max-width: 34rem;
  margin-top: var(--sp-4);
}
.contact-form label {
  color: var(--text-dim);
  font-size: var(--fs-1);
}
.contact-form .cta {
  display: inline-block;
  width: auto;
  margin-top: var(--sp-1);
}

/* build-time notice — deliberately unlovely, so it cannot ship unnoticed */
.build-note {
  max-width: 34rem;
  margin-top: var(--sp-3);
  padding: var(--sp-2);
  border: 1px dashed var(--border-hi);
  border-radius: var(--radius);
  background: var(--surface-1);
  color: var(--text-faint);
  font-size: var(--fs-1);
}

.contact-email {
  margin-top: var(--sp-3);
  font-size: var(--fs-3);
}

/* ── section accents — one colour per section, at the word level ───────
   Wrap a word or short phrase in one of these three classes to move or
   recolour emphasis; that is the whole mechanism. These are the MUTED
   working accents — the vivid --brand-* colours stay in the hero facet
   and nowhere else. */
.accent-green  { color: var(--accent-hi); }
.accent-blue   { color: var(--accent-blue-hi); }
.accent-purple { color: var(--accent-purple-hi); }

/* Contact is the purple section. Rebinding Pico's own variables on the
   section lets them cascade to the mailto link, the field focus ring and the
   button — no per-element overrides, no !important.
   The fill is --accent-purple-hi rather than --accent-purple because the
   darker step only reaches 3.18:1 against a dark label; see the task 08 log.
   Hover therefore darkens instead of lightening — purple has no brighter
   step to move to. */
#contact {
  --pico-primary:                  var(--accent-purple-hi);
  --pico-primary-background:       var(--accent-purple-hi);
  --pico-primary-border:           var(--accent-purple-hi);
  --pico-primary-underline:        var(--accent-purple-dim);
  --pico-primary-hover:            var(--accent-purple);
  --pico-primary-hover-background: var(--accent-purple);
  --pico-primary-hover-border:     var(--accent-purple);
  --pico-primary-hover-underline:  var(--accent-purple-hi);
  --pico-primary-focus:            var(--accent-purple-dim);
  --pico-form-element-active-border-color: var(--accent-purple-hi);
  --pico-form-element-focus-color:         var(--accent-purple-hi);
}
/* the global :focus-visible outline is green; inside Contact it follows the
   section. Pico's own focus border and ring are already purple via the
   variables above — this is the third focus affordance, and it is the one
   a keyboard user actually sees. */
#contact :focus-visible { outline-color: var(--accent-purple-hi); }

/* ── footer ───────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--surface-1);
  border-top: 1px solid var(--border);
  padding-block: var(--sp-4);
  color: var(--text-dim);
  font-size: var(--fs-1);
}
