/* Light theme first, dark overrides (dark is the default class on <html>). */
:root {
  --background: #fafafa;
  --foreground: #171717;
  --muted: #737373;
  --line: rgba(23, 23, 23, 0.1);
  --fg-rgb: 23, 23, 23;
  color-scheme: light;
}
.dark {
  --background: #0a0a0a;
  --foreground: #ededed;
  --muted: #a3a3a3;
  --line: rgba(237, 237, 237, 0.1);
  --fg-rgb: 237, 237, 237;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: var(--background); }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  color: var(--foreground);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.2s, color 0.2s;
}

h1, h2, p, figure { margin: 0; }
a { color: inherit; }

/* ---------- background studs ---------- */
#studs {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
main, footer { position: relative; z-index: 1; }

/* ---------- layout ---------- */
main {
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
  flex: 1;
}
@media (min-width: 768px) { main { padding-top: 3rem; } }

.intro { margin: 2.5rem 0 2rem; }
.head { display: flex; align-items: center; justify-content: space-between; }

h1 {
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}
.sub { color: var(--muted); font-size: 0.875rem; line-height: 1.25rem; margin-bottom: 0.5rem; }

.links { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; font-size: 0.875rem; line-height: 1.25rem; }
.sep { color: var(--muted); }

.u {
  text-decoration-line: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--muted);
  transition: text-decoration-color 0.2s;
}
.u:hover { text-decoration-color: var(--foreground); }
.u:focus-visible, .icon-btn:focus-visible, .shot:focus-visible { outline: 2px solid var(--foreground); outline-offset: 3px; border-radius: 4px; }

.icon-btn {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s;
}
.icon-btn:hover { color: var(--foreground); }
.dark .i-moon, .light .i-sun { display: none; }

.block { margin-bottom: 2.5rem; font-size: 0.875rem; line-height: 1.25rem; }
h2 { font-size: 1.125rem; line-height: 1.75rem; font-weight: 500; text-transform: lowercase; margin-bottom: 0.5rem; }
.items > * + * { margin-top: 1rem; }
.items p { line-height: 1.625; }
.name { font-weight: 500; }
.dash { color: var(--muted); }

/* ---------- image placeholders ---------- */
.with-shot { display: grid; grid-template-columns: 1fr 112px; gap: 1rem; align-items: start; }
@media (max-width: 520px) {
  .with-shot { grid-template-columns: 1fr; gap: 0.75rem; }
  .with-shot .shot { width: 60%; }
}
.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.625rem; margin-top: 1rem; }

.shot {
  appearance: none;
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(var(--fg-rgb), 0.025);
  color: var(--muted);
  cursor: zoom-in;
  transition: border-color 0.2s, transform 0.2s;
}
.shot.wide { aspect-ratio: 16 / 6; margin-top: 1rem; }
.shot:hover { border-color: rgba(var(--fg-rgb), 0.28); }
.shot:active { transform: scale(0.985); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background-image: radial-gradient(circle, rgba(var(--fg-rgb), 0.16) 0.75px, transparent 1.1px);
  background-size: 9px 9px;
  background-position: center;
}
.ph svg { opacity: 0.75; }
.cap {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 5px;
  font-size: 11px;
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}

/* ---------- lightbox ---------- */
#lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  color: var(--foreground);
}
#lightbox::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(6px); }
.light #lightbox::backdrop { background: rgba(250, 250, 250, 0.7); }
#lightbox[open] { display: grid; place-items: center; }
#lightbox figure { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.stage {
  position: relative;
  width: min(88vw, 900px);
  aspect-ratio: 4 / 3;
  max-height: 78vh;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--background);
  transform-origin: 0 0;
}
.stage.wide { aspect-ratio: 16 / 6; }
.stage img { width: 100%; height: 100%; object-fit: contain; display: block; background: var(--background); }
.stage .ph { background-size: 14px 14px; gap: 0.5rem; align-content: center; }
.stage .ph svg { width: 28px; height: 28px; }
.stage .ph span { font-size: 0.8125rem; color: var(--muted); }
#lightbox figcaption { font-size: 0.875rem; color: var(--muted); }
#lightbox .close { position: fixed; top: 1rem; right: 1rem; }

/* ---------- footer + dunes ---------- */
.foot-wrap { max-width: 42rem; margin: 0 auto; padding: 0 1.5rem; text-align: center; }
.rule { border-top: 1px solid var(--line); padding-top: 2rem; }
.foot {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--muted);
}
.dunes { position: relative; width: 100%; height: 180px; margin-top: 3rem; overflow: hidden; }
@media (min-width: 768px) { .dunes { height: 240px; } }
.dunes canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }

/* ---------- load-in (CSS only, so content shows even if a script fails) ---------- */
@keyframes rise {
  from { opacity: 0; filter: blur(6px); transform: translateY(6px); }
}
.reveal > * { animation: rise 0.6s ease both; }
.reveal > :nth-child(2) { animation-delay: 90ms; }
.reveal > :nth-child(3) { animation-delay: 180ms; }
.reveal > :nth-child(4) { animation-delay: 270ms; }
.reveal > :nth-child(5) { animation-delay: 360ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal > * { animation: none; }
  body, .shot, .u, .icon-btn { transition: none; }
}
