/* ==========================================================================
   Base: reset, browser surfaces, layout primitives
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--color-text-subtle) var(--color-bg);
  scroll-behavior: smooth;   /* in-page links (the footer's "back to top") glide instead of jumping */
}

body {
  margin: 0;
  background: var(--color-surface);   /* inner pages are white; home.css gives the homepage its warm background */
  color: var(--color-text);
  font: var(--fw-regular) var(--fs-base) / var(--lh-body) var(--font-family);
  caret-color: var(--color-accent);
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
address { font-style: normal; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }

::selection { background: var(--color-accent); color: var(--color-white); }
:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0s !important; }
  html { scroll-behavior: auto; }
}

/* ---- Container ---- */
.container {
  width: min(var(--container-max), 100% - var(--container-gutter) * 2);
  margin-inline: auto;
}

/* ---- Media: every image lives in one of these ----
   The wrapper owns width + aspect-ratio; the image just fills it.
   Usage: <div class="media media--square"><img ...></div>            */
.media {
  position: relative;
  display: block;   /* also on <a> and <span> wrappers */
  overflow: hidden;
  aspect-ratio: var(--ratio, 1);
  border-radius: var(--media-radius, var(--radius-md));
  background: var(--color-placeholder);
}
.media > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, 50% 50%);
  transition: transform var(--duration-slow) var(--ease-out), filter var(--duration-base) var(--ease-out);
}
.media--square { --ratio: 1; }
.media--portrait { --ratio: 4 / 5; }
.media--landscape { --ratio: 5 / 4; }
.media--wide { --ratio: 16 / 9; }
.media--hero { --ratio: 21 / 10; }   /* matches the 3105×1470 banner photos */
.media--fill { aspect-ratio: auto; height: 100%; }   /* when a grid cell sets the size */
.media--flat { --media-radius: 0; }
.media--lg { --media-radius: var(--radius-lg); }
.media--sm { --media-radius: var(--radius-sm); }

/* Hover zoom, opt-in on the clickable parent */
.zoom:hover .media > img { transform: scale(var(--zoom-scale)); }

/* ---- Icons (SVG sprite: assets/sprite.svg) ---- */
.icon {
  width: var(--icon-size);
  height: var(--icon-size);
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--sm { --icon-size: var(--icon-size-sm); }
.icon--lg { --icon-size: 30px; }
/* The sprite arrow points right (→). In RTL it means "back", and .icon--flip turns it into "forward".
   In LTR the meanings swap, so a plain arrow is mirrored and a flipped one is left as drawn. */
.icon--flip { transform: scaleX(-1); }
.icon--arrow:dir(ltr) { transform: scaleX(-1); }
.icon--arrow.icon--flip:dir(ltr) { transform: none; }

/* ---- Utilities ---- */
.num { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
