/* ==========================================================================
   METRIX LAB - base.css
   Modern reset, document defaults, typography, layout primitives.
   Load order: 2nd (after tokens.css).
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* offset in-page anchors for the sticky header */
  scroll-padding-top: calc(var(--header-height) + var(--space-lg));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Belt-and-suspenders horizontal-overflow guard. body already clips, but on
     iOS Safari / some browsers the documentElement is the real scroll container,
     so a decorative/section bleed could still surface a horizontal scrollbar
     (the stray "bar" along the bottom edge). Clamp x-scroll at the root too. */
  overflow-x: hidden;
}

body {
  min-height: 100%;
  background-color: var(--color-bg);
  color: var(--color-text-body);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

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

svg {
  fill: none;
}

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

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

ul[role="list"],
ol[role="list"] {
  list-style: none;
}

/* The [hidden] attribute must always win. Components that set display (e.g.
   .contact__form / .contact__success are flex) would otherwise override the
   UA `[hidden]{display:none}` rule, leaving JS-toggled panels stuck visible -
   which showed the contact "success" state next to the live form on load. */
[hidden] {
  display: none !important;
}

p,
li {
  text-wrap: pretty;
}

/* ----- SELECTION ---------------------------------------------------------- */
::selection {
  background-color: var(--color-accent);
  color: var(--color-text-on-accent);
}

/* ----- HEADINGS ----------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-text);
  line-height: var(--lh-heading);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); letter-spacing: var(--tracking-tighter); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-h2); letter-spacing: var(--tracking-tighter); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

strong, b { color: var(--color-text); font-weight: 600; }

/* ----- LINKS -------------------------------------------------------------- */
a {
  color: var(--color-accent-soft);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--color-accent); }

/* ----- FOCUS VISIBLE ------------------------------------------------------ */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-xs);
}
/* never show focus ring on mouse, only keyboard */
:focus:not(:focus-visible) { outline: none; }

/* ----- LAYOUT: CONTAINER -------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}
.container--narrow { max-width: var(--container-narrow); }

/* ----- LAYOUT: SECTION ---------------------------------------------------- */
.section {
  position: relative;
  padding-block: var(--section-padding-y);
  background-color: var(--color-bg);
}

/* Alternating surface backgrounds for visual rhythm.
   Use .section--dark to explicitly raise a section to charcoal.
   Builders can also rely on this default odd/even cadence. */
.section--dark {
  background-color: var(--color-surface);
}
.section--alt {
  background-color: var(--color-bg-alt);
}
/* subtle top hairline divider between stacked sections */
.section--divided::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-grey-700) 30%, var(--color-grey-700) 70%, transparent);
  opacity: 0.6;
}

/* ----- EYEBROW ------------------------------------------------------------ */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-body);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-md);
}
/* optional leading tick mark for the eyebrow */
.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--gradient-accent-h);
  display: inline-block;
}
.eyebrow--no-tick::before { display: none; }

/* ----- SECTION TITLE ------------------------------------------------------ */
.section-title {
  font-size: var(--fs-h2);
  font-family: var(--font-heading);
  color: var(--color-text);
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-tighter);
  margin-bottom: var(--space-md);
  max-width: 22ch;
}
.section-title--center { margin-inline: auto; text-align: center; }
/* gradient-clipped accent word helper: wrap word in <span class="accent-text"> */
.accent-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--color-accent); /* fallback - true brand orange when no clip */
}

/* Forced-colors / Windows High Contrast: the gradient background-image is
   dropped while a transparent text-fill remains, which would make every
   gradient-clipped accent word invisible. Restore solid, system-colored text.
   Each other gradient-clipped element repeats this guard in its own file so the
   override wins on source order (see components.css, footer.css, portfolio.css). */
@media (forced-colors: active) {
  .accent-text {
    -webkit-text-fill-color: currentColor;
    background: none;
    color: CanvasText;
  }
}

/* section intro/lead paragraph below the title */
.section-lead {
  font-size: var(--fs-lead);
  color: var(--color-text-muted);
  max-width: 60ch;
  line-height: var(--lh-snug);
}

/* a shared section header block helper (eyebrow + title + lead) */
.section-header {
  margin-bottom: var(--space-3xl);
  max-width: 720px;
}
.section-header--center {
  margin-inline: auto;
  text-align: center;
}
.section-header--center .eyebrow { justify-content: center; }

/* ----- UTILITY: VISUALLY HIDDEN ------------------------------------------- */
.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;
}

/* ----- UTILITY: TEXT MUTED / SMALL ---------------------------------------- */
.text-muted { color: var(--color-text-muted); }
.text-faint { color: var(--color-text-faint); }
.text-accent { color: var(--color-accent); }
.text-center { text-align: center; }

/* skip link for a11y */
.skip-link {
  position: absolute;
  left: var(--space-md);
  top: -100%;
  z-index: var(--z-top);
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.skip-link:focus { top: var(--space-md); }
