@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/InstrumentSerif-Regular.ttf") format("truetype");
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/NotoSans-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-stretch: 62.5% 100%;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #000;
  --fg: #f2f2f0;
  --muted: rgba(242, 242, 240, 0.55);
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: 32px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  overflow: hidden;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* Header */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--gutter);
  pointer-events: none;
}
.site-header::before {
  content: "";
  position: absolute;
  inset: 0 0 -24px 0;
  z-index: -1;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0));
  backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
  mask-image: linear-gradient(to bottom, #000 55%, transparent);
}
.brand { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; pointer-events: auto; }
.name { font-family: var(--serif); font-size: 36px; line-height: 1; letter-spacing: -0.01em; }
.tagline { font-size: 14px; color: var(--muted); }

.menu-toggle {
  pointer-events: auto;
  width: 48px;
  height: 48px;
  margin-top: -6px;
  opacity: 0.9;
  transition: opacity 0.25s ease;
}
.menu-toggle:hover, .menu-toggle:focus-visible { opacity: 1; }
.menu-toggle img { display: block; width: 48px; height: 48px; }

/* Canvas */
.canvas {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.canvas.dragging { cursor: grabbing; }
.canvas:not(.ready) { opacity: 0; }
.canvas { transition: opacity 0.6s ease; }

.tile {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  overflow: hidden;
  background: #111;
  cursor: inherit;
  will-change: translate;
  -webkit-touch-callout: none;
}
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.tile .expand {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #f2f2f0;
  background: rgba(242, 242, 240, 0.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.tile:hover .expand, .tile:focus-visible .expand { opacity: 1; }
.tile:focus-visible { outline: 2px solid var(--fg); outline-offset: -2px; }
@media (hover: none) { .tile .expand { opacity: 1; } }

/* Menu overlay */
.menu {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.menu:not([hidden]).open { opacity: 1; }
.menu-body {
  max-width: 756px;
  padding: 160px var(--gutter) 64px;
  font-size: 18px;
  line-height: 1.75;
  color: rgba(242, 242, 240, 0.85);
}
.menu-body p { margin: 0 0 24px; }
.menu-body a { color: var(--fg); text-decoration: none; border-bottom: 1px solid rgba(242, 242, 240, 0.4); }
.menu-body a:hover { border-bottom-color: var(--fg); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.94);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.lightbox[hidden] { display: none; }
.lightbox.open { opacity: 1; }
.lightbox img {
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  object-fit: contain;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}
.lightbox button {
  position: absolute;
  width: 48px;
  height: 48px;
  font-size: 36px;
  line-height: 48px;
  text-align: center;
  color: var(--fg);
  opacity: 0.85;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
}
.lightbox button:hover { opacity: 1; }
.lb-close { top: 20px; right: 20px; }
.lb-prev { left: 12px; top: 50%; margin-top: -24px; }
.lb-next { right: 12px; top: 50%; margin-top: -24px; }

/* 404 / error */
.message { padding: 160px var(--gutter); }
.message h1 { font-weight: 400; font-size: 48px; margin: 0 0 16px; }
.message a { color: var(--muted); }
body:has(.message) { overflow: auto; }

@media (max-width: 767px) {
  :root { --gutter: 20px; }
  .name { font-size: 30px; }
  .menu-body { padding-top: 140px; font-size: 17px; }
  .tile .expand { right: 8px; bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .menu, .lightbox, .tile .expand, .menu-toggle { transition: none; }
}
