/* base.css — reset, typography, primitives.
   Visual values reference design-tokens.css only. Structural CSS (display,
   grid, position) is not a "visual value" and is allowed here. */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--ink);
  color: var(--stone);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Museum-wall surface: a fine film/plaster grain over everything so the screen
   reads as a material, not a backlight. Monochrome alpha noise, no color. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}
/* keep page content above the grain */
.nav, main, .footer, .rail { position: relative; z-index: 2; }

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

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: var(--leading-tight);
  letter-spacing: var(--track-tight);
}

/* --- Reusable primitives --- */

.shell {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--track-wider);
  text-transform: uppercase;
  color: var(--stone-mute);
}

.lede {
  font-size: var(--text-lg);
  line-height: var(--leading-body);
  color: var(--stone-mute);
  max-width: var(--maxw-text);
}

/* Quiet, confident link with an underline that draws on hover */
.link {
  font-size: var(--text-sm);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--stone);
  position: relative;
  padding-bottom: var(--s-1);
}
.link::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--accent-line);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.link:hover::after { transform: scaleX(1); }

/* Outlined button — gallery placard feel */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--text-sm);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--stone);
  padding: var(--s-4) var(--s-6);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  min-height: 44px;
  transition: background var(--dur) var(--ease),
              color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.btn:hover { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.btn .arrow { transition: transform var(--dur) var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }

/* Accessibility */
.skip-link {
  position: absolute;
  left: var(--s-4); top: var(--s-4);
  transform: translateY(-200%);
  background: var(--stone);
  color: var(--ink);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--radius);
  z-index: calc(var(--z-nav) + 1);
  transition: transform var(--dur-fast) var(--ease);
}
.skip-link:focus { transform: translateY(0); }

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

.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: sections rise gently into place */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* Weighted unveil: the work is revealed by a curtain wipe + settle, never a
   plain fade. The frame clips, the image eases down from a hair of scale. */
.unveil { position: relative; overflow: hidden; }
.unveil > img,
.unveil > .unveil__fill {
  clip-path: inset(0 0 100% 0);
  transform: scale(1.06);
  transition: clip-path 1.2s var(--ease-out),
              transform 1.6s var(--ease-out);
  will-change: clip-path, transform;
}
.unveil.is-visible > img,
.unveil.is-visible > .unveil__fill {
  clip-path: inset(0 0 0 0);
  transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .unveil > img, .unveil > .unveil__fill { clip-path: none; transform: none; transition: none; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* Collector's loupe: a circular lens that magnifies the work under the cursor,
   the way you'd lean in with a glass. Built in JS; styled here. */
.loupe {
  position: fixed;
  top: 0; left: 0;
  width: var(--loupe-size);
  height: var(--loupe-size);
  margin: calc(var(--loupe-size) / -2) 0 0 calc(var(--loupe-size) / -2);
  border-radius: 50%;
  border: 1px solid var(--loupe-ring);
  box-shadow: var(--shadow-mount-soft),
              inset 0 0 0 6px var(--ink),
              inset 0 0 30px var(--ink-shadow);
  background-repeat: no-repeat;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  z-index: var(--z-loupe);
}
.loupe.is-active { opacity: 1; transform: scale(1); }
@media (pointer: fine) and (min-width: 901px) { [data-loupe] { cursor: zoom-in; } }
.loupe::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 60px var(--ink-shadow-soft);
}
@media (max-width: 900px), (pointer: coarse) { .loupe { display: none; } }
