/*
 * VeloConnect — global styles.
 *
 * theme.json carries element typography, colour and spacing. This file holds
 * what theme.json cannot express: the ground, the shared components every block
 * builds on (buttons, the surface material, section rhythm, the layout wrap),
 * and a small number of accessibility affordances.
 *
 * The vocabulary is the round-3 prototype's, docs/prototypes/redesign-3/site.css.
 * CLAUDE.md §4 maps each of its variables and classes to the names used here.
 *
 * Tokens only — no literal colours, no ad-hoc pixel values.
 */

/* ---------------------------------------------------------------------------
   Base
   --------------------------------------------------------------------------- */

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

/*
 * No root font-size override -- 16px, the browser default, as in the prototype.
 * A fluid root scales the whole page with the viewport and makes every measured
 * size in the design wrong at every width but one.
 */
html {
  -webkit-text-size-adjust: 100%;
  background: var(--vc-page);
  /* Native controls, scrollbars and autofill follow the ground. Without this a
     <select> opens as a white sheet on a black page. tokens.css sets `light`
     under the light scheme and `dark` again inside each dark island; every
     element inherits it, so no block sets its own. */
  color-scheme: dark;
}

/*
 * The page ground is --vc-page: near-black, the portal's own dark theme, for
 * every visitor; the portal's light grey for one who switched (inc/
 * color-scheme.php). Surfaces step UP from it in both (surface-1 → 2 → 3): a
 * nested surface is always lighter than what holds it -- the portal's "a card
 * is lighter than the page" rule, which its own light theme follows too.
 * Block CSS never asks which scheme it is in; the tokens answer.
 */
body {
  margin: 0;
  background: var(--vc-page);
  color: var(--vc-fg);
  font-family: var(--vc-font-body);
  font-size: var(--vc-text-base);
  line-height: var(--vc-leading-normal);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: color-mix(in srgb, var(--vc-blue) 45%, transparent);
  color: var(--vc-white);
}

/* The prototype's .wrap gutter: 32px a side, 16px on a phone. theme.json's root
   padding and every block's padding-inline read --vc-gutter, so switching it
   here moves the whole page at once. */
@media (max-width: 35rem) {
  :root {
    --vc-gutter: var(--vc-gutter-sm);
    --vc-header: 4rem;
  }
}

/*
 * No gap between the chrome and the content.
 *
 * theme.json sets a root blockGap, and WordPress turns that into
 * `:where(.wp-site-blocks) > * { margin-block-start: … }` -- which applies
 * between the top-level children: header, main, footer. Every section block
 * owns its vertical padding, so the chrome sits flush against them.
 */
.wp-site-blocks > * {
  margin-block-start: 0;
}

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

code,
kbd,
samp,
pre {
  font-family: var(--vc-font-mono);
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

a {
  text-underline-offset: 0.2em;
}

/* Anchor targets clear the sticky header instead of hiding behind it. */
:target {
  scroll-margin-block-start: calc(var(--vc-header) + var(--vc-space-md));
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/*
 * Honour the reduced-motion preference globally. Near-zero rather than `none`
 * so transitionend/animationend listeners still fire and nothing hangs waiting
 * for an event that never arrives.
 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------------------------
   Sticky chrome
   ---------------------------------------------------------------------------

   The header block renders inside the template part's own <header> element,
   which is exactly as tall as the header -- a sticky child of it has no room to
   stick. The wrapper is what has to be sticky. Scoped with :has() so the minimal
   header (forms that remove the exits) stays in the flow.
   --------------------------------------------------------------------------- */

.wp-site-blocks
  > .wp-block-template-part:has(> .vc-header:not(.vc-header--minimal)) {
  position: sticky;
  inset-block-start: var(--wp-admin--admin-bar--height, 0px);
  z-index: 200;
}

/* Below 600px core un-fixes the admin bar, so it scrolls away and the header
   must stick to the very top. */
@media (max-width: 600px) {
  .wp-site-blocks
    > .wp-block-template-part:has(> .vc-header:not(.vc-header--minimal)) {
    inset-block-start: 0;
  }
}

/* ---------------------------------------------------------------------------
   Accessibility
   --------------------------------------------------------------------------- */

/* Core's skip link (block themes print one targeting <main>), drawn like the
   prototype's: a white pill that drops in on focus. */
.skip-link.screen-reader-text:focus {
  inset-inline-start: var(--vc-space-sm);
  inset-block-start: var(--vc-space-xs);
  padding: 0.625rem 0.875rem;
  border-radius: var(--vc-radius-md);
  background: var(--vc-white);
  color: var(--vc-fg-inverse);
  font-family: var(--vc-font-body);
  font-size: var(--vc-text-sm);
  font-weight: var(--vc-weight-semibold);
  box-shadow: var(--vc-shadow-popover);
}

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

/*
 * One consistent focus ring everywhere, including inside blocks: the text-safe
 * blue, offset off the element. The radius is zero-specificity so a pill or a
 * card keeps its own shape under the ring.
 */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--vc-link);
  outline-offset: 3px;
}

:where(a:focus-visible, summary:focus-visible) {
  border-radius: var(--vc-radius-sm);
}

/* ---------------------------------------------------------------------------
   Layout
   --------------------------------------------------------------------------- */

/*
 * Full-bleed bands abut: no block gap between top-level sections.
 *
 * theme.json's blockGap prints as `:root :where(.is-layout-constrained) > *
 * { margin-block-start: … }`, (0,1,0), and core prints it AFTER the block
 * stylesheets -- so every section that does not element-qualify its own margin
 * gets 24px of page ground above it, and a band on surface-1 or the brand wash
 * shows it as a black strip (above the spec table, the code tabs, the channel
 * grid). Section blocks own their vertical padding; the gap is never wanted
 * between them.
 *
 * Scoped to `.alignfull` children of the constrained page layouts (page.html,
 * front-page.html, page-landing.html: <main> holds the inner hero and
 * post-content, post-content holds the sections). Anything constrained -- a core
 * paragraph dropped into a page -- keeps the gap, and so does every block's
 * inside: this reaches only direct children. The blog and legal templates use a
 * flow layout and are not touched.
 */
main.is-layout-constrained > .alignfull,
.wp-block-post-content.is-layout-constrained > .alignfull {
  margin-block: 0;
}

/*
 * The prototype's .wrap: 1280px, never closer than one gutter to the viewport
 * edge. The width does the gutter, so nothing inside needs padding-inline -- the
 * column edge lines up with the header's logo at every width.
 */
.vc-wrap {
  width: min(var(--vc-wide), 100% - 2 * var(--vc-gutter));
  margin-inline: auto;
}

/* The prototype's .sec: generous fluid padding and a hairline on top. */
.vc-section {
  padding-block: var(--vc-section);
  border-block-start: 1px solid var(--vc-line);
}

/* ---------------------------------------------------------------------------
   Type helpers
   --------------------------------------------------------------------------- */

/* The prototype's .lede. */
.vc-lede {
  margin-block: var(--vc-space-md) 0;
  max-width: 60ch;
  font-size: var(--vc-text-lg);
  line-height: var(--vc-leading-normal);
  color: var(--vc-fg-2);
  text-wrap: pretty;
}

/*
 * The eyebrow: a quiet label, not a shouted one. The round-3 prototype has no
 * tracked capitals and no coloured labels anywhere -- its labels (.glance dt,
 * .meta) are sentence case in --text-2. Every block's own __eyebrow class
 * carries the same four values; change them together.
 */
.vc-eyebrow {
  margin: 0 0 var(--vc-space-xs);
  font-family: var(--vc-font-body);
  font-size: var(--vc-text-sm);
  font-weight: var(--vc-weight-medium);
  line-height: var(--vc-leading-snug);
  color: var(--vc-fg-2);
}

/* Shared section header -- eyebrow, title, lede. Used by most section blocks. */

.vc-section-head {
  max-width: 46rem;
}

.vc-section-head__title {
  margin: 0;
  font-family: var(--vc-font-display);
  font-size: var(--vc-text-title);
  font-weight: var(--vc-weight-display);
  line-height: var(--vc-leading-title);
  letter-spacing: var(--vc-tracking-title);
  text-wrap: balance;
}

.vc-section-head__lede {
  margin: var(--vc-space-sm) 0 0;
  max-width: 52ch;
  font-size: var(--vc-text-md);
  line-height: var(--vc-leading-normal);
  color: var(--vc-fg-2);
  text-wrap: pretty;
}

/*
 * The prototype's .sec-head: title left, lede right, both on one baseline.
 * Opt-in, because the stacked head above is what 0.16 blocks were laid out for.
 */
.vc-section-head--split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: var(--vc-space-lg) var(--vc-space-2xl);
  align-items: end;
  max-width: none;
  margin-block-end: 3.5rem;
}

.vc-section-head--split .vc-section-head__lede {
  margin: 0;
}

@media (max-width: 60rem) {
  .vc-section-head--split {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 35rem) {
  .vc-section-head--split {
    margin-block-end: var(--vc-space-xl);
  }
}

/* The prototype's .more: a text link with an arrow that nudges on hover. */
.vc-more {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-weight: var(--vc-weight-emphasis);
  color: var(--vc-link);
  text-decoration: none;
}

.vc-more svg {
  inline-size: 0.875rem;
  block-size: 0.875rem;
  transition: transform var(--vc-base) var(--vc-ease);
}

.vc-more:hover {
  color: var(--vc-link-hover);
  text-decoration: none;
}

.vc-more:hover svg {
  transform: translateX(3px);
}

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */

/* The prototype's .cta: a wrapping row of actions under a lede. */
.vc-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--vc-space-xs);
  margin-block-start: 2.25rem;
}

.vc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--vc-space-2xs);
  min-block-size: 2.875rem;
  padding: 0.5rem 1.375rem;
  border: 0;
  border-radius: var(--vc-radius-full);
  background: transparent;
  color: var(--vc-fg);
  font-family: var(--vc-font-body);
  font-size: 0.9375rem;
  font-weight: var(--vc-weight-semibold);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--vc-fast) var(--vc-ease),
    box-shadow var(--vc-fast) var(--vc-ease),
    color var(--vc-fast) var(--vc-ease),
    filter var(--vc-fast) var(--vc-ease);
}

.vc-btn:hover {
  text-decoration: none;
}

@media (max-width: 35rem) {
  .vc-btn {
    min-block-size: 2.75rem;
  }
}

/* Header-scale: the prototype's 34px pill. */
.vc-btn--sm {
  min-block-size: 2.125rem;
  padding: 0.375rem 1rem;
  font-size: var(--vc-text-sm);
  font-weight: var(--vc-weight-medium);
}

/* A finger needs 44px: the small pill grows on a phone (header, cookie banner). */
@media (max-width: 35rem) {
  .vc-btn--sm {
    min-block-size: 2.75rem;
  }
}

/*
 * The primary action carries the brand gradient, exactly as the portal's own
 * primary button does -- Figma binds both to one variable,
 * `gradient/button/primary-secondary`.
 *
 * A flat `--vc-blue` fill shows only the blue half of the brand, so violet
 * would appear nowhere but the logo. Do not "simplify" this back to a solid.
 *
 * Hover shifts brightness rather than background-position: sizing the gradient
 * larger than the button to slide it re-introduces the exact problem, because
 * the visible slice is blue-only until the animation finishes.
 *
 * The label is pure white: it clears 4.55:1 at the violet end, where the app's
 * #F0F3FF would not (check-contrast.py).
 */
.vc-btn--primary {
  background: var(--vc-gradient-brand);
  color: var(--vc-primary-fg);
  box-shadow: var(--vc-shadow-brand);
}

.vc-btn--primary:hover {
  filter: brightness(1.08) saturate(1.04);
  color: var(--vc-primary-fg);
}

/* The prototype's .btn.ghost: a hairline ring, no fill. Used on any ground. */
.vc-btn--ghost,
.vc-btn--ghost-inverse {
  background: transparent;
  color: var(--vc-fg);
  box-shadow: inset 0 0 0 1px var(--vc-edge);
}

.vc-btn--ghost:hover,
.vc-btn--ghost-inverse:hover {
  color: var(--vc-fg);
  box-shadow: inset 0 0 0 1px var(--vc-edge-hover);
}

/* The prototype's .pill: "Get started" in the header, a fill that inverts the
   page. Lime on dark since 2026-10-29, the VeloGroup accent (owner's trial; it
   was fg, a white pill); ink on light, where lime all but vanished into the
   page. Hover lightens toward white (pill-hover). */
.vc-btn--inverse {
  background: var(--vc-pill);
  color: var(--vc-pill-fg);
}

.vc-btn--inverse:hover {
  background: color-mix(
    in srgb,
    var(--vc-pill) var(--vc-pill-hover),
    var(--vc-white)
  );
  color: var(--vc-pill-fg);
}

/* Borderless, for a secondary action that should not compete with the primary
   one beside it -- "Sign in" next to "Get started". */
.vc-btn--quiet {
  background: transparent;
  color: var(--vc-fg-2);
}

.vc-btn--quiet:hover {
  color: var(--vc-fg);
}

.vc-btn--secondary {
  background: var(--vc-violet);
  color: var(--vc-secondary-fg);
}

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

/* ---------------------------------------------------------------------------
   Surface -- the card material
   ---------------------------------------------------------------------------

   The prototype's .surface: one step up from what holds it, edged with an inset
   hairline rather than a border (so it adds no layout width), and a long, soft
   shadow that reads as depth on near-black rather than as a grey halo.

   A nested surface steps up again -- surface-1, 2, 3. Never put a surface on
   one of the same level: two equal greys read as one flat panel.
   --------------------------------------------------------------------------- */

.vc-surface {
  background: var(--vc-surface-1);
  border-radius: var(--vc-radius-lg);
  box-shadow:
    inset 0 0 0 1px var(--vc-line),
    var(--vc-shadow-lg);
}

.vc-surface .vc-surface {
  background: var(--vc-surface-2);
  box-shadow: inset 0 0 0 1px var(--vc-line-2);
}

.vc-surface .vc-surface .vc-surface {
  background: var(--vc-surface-3);
}

/* ---------------------------------------------------------------------------
   Breadcrumbs -- the prototype's .crumbs
   --------------------------------------------------------------------------- */

.vc-breadcrumbs {
  margin-block-end: 1.75rem;
  font-size: 0.84375rem;
  color: var(--vc-fg-3);
}

.vc-breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vc-space-2xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

.vc-breadcrumbs li + li::before {
  content: "/";
  margin-inline-end: var(--vc-space-2xs);
  color: var(--vc-fg-3);
}

.vc-breadcrumbs a {
  color: inherit;
  text-decoration: none;
}

.vc-breadcrumbs a:hover {
  color: var(--vc-fg);
  text-decoration: none;
}

.vc-breadcrumbs [aria-current="page"] {
  color: var(--vc-fg-2);
}

/* ---------------------------------------------------------------------------
   Core blocks the templates use directly
   --------------------------------------------------------------------------- */

/* 404 and search templates. Core draws the field for a light page. */
.wp-block-search__input {
  padding: 0.75rem 1rem;
  border: 1px solid var(--vc-control);
  border-radius: var(--vc-radius-card);
  background: var(--vc-surface-1);
  color: var(--vc-fg);
  font: inherit;
}

.wp-block-search__inside-wrapper {
  border-color: var(--vc-control);
  border-radius: var(--vc-radius-card);
  background: var(--vc-surface-1);
}

.wp-block-search__button-inside .wp-block-search__input {
  border: 0;
  background: transparent;
}

.wp-block-separator {
  border: 0;
  border-block-start: 1px solid currentColor;
  opacity: 1;
}

/* ---------------------------------------------------------------------------
   Header / footer chrome
   --------------------------------------------------------------------------- */

/*
 * The header and footer are styled by their own blocks -- blocks/site-header/
 * style.css and blocks/site-footer/style.css. What stays here is the rule the
 * minimal header needs, since it shares the .vc-header class but none of the
 * sticky behaviour.
 */

.vc-header--minimal {
  position: static;
  padding-block: var(--vc-space-sm);
  padding-inline: var(--vc-gutter);
  background: transparent;
  border-block-end: 0;
  box-shadow: none;
  backdrop-filter: none;
}

/* ---------------------------------------------------------------------------
   Editor placeholder for an unconfigured block
   --------------------------------------------------------------------------- */

.vc-block-placeholder {
  display: flex;
  flex-direction: column;
  gap: var(--vc-space-3xs);
  padding: var(--vc-space-lg);
  border: 1px dashed var(--vc-line-2);
  border-radius: var(--vc-radius-lg);
  background: var(--vc-surface-1);
  color: var(--vc-fg-2);
  text-align: center;
}

.vc-block-placeholder strong {
  font-family: var(--vc-font-display);
  color: var(--vc-fg);
}

/* ---------------------------------------------------------------------------
   Scroll reveal

   Opt-in per element via data-vc-reveal. Sections start visible and are hidden
   only once the observer is confirmed running (html.vc-reveal), so content is
   never left invisible on a browser that cannot animate it in.
   --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  html.vc-reveal [data-vc-reveal] {
    opacity: 0;
    transform: translateY(1.25rem);
    transition:
      opacity var(--vc-slow) var(--vc-ease),
      transform var(--vc-slow) var(--vc-ease);
  }

  html.vc-reveal [data-vc-reveal][data-vc-revealed="true"] {
    opacity: 1;
    transform: none;
  }
}

/* ---------------------------------------------------------------------------
   Cookie banner (inc/consent.php, assets/js/consent.js)
   ---------------------------------------------------------------------------

   A card at the foot of the viewport, not a dialog: it blocks nothing and takes
   no focus unless "Cookie settings" opened it. Below the sticky header (200), so
   the phone menu covers it. Both choices share one style, so neither is the
   easy way out.
   --------------------------------------------------------------------------- */

.vc-consent {
  position: fixed;
  inset-inline: var(--vc-gutter);
  inset-block-end: var(--vc-space-md);
  z-index: 190;
  display: grid;
  gap: var(--vc-space-xs);
  max-inline-size: 26rem;
  padding: var(--vc-space-md) var(--vc-space-lg);
  border-radius: var(--vc-radius-lg);
  background: var(--vc-surface-2);
  box-shadow:
    inset 0 0 0 1px var(--vc-line-2),
    var(--vc-shadow-xl);
  color: var(--vc-fg);
}

.vc-consent[hidden] {
  display: none;
}

.vc-consent__title {
  margin: 0;
  font-size: var(--vc-text-md);
  font-weight: var(--vc-weight-semibold);
  line-height: var(--vc-leading-card);
}

.vc-consent__text,
.vc-consent__status {
  margin: 0;
  color: var(--vc-fg-2);
  font-size: var(--vc-text-sm);
  line-height: var(--vc-leading-normal);
}

.vc-consent__text a {
  color: var(--vc-link);
}

.vc-consent__text a:hover {
  color: var(--vc-link-hover);
}

.vc-consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vc-space-xs);
  justify-content: flex-end;
  margin-block-start: var(--vc-space-2xs);
}

@media (max-width: 35rem) {
  .vc-consent {
    inset-block-end: var(--vc-space-sm);
    padding: var(--vc-space-md);
    max-inline-size: none;
  }

  .vc-consent__actions .vc-btn {
    flex: 1 1 0;
  }
}

/* No heading ends on one stranded word: lines are balanced (a no-op where unsupported). */
h1,
h2,
h3 {
  text-wrap: balance;
}


/* ---- Store badges (inc/mobile-app.php) ---------------------------------------
 *
 * Apple's and Google's own artwork, unaltered, as both require: no recolouring,
 * no effects, nothing drawn over them. Both are drawn 2.5rem tall, over the
 * 40px minimum Apple sets for its badge on screen. Google's file carries a
 * transparent margin round its black plate, so it is drawn taller and pulled
 * back into line by the same margin, which leaves the two plates one height.
 */
.vc-app-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--vc-space-xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

.vc-app-badge {
  display: inline-block;
  border-radius: var(--vc-radius-sm);
  line-height: 0;
}

.vc-app-badge img {
  display: block;
  width: auto;
  height: 2.5rem;
}

/* Google's PNG is 646 x 250 with its 564 x 168 plate 41px in from every edge. */
.vc-app-badge--google-play img {
  height: calc(2.5rem * 250 / 168);
  margin: calc(-2.5rem * 41 / 168);
}

.vc-app-badge:focus-visible {
  outline: 2px solid var(--vc-link);
  outline-offset: 3px;
}
