* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; background: #000; color: #fff; }
body { font-family: "Cormorant Garamond", Georgia, serif; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#gl.drag { cursor: grabbing; }
#gl.hover { cursor: pointer; }

#grain {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; opacity: .06; mix-blend-mode: screen;
}

.title {
  position: fixed; left: clamp(16px, 3vw, 40px); top: clamp(14px, 3.5vh, 36px);
  display: flex; align-items: center; gap: 0 18px; flex-wrap: wrap;
  pointer-events: none; mix-blend-mode: difference;
}
.title h1 {
  font-family: "Playfair Display", Georgia, serif; font-weight: 600;
  font-size: clamp(26px, 3.6vw, 52px); letter-spacing: .01em; line-height: 1; white-space: nowrap;
}
.title p { font-size: clamp(13px, 1.2vw, 17px); letter-spacing: .08em; opacity: .75; }

.counter {
  position: fixed; left: clamp(16px, 3vw, 40px); bottom: 14px; font-size: 14px; letter-spacing: .15em;
  mix-blend-mode: difference; pointer-events: none; font-variant-numeric: tabular-nums;
}
.loader {
  position: fixed; left: 24px; bottom: 20px; font-size: 12px; letter-spacing: .2em;
  transition: opacity .6s;
}
.loader.done { opacity: 0; }

.title, .counter { transition: opacity .5s; }
.source {
  position: fixed; right: clamp(16px, 3vw, 40px); bottom: 14px;
  font-size: 13px; font-style: italic; letter-spacing: .04em; opacity: .55; white-space: nowrap; transition: opacity .5s;
}
.source a { color: inherit; }
body.zoomed .title, body.zoomed .source { opacity: 0; }

.arrow {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 56px; height: 56px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.35); color: #fff; font: 24px/1 "Cormorant Garamond", Georgia, serif;
  cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .4s, background .2s;
}
.arrow:hover { background: rgba(255,255,255,.15); }
.arrow-prev { left: clamp(12px, 3vw, 40px); }
.arrow-next { right: clamp(12px, 3vw, 40px); }
body.zoomed .arrow { opacity: 1; pointer-events: auto; transition-delay: .3s; }

.credit {
  position: fixed; left: 50%; bottom: 3vh; transform: translateX(-50%);
  font-size: 12px; letter-spacing: .15em; opacity: 0; pointer-events: none; transition: opacity .4s;
}
body.zoomed .credit { opacity: .6; transition-delay: .4s; }
body.zoomed #gl { cursor: zoom-out; }

/* ---------- settings ---------- */
.settings { position: fixed; top: 16px; right: 16px; z-index: 10; font-size: 12px; }
.settings button {
  font: inherit; color: #fff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
  border-radius: 6px; padding: 6px 10px; cursor: pointer;
}
.settings button:hover { background: rgba(255,255,255,.18); }
.settings-toggle { float: right; width: 34px; height: 34px; padding: 0 !important; font-size: 16px !important; }
.settings-panel {
  display: none; clear: both; margin-top: 8px; width: min(320px, calc(100vw - 32px));
  max-height: calc(100vh - 80px); overflow-y: auto; padding: 16px;
  background: rgba(12,12,12,.92); border: 1px solid rgba(255,255,255,.12); border-radius: 10px;
  backdrop-filter: blur(8px);
}
.settings.open .settings-panel { display: block; }
.settings h2 { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; margin-bottom: 8px; }
.settings h3 { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; opacity: .5; margin: 14px 0 6px; font-weight: 600; }
.settings .row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin-bottom: 8px; }
.settings .row output { opacity: .6; font-variant-numeric: tabular-nums; }
.settings .row input { grid-column: 1 / -1; width: 100%; accent-color: #fff; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.settings .hint { margin-top: 10px; opacity: .45; line-height: 1.4; }
