/* Latent Lattice — No external requests. */
@font-face {
  font-family: "Cormorant Garamond";
  src: url("../assets/fonts/cormorant-garamond.woff") format("woff");
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("../assets/fonts/cormorant-garamond-italic.woff") format("woff");
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --black: #000000;
  --ink: #0a0908;
  --gold: #d4af5a;
  --gold-soft: #e8d5a3;
  --gold-dim: #8a6d32;
  --gold-glow: rgba(212, 175, 90, 0.45);
  --serif: "Cormorant Garamond", "Palatino Linotype", Palatino, "Book Antiqua",
    "Hoefler Text", Georgia, "Times New Roman", serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--black);
  color: var(--gold-soft);
  font-family: var(--serif);
  min-height: 100%;
}

img { max-width: 100%; height: auto; }

a {
  color: var(--gold);
  text-decoration-color: rgba(212, 175, 90, 0.4);
  text-underline-offset: 0.18em;
}
a:hover { color: var(--gold-soft); }
a:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 100;
  background: var(--black);
  color: var(--gold-soft);
  padding: 0.3rem 0.6rem;
}
.skip:focus { top: 12px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Stage (entrance + room) ---------- */
.viewport {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--black);
  overflow: hidden;
  position: relative;
}

.stage {
  position: relative;
  width: min(100vw, calc(100dvh * 16 / 9));
  height: min(100dvh, calc(100vw * 9 / 16));
  background: var(--black);
  overflow: hidden;
  isolation: isolate;
}

.stage picture,
.stage picture img,
.stage > img.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.stage picture img,
.stage > img.scene {
  object-fit: cover;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.stage .shimmer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Tagline under the painted "latent lattice" title (title sits ~8–11.2% down). */
.tagline {
  position: absolute;
  left: 50%;
  top: 12.8%;
  transform: translateX(-50%);
  z-index: 4;
  margin: 0;
  width: min(78%, 40rem);
  text-align: center;
  font-family: var(--serif);
  font-size: clamp(0.68rem, 1.45vw, 1.02rem);
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 1.4;
  color: var(--gold-soft);
  opacity: 0.58;
  pointer-events: none;
  text-wrap: balance;
}
.tag-break { display: none; }


/* Hotspots are placed by center + size, so they stay aligned as the 16:9 stage scales. */
.hotspot {
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  width: var(--w);
  height: var(--h);
  transform: translate(-50%, -50%);
  z-index: 3;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  border-radius: 6px;
  -webkit-tap-highlight-color: transparent;
}

.hotspot.passage { border-radius: 50%; }
.hotspot.sofa { border-radius: 10px; z-index: 5; }
.hotspot.bookcase { z-index: 4; }
.hotspot.soon { cursor: default; z-index: 3; }

@media (pointer: coarse) {
  .hotspot {
    width: max(2.75rem, var(--w));
    height: max(2.75rem, var(--h));
  }
}

.hotspot .glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: none;
  background: transparent;
  transition: box-shadow 0.35s ease, background 0.35s ease;
  pointer-events: none;
}

/* A faint standing glow on the lit doors, plus a single pulse on load. */
.hotspot.door .glow {
  box-shadow: 0 0 12px 3px rgba(212, 175, 90, 0.14);
  animation: doorPulse 2.6s ease-out 0.45s 1 both;
}

@keyframes doorPulse {
  0% {
    box-shadow: 0 0 12px 3px rgba(212, 175, 90, 0.14);
    background: transparent;
  }
  40% {
    box-shadow:
      0 0 22px 6px rgba(212, 175, 90, 0.5),
      0 0 40px 10px rgba(212, 175, 90, 0.22),
      inset 0 0 16px rgba(212, 175, 90, 0.2);
    background: rgba(212, 175, 90, 0.07);
  }
  100% {
    box-shadow: 0 0 12px 3px rgba(212, 175, 90, 0.14);
    background: transparent;
  }
}

.hotspot.door:hover .glow,
.hotspot.door:focus-visible .glow,
.hotspot.link:hover .glow,
.hotspot.link:focus-visible .glow {
  animation: none;
  box-shadow:
    0 0 18px 5px var(--gold-glow),
    0 0 36px 8px rgba(212, 175, 90, 0.2),
    inset 0 0 18px rgba(212, 175, 90, 0.18);
  background: rgba(212, 175, 90, 0.06);
}

.hotspot.soon:hover .glow,
.hotspot.soon:focus-visible .glow {
  box-shadow: 0 0 14px 3px rgba(212, 175, 90, 0.22);
  background: rgba(212, 175, 90, 0.04);
}

.hotspot:focus { outline: none; }
.hotspot:focus-visible .glow {
  outline: 1px solid var(--gold);
  outline-offset: 2px;
}

/* Faint pulsing node on clickable furniture. */
.hotspot.link .node {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 0.42rem;
  height: 0.42rem;
  margin: -0.21rem 0 0 -0.21rem;
  border-radius: 50%;
  background: var(--gold-soft);
  box-shadow: 0 0 8px 3px rgba(212, 175, 90, 0.5);
  pointer-events: none;
  z-index: 5;
  animation: nodePulse 2.8s ease-in-out infinite;
}
.hotspot.passage .node { top: 48%; }
.hotspot.sofa .node { top: 38%; left: 52%; }
.hotspot.bookcase .node { top: 16%; }

@keyframes nodePulse {
  0%, 100% {
    transform: scale(0.85);
    opacity: 0.5;
    box-shadow: 0 0 5px 2px rgba(212, 175, 90, 0.3);
  }
  50% {
    transform: scale(1.2);
    opacity: 0.95;
    box-shadow: 0 0 12px 5px rgba(212, 175, 90, 0.55);
  }
}

.hotspot .label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.45rem);
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: clamp(0.72rem, 1.45vw, 0.95rem);
  font-weight: 500;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: lowercase;
  color: var(--gold-soft);
  background: rgba(0, 0, 0, 0.62);
  padding: 0.18rem 0.5rem 0.22rem;
  border: 1px solid rgba(212, 175, 90, 0.28);
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 6;
}

.hotspot:hover .label,
.hotspot:focus-visible .label,
.hotspot.is-labeled .label {
  opacity: 1;
}

/* Passage label sits below the arch so it isn't clipped. Bookcase label sits above, clear of the sofa. */
.hotspot.passage .label {
  bottom: auto;
  top: calc(100% + 0.4rem);
}
.hotspot.bookcase .label {
  bottom: calc(100% + 0.4rem);
  top: auto;
}

/* Wide, non-touch viewports: clickable labels fade in for ~3s, then hide until hover/focus.
   (Do not key this off hover:none — headless and some environments report that even on a wide window.) */
@media (min-width: 701px) and (not (pointer: coarse)) {
  .hotspot.link .label {
    animation: introLabel 3.2s ease 0.35s 1 both;
  }
  html.will-arrive .hotspot.link .label {
    animation-delay: 0.85s;
  }
  .hotspot.link:hover .label,
  .hotspot.link:focus-visible .label {
    animation: none;
    opacity: 1;
  }
}

@keyframes introLabel {
  0%   { opacity: 0; }
  18%  { opacity: 1; }
  72%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Shared pin for letterbox-or-bottom chrome. */
.back-out,
.room-nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(1.15rem, calc((100dvh - min(100dvh, 100vw * 9 / 16)) / 2 - 2.35rem));
  z-index: 8;
}

.back-out {
  color: var(--gold-soft);
  font-size: clamp(0.85rem, 1.6vw, 1.05rem);
  letter-spacing: 0.14em;
  text-transform: lowercase;
  text-decoration: none;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.28rem 0.8rem 0.34rem;
  border: 1px solid rgba(212, 175, 90, 0.28);
  border-radius: 2px;
}
.back-out:hover { color: var(--gold); border-color: var(--gold); }

/* Touch / narrow: permanent small labels + a text nav in the letterbox. */
.room-nav {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.15rem 0.35rem;
  width: min(96vw, 26rem);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  color: var(--gold-dim);
  line-height: 1.3;
}
.room-nav a {
  color: var(--gold-soft);
  text-decoration: none;
  padding: 0.28rem 0.2rem;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
}
.room-nav a:hover,
.room-nav a:focus-visible {
  color: var(--gold);
  border-bottom-color: rgba(212, 175, 90, 0.5);
}
.room-nav .dot { opacity: 0.7; }

@media (pointer: coarse), (max-width: 700px) {
  .hotspot.link .label,
  .hotspot.door .label {
    opacity: 1;
    animation: none;
  }
  .room-nav { display: flex; }
  .back-out { display: none; }
}

/* Frozen mid-intro / mid-pulse state, used only for documentation screenshots (?shot=1). */
html.shot .hotspot.door .glow {
  animation: none;
  box-shadow:
    0 0 22px 6px rgba(212, 175, 90, 0.5),
    0 0 40px 10px rgba(212, 175, 90, 0.22),
    inset 0 0 16px rgba(212, 175, 90, 0.2);
  background: rgba(212, 175, 90, 0.07);
}
html.shot .hotspot.link .label,
html.shot .hotspot.door .label {
  animation: none !important;
  opacity: 1 !important;
}

/* Enter / arrive transitions */
.stage {
  transition: transform 0.7s ease, opacity 0.7s ease, filter 0.7s ease;
}
body.is-entering .stage {
  transform: scale(1.1);
  opacity: 0;
  filter: brightness(1.2);
}
html.will-arrive body .stage {
  animation: arrive 0.8s ease both;
}
@keyframes arrive {
  from { opacity: 0; transform: scale(1.05); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .stage,
  .hotspot .glow,
  .hotspot .label,
  .hotspot.link .node,
  body.is-entering .stage {
    transition: none;
    animation: none;
    filter: none;
  }
  .hotspot { transform: translate(-50%, -50%); }
  .hotspot.door .glow {
    animation: none;
    box-shadow: 0 0 12px 3px rgba(212, 175, 90, 0.2);
  }
  .hotspot.link .node {
    animation: none;
    opacity: 0.75;
  }
  body.is-entering .stage { opacity: 0; transform: none; }
  html.will-arrive body .stage { animation: none; }
}

/* Debug outlines: add ?debug=1 to the URL */
body.debug .hotspot {
  outline: 1px solid rgba(212, 175, 90, 0.85);
  outline-offset: -1px;
  background: rgba(212, 175, 90, 0.12);
}
body.debug .hotspot .label { opacity: 1; animation: none; }

/* ---------- Text pages ---------- */
body.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--black);
  color: var(--gold-soft);
}

.page-nav {
  padding: 1.25rem 1.5rem 0;
}
.page-nav a {
  letter-spacing: 0.1em;
  font-size: 0.95rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(212, 175, 90, 0.35);
  padding-bottom: 0.05rem;
}

.page-main {
  flex: 1;
  width: min(40rem, calc(100% - 2.5rem));
  margin: 2.4rem auto 3rem;
}

.eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  text-transform: lowercase;
  color: var(--gold-dim);
}

.page-main h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.1rem, 6vw, 3.1rem);
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.page-main h2 {
  margin: 2rem 0 0.6rem;
  font-size: 1.45rem;
  font-weight: 500;
  color: var(--gold);
}

.lead {
  font-size: 1.25rem;
  line-height: 1.45;
  margin: 0 0 1.2rem;
  color: var(--gold-soft);
}

.page-main p,
.page-main li {
  font-size: 1.15rem;
  line-height: 1.55;
}

.placeholder-note,
.placeholder {
  border: 1px dashed rgba(212, 175, 90, 0.38);
  background: rgba(212, 175, 90, 0.04);
  padding: 0.8rem 1rem;
  margin: 1.2rem 0;
}
.placeholder-note {
  font-size: 1.05rem;
  color: var(--gold-soft);
}
.placeholder h2 { margin-top: 0; }
.placeholder p:last-child { margin-bottom: 0; }

.links {
  list-style: none;
  margin: 1.4rem 0;
  padding: 0;
}
.links li { margin: 0 0 0.7rem; }
.links a { font-size: 1.2rem; }

.page-foot {
  margin-top: auto;
  padding: 0 1.5rem 1.4rem;
  width: min(40rem, calc(100% - 2.5rem));
  margin-left: auto;
  margin-right: auto;
}
.page-foot p {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  color: var(--gold-dim);
  line-height: 1.45;
}

@media (max-width: 520px) {
  .hotspot .label {
    font-size: 0.66rem;
    letter-spacing: 0.07em;
    line-height: 1.25;
  }
  .hotspot.passage .label {
    white-space: nowrap;
    max-width: none;
  }
  .tagline {
    font-size: 0.66rem;
    width: min(70%, 18rem);
    letter-spacing: 0.03em;
  }
  .tag-break { display: block; }
  .room-nav { font-size: 0.74rem; letter-spacing: 0.08em; }
}


/* ---------- Griff's corner ---------- */
.griff-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--black);
  color: var(--gold-soft);
}

.griff-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--black);
}

.griff-page .stage {
  width: min(100vw, calc(100dvh * 16 / 9));
  height: min(100dvh, calc(100vw * 9 / 16));
  flex-shrink: 0;
}

.stone-line {
  position: absolute;
  left: 50%;
  top: 8.5%;
  transform: translateX(-50%);
  z-index: 4;
  margin: 0;
  width: min(80%, 36rem);
  text-align: center;
  font-family: var(--serif);
  font-size: clamp(0.85rem, 2vw, 1.25rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.4;
  color: var(--gold-soft);
  opacity: 0.72;
  pointer-events: none;
  text-wrap: balance;
}

/* Pin back-out to the stage itself so a scrolling page still has a way out. */
.griff-page .back-out.on-stage {
  position: absolute;
  left: 50%;
  bottom: 3.2%;
  transform: translateX(-50%);
  z-index: 8;
}

.griff-nav {
  display: none;
  position: static;
  transform: none;
  margin: 0.85rem auto 0.2rem;
  bottom: auto;
}

@media (pointer: coarse), (max-width: 700px) {
  .griff-page .back-out.on-stage { display: none; }
  .griff-page .griff-nav { display: flex; }
}

.own-time {
  width: min(36rem, calc(100% - 2.5rem));
  margin: 2.2rem auto 1.2rem;
}

.own-time h2 {
  margin: 0 0 1.1rem;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: var(--gold-dim);
}

.own-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid rgba(212, 175, 90, 0.22);
}

.own-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(212, 175, 90, 0.22);
  font-size: 1.15rem;
}

.own-list a {
  color: var(--gold-soft);
  text-decoration: none;
  border-bottom: 1px solid rgba(212, 175, 90, 0.35);
  padding-bottom: 0.05rem;
}
.own-list a:hover { color: var(--gold); }

.own-list .meta {
  flex-shrink: 0;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: var(--gold-dim);
}

.own-note {
  margin: 1.4rem 0 1.2rem;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--gold-soft);
  opacity: 0.85;
}

.own-back {
  margin: 0 0 0.5rem;
}
.own-back a {
  letter-spacing: 0.12em;
  text-transform: lowercase;
  text-decoration: none;
  border-bottom: 1px solid rgba(212, 175, 90, 0.35);
  font-size: 0.95rem;
}

.griff-page .page-foot {
  width: min(36rem, calc(100% - 2.5rem));
  margin-top: auto;
}

@media (max-width: 520px) {
  .stone-line {
    font-size: 0.78rem;
    width: min(86%, 20rem);
    top: 7.5%;
  }
  .own-time { margin-top: 1.4rem; }
}
