/* ==========================================================================
   Max Cooper III — shared shell for the multi-page "rooms" site.
   Same system as the one-pager: charcoal / off-white / chalk-yellow from
   Max's doodle artwork, Anton + Montserrat, one easing, grain everywhere.
   Each room adds a small <style> of its own on top of this.
   ========================================================================== */

:root {
  --ground: #101013;
  --ground-2: #17171b;
  --ink: #f4f2ec;
  --muted: #a5a29a;
  --line: #26262c;
  --yellow: #e8c63f;
  --yellow-dim: #b7a83e;
  --red: #e04b3b;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --pad: clamp(20px, 5vw, 64px);
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  /* stop Android/Samsung "text booster" from inflating type unpredictably */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Montserrat", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh; /* fallback for browsers without svh */
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }

body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--yellow); color: #101013; }
a { color: inherit; text-decoration: none; }
:where(a, button, input, textarea):focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; border-radius: 2px; }
img { max-width: 100%; height: auto; display: block; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 200; background: var(--yellow); color: #101013; font-weight: 700; padding: 10px 16px; border-radius: 6px; }
.skip:focus { left: 8px; }

/* ---- type ------------------------------------------------------------ */
.sec-h {
  font-family: "Anton", sans-serif;
  font-weight: 400;
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.05;
  margin: 0 0 14px;
  color: var(--ink);
  text-wrap: balance;
  position: relative;
  display: inline-block;
}
.scrawl { position: absolute; left: 0; bottom: -10px; width: min(70%, 210px); height: 12px; overflow: visible; }
.scrawl path { fill: none; stroke: var(--red); stroke-width: 3.4; stroke-linecap: round; stroke-dasharray: 240; stroke-dashoffset: 240; }
.is-in .scrawl path, .sec-h.is-in .scrawl path { animation: scrawl-draw 0.9s var(--ease) 0.25s forwards; }
@keyframes scrawl-draw { to { stroke-dashoffset: 0; } }

/* ---- buttons ---------------------------------------------------------- */
.btn {
  display: inline-block;
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 15px 30px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.3s var(--ease), background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.btn-solid { background: var(--yellow); color: #101013; }
.btn-solid:hover { background: #f3d558; }
.btn-ghost { border-color: #4a4a52; color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--yellow); color: var(--yellow); }

/* ---- reveals ----------------------------------------------------------- */
.rv { opacity: 0; transform: translateY(28px); transition: opacity 0.75s var(--ease), transform 0.75s var(--ease); }
.rv.is-in { opacity: 1; transform: none; }

/* ---- nav ----------------------------------------------------------------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 var(--pad);
  height: 68px;
  transition: background 0.35s ease, box-shadow 0.35s ease;
}
.nav.is-scrolled {
  background: rgba(16, 16, 19, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--line);
}
.nav-mark { font-family: "Anton", sans-serif; font-size: 1.25rem; letter-spacing: 0.04em; color: var(--ink); }
.nav-mark span { color: var(--red); }
.nav-links { display: flex; align-items: center; gap: clamp(16px, 3vw, 34px); }
.nav-links a { font-size: 0.86rem; font-weight: 600; color: var(--ink); position: relative; padding: 4px 0; }
.nav-links a::after {
  content: "";
  position: absolute; left: 0; bottom: -2px;
  width: 100%; height: 2px;
  background: var(--yellow);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.32s var(--ease);
}
.nav-links a:hover::after, .nav-links a.is-here::after { transform: scaleX(1); transform-origin: left center; }
.nav-join {
  background: var(--yellow);
  color: #101013 !important;
  font-weight: 700;
  border-radius: 999px;
  padding: 10px 20px !important;
  transition: background 0.25s ease, transform 0.25s var(--ease);
}
.nav-join::after { display: none; }
.nav-join:hover { background: #f3d558; transform: translateY(-1px); }
.nav-burger { display: none; }
/* social marks beside the name (injected by room.js) */
.nav-social { display: flex; align-items: center; gap: 7px; margin-right: auto; margin-left: 8px; }
.nav-social a { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; opacity: 0.72; transition: opacity 0.2s ease, transform 0.3s var(--ease); }
.nav-social a:hover { opacity: 1; transform: translateY(-2px); }
.nav-social svg { width: 15px; height: 15px; fill: var(--ink); }
/* the full 10-mark row only fits alongside the nav links on wide screens */
@media (max-width: 1420px) and (min-width: 1281px) { .nav-social { gap: 4px; } .nav-social a { width: 26px; height: 26px; } .nav-social svg { width: 13px; height: 13px; } }
@media (max-width: 700px) { .nav-social a.nav-soc-more { display: none; } }
@media (max-width: 480px) { .nav-social { gap: 3px; margin-left: 4px; } .nav-social a { width: 26px; height: 26px; } .nav-social svg { width: 13px; height: 13px; } }

/* ---- footer + piano --------------------------------------------------------- */
.foot { background: var(--ground); margin-top: auto; }
.foot-piano { position: relative; display: flex; height: 78px; border-top: 1px solid var(--line); user-select: none; touch-action: none; }
.foot-piano-label {
  /* a sticky note ON the keys, so the note and the piano arrive together */
  position: absolute; top: 50%; right: var(--pad);
  font-size: 0.78rem; font-weight: 700;
  color: #101013;
  background: var(--yellow);
  padding: 5px 12px 4px;
  border-radius: 3px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  transform: translateY(-50%) rotate(-2deg);
  z-index: 3;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.pk { flex: 1; position: relative; background: var(--ink); border-right: 1px solid #101013; border-radius: 0 0 4px 4px; transition: background 0.35s ease; cursor: pointer; }
.pk.is-down { background: var(--yellow); transition-duration: 0s; }
.pk-black { position: absolute; top: 0; right: -17%; width: 34%; height: 58%; background: #101013; border-radius: 0 0 3px 3px; z-index: 2; cursor: pointer; transition: background 0.35s ease; }
.pk-black.is-down { background: var(--yellow-dim); transition-duration: 0s; }
.foot-inner { padding: clamp(40px, 6vw, 64px) var(--pad) 26px; }
.foot-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(140px, 1fr));
  gap: 36px 40px;
  max-width: 1120px;
  margin: 0 auto;
}
.foot-brand p { color: var(--muted); font-size: 0.86rem; margin: 10px 0 18px; max-width: 30ch; }
.foot-mark { font-family: "Anton", sans-serif; font-size: 1.3rem; letter-spacing: 0.04em; color: var(--ink); }
.foot-mark span { color: var(--red); }
.foot-col h3 {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 4px 0 14px;
}
.foot-links { list-style: none; margin: 0; padding: 0; }
.foot-links li { margin: 0 0 10px; }
.foot-links a { font-size: 0.9rem; color: var(--ink); transition: color 0.2s ease; }
.foot-links a:hover { color: var(--yellow); }
.foot-social { display: flex; gap: 12px; flex-wrap: wrap; }
.foot-social a { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 50%; transition: border-color 0.25s ease, transform 0.3s var(--ease); }
.foot-social a:hover { border-color: var(--yellow); transform: translateY(-3px); }
.foot-social svg { width: 17px; height: 17px; fill: var(--ink); }
.foot-privacy {
  max-width: 1120px;
  margin: 36px auto -22px;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}
.foot-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  align-items: center;
  max-width: 1120px;
  margin: 40px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.foot-bar p { margin: 0; color: #6a6a72; font-size: 0.78rem; }
.foot-bar a { color: var(--muted); }
.foot-bar a:hover { color: var(--yellow); }
.foot-bar span { margin: 0 8px; color: #3a3a42; }
@media (max-width: 900px) { .foot-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); } .foot-brand { grid-column: 1 / -1; } }

/* ---- tape-wipe page transition ------------------------------------------------ */
.tape {
  position: fixed;
  z-index: 300;
  left: -12vw; right: -12vw;
  top: 50%;
  height: 26vh;
  background: var(--yellow);
  transform: translate(120vw, -50%) rotate(-3deg);
  display: flex;
  align-items: center;
  overflow: hidden;
  pointer-events: none;
  will-change: transform;
  contain: layout paint;
}
/* Arrival: an instant CSS-only stand-in for the tape, painted on the very
   first frame of the incoming page (set by an inline <head> script), so the
   wipe is continuous across the navigation — no flash of the new page. The
   real .tape element takes over and this is removed one frame later. */
html.mc-tape-hold::before {
  content: "";
  position: fixed;
  z-index: 301;
  left: -12vw; right: -12vw;
  top: 50%;
  height: 26vh;
  background: var(--yellow);
  transform: translateY(-50%) rotate(-3deg);
  pointer-events: none;
  /* if room.js never runs (blocked/stalled — Samsung strand report
     2026-07-08) the stand-in must not stay stuck: it clears itself */
  animation: mc-tape-hold-clear 0.4s ease 2.5s forwards;
}
@keyframes mc-tape-hold-clear { to { opacity: 0; visibility: hidden; } }
.tape span {
  font-family: "Anton", sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.8rem);
  color: #101013;
  white-space: nowrap;
  letter-spacing: 0.08em;
  line-height: 1;
}
.tape.is-in { animation: tape-in 0.5s var(--ease) forwards; }
.tape.is-out { animation: tape-out 0.55s var(--ease) forwards; }
@keyframes tape-in { from { transform: translate(120vw, -50%) rotate(-3deg); } to { transform: translate(0, -50%) rotate(-3deg); } }
@keyframes tape-out { from { transform: translate(0, -50%) rotate(-3deg); } to { transform: translate(-120vw, -50%) rotate(-3deg); } }

/* ---- 3D auto-rotate toggle ---------------------------------------------- */
.spin-toggle {
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(16, 16, 19, 0.55);
  color: var(--ink);
  cursor: pointer;
  z-index: 3;
  opacity: 0.75;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}
.spin-toggle:hover { opacity: 1; border-color: var(--yellow); }
.spin-toggle svg { width: 11px; height: 11px; fill: currentColor; }
.spin-toggle--table { top: 16px; right: 16px; width: 42px; height: 42px; opacity: 0.85; }
.spin-toggle--table svg { width: 13px; height: 13px; }

/* ---- cookie consent ---------------------------------------------------- */
.consent {
  position: fixed;
  left: 18px; bottom: 18px;
  z-index: 250;
  width: min(340px, calc(100vw - 36px));
  background: var(--ground-2);
  border: 1px solid #3a3a42;
  border-radius: 12px;
  padding: 18px 20px 16px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  transform: translateY(16px);
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.45s var(--ease);
}
.consent.is-on { opacity: 1; transform: none; }
.consent p { margin: 0 0 14px; font-size: 0.82rem; line-height: 1.6; color: var(--muted); }
.consent p strong { color: var(--ink); }
.consent .consent-q { font-weight: 700; color: var(--ink); }
.consent .consent-fine { font-size: 0.72rem; color: #8a8a92; margin: -8px 0 10px; }
.consent .consent-fine + .consent-fine { margin-top: 0; }
.consent-btns { display: flex; gap: 10px; }
.consent-btns button {
  font-family: "Montserrat", sans-serif;
  font-weight: 700; font-size: 0.72rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: 999px; padding: 9px 16px; cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.consent-yes { background: var(--yellow); color: #101013; border: 1px solid var(--yellow); }
.consent-yes:hover { background: #f3d558; }
.consent-no { background: transparent; color: var(--muted); border: 1px solid #3a3a42; }
.consent-no:hover { color: var(--ink); border-color: #5a5a62; }
@media (prefers-reduced-motion: reduce) { .consent { transition: none; } }

/* ---- 3D item stages: photo first, canvas fades in when the model is live ---- */
.item-3d-wrap { position: relative; display: block; }
.item-3d-wrap > img { display: block; width: 100%; }
.item-3d-wrap > canvas.item-3d { position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s ease; }
.item-3d-wrap.is-ready > img { visibility: hidden; }
.item-3d-wrap.is-ready > canvas.item-3d { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .item-3d-wrap > canvas.item-3d { transition: none; } }

/* ---- easter egg: doodle rain ---------------------------------------------------- */
.doodle-drop { position: fixed; top: -60px; z-index: 55; pointer-events: none; animation: doodle-fall linear forwards; }
.doodle-drop path { fill: none; stroke: var(--yellow); stroke-width: 3; stroke-linecap: round; }
@keyframes doodle-fall { to { transform: translateY(115vh) rotate(240deg); opacity: 0.1; } }

/* ---- responsive ------------------------------------------------------------------- */
/* burger kicks in at 1280px: below that the links can't share the bar with
   the full 10-mark social row */
@media (max-width: 1280px) {
  .nav-links {
    position: fixed;
    inset: 68px 0 auto 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    background: rgba(16, 16, 19, 0.97);
    padding: 18px var(--pad) 26px;
    border-bottom: 1px solid var(--line);
    transform: translateY(-130%);
    transition: transform 0.4s var(--ease);
  }
  .nav-links.is-open { transform: none; }
  .nav-links a { font-size: 1.05rem; padding: 8px 0; }
  .nav-burger { display: inline-flex; flex-direction: column; justify-content: center; gap: 6px; width: 44px; height: 44px; padding: 10px; background: none; border: 0; cursor: pointer; }
  .nav-burger span { display: block; height: 2px; width: 100%; background: var(--ink); transition: transform 0.3s var(--ease); }
  .nav-burger[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
  .nav-burger[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }
  .foot-piano { height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv { opacity: 1; transform: none; transition: none; }
  .scrawl path { stroke-dashoffset: 0; animation: none; }
  .tape.is-in, .tape.is-out { animation-duration: 0.01s; }
  .doodle-drop { display: none; }
  .btn, .foot-social a, .nav-links { transition: none; }
}
