/*
  base.css
  Reset + global defaults: box sizing, body, headings, links, images, focus styles,
  and a few helper classes used everywhere (visually-hidden, skip-link, accent-text).
*/

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

html {
  -webkit-text-size-adjust: 100%;
  /* Keeps anchored sections from hiding under the sticky navbar */
  scroll-padding-top: calc(var(--navbar-height) + var(--space-4));
}

/* Smooth scrolling only for people who haven't asked for less motion */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  min-height: 100dvh;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color var(--duration-base) var(--ease-out), color var(--duration-base) var(--ease-out);
}

/* When the mobile menu is open, stop the page behind it from scrolling */
body.is-locked {
  overflow: hidden;
}

h1,
h2,
h3,
h4 {
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* Numbers in the small mono labels line up in neat columns */
.project-card__meta {
  font-variant-numeric: tabular-nums;
}

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

ul,
ol {
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

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

::selection {
  background: var(--color-accent);
  color: #ffffff;
}

/* Visible keyboard focus ring in the accent colour.
   (No border-radius here: the ring follows each element's own corners,
   so round icon buttons keep a round ring.) */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* Browser-drawn details in the site's own colours: scrollbar, text cursor, checkboxes */
html {
  scrollbar-color: var(--color-border-strong) var(--color-bg);
  accent-color: var(--color-accent);
}

input,
textarea {
  caret-color: var(--color-accent);
}

/* ---------- Helpers ---------- */

/* Hidden on screen, still read by screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* "Skip to content" link, only appears when focused with the keyboard */
.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: var(--z-skip);
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary-btn);
  color: var(--color-on-primary);
  border-radius: var(--radius-control);
  transform: translateY(-200%);
}

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

.accent-text {
  color: var(--color-accent);
}

.scroll-sentinel {
  position: absolute;
  top: 0;
  height: 1px;
  width: 1px;
}
