/* ─── Reset & Base ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Theme tokens ───────────────────────────────── */
:root {
  /* Core colours */
  --bg:          #f4efe8;
  --ink:         #1a1714;
  --muted:       #9a9086;
  --accent:      #c0392b;
  --sans:        'Inter', system-ui, sans-serif;
  --header-h:    58px;

  /* Glass / surface */
  --glass-bg:          rgba(244, 239, 232, 0.86);
  --glass-bg-sm:       rgba(244, 239, 232, 0.82);
  --glass-border:      rgba(0, 0, 0, 0.07);
  --glass-border-hi:   rgba(0, 0, 0, 0.13);
  --btn-hover:         rgba(0, 0, 0, 0.06);

  /* Canvas */
  --dot-color:         rgba(0, 0, 0, 0.09);

  /* Photos */
  --photo-border:      rgba(0, 0, 0, 0.05);
  --photo-shadow:      0 2px 12px rgba(0,0,0,.08);
  --photo-shadow-hi:   0 8px 32px rgba(0,0,0,.18);

  /* Transitions */
  --theme-transition: background-color .3s ease, color .3s ease, border-color .3s ease, box-shadow .3s ease;
}

[data-theme="dark"] {
  --bg:          #111010;
  --ink:         #e4dfd8;
  --muted:       #5c5751;

  --glass-bg:          rgba(22, 20, 19, 0.90);
  --glass-bg-sm:       rgba(22, 20, 19, 0.86);
  --glass-border:      rgba(255, 255, 255, 0.07);
  --glass-border-hi:   rgba(255, 255, 255, 0.13);
  --btn-hover:         rgba(255, 255, 255, 0.07);

  --dot-color:         rgba(255, 255, 255, 0.055);

  --photo-border:      rgba(255, 255, 255, 0.06);
  --photo-shadow:      0 2px 16px rgba(0,0,0,.45);
  --photo-shadow-hi:   0 8px 36px rgba(0,0,0,.65);
}

/* Smooth colour transitions across the whole page */
html { transition: var(--theme-transition); }
body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: var(--theme-transition);
}

/* ─── Header ─────────────────────────────────────── */
.header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 40px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--glass-border);
  transition: var(--theme-transition);
}

.header-logo {
  color: var(--ink);
  transition: color .3s;
  display: flex;
  align-items: center;
}
.header-logo svg { height: 9.6px; width: auto; display: block; }

.header-nav { display: flex; gap: 28px; flex: 1; }
.header-nav a {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .15em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  transition: color .2s;
}
.header-nav a:hover { color: var(--ink); }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Hamburger — hidden on desktop */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 32px;
  height: 32px;
  padding: 8px 6px;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* ─── Full-screen mobile nav overlay ─────────────── */
.mobile-nav {
  display: none; /* revealed via media query */
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  flex-direction: column;
  justify-content: space-between;
  padding: 0 16px 40px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}
.mobile-nav.open {
  opacity: 1;
  pointer-events: auto;
}

/* Top bar inside overlay */
.mobile-nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  flex-shrink: 0;
}
.mobile-nav-logo {
  color: var(--ink);
  display: flex;
  align-items: center;
}
.mobile-nav-logo svg { height: 9.6px; width: auto; display: block; }

.mobile-nav-close {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 8px 0;
  transition: color .2s;
}
.mobile-nav-close:hover { color: var(--ink); }
.mobile-nav-close span { font-size: 10px; }

/* Nav links — centred & large */
.mobile-nav-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 4px;
}
.mobile-nav-links a {
  display: block;
  font-size: clamp(36px, 11vw, 52px);
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  line-height: 1.35;
  transition: color .2s, opacity .2s;
}
.mobile-nav-links a:hover { color: var(--accent); }

/* Bottom tagline */
.mobile-nav-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mobile-nav-tagline {
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s;
}
.mobile-nav-tagline:hover { color: var(--ink); }

/* Zoom buttons */
.zoom-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--glass-border-hi);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s, color .3s;
}
.zoom-btn:hover { background: var(--btn-hover); }

.zoom-level {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .08em;
  color: var(--muted);
  min-width: 38px;
  text-align: center;
  transition: color .3s;
}

/* ─── Theme toggle ───────────────────────────────── */
.theme-toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  border: 1px solid var(--glass-border-hi);
  background: var(--btn-hover);
  cursor: pointer;
  position: relative;
  margin-left: 4px;
  transition: background .3s, border-color .3s;
  flex-shrink: 0;
}
.theme-toggle::before {
  /* sliding knob */
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), background .3s;
}
[data-theme="dark"] .theme-toggle::before {
  transform: translateX(20px);
  background: var(--ink);
}
/* Sun / moon glyphs */
.theme-toggle::after {
  content: '☀';
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  line-height: 1;
  color: var(--muted);
  pointer-events: none;
  transition: opacity .2s;
}
[data-theme="dark"] .theme-toggle::after {
  content: '☾';
  left: 5px;
  right: auto;
}

/* divider between zoom and toggle */
.header-divider {
  width: 1px;
  height: 16px;
  background: var(--glass-border-hi);
  margin: 0 2px;
}

/* ─── Map Viewport ───────────────────────────────── */
.map-viewport {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.map-viewport.panning { cursor: grabbing; }

/* Large infinite canvas */
.map-canvas {
  position: absolute;
  width: 5200px;
  height: 3600px;
  transform-origin: 0 0;
  will-change: transform;
  contain: layout style;
  background-image: radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
  background-size: 40px 40px;
  background-color: var(--bg);
  transition: background-color .3s;
}

/* Promote photos to their own compositor layer */
.photo-inner {
  isolation: isolate;
}

/* ─── Tile (infinite canvas repeat unit) ────────── */
.tile {
  position: absolute;
  left: 0; top: 0;
  width: 5200px;
  height: 3600px;
}

/* ─── Photo Items ────────────────────────────────── */
.photo {
  position: absolute;
  width: var(--w, 200px);
  cursor: pointer;
  user-select: none;
  z-index: 3;
}

.photo-inner {
  width: 100%;
  overflow: hidden;
  position: relative;
  box-shadow: var(--photo-shadow);
  transition: box-shadow .3s;
}
.photo-inner::before {
  content: '';
  display: block;
  padding-top: calc(var(--h, 260) / var(--w, 200) * 100%);
}

.photo-inner img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .55s cubic-bezier(.25,.46,.45,.94), filter .4s;
  filter: grayscale(8%) brightness(.96);
  will-change: transform;
  -webkit-user-drag: none;
}
.photo:hover .photo-inner img {
  transform: scale(1.05);
  filter: grayscale(0%) brightness(1.02);
}
.photo:hover .photo-inner {
  box-shadow: var(--photo-shadow-hi);
}

/* thin inset border */
.photo-inner::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid var(--photo-border);
  pointer-events: none;
  transition: border-color .3s;
}

/* label below each photo */
.photo-label {
  text-align: center;
  margin-top: 7px;
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
  transition: color .3s;
}

/* click pulse */
.photo.clicked .photo-inner { animation: pulse .25s ease-out; }
@keyframes pulse {
  0%  { transform: scale(1); }
  50% { transform: scale(.96); }
  100%{ transform: scale(1); }
}

/* ─── HUD ────────────────────────────────────────── */
.hud {
  position: fixed;
  bottom: 24px;
  left: 28px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 20px;
}
.hud-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--glass-bg-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  transition: var(--theme-transition);
}
.hud-icon { font-size: 13px; }
.hud-coords {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .1em;
  color: var(--muted);
  background: var(--glass-bg-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  font-variant-numeric: tabular-nums;
  transition: var(--theme-transition);
}

/* ─── Minimap ────────────────────────────────────── */
.minimap {
  position: fixed;
  bottom: 24px;
  right: 28px;
  z-index: 100;
  width: 140px;
  height: 80px;
  border: 1px solid var(--glass-border-hi);
  border-radius: 4px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
  transition: var(--theme-transition);
}
.minimap-viewport {
  position: absolute;
  border: 1.5px solid var(--accent);
  border-radius: 2px;
  background: rgba(192,57,43,.08);
  pointer-events: none;
}

/* ─── Lightbox ───────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, visibility .35s ease;
}
.lightbox.open { opacity: 1; visibility: visible; }

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10,9,8,.94);
  backdrop-filter: blur(5px);
  cursor: zoom-out;
}

.lightbox-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-img-wrap {
  max-width: 84vw;
  max-height: 82vh;
  line-height: 0;
}
.lightbox-img {
  will-change: transform, opacity;
  display: block;
  max-width: 84vw;
  max-height: 80vh;
  object-fit: contain;
  transform: scale(.93);
  opacity: 0;
  transition: transform .4s cubic-bezier(.25,.46,.45,.94), opacity .35s ease;
}
.lightbox.open .lightbox-img {
  transform: scale(1);
  opacity: 1;
  transition-delay: 0.06s;
}

.lightbox-meta {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.lightbox-index {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .18em;
  color: rgba(255,255,255,.32);
}
.lightbox-sep { color: rgba(255,255,255,.18); font-size: 12px; }
.lightbox-caption {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(255,255,255,.65);
}

.lightbox-close {
  position: fixed;
  top: 24px; right: 32px;
  z-index: 210;
  background: none;
  border: none;
  color: rgba(255,255,255,.4);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  transition: color .2s, transform .25s;
}
.lightbox-close:hover { color: #fff; transform: rotate(90deg); }

.lightbox-nav {
  position: fixed;
  top: 50%; transform: translateY(-50%);
  z-index: 210;
  background: none;
  border: none;
  color: rgba(255,255,255,.32);
  font-size: 22px;
  cursor: pointer;
  padding: 16px 22px;
  transition: color .2s, transform .2s;
}
.lightbox-nav:hover { color: #fff; }
.lightbox-nav.prev { left: 20px; }
.lightbox-nav.prev:hover { transform: translateY(-50%) translateX(-4px); }
.lightbox-nav.next { right: 20px; }
.lightbox-nav.next:hover { transform: translateY(-50%) translateX(4px); }

/* ─── Grain overlay ──────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: .03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
}

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 640px) {
  /* Header */
  .header        { padding: 0 16px; gap: 0; }
  .header-logo svg { height: 9.66px; }
  .header-nav    { display: none; }
  .header-right  { gap: 10px; margin-left: auto; }
  .hamburger     { display: flex; }
  .mobile-nav    { display: flex; }
  .zoom-btn      { display: none; }
  .zoom-level    { display: none; }
  .header-divider{ display: none; }

  /* Map */
  .minimap { display: none; }

  /* HUD */
  .hud         { bottom: 16px; left: 16px; gap: 10px; }
  .hud-hint    { display: none; }
  .hud-coords  { font-size: 9px; padding: 4px 9px; }

  /* Lightbox */
  .lightbox-img-wrap { max-width: 100vw; max-height: 78vh; }
  .lightbox-img      { max-width: 100vw; max-height: 76vh; }
  .lightbox-nav      { padding: 14px 12px; font-size: 20px; }
  .lightbox-nav.prev { left: 0; }
  .lightbox-nav.next { right: 0; }
  .lightbox-nav.prev:hover { transform: translateY(-50%); }
  .lightbox-nav.next:hover { transform: translateY(-50%); }
  .lightbox-close    { top: 16px; right: 16px; font-size: 24px; }
  .lightbox-meta     { margin-top: 10px; gap: 8px; }
  .lightbox-caption  { font-size: 11px; }
}

/* ─────────────────────────────────────────────────
   About modal — macOS window
───────────────────────────────────────────────── */
.about-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 600;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .3s ease;
}
.about-modal.open {
  display: flex;
  opacity: 1;
}
.about-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.about-window {
  position: relative;
  width: min(540px, calc(100vw - 40px));
  background: #1c1c1e;
  border-radius: 12px;
  box-shadow: 0 32px 80px rgba(0,0,0,.7), 0 0 0 .5px rgba(255,255,255,.08);
  overflow: hidden;
  transform: scale(.95) translateY(8px);
  transition: transform .3s ease;
}
.about-modal.open .about-window {
  transform: scale(1) translateY(0);
}
.about-titlebar {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 44px;
  background: #2a2a2c;
  border-bottom: 1px solid rgba(255,255,255,.06);
  user-select: none;
}
.about-dots {
  position: absolute;
  left: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.about-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: filter .15s;
}
.about-dot:hover { filter: brightness(1.2); }
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #ffbd2e; }
.dot-green  { background: #28c840; }
.about-window-title {
  font-size: 12px;
  color: rgba(255,255,255,.4);
  letter-spacing: .04em;
}
.about-body {
  padding: 36px 40px 40px;
  text-align: center;
}
.about-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 20px;
  letter-spacing: .02em;
}
.about-bio {
  font-size: 14px;
  line-height: 1.75;
  color: rgba(255,255,255,.55);
  margin: 0 0 14px;
}
.about-contact {
  margin-top: 28px;
}
.about-contact a {
  font-size: 13px;
  color: rgba(255,255,255,.35);
  text-decoration: none;
  letter-spacing: .04em;
  transition: color .2s;
}
.about-contact a:hover { color: rgba(255,255,255,.7); }

[data-theme="light"] .about-window   { background: #f5f5f7; box-shadow: 0 32px 80px rgba(0,0,0,.25), 0 0 0 .5px rgba(0,0,0,.08); }
[data-theme="light"] .about-titlebar { background: #e8e8ea; border-bottom-color: rgba(0,0,0,.06); }
[data-theme="light"] .about-window-title { color: rgba(0,0,0,.35); }
[data-theme="light"] .about-bio     { color: rgba(0,0,0,.5); }
[data-theme="light"] .about-contact a { color: rgba(0,0,0,.35); }
[data-theme="light"] .about-contact a:hover { color: rgba(0,0,0,.7); }

@media (max-width: 640px) {
  .about-window {
    width: calc(100% - 40px);
    border-radius: 16px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(.96) translateY(8px);
  }
  .about-modal.open .about-window { transform: scale(1) translateY(0); }
  .about-body   { padding: 36px 32px 48px; text-align: left; }
  .about-name   { font-size: 17px; margin-bottom: 16px; }
  .about-bio    { font-size: 14px; margin-bottom: 12px; }
  .about-contact { margin-top: 20px; }
}
