/* ============================================================
   base — reset, global details (selection, focus, grain),
   header and the mobile menu.
   ============================================================ */

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

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

body {
  margin: 0;
  background: var(--fog);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-m);
  line-height: 1.45;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

::selection { background: var(--finder); color: var(--white); }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--finder);
  outline-offset: 3px;
  border-radius: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--white);
  transform: translateY(-160%);
}
.skip-link:focus-visible { transform: none; }

/* ---------- grain: SVG noise, very low opacity ---------- */
.grain {
  position: fixed;
  inset: -50%;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.4 -0.35'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  will-change: transform;
  animation: grain 0.9s steps(1) infinite;
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -4%); }
  60%  { transform: translate(-4%, -1%); }
  80%  { transform: translate(3%, 3%); }
}
@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
}

/* ---------- header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: var(--z-header);
  height: var(--header-h);
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  color: var(--ink);
  font-size: var(--fs-s);
  font-weight: 500;
  transition: color 0.3s var(--ease-out), background-color 0.3s var(--ease-out);
}
/* once the page moves, the bar gets a solid ground so the links
   never sit on top of the portrait or the work images */
.site-header.is-solid { background: var(--fog); }
.site-header.is-dark { color: var(--white); }
.site-header.is-solid.is-dark { background: var(--ink); }

.brand { justify-self: start; white-space: nowrap; }
.brand sup { font-size: 0.7em; vertical-align: 0.4em; margin-left: 0.15em; }

.nav { display: flex; gap: clamp(16px, 2.4vw, 40px); }

.link {
  position: relative;
  display: inline-block;
  padding: 4px 0;
}
.link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 1px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.45s var(--ease-out);
}
.link:hover::after,
.link.is-active::after {
  transform: scaleX(1);
  transform-origin: left center;
}

.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.6vw, 24px);
}

.lang { display: flex; gap: 2px; }
.lang button {
  padding: 4px 5px;
  opacity: 0.62; /* still AA on fog and on black */
  transition: opacity 0.2s;
}
.lang button[aria-pressed="true"] { opacity: 1; }
.lang button:hover { opacity: 1; }

.btn-pill {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border: 1px solid currentColor;
  border-radius: 999px;
  white-space: nowrap;
  transition: background-color 0.25s, color 0.25s;
}
.btn-pill:hover { background: var(--ink); color: var(--fog); border-color: var(--ink); }
.site-header.is-dark .btn-pill:hover { background: var(--white); color: var(--ink); border-color: var(--white); }

.menu-toggle { display: none; padding: 6px 0; }

/* ---------- mobile menu ---------- */
.menu {
  position: fixed;
  inset: 0;
  z-index: var(--z-menu);
  background: var(--ink);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: calc(var(--header-h) + 24px) var(--gutter) var(--gutter);
}
.menu[hidden] { display: none; }
.menu__links { display: grid; gap: 4px; margin-top: auto; }
.menu__links a {
  font-size: clamp(3rem, 16vw, 6rem);
  line-height: 0.95;
  font-weight: 700;
  font-variation-settings: "wdth" 80;
  letter-spacing: -0.01em;
}
.menu__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  font-size: var(--fs-s);
}
.menu__close {
  position: absolute;
  top: 0; right: var(--gutter);
  height: var(--header-h);
  font-size: var(--fs-s);
  font-weight: 500;
}

@media (max-width: 760px) {
  .site-header { grid-template-columns: 1fr auto; }
  .nav, .header-actions .btn-pill { display: none; }
  .menu-toggle { display: inline-block; }
}

/* ---------- intro: initial states (only while JS runs it) ---------- */
.js-intro .site-header,
.js-intro .hero__corner { opacity: 0; }
.js-intro .hero__char { transform: translateY(115%); }
.js-intro .hero__img { opacity: 0; }

/* ---------- cursor: always the system one ---------- */
a[href], button:not([disabled]), [role="button"], label[for], summary { cursor: pointer; }
