/* =============================================================
   BASE
   Reset, document defaults, typography base, container and the
   small set of shared helpers used across sections.
   ============================================================= */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchored jumps land below the sticky nav */
  scroll-padding-top: calc(var(--nav-height) + var(--space-4));
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Text selection — the one place browser blue gives way to the accent */
::selection {
  background-color: var(--color-accent);
  color: var(--color-on-accent);
}

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

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

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

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

/* --- Typography base --------------------------------------- */
h1,
h2,
h3,
h4 {
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

strong {
  font-weight: var(--weight-semibold);
}

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

/* Horizontal container with page gutters */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* A standard vertical section */
.section {
  padding-block: var(--section-gap);
}

/* --- Section heading pattern ------------------------------- */
/* Small uppercase eyebrow that labels a section quietly */
.eyebrow {
  /* display:block, not inline-block — an inline-block as the first
     child of a block container sits inside an implicit line box
     sized by the parent's inherited font metrics and baseline-
     aligns within it, which was pushing "About" a few pixels below
     "Current focus" even with identical line-height. */
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-accent);
  line-height: 1;
}

.section-title {
  font-size: var(--text-2xl);
  margin-top: var(--space-3);
}

/* Wraps an eyebrow/title pair, spacing it from what follows */
.section-head {
  margin-bottom: var(--space-7);
}

/* Used by Experience's heading — a touch more room than the
   default, so "Where I've worked" doesn't crowd the list. */
.section-head--roomy {
  margin-bottom: clamp(1.75rem, 4vw, 3rem);
}

/* Optional short line beneath a section title */
.section-lead {
  margin-top: var(--space-4);
  max-width: 46ch;
  color: var(--color-text-secondary);
  font-size: var(--text-lg);
}

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

/* Visible, consistent focus for keyboard users only */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Remove the default outline when focus-visible is supported
   and we are providing our own ring on a component */
:focus:not(:focus-visible) {
  outline: none;
}

/* Skip link — first stop for keyboard / screen-reader users */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  z-index: 200;
  padding: var(--space-2) var(--space-4);
  background: var(--color-text);
  color: var(--color-bg);
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
  transition: transform var(--dur) var(--ease);
}

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

/* Screen-reader-only text */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- Scroll reveal (case-study / live-project chapters) ----- */
/* The .reveal class is added by js/reveal.js only, on those long
   storytelling pages; without JS these elements are never hidden.
   Entrance is a few pixels of rise and a fade — nothing more. */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* --- Load reveal (homepage) ---------------------------------
   [data-reveal-load] fades/rises once on page load, staggered
   top-to-bottom via --reveal-order (set inline per element — see
   index.html). Pure CSS, not scroll-triggered: above-the-fold
   content never waits on an intersection event to appear, and
   nothing can end up permanently stuck at opacity:0 the way an
   IntersectionObserver occasionally left the footer (no script to
   fail, no async race — the animation always runs on render). */
@keyframes reveal-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

[data-reveal-load] {
  animation: reveal-in var(--dur-slow) var(--ease-out) both;
  animation-delay: calc(var(--reveal-order, 0) * 45ms);
}

/* --- Motion preferences ------------------------------------ */
@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;
  }
}
