/* ==========================================================================
   CMO Partners — Base & Components
   Requires css/tokens.css to be loaded first.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--sp-5));
}

body {
  min-height: 100svh;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
svg {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

/* --------------------------------------------------------------------------
   2. Typography
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  text-wrap: balance;
  letter-spacing: var(--tracking-display);
}

h1 {
  font-size: var(--t-h1);
  line-height: var(--lh-tight);
  font-weight: var(--fw-semibold);
}

h2 {
  font-size: var(--t-h2);
  line-height: var(--lh-snug);
  font-weight: var(--fw-semibold);
}

h3 {
  font-size: var(--t-h3);
  line-height: 1.27;
  font-weight: var(--fw-medium);
}

p {
  text-wrap: pretty;
}

.lead {
  font-size: var(--t-body-lg);
  color: var(--c-text-muted);
  max-width: 52ch;
}

.muted {
  color: var(--c-text-muted);
}

/* Section eyebrow — the small tracked label above a heading */
.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--t-cap);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--c-text-muted);
  margin-bottom: var(--sp-4);
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--r-full);
  background: var(--c-pink);
  flex: none;
}

/* Metric delta — "▲ 18% vs last month" */
.delta {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--t-cap);
  font-weight: var(--fw-medium);
  color: var(--c-pink-ink);
}

/* --------------------------------------------------------------------------
   3. Layout
   -------------------------------------------------------------------------- */

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

.container--wide {
  max-width: var(--container-wide);
}

.container--text {
  max-width: var(--container-text);
}

.section {
  padding-block: var(--section-y);
}

/* Pair this with .on-dark, which flips the tokens. Do NOT reach for
   --c-text-invert here: .on-dark has already swapped it to the dark value,
   so it would paint text the same colour as the background. */
.section--dark {
  background: var(--c-graphite);
  color: var(--c-text);
}

.grid {
  display: grid;
  gap: var(--sp-5);
}

@media (min-width: 720px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1000px) {
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
  .grid--5 { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 999px) {
  .grid--4,
  .grid--5 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 519px) {
  .grid--4,
  .grid--5 { grid-template-columns: 1fr; }
}

.stack > * + * {
  margin-top: var(--sp-4);
}

/* --------------------------------------------------------------------------
   4. Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px; /* WCAG 2.5.8 target size */
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  font-size: var(--t-body);
  font-weight: var(--fw-medium);
  line-height: 1.2;
  cursor: pointer;
  transition:
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

/* Pink Ink, not Signature Pink — white-on-pink needs 4.5:1 */
.btn--primary {
  background: var(--c-pink-ink);
  color: #fff;
}

.btn--primary:hover {
  background: #bf0c4e;
}

.btn--secondary {
  border: 1px solid var(--c-pink-ink);
  color: var(--c-pink-ink);
  background: transparent;
}

.btn--secondary:hover {
  background: var(--c-glass);
}

.btn--ghost {
  color: var(--c-text);
  border: 1px solid var(--c-border-strong);
}

.btn--ghost:hover {
  background: var(--c-surface-sunk);
}

.btn .arrow {
  transition: transform var(--dur) var(--ease);
}

.btn:hover .arrow {
  transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   5. Focus — visible for everyone, always
   -------------------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--c-pink-ink);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -100px;
  z-index: 100;
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-graphite);
  color: var(--c-text-invert);
  border-radius: var(--r-md);
  transition: top var(--dur) var(--ease);
}

.skip-link:focus {
  top: var(--sp-4);
}

/* --------------------------------------------------------------------------
   6. Liquid glass
   -------------------------------------------------------------------------- */

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--glass-shadow);
}

/* Without backdrop-filter the panel must stay readable, so fall back to
   near-opaque rather than a translucent smear. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass {
    background: rgba(255, 255, 255, 0.95);
  }

  .on-dark .glass {
    background: rgba(27, 28, 31, 0.95);
  }
}

/* --------------------------------------------------------------------------
   7. Cards & panels
   -------------------------------------------------------------------------- */

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}

.panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-5);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.stat__label {
  font-size: var(--t-cap);
  color: var(--c-text-muted);
}

.stat__value {
  font-size: var(--t-h2);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-display);
  font-variant-numeric: tabular-nums;
}

/* Status dot — colour is never the only signal, the label carries it too */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--t-cap);
  color: var(--c-text-muted);
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--r-full);
  background: var(--c-pink);
  flex: none;
}

/* --------------------------------------------------------------------------
   8. Contour system
   -------------------------------------------------------------------------- */

.contour {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.contour svg {
  width: 100%;
  height: 100%;
}

.contour__line {
  fill: none;
  stroke: var(--c-contour);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.contour__node {
  fill: var(--c-pink);
}

.contour__node-glow {
  fill: var(--c-pink);
  opacity: 0.25;
  filter: blur(6px);
}

.contour__link {
  fill: none;
  stroke: var(--c-pink);
  stroke-width: 1;
  opacity: 0.4;
}

/* Sections that host contour need a stacking context for content above it */
.has-contour {
  position: relative;
  isolation: isolate;
}

.has-contour > .container {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   9. Motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   10. Utilities
   -------------------------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.flow > * + * {
  margin-top: var(--sp-4);
}

.center {
  text-align: center;
  margin-inline: auto;
}
