/* Collage site renderer styles.
   Layout idea: a free-position design canvas (1024 wide on desktop, 320 on phone)
   scaled to the window. Everything inside .stage is in design pixels. */
:root {
  --s: 1;
  --bubble: #FFE45C;
  --ink: #111111;
  --paper: #ffffff;
  --chrome-bg: #F2F2F2;
  --caption: #8b8680;
  --panel: #ffffff;
  --shade: rgba(20, 16, 10, 0.72);
  --font-ui: "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: Georgia, "Times New Roman", serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); font-family: var(--font-ui); }
body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: var(--cursor), auto; }

#viewport { position: fixed; inset: 0; overflow: hidden; background: var(--paper); }
#app { position: absolute; inset: 0; overflow-x: hidden; overflow-y: auto; outline: none; overscroll-behavior: none; -webkit-overflow-scrolling: touch; }
#app.mode-world { scrollbar-width: none; }
#app.mode-world::-webkit-scrollbar { display: none; }
.page { position: relative; width: 100%; overflow: clip; animation: page-in 0.22s ease-out; }
@keyframes page-in { from { opacity: 0.2; } to { opacity: 1; } }
.pin { position: sticky; top: 0; width: 100%; overflow: hidden; }
.pin.strip { overflow-x: auto; overflow-y: hidden; }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.phone-bg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; }

/* ---------- layers ---------- */
.layer { position: absolute; left: 0; top: 0; transform-origin: 50% 50%; }
.layer .idle, .layer .inner { display: block; width: 100%; height: 100%; }
.layer .inner { position: relative; color: inherit; text-decoration: none; background: none; border: 0; padding: 0; margin: 0; font: inherit; text-align: inherit; transition: transform 0.15s ease-out; -webkit-tap-highlight-color: transparent; }
.layer a.inner, .layer button.inner { cursor: pointer; }
body.has-cursor .layer a.inner, body.has-cursor .layer button.inner { cursor: var(--cursor), pointer; }
.layer img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.layer.has-h img, .layer.has-h canvas { height: 100%; }
.layer canvas { display: block; width: 100%; height: auto; }
.layer.plane-backdrop { pointer-events: none; }
.layer .inner:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

.layer.hover-scale .inner:hover { transform: scale(1.06); }
.layer.hover-wiggle .inner:hover { animation: wiggle 0.5s ease-in-out; }
.layer.hover-outline .inner:hover { filter: drop-shadow(0 0 0 var(--ink)) drop-shadow(2px 2px 0 var(--ink)) drop-shadow(-2px -2px 0 var(--ink)); }
.layer.hover-lift .inner:hover { transform: translateY(-8px) rotate(-2deg); }

/* phones: tappable cut-outs carry an outline so people know what to tap */
[data-bp="phone"] .layer.is-link.kind-image .inner {
  filter: drop-shadow(1.5px 0 0 var(--ink)) drop-shadow(-1.5px 0 0 var(--ink)) drop-shadow(0 1.5px 0 var(--ink)) drop-shadow(0 -1.5px 0 var(--ink));
}

/* ---------- idle animations ---------- */
.idle-float  { animation: float 5s ease-in-out infinite alternate; }
.idle-sway   { animation: sway 4.5s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.idle-spin   { animation: spin 40s linear infinite; }
.idle-bounce { animation: bounce 1.1s cubic-bezier(.3,0,.7,1) infinite alternate; }
.idle-wiggle { animation: wiggle 1.6s ease-in-out infinite; }
.idle-pulse  { animation: pulse 2.2s ease-in-out infinite alternate; }
.idle { animation-delay: var(--idle-delay, 0s) !important; }
@keyframes float  { from { transform: translateY(6px); } to { transform: translateY(-8px); } }
@keyframes sway   { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-16px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
@keyframes pulse  { from { transform: scale(0.96); } to { transform: scale(1.07); } }

/* ---------- speech bubbles ---------- */
.bubble {
  position: relative; display: block; width: 100%;
  background: var(--bubble); color: var(--ink);
  font: 700 15px/1.2 var(--font-ui); text-transform: uppercase; letter-spacing: 0.01em;
  padding: 9px 13px 10px; border-radius: 13px; border: 1.5px solid var(--ink);
  white-space: pre-line; overflow-wrap: break-word;
}
.bubble.style-white { background: #fff; }
.bubble::before, .bubble::after { content: ""; position: absolute; width: 20px; height: 18px; }
.bubble::before { background: var(--ink); }
.bubble::after { background: var(--bubble); }
.bubble.style-white::after { background: #fff; }
.bubble.tail-none::before, .bubble.tail-none::after { display: none; }
.bubble.tail-bottom-left::before  { left: 20px; bottom: -17px; clip-path: polygon(0 0, 100% 0, 10% 100%); }
.bubble.tail-bottom-left::after   { left: 22px; bottom: -13px; clip-path: polygon(0 0, 100% 0, 10% 100%); width: 17px; height: 15px; }
.bubble.tail-bottom-right::before { right: 20px; bottom: -17px; clip-path: polygon(0 0, 100% 0, 90% 100%); }
.bubble.tail-bottom-right::after  { right: 22px; bottom: -13px; clip-path: polygon(0 0, 100% 0, 90% 100%); width: 17px; height: 15px; }
.bubble.tail-top-left::before     { left: 20px; top: -17px; clip-path: polygon(0 100%, 100% 100%, 10% 0); }
.bubble.tail-top-left::after      { left: 22px; top: -13px; clip-path: polygon(0 100%, 100% 100%, 10% 0); width: 17px; height: 15px; }
.bubble.tail-top-right::before    { right: 20px; top: -17px; clip-path: polygon(0 100%, 100% 100%, 90% 0); }
.bubble.tail-top-right::after     { right: 22px; top: -13px; clip-path: polygon(0 100%, 100% 100%, 90% 0); width: 17px; height: 15px; }
.bubble.tail-left::before         { left: -17px; top: 12px; width: 18px; height: 20px; clip-path: polygon(100% 0, 100% 100%, 0 80%); }
.bubble.tail-left::after          { left: -13px; top: 14px; width: 15px; height: 17px; clip-path: polygon(100% 0, 100% 100%, 0 80%); }
.bubble.tail-right::before        { right: -17px; top: 12px; width: 18px; height: 20px; clip-path: polygon(0 0, 0 100%, 100% 80%); }
.bubble.tail-right::after         { right: -13px; top: 14px; width: 15px; height: 17px; clip-path: polygon(0 0, 0 100%, 100% 80%); }

/* ---------- text ---------- */
.text { white-space: pre-line; overflow-wrap: break-word; }
.text.t-h1 { font: 600 76px/1 var(--font-display); text-wrap: balance; }
.text.t-h2 { font: italic 600 44px/1.05 var(--font-display); text-wrap: balance; }
.text.t-lead { font: 500 24px/1.25 var(--font-display); }
.text.t-body { font: 400 17px/1.5 var(--font-body); }
.text.t-caption { font: italic 400 13px/1.4 var(--font-body); color: var(--caption); }
.text.t-tag { display: inline-block; width: auto; white-space: pre; background: var(--ink); color: var(--paper); font: 800 17px/1.15 var(--font-ui); text-transform: uppercase; letter-spacing: 0.03em; padding: 3px 8px 4px; }
a.inner:hover .text.t-tag { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }

/* ---------- info pins (hotspots) ---------- */
.hs-pin {
  display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 50%;
  background: #fff; color: #222; border: 0; padding: 0; cursor: pointer;
  font: italic 700 16px/1 var(--font-body); box-shadow: 0 1px 6px rgba(0,0,0,0.35);
  transition: transform 0.15s ease-out; animation: pin-pulse 4s ease-in-out infinite;
}
body.has-cursor .hs-pin { cursor: var(--cursor), pointer; }
.hs-pin:hover, .layer.open .hs-pin { transform: scale(1.15); }
.hs-pin:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
@keyframes pin-pulse { 0%, 88%, 100% { box-shadow: 0 1px 6px rgba(0,0,0,0.35); } 94% { box-shadow: 0 0 0 7px rgba(255,255,255,0.55), 0 1px 6px rgba(0,0,0,0.35); } }
.layer.open { z-index: 900; }
.hs-panel {
  position: absolute; top: -12px; left: calc(100% + 10px); width: 240px;
  background: var(--panel); color: var(--ink); border-radius: 8px; padding: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.28); font: italic 400 14px/1.4 var(--font-body);
  animation: pop 0.16s ease-out;
}
.hs-panel.side-left { left: auto; right: calc(100% + 10px); }
.hs-panel img { display: block; width: 100%; height: auto; border-radius: 4px; }
.hs-panel p { margin: 6px 4px 2px; }
@keyframes pop { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }

/* ---------- overlays: lightbox and phone info sheet ---------- */
.overlay { position: absolute; inset: 0; z-index: 80; display: grid; place-items: center; background: var(--shade); padding: 24px; animation: page-in 0.18s ease-out; }
.overlay[hidden] { display: none; }
.overlay figure { margin: 0; max-width: min(92%, 900px); max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.overlay figure img { height: 74vh; width: auto; max-width: 100%; object-fit: contain; display: block; }
.overlay figcaption { color: #fff; font: italic 400 16px/1.4 var(--font-body); text-align: center; }
.overlay .sheet { background: var(--panel); border-radius: 12px; padding: 12px; width: min(320px, 100%); font: italic 400 16px/1.4 var(--font-body); box-shadow: 0 10px 40px rgba(0,0,0,0.4); }
.overlay .sheet img { width: 100%; height: auto; display: block; border-radius: 6px; }
.overlay .sheet p { margin: 8px 4px 4px; }
.overlay .close { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; color: #111; font: 700 20px/1 var(--font-ui); cursor: pointer; }

/* ---------- fixed chrome ---------- */
.chrome { position: absolute; inset: 0; z-index: 50; pointer-events: none; --u: calc(var(--s) * 1px); }
.chrome > * { pointer-events: auto; position: absolute; }
.c-menu { left: calc(48 * var(--u)); top: calc(38 * var(--u)); width: calc(33 * var(--u)); height: calc(28 * var(--u)); display: flex; flex-direction: column; justify-content: space-between; padding: 0; background: none; border: 0; }
.c-menu span { display: block; height: 22%; border-radius: 99px; background: var(--ink); box-shadow: 0 0 0 calc(1.2 * var(--u)) rgba(255,255,255,0.55); }
.c-home { right: calc(48 * var(--u)); top: calc(38 * var(--u)); width: calc(36 * var(--u)); height: calc(36 * var(--u)); background: var(--bubble); display: grid; place-items: center; }
.c-home svg { width: 62%; height: 62%; fill: var(--ink); }
.c-btn { right: calc(98 * var(--u)); top: calc(40 * var(--u)); height: calc(30 * var(--u)); min-width: calc(92 * var(--u)); padding: 0 calc(14 * var(--u)); border-radius: calc(4 * var(--u)); background: var(--chrome-bg); color: var(--ink); text-decoration: none; display: grid; place-items: center; font: 400 calc(15 * var(--u))/1 var(--font-ui); }
.c-menu:hover, .c-home:hover, .c-btn:hover { transform: scale(1.06); }
.c-menu, .c-home, .c-btn { transition: transform 0.15s ease-out; }
.chrome a:focus-visible, .chrome button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
[data-bp="phone"] .c-menu { left: calc(8 * var(--u)); top: calc(9 * var(--u)); width: calc(34 * var(--u)); height: calc(27 * var(--u)); }
[data-bp="phone"] .c-home { right: calc(7 * var(--u)); top: calc(7 * var(--u)); width: calc(38 * var(--u)); height: calc(38 * var(--u)); }
[data-bp="phone"] .c-btn { right: calc(51 * var(--u)); top: calc(9 * var(--u)); height: calc(30 * var(--u)); min-width: calc(86 * var(--u)); font-size: calc(17 * var(--u)); }

.c-music { left: 0; bottom: 0; display: flex; align-items: flex-end; gap: 8px; padding: 10px; }
.c-music button { width: 46px; height: 46px; border-radius: 50%; border: 0; background: #FF5100; color: #fff; font-size: 18px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.c-music .label { background: var(--chrome-bg); color: var(--ink); font: 700 11px/1 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; padding: 6px 8px; border-radius: 3px; margin-bottom: 14px; }
.c-music iframe { border: 0; width: min(300px, 70vw); height: 120px; background: #fff; border-radius: 6px; box-shadow: 0 4px 18px rgba(0,0,0,0.3); }

.c-edit { right: 12px; bottom: 12px; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); font-size: 18px; cursor: pointer; opacity: 0.75; display: grid; place-items: center; padding: 0; }
.c-edit:hover { opacity: 1; transform: scale(1.08); }
.c-edit svg { width: 20px; height: 20px; }
[data-bp="phone"] .c-edit { display: none; }

.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .idle, .hs-pin, .page, .overlay, .hs-panel { animation: none !important; }
  .layer .inner { transition: none; }
}

[hidden] { display: none !important; }
