/* ==========================================================================
   BASE
   Reset, document defaults, typography primitives and the two layout
   primitives every section is built from (.shell and .section).
   Depends on: tokens.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. RESET
   -------------------------------------------------------------------------- */

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

html {
  /* Anchor links land below the fixed-height header once nav is wired up. */
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1rem);
  -webkit-text-size-adjust: 100%;
}

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

/* :where() keeps this at zero specificity, so a component can set its own
   padding on a list without having to out-specify the reset. */
:where(ul[class], ol[class]) {
  padding: 0;
  list-style: none;
}

body {
  min-height: 100svh;
  /* Replaces the space the now-fixed header gave up in the flow. */
  padding-top: var(--header-height);
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--fs-ui);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Nothing may cause a horizontal scrollbar. Sections that scroll
     internally (the recommendation rail) opt in explicitly. */
  overflow-x: hidden;
}

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

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

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

/* --------------------------------------------------------------------------
   2. ACCESSIBILITY
   -------------------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Visually hidden but available to assistive tech. */
.u-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--color-surface-header);
  color: var(--color-text-strong);
  font-weight: var(--fw-semibold);
  transform: translateY(-150%);
}
.skip-link:focus {
  transform: translateY(0);
}

@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;
  }
}

/* --------------------------------------------------------------------------
   3. LAYOUT PRIMITIVES

   .shell   - the centred 1760px measure with the page gutter.
   .section - a two-column grid: the left rail label, then the content.
              Below 1024px it collapses to one column and the rail label
              becomes an eyebrow heading stacked above its section.
   -------------------------------------------------------------------------- */

.shell {
  width: 100%;
  max-width: calc(var(--layout-max) + var(--page-gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}

.section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-16);
}

/* The content column of every section. Capped at the Figma main column so
   the layout stops growing past the 1920 reference instead of stretching. */
.section__body {
  min-width: 0;               /* lets grid/flex children shrink properly */
  max-width: var(--layout-main);
}

/* The rail label: "ABILITIES", "IMPACT", ... Same element at every size,
   only its placement changes - so there is no duplicated markup and the
   heading order stays intact. */
.section__eyebrow {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--fs-eyebrow);
  font-weight: var(--fw-medium);
  line-height: var(--lh-eyebrow);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
}

.section__eyebrow-link {
  display: inline-block;
  color: var(--color-link);
  font-weight: var(--fw-light);
  /* The frame sets this link in mixed case inside an uppercase label. */
  text-transform: none;
  /* Padding pulled back out by an equal negative margin: the hit area grows
     to 44px without shifting where the text sits. */
  padding-block: 10px;
  margin-block: -10px;
}
.section__eyebrow-link:hover { text-decoration: underline; }

/* --- Desktop: restore the true two-column frame ------------------------- */
@media (min-width: 1024px) {
  .section {
    grid-template-columns: var(--layout-rail) minmax(0, 1fr);
    gap: var(--layout-rail-gap);
    align-items: start;
  }
  .section__eyebrow {
    grid-column: 1;
    /* Each label's vertical offset is set per section in home.css, taken
       from the frame. Most are within a few px of their section's top; the
       IMPACT label is the outlier at +56. */
    margin-top: var(--eyebrow-offset, 0px);
  }
  .section__body { grid-column: 2; }

  /* Sections with no rail label still align to the content column. */
  .section--no-eyebrow .section__body { grid-column: 2; }
}
