/*
 * Chainline Cycles - shared tokens, reset and the few components every
 * section uses. Section styles live in their own file (header.css, bikes.css,
 * workshop.css, visit.css) and only read these custom properties.
 *
 * Structure follows a retail system: near-monochrome chrome, one soft
 * surface grey, an 8px grid, pill-shaped controls on square surfaces, and a
 * single green accent kept for actions and focus.
 */

:root {
  /* Colour */
  --ink: #111111;
  --charcoal: #39393b;
  --mute: #6b6b6d; /* 5.3:1 on white, 4.9:1 on --surface */
  --hairline: #cacacb;
  --hairline-soft: #e5e5e5;
  --surface: #f5f5f5;
  --canvas: #ffffff;
  --on-ink: #ffffff;
  --accent: #0b6b4c; /* 6.6:1 on white */
  --accent-deep: #08503a;
  --accent-soft: #e4f1eb;
  --sale: #c8102e; /* 5.9:1 on white */
  --success: #0b6b4c;
  --error: #b00020;

  /* Type */
  --font-sans: 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;
  --text-xs: 0.75rem; /* 12px */
  --text-sm: 0.875rem; /* 14px */
  --text-md: 1rem; /* 16px */
  --text-lg: 1.5rem; /* 24px */
  --text-xl: 2rem; /* 32px */
  --text-display: clamp(2.75rem, 7vw, 5.5rem);
  --leading-tight: 1.05;
  --leading-heading: 1.2;
  --leading-body: 1.5;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-bold: 700;

  /* Space (8px grid with the reference's in-between steps) */
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-section: clamp(48px, 8vw, 96px);

  /* Shape: square surfaces, pill controls. Nothing in between. */
  --radius-none: 0;
  --radius-pill: 9999px;

  /* Layout */
  --container: 1280px;
  --gutter: clamp(16px, 4vw, 48px);
  --header-height: 64px;

  --focus-ring: 3px solid var(--accent);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--space-md));
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-body);
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  font-weight: var(--weight-medium);
  line-height: var(--leading-heading);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

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

img {
  height: auto;
}

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

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

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* Shared components */

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

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

.section--surface {
  background: var(--surface);
}

.section-head {
  display: grid;
  gap: var(--space-xs);
  margin-bottom: var(--space-xl);
  max-width: 48rem;
}

.section-head h2 {
  font-size: var(--text-xl);
}

.section-head p {
  color: var(--charcoal);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: 48px;
  padding: var(--space-sm) var(--space-xl);
  border: 1.5px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.button-primary {
  background: var(--ink);
  color: var(--on-ink);
}

.button-primary:hover {
  background: var(--charcoal);
}

.button-accent {
  background: var(--accent);
  color: var(--on-ink);
}

.button-accent:hover {
  background: var(--accent-deep);
}

.button-secondary {
  background: transparent;
  border-color: var(--hairline);
  color: var(--ink);
}

.button-secondary:hover {
  border-color: var(--ink);
}

.button-small {
  min-height: 40px;
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-sm);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: var(--space-xs) var(--space-md);
  border: 1.5px solid var(--hairline-soft);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
}

.chip[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
}

/* Section styles set display on their blocks, which would otherwise beat the attribute. */
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--space-xs);
  left: var(--space-xs);
  z-index: 100;
  padding: var(--space-xs) var(--space-md);
  background: var(--ink);
  color: var(--on-ink);
  border-radius: var(--radius-pill);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

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

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