@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('vendor/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('vendor/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('vendor/fonts/playfair-display-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('vendor/fonts/playfair-display-latin-500-normal.woff2') format('woff2');
}

:root {
  --red: #e6392b;
  --ink: #111;
  --paper: #fdfdfb;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --serif: 'Playfair Display', Georgia, serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  cursor: crosshair;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- preloader ---------- */
.preloader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
}
.preloader__dots span {
  display: inline-block;
  width: 12px; height: 18px;
  background: var(--red);
  margin: 0 7px;
  animation: dotblink 0.7s infinite alternate;
}
.preloader__dots span:nth-child(2) { animation-delay: 0.18s; }
.preloader__dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes dotblink { from { opacity: 1; } to { opacity: 0.15; } }

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; justify-content: space-between; align-items: center;
  padding: 26px 40px;
  font-size: 15px; letter-spacing: 0.14em;
}
.nav__link {
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
}
.nav__link--active { border-bottom: 2px solid var(--ink); }
.nav__link::after {
  content: ''; position: absolute; left: 0; bottom: 0;
  width: 0; height: 2px; background: var(--red);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav__link:hover::after { width: 100%; }

/* ---------- scattered letters ---------- */
.letters { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.letter {
  position: absolute; top: 0; left: 0;
  will-change: transform;
}
.letter__inner {
  font-family: Helvetica, Arial, sans-serif;
  font-weight: 700;
  color: var(--red);
  line-height: 0.8;
  display: block;
  will-change: transform;
}
.letter--bit .letter__inner {
  width: 0.55em; height: 1em;
  background: var(--red);
  font-size: inherit;
}

/* ---------- plaque ---------- */
.plaque {
  position: fixed; z-index: 10;
  left: 50%; top: 50%;
  width: 300px; height: 420px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.plaque__frame { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.plaque__outline {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
  stroke-dasharray: 5 5;
  vector-effect: non-scaling-stroke;
}
.plaque__handles { position: absolute; inset: 0; }
.handle {
  position: absolute;
  width: 9px; height: 9px;
  background: var(--ink);
  transform: translate(-50%, -50%);
  transition: opacity 0.3s;
}
.handle--hollow { background: var(--paper); border: 1px solid var(--ink); }
.plaque__content {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 26px;
  text-align: center;
}
.plaque__numeral {
  font-family: var(--serif);
  font-size: 110px;
  line-height: 1;
  color: var(--ink);
  -webkit-text-stroke: 1.4px var(--ink);
  -webkit-text-fill-color: transparent;
}
.plaque__caption {
  font-family: var(--serif);
  font-size: 27px;
  letter-spacing: 0.04em;
  line-height: 1.25;
}

/* ---------- chapters ---------- */
.chapter {
  position: fixed; inset: 0; z-index: 20;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}
.chapter.is-active { pointer-events: auto; }
.chapter__mono {
  position: absolute; left: 50%;
  transform: translateX(-50%);
  width: min(760px, 84vw);
  text-align: center;
  font-size: 19px;
  line-height: 1.6;
  letter-spacing: 0.1em;
  white-space: pre-wrap;
}
.chapter__mono--top { top: 14vh; }
.chapter__mono--mid { top: 42vh; }
.chapter__mono--bottom { bottom: 16vh; }

.chapter__quote {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -46%);
  width: min(980px, 90vw);
  font-family: var(--serif);
  font-size: clamp(34px, 5.4vw, 64px);
  line-height: 1.14;
  text-align: center;
}

/* placeholder blocks instead of images */
.chapter__blocks {
  position: absolute; left: 50%; top: 54%;
  transform: translate(-50%, -50%);
  display: flex; gap: 28px; align-items: center;
}
.chapter__blocks--grid { top: 56%; }
.ph-block {
  background: #e9e7e2;
  border: 1px dashed #b9b6af;
  width: 240px; height: 170px;
  position: relative;
  display: flex; align-items: flex-end;
}
.ph-block--tall { width: 210px; height: 280px; }
.ph-block--wide { width: 330px; height: 200px; }
.ph-block__tag {
  font-size: 12px; letter-spacing: 0.16em;
  padding: 8px 10px;
  color: #6d6a63;
}

/* contacts */
.chapter__contacts {
  position: absolute; left: 50%; bottom: 12vh;
  transform: translateX(-50%);
  width: min(1000px, 88vw);
  display: flex; justify-content: space-between; gap: 60px;
}
.contact { width: 46%; text-align: center; }
.contact__head { font-size: 17px; letter-spacing: 0.12em; margin-bottom: 18px; }
.contact__body {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 19px; line-height: 1.45;
}

/* ---------- sound + progress ---------- */
.sound {
  position: fixed; left: 50%; bottom: 22px; z-index: 40;
  transform: translateX(-50%);
  background: none; border: none; color: var(--ink);
  cursor: pointer; padding: 6px;
}
.sound:hover { color: var(--red); }

.progress {
  position: fixed; right: 26px; top: 50%; z-index: 40;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 10px;
}
.progress__dot {
  width: 7px; height: 7px;
  border: 1px solid var(--ink);
  background: transparent;
  cursor: pointer;
  transition: background 0.25s, transform 0.25s;
}
.progress__dot.is-on { background: var(--red); border-color: var(--red); transform: scale(1.35); }

/* ---------- popup ---------- */
.popup {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 7vh;
  pointer-events: none;
}
.popup__box {
  pointer-events: auto;
  position: relative;
  width: min(560px, 92vw);
  border: 1px dashed var(--ink);
  background: var(--paper);
  text-align: center;
  padding: 30px 40px 26px;
  font-size: 16px; line-height: 1.5;
}
.popup__close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none;
  font-size: 22px; cursor: pointer; color: var(--ink);
}
.popup__close:hover { color: var(--red); }
.popup__warn { font-family: Helvetica, Arial, sans-serif; font-size: 17px; }
.popup__link {
  display: inline-block;
  margin-top: 14px;
  letter-spacing: 0.12em;
  text-underline-offset: 4px;
}
.popup__link:hover { color: var(--red); }
.popup__divider { border-top: 1px dashed var(--ink); margin: 22px -40px; }
.popup__cookie { font-family: Helvetica, Arial, sans-serif; font-size: 16px; }

/* flash overlay on chapter switch */
.flash {
  position: fixed; inset: 0; z-index: 60;
  background: var(--red);
  opacity: 0; pointer-events: none;
}

@media (max-width: 720px) {
  .nav { padding: 18px 20px; font-size: 13px; }
  .plaque { width: 220px; height: 320px; }
  .plaque__numeral { font-size: 74px; }
  .plaque__caption { font-size: 20px; }
  .chapter__mono { font-size: 14px; }
  .chapter__blocks { flex-direction: column; }
  .chapter__contacts { flex-direction: column; gap: 30px; bottom: 9vh; }
  .contact { width: 100%; }
  .progress { right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .preloader__dots span { animation: none; }
}
