/* ============================================================
   Matthias Brandstetter — personal site
   Dark "print-mat" system: instrument/registration framing, brass
   accent, monospace labels. Framework-free. Palette tokens are CSS
   custom properties on .root. The homepage opens with a full-bleed
   WebGL particle hero (js/hero.js); the rest of the page shares the
   same palette and type.
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--bg); /* paint the root element so no gap ever shows white */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  /* clip (not hidden) — hidden would establish a scroll container on an
     ancestor of the sticky hero and break position: sticky. */
  overflow-x: clip;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

button {
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

::selection { background: #B08D57; color: #14151A; }

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

/* ---- design tokens --------------------------------------------------- */
:root {
  --bg: #14151A;
  --bg-a: rgba(20, 21, 26, 0.72);
  --tile: #1B1D23;
  --ink: #EDEAE3;
  --muted: #8B8D97;
  --faint: #767884;
  --line: #2E3038;
  --accent: #B08D57;
  --serif: 'Work Sans', sans-serif;
  --sans:  'Work Sans', sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --frame-inset: 24px;
  --consent-h: 0px; /* height reserved for the fixed consent banner (set by JS) */
}
.root {
  font-family: var(--sans);
}
.page {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: var(--consent-h);
}

/* ---- header ---------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: transform .4s cubic-bezier(.22,.61,.36,1),
              background .3s, border-color .3s, backdrop-filter .3s;
}
.site-header.is-scrolled {
  background: var(--bg-a);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom-color: var(--line);
}
.site-header.is-hidden { transform: translateY(-100%); }

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem clamp(1.5rem, 5vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1.5rem;
}
.monogram {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink);
  transition: color .2s;
}
.monogram:hover { color: var(--accent); }

.header-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.text-btn { color: var(--muted); cursor: pointer; transition: color .2s; }
.text-btn:hover { color: var(--ink); }

/* ---- hero — particle field + print-mat frame ------------------------- */
.hero-scroller {
  height: 220vh;
  position: relative;
}
.hero {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
#particle-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
}
/* static fallback — shown if WebGL is unavailable, or before init */
.hero-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse at 50% 60%, #22242c 0%, #1a1b20 55%, #14151A 100%);
}
/* 1px inset "print mat" frame */
.hero::before {
  content: "";
  position: absolute;
  inset: var(--frame-inset);
  border: 1px solid rgba(237, 234, 227, 0.35);
  z-index: 3;
  pointer-events: none;
}
/* four corner registration marks */
.reg-mark {
  position: absolute;
  width: 14px;
  height: 14px;
  z-index: 4;
  pointer-events: none;
}
.reg-mark::before, .reg-mark::after { content: ""; position: absolute; background: var(--accent); }
.reg-mark::before { width: 100%; height: 1px; top: 50%; }
.reg-mark::after  { height: 100%; width: 1px; left: 50%; }
.reg-tl { top: calc(var(--frame-inset) - 7px); left: calc(var(--frame-inset) - 7px); }
.reg-tr { top: calc(var(--frame-inset) - 7px); right: calc(var(--frame-inset) - 7px); }
.reg-bl { bottom: calc(var(--frame-inset) - 7px); left: calc(var(--frame-inset) - 7px); }
.reg-br { bottom: calc(var(--frame-inset) - 7px); right: calc(var(--frame-inset) - 7px); }

.hero-content {
  position: relative;
  z-index: 2;
  padding: 0 calc(var(--frame-inset) + 24px) calc(var(--frame-inset) + 40px + var(--consent-h));
  width: 100%;
}
.exif {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  gap: 24px;
  margin-bottom: 28px;
}
.exif span { color: var(--accent); }
.playground-note {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 22px;
}
.playground-note::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  flex: none;
}
.hero-title {
  font-family: var(--sans);
  font-size: clamp(48px, 9vw, 118px);
  line-height: 0.95;
  font-weight: 300;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 0;
}
.hero-role {
  margin-top: 16px;
  font-size: clamp(14px, 1.6vw, 18px);
  color: var(--muted);
  max-width: 480px;
  font-weight: 400;
}
.hero-role .accent { color: var(--accent); }
.frame-counter {
  position: absolute;
  top: calc(var(--frame-inset) + 16px);
  right: calc(var(--frame-inset) + 24px);
  z-index: 4;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.scroll-cue {
  position: absolute;
  bottom: calc(var(--frame-inset) + 16px + var(--consent-h));
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* ---- layout ---------------------------------------------------------- */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 5vw, 3rem);
}
section { scroll-margin-top: 6rem; }

.moment-about {
  min-height: 80vh;
  display: flex;
  align-items: center;
  padding: clamp(9rem, 18vh, 15rem) 0;
}
.about-text {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  line-height: 1.55;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 0;
  max-width: 55ch;
  text-wrap: pretty;
}

/* ---- photos ---------------------------------------------------------- */
.moment-photos { padding: clamp(9rem, 18vh, 15rem) 0; }
.photos-lead {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 clamp(4rem, 10vh, 8rem);
}
.gallery {
  display: flex;
  flex-direction: column;
  gap: clamp(120px, 18vh, 180px);
}
.gallery figure { margin: 0; max-width: 100%; }
.gallery img {
  width: 100%;
  object-fit: cover;
  display: block;
  background: var(--tile);
}
.provenance {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin: clamp(4rem, 9vh, 7rem) 0 0;
}
@media (max-width: 640px) {
  .gallery figure { width: 100% !important; align-self: stretch !important; }
}

/* ---- contact --------------------------------------------------------- */
.moment-contact {
  min-height: 70vh;
  display: flex;
  align-items: center;
  padding: clamp(9rem, 18vh, 15rem) 0;
}
.contact-inner { display: flex; flex-direction: column; gap: 1.1rem; }
.contact-lead {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0 0 0.75rem;
  color: var(--ink);
}
.contact-link {
  font-family: var(--sans);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: var(--accent);
  width: fit-content;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: border-color .2s;
}
.contact-link:hover { border-bottom-color: var(--accent); }

/* ---- footer ---------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem clamp(1.5rem, 5vw, 3rem);
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.footer-inner .copyright { color: var(--faint); }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: var(--muted); cursor: pointer; transition: color .2s; }
.footer-links a:hover { color: var(--ink); }

/* ---- legal overlay --------------------------------------------------- */
.legal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg);
  overflow-y: auto;
}
.legal-overlay[hidden] { display: none; }
.legal-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(4rem, 10vh, 7rem) clamp(1.5rem, 5vw, 3rem) 6rem;
}
.legal-back { font-family: var(--mono); font-size: 12px; color: var(--accent); cursor: pointer; letter-spacing: 0.04em; }
.legal-title {
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -0.01em;
  margin: 2.5rem 0 2rem;
  color: var(--ink);
}
.legal-blocks { display: flex; flex-direction: column; gap: 1.5rem; max-width: 55ch; }
.legal-blocks h3 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 0.5rem;
}
.legal-blocks p {
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0;
  white-space: pre-line;
}
.legal-blocks img { display: block; }

/* ---- consent banner -------------------------------------------------- */
.consent {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 70;
  background: var(--tile);
  border-top: 1px solid var(--line);
}
.consent[hidden] { display: none; }
.consent-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem clamp(1.5rem, 5vw, 3rem);
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.consent-text {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
  max-width: 60ch;
}
.consent-text .link { color: var(--accent); cursor: pointer; }
.consent-actions {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.consent-actions .decline { color: var(--muted); cursor: pointer; transition: color .2s; }
.consent-actions .decline:hover { color: var(--ink); }
.consent-actions .accept { color: var(--accent); cursor: pointer; border-bottom: 1px solid var(--accent); padding-bottom: 1px; }

/* ---- reduced motion -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
