/*
 * base.css — reset, typography and layout primitives (spec 6.2).
 * Mobile first: base rules target a 360px phone, enhancements use min-width only.
 * Breakpoints used across the project (spec 6.3): 480, 640, 768, 960, 1200.
 */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

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

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

img {
  height: auto;
}

a {
  color: var(--c-primary-600);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

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

button {
  cursor: pointer;
}

table {
  border-collapse: collapse;
}

/* Visible focus everywhere (spec 13.2) */
:focus-visible {
  outline: var(--ring-w) solid var(--c-primary-600);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Visually hidden but reachable by assistive technology */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
 * Typography
 * ----------------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  line-height: var(--lh-tight);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
}

h2 {
  font-size: var(--fs-h2);
}

h3 {
  font-size: var(--fs-h3);
}

p {
  max-width: var(--measure);
}

strong {
  font-weight: var(--fw-bold);
}

.eyebrow {
  display: block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-primary-600);
  margin-bottom: var(--s-2);
}

.lead {
  font-size: var(--fs-lg);
  color: var(--c-text-muted);
  max-width: var(--measure);
  margin-top: var(--s-3);
}

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

.text-sm {
  font-size: var(--fs-sm);
}

.text-center {
  text-align: center;
}

/* --------------------------------------------------------------------------
 * Layout primitives
 * ----------------------------------------------------------------------- */
.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

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

.section--tight {
  padding-block: var(--s-8);
}

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

.section--band {
  background: var(--grad-band);
}

/* Vertical rhythm between stacked sections without double padding */
.stack > * + * {
  margin-top: var(--s-4);
}

.stack-2 > * + * {
  margin-top: var(--s-2);
}

.stack-3 > * + * {
  margin-top: var(--s-3);
}

.stack-6 > * + * {
  margin-top: var(--s-6);
}

.stack-8 > * + * {
  margin-top: var(--s-8);
}

/* Single column on mobile, 2 from 640px, 3 from 960px (spec 6.2) */
.grid {
  display: grid;
  gap: var(--s-6);
  grid-template-columns: 1fr;
}

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

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

/* Modifier classes to override the column count per section */
@media (min-width: 640px) {
  .grid--1 {
    grid-template-columns: 1fr;
  }
}

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

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

@media (min-width: 960px) {
  .grid--wide-first {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .section {
    padding-block: var(--s-24);
  }

  .section--tight {
    padding-block: var(--s-12);
  }
}

/* Skip link: first focusable element on the page (spec FR-NAV-6) */
.skip-link {
  position: absolute;
  left: var(--s-2);
  top: var(--s-2);
  z-index: calc(var(--z-menu) + 1);
  padding: var(--s-2) var(--s-4);
  min-height: var(--tap-min);
  display: inline-flex;
  align-items: center;
  background-color: var(--c-primary-600);
  color: #fff;
  border-radius: var(--radius-pill);
  text-decoration: none;
  font-weight: var(--fw-medium);
  transform: translateY(-200%);
  transition: transform var(--t-fast);
}

.skip-link:focus {
  transform: translateY(0);
}
