/* ==========================================================================
   CodePossum — base.css
   Design tokens, reset, typography, layout primitives, header, footer,
   buttons, forms, motion. Page-specific styles live in pages.css.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Brand — sampled from the original artwork (#0475fe is the exact wordmark blue) */
  --blue: #0475fe;
  --blue-dark: #0362d8;
  --blue-press: #0254b8;
  --blue-cta: #0470f0;        /* button background (white text meets 4.5:1) */
  --blue-text: #0464d8;       /* small blue text (meets 4.5:1 on white/mist) */
  --link: #0457c4;            /* darker blue for body-text links (AA on white) */
  --navy: #031f3f;
  --navy-2: #06294f;
  --ink: #15181d;
  --muted: #4c5766;
  --mist: #f2f7ff;
  --mist-2: #e8f1ff;
  --line: #e2eaf7;
  --line-2: #d4e2f7;
  --coral: #e96c64;
  --white: #ffffff;

  --radius-s: 12px;
  --radius: 18px;
  --radius-l: 28px;

  --shadow-s: 0 1px 2px rgba(8, 24, 58, .05), 0 6px 18px -8px rgba(8, 24, 58, .10);
  --shadow-m: 0 2px 4px rgba(8, 24, 58, .05), 0 18px 44px -20px rgba(8, 24, 58, .18);
  --shadow-l: 0 6px 12px rgba(8, 24, 58, .05), 0 36px 90px -36px rgba(8, 24, 58, .28);

  --font-display: 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --container: 1160px;
  --gutter: clamp(20px, 4vw, 40px);
  --section-y: clamp(72px, 10vw, 124px);
  --header-h: 76px;

  --ease: cubic-bezier(.22, .61, .24, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
::selection { background: var(--blue); color: #fff; }

/* Page-load fade (subtle) */
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
body { animation: page-in .45s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { body { animation: none; } }

/* Cross-document view transitions where supported — the header persists,
   the page content rises softly. Falls back to an instant swap. */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
main { view-transition-name: page-main; }
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(page-main) { animation: vt-out .22s ease both; }
  ::view-transition-new(page-main) { animation: vt-in .38s var(--ease) both; }
}
@keyframes vt-out { to { opacity: 0; transform: translateY(-10px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(16px); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation-duration: .001s !important; }
}

/* ---------- Accessibility helpers ---------- */
.skip-link {
  position: fixed;
  top: 10px; left: 10px;
  z-index: 300;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform .2s var(--ease);
}
.skip-link:focus-visible { transform: none; outline: 3px solid var(--blue); outline-offset: 2px; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
:focus-visible { outline: 3px solid rgba(4, 117, 254, .55); outline-offset: 2px; border-radius: 4px; }

/* ---------- Layout ---------- */
.container { width: min(100% - (2 * var(--gutter)), var(--container)); margin-inline: auto; }
.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(48px, 6vw, 72px); }
.section--mist { background: var(--mist); }
.section--mist-2 { background: linear-gradient(180deg, var(--white) 0%, var(--mist) 22%, var(--mist) 78%, var(--white) 100%); }
.section--navy { background: var(--navy); color: #e9f0fb; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}
.display { font-size: clamp(2.55rem, 5.7vw, 4.35rem); font-weight: 900; line-height: 1.04; letter-spacing: -0.022em; }
.h2 { font-size: clamp(1.9rem, 3.6vw, 2.85rem); font-weight: 800; }
.h3 { font-size: clamp(1.2rem, 1.8vw, 1.45rem); font-weight: 800; }
.lead { font-size: clamp(1.06rem, 1.5vw, 1.25rem); line-height: 1.65; color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); }
.small { font-size: .92rem; line-height: 1.6; }
.accent { color: var(--blue); }
.section--navy h2, .section--navy h3 { color: #fff; }
.section--navy .lead, .section--navy .muted { color: #b9c9e6; }
.section--navy .eyebrow { color: #8fb8ff; }
.section--navy .eyebrow::before { background: #8fb8ff; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: .86rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--blue-text);
}
.eyebrow::before { content: ""; width: 22px; height: 2px; border-radius: 2px; background: var(--blue); }

.section-head { max-width: 720px; margin-bottom: clamp(36px, 5vw, 56px); }
.section-head .lead { margin-top: 16px; }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center .lead { margin-inline: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 28px;
  border-radius: 999px;
  border: 2px solid transparent;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.02rem;
  line-height: 1.2;
  text-decoration: none;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease),
              background-color .22s var(--ease), border-color .22s var(--ease), color .22s var(--ease);
  will-change: transform;
}
.btn .btn-arrow { transition: transform .22s var(--ease); }
.btn:hover .btn-arrow { transform: translateX(4px); }
.btn:active { transform: translateY(1px) scale(.99); }

.btn--primary { background: var(--blue-cta); color: #fff; box-shadow: 0 10px 24px -12px rgba(4, 117, 254, .55); }
.btn--primary:hover { background: var(--blue-dark); transform: translateY(-2px); box-shadow: 0 16px 34px -14px rgba(4, 117, 254, .65); }
.btn--secondary { background: var(--white); color: var(--ink); border-color: var(--line-2); }
.btn--secondary:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow-s); }
.btn--ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn--ghost:hover { border-color: #fff; background: rgba(255, 255, 255, .08); transform: translateY(-2px); }
.btn--sm { padding: 11px 20px; font-size: .95rem; }

.btn-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

/* Text link with animated underline */
.link-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--blue-text);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size .25s var(--ease);
  padding-bottom: 2px;
}
.link-more:hover { background-size: 0% 2px; background-position: 100% 100%; }
.link-more .btn-arrow { transition: transform .22s var(--ease); }
.link-more:hover .btn-arrow { transform: translateX(4px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
  border-bottom: 1px solid transparent;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.site-header.is-scrolled {
  background: rgba(255, 255, 255, .88);
  border-bottom-color: var(--line);
  box-shadow: 0 12px 30px -22px rgba(8, 24, 58, .25);
}
.scroll-progress {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 3px;
  pointer-events: none;
}
.scroll-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #5fa8ff);
  transform-origin: 0 50%;
  transform: scaleX(var(--progress, 0));
  transition: transform .12s linear;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--header-h);
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; flex: 0 0 auto; }
.brand img.brand-icon { width: 42px; height: 42px; }
.brand img.brand-word { height: 27px; width: auto; }
.brand:hover img.brand-icon { transform: rotate(-4deg) scale(1.04); }
.brand img.brand-icon { transition: transform .25s var(--ease); }

.main-nav { display: flex; align-items: center; gap: 6px; }
.main-nav ul { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.main-nav a, .nav-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 15px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .99rem;
  color: var(--ink);
  text-decoration: none;
  border: 0;
  background: transparent;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.main-nav a:hover, .nav-toggle-btn:hover { background: var(--mist-2); color: var(--blue); }
.main-nav a[aria-current="page"] { color: var(--blue-text); background: var(--mist-2); }
.nav-toggle-btn .chev { transition: transform .2s var(--ease); }
.nav-toggle-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }

.nav-item--drop { position: relative; }
.nav-drop {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  translate: -50% 0;
  min-width: 292px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-l);
  padding: 10px;
  display: grid;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .22s var(--ease), transform .22s var(--ease), visibility .22s;
  z-index: 120;
}
.nav-item--drop.open .nav-drop { opacity: 1; visibility: visible; transform: none; }
.nav-drop a { display: grid; gap: 2px; padding: 11px 14px; border-radius: 12px; }
.nav-drop a .drop-title { font-family: var(--font-display); font-weight: 800; color: var(--ink); }
.nav-drop a .drop-sub { font-size: .86rem; color: var(--muted); font-family: var(--font-body); font-weight: 400; }
.nav-drop a:hover { background: var(--mist); }
.nav-drop a:hover .drop-title { color: var(--blue); }

.header-cta { flex: 0 0 auto; }

/* Mobile nav */
.nav-burger {
  display: none;
  width: 46px; height: 46px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: #fff;
  position: relative;
  z-index: 130;
}
.nav-burger span, .nav-burger span::before, .nav-burger span::after {
  content: "";
  display: block;
  width: 20px; height: 2.4px;
  border-radius: 2px;
  background: var(--ink);
  margin-inline: auto;
  transition: transform .25s var(--ease), opacity .2s var(--ease);
}
.nav-burger span::before { transform: translateY(-6.5px); }
.nav-burger span::after { transform: translateY(4.1px); }
.nav-burger[aria-expanded="true"] span { background: transparent; }
.nav-burger[aria-expanded="true"] span::before { transform: translateY(0) rotate(45deg); }
.nav-burger[aria-expanded="true"] span::after { transform: translateY(-2.4px) rotate(-45deg); }

@media (max-width: 940px) {
  .main-nav {
    position: fixed;
    inset: 0;
    z-index: 125;
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: calc(var(--header-h) + 28px) var(--gutter) 40px;
    gap: 6px;
    overflow-y: auto;
    transform: translateY(-105%);
    visibility: hidden;
    transition: transform .35s var(--ease), visibility .35s;
  }
  .main-nav.open { transform: none; visibility: visible; }
  .main-nav ul { flex-direction: column; align-items: stretch; gap: 2px; }
  .main-nav a, .nav-toggle-btn { font-size: 1.35rem; padding: 15px 14px; border-radius: 14px; }
  .nav-item--drop { position: static; }
  .nav-drop {
    position: static;
    translate: none;
    box-shadow: none;
    border: 0;
    border-left: 3px solid var(--mist-2);
    border-radius: 0;
    padding: 0 0 0 10px;
    margin: 2px 0 8px 14px;
    display: none;
    opacity: 1; visibility: visible; transform: none;
  }
  .nav-item--drop.open .nav-drop { display: grid; }
  .nav-burger { display: block; }
  .header-cta { display: none; }
  .main-nav .mobile-cta { margin-top: 18px; }
}
.main-nav .mobile-cta { display: none; }
@media (max-width: 940px) { .main-nav .mobile-cta { display: inline-flex; } }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0s); }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Kinetic headings: words rise in, staggered ---------- */
.wt-i { display: inline-block; }
.reveal .wt-i { opacity: 0; transform: translateY(.45em); font-variation-settings: 'wght' 640; }
.reveal.is-visible .wt-i {
  opacity: 1;
  transform: none;
  font-variation-settings: 'wght' 860;
  transition: opacity .6s var(--ease), transform .6s var(--ease), font-variation-settings .8s var(--ease);
  transition-delay: calc(var(--i, 0) * 42ms);
}
@media (prefers-reduced-motion: reduce) {
  .reveal .wt-i { opacity: 1; transform: none; transition: none; font-variation-settings: 'wght' 860; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--white); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: clamp(28px, 4vw, 56px);
  padding-block: clamp(48px, 6vw, 72px) 40px;
}
.footer-brand .brand { margin-bottom: 14px; }
.footer-brand p { max-width: 34ch; }
.footer-col h2 {
  font-size: .86rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 14px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.footer-col a { color: var(--ink); text-decoration: none; font-weight: 600; display: inline-block; padding-block: 3px; }
.footer-col a:hover { color: var(--blue); }
.footer-bottom {
  border-top: 1px solid var(--line);
  padding-block: 22px 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: .9rem;
}
.footer-note { display: inline-flex; align-items: center; gap: 8px; }
.footer-note::before { content: "{ }"; font-family: var(--font-display); font-weight: 800; color: var(--blue-text); letter-spacing: .05em; white-space: nowrap; }
@media (max-width: 940px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Forms ---------- */
.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field label { font-family: var(--font-display); font-weight: 800; font-size: .98rem; }
.field .hint { font-size: .88rem; color: var(--muted); }
.field input[type="text"], .field input[type="email"], .field textarea, .field select {
  width: 100%;
  border: 1.5px solid var(--line-2);
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field textarea { min-height: 148px; resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(4, 117, 254, .16);
}
.field.has-error input, .field.has-error textarea { border-color: #c93a2e; }
.field .error { color: #a5271c; font-size: .9rem; font-weight: 700; display: none; }
.field.has-error .error { display: block; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.check-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: 10px; }
.check-item:hover { background: var(--mist); }
.check-item input { width: 24px; height: 24px; margin-top: 1px; accent-color: var(--blue); }
.check-item label { font-weight: 600; font-family: var(--font-body); }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
fieldset legend { font-family: var(--font-display); font-weight: 800; font-size: .98rem; padding: 0; margin-bottom: 7px; }

/* ---------- Dialog ---------- */
dialog.brief-dialog {
  border: 0;
  border-radius: var(--radius-l);
  padding: 0;
  width: min(680px, calc(100vw - 32px));
  box-shadow: var(--shadow-l);
}
dialog.brief-dialog::backdrop { background: rgba(4, 16, 36, .55); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 1.3rem; }
.dialog-close { border: 1px solid var(--line-2); background: #fff; border-radius: 10px; padding: 8px 12px; font-weight: 800; font-family: var(--font-display); }
.dialog-close:hover { border-color: var(--blue); color: var(--blue); }
.dialog-body { padding: 22px 24px; max-height: min(62vh, 560px); overflow: auto; }
.dialog-body pre {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92rem;
  line-height: 1.6;
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 18px;
}
.dialog-foot { padding: 16px 24px 22px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }

/* ---------- Utilities ---------- */
.center { text-align: center; }
.mt-1 { margin-top: 10px; } .mt-2 { margin-top: 20px; } .mt-3 { margin-top: 32px; } .mt-4 { margin-top: 48px; }
.nowrap { white-space: nowrap; }
.stack { display: grid; gap: 14px; }

/* Cards */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.card--hover:hover { transform: translateY(-5px); box-shadow: var(--shadow-m); border-color: var(--line-2); }

/* Icon chip */
.icon-chip {
  width: 54px; height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--mist-2);
  color: var(--blue);
  flex: 0 0 auto;
}
.icon-chip svg { width: 27px; height: 27px; }

/* Concept / placeholder labels */
.chip-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: .8rem;
  letter-spacing: .02em;
  background: #fff;
  border: 1px solid var(--line-2);
  color: var(--muted);
}
.chip-label--blue { background: var(--mist-2); border-color: transparent; color: var(--blue-dark); }
.chip-label--coral { background: #fdeeec; border-color: transparent; color: #b0402f; }
.chip-label .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Scroll-driven motion (native, progressive) ----------
   Where the platform supports scroll timelines, motion is driven by scroll
   position itself — no scroll listeners. Older engines keep the JS fallback
   (progress bar/parallax) and the reveal-on-scroll behaviour. */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .scroll-progress span {
      animation: sda-progress linear both;
      animation-timeline: scroll();
      transition: none;
    }
    @keyframes sda-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

    .hero-art-frame {
      animation: sda-hero linear both;
      animation-timeline: scroll();
      animation-range: 0px 90vh;
    }
    @keyframes sda-hero { from { transform: translateY(10px); } to { transform: translateY(-24px); } }

    .hero-watermark {
      animation: sda-wm linear both;
      animation-timeline: scroll();
      animation-range: 0px 130vh;
    }
    @keyframes sda-wm { to { transform: translateY(-84px); } }

    .hero-art-frame img,
    .art-card img {
      animation: sda-zoom linear both;
      animation-timeline: view();
      animation-range: cover 0% cover 42%;
    }
    @keyframes sda-zoom { from { transform: scale(1.045); } to { transform: scale(1); } }
  }
}
.hero-art-frame, .art-card { overflow: clip; }

/* ---------- Reduced motion: kill long animations ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
