/* ============================================================
   KEVIN'S ROOM — STYLES
   ============================================================ */

:root {
  --paper: #f6efe4;
  --paper-2: #efe5d6;
  --ink: #23201b;
  --ink-2: #6b625a;
  --line: rgba(35, 32, 27, 0.12);
  --amber: #c98a2b;
  --amber-2: #f1d9a6;
  --clay: #b8583a;
  --brand-red: #ec3013;
  --font-brand: 'Archivo', 'Instrument Sans', system-ui, sans-serif;
  --sky: #cfe3ee;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --panel-w: min(520px, 100vw);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
::selection { background: var(--amber-2); }

/* ---------- Canvas ---------- */
#scene {
  position: fixed; inset: 0;
  display: block;
  width: 100%; height: 100%;
  touch-action: none;
  cursor: grab;
}
#scene.is-dragging { cursor: grabbing; }
#scene.is-hover { cursor: pointer; }

/* ---------- Grain ---------- */
.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none; z-index: 2;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 6s steps(8) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 25% { transform: translate(-4%, 3%); }
  50% { transform: translate(3%, -5%); } 75% { transform: translate(-2%, -2%); } 100% { transform: translate(0, 0); }
}

/* ---------- Loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 50;
  background: var(--paper);
  display: grid; place-items: center;
  transition: opacity 0.9s var(--ease), visibility 0.9s;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__inner { text-align: center; }
.loader__mark { display: flex; justify-content: center; margin-bottom: 18px; }
.loader__mark img { width: 82px; height: auto; animation: markIn 0.9s var(--ease) both; }
@keyframes markIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.loader__name {
  font-family: var(--font-brand); font-weight: 600;
  font-size: clamp(1.6rem, 3.6vw, 2.4rem); letter-spacing: -0.02em; line-height: 1;
}
.loader__line { color: var(--ink-2); margin-top: 0.8rem; font-size: 0.95rem; }
.loader__bar {
  width: 160px; height: 2px; margin: 1.6rem auto 0;
  background: var(--line); overflow: hidden; border-radius: 2px;
}
.loader__bar i { display: block; height: 100%; width: 0; background: var(--brand-red); transition: width 0.3s; }

/* ---------- HUD ---------- */
.hud {
  position: fixed; inset: 0; z-index: 5; pointer-events: none;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(16px, 2.5vw, 28px);
}
.hud > * { pointer-events: auto; }
.hud__top, .hud__bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hud__brand {
  font-family: var(--font-brand); font-weight: 600; font-size: 1.05rem; letter-spacing: -0.02em;
  text-decoration: none; display: flex; align-items: center; gap: 10px; color: var(--ink);
}
.hud__mark { width: 36px; height: auto; display: block; }
.hud__brand small { margin-left: 2px; }
.hud__brand small { font-family: var(--font-body); font-size: 0.75rem; color: var(--ink-2); letter-spacing: 0.08em; text-transform: uppercase; }
.hud__actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 999px;
  background: rgba(246, 239, 228, 0.82); backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  font-size: 0.82rem; letter-spacing: 0.01em;
  transition: background 0.2s, transform 0.2s var(--ease), border-color 0.2s;
}
.chip:hover { background: #fff; border-color: rgba(35,32,27,0.25); transform: translateY(-1px); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip[aria-pressed="true"] svg { color: var(--brand-red); }
.chip svg { width: 14px; height: 14px; }
.hud__hint {
  font-size: 0.82rem; color: var(--ink-2);
  padding: 8px 14px; border-radius: 999px;
  background: rgba(246, 239, 228, 0.7); backdrop-filter: blur(8px);
  transition: opacity 0.5s;
}
.hud__hint.is-hidden { opacity: 0; }
.hud__nav { display: flex; gap: 4px; flex-wrap: wrap; }
.hud__nav .chip { font-size: 0.78rem; padding: 7px 11px; }

/* ---------- Object label (follows 3D) ---------- */
.label {
  position: fixed; z-index: 4; pointer-events: none;
  transform: translate(-50%, -130%);
  padding: 6px 12px; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-size: 0.8rem; white-space: nowrap;
  opacity: 0; transition: opacity 0.18s;
}
.label.is-visible { opacity: 1; }
.label::after {
  content: ""; position: absolute; left: 50%; bottom: -5px;
  width: 8px; height: 8px; background: var(--ink); transform: translateX(-50%) rotate(45deg);
}

/* ---------- Welcome card ---------- */
.welcome {
  position: fixed; z-index: 20;
  left: 50%; bottom: clamp(70px, 12vh, 120px); transform: translate(-50%, 20px);
  width: min(520px, calc(100vw - 32px));
  background: rgba(246, 239, 228, 0.94); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 24px 26px;
  opacity: 0; visibility: hidden;
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), visibility 0.6s;
  box-shadow: 0 20px 50px -20px rgba(60, 40, 10, 0.35);
}
.welcome.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.welcome h1 {
  font-family: var(--font-display); font-weight: 400; font-size: 2rem; line-height: 1.05;
  letter-spacing: -0.02em; margin-bottom: 10px;
  font-variation-settings: "opsz" 144, "SOFT" 60;
}
.welcome p { color: var(--ink-2); font-size: 0.95rem; margin-bottom: 8px; }
.welcome__row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: var(--paper); font-size: 0.9rem;
  transition: transform 0.2s var(--ease), background 0.2s; text-decoration: none;
}
.btn:hover { transform: translateY(-1px); background: #000; }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid rgba(35,32,27,0.3); }
.btn--ghost:hover { background: #fff; }
.btn--amber { background: var(--amber); color: #fff; }
.btn--amber:hover { background: #b57a22; }

/* ---------- Tour caption ---------- */
.tour {
  position: fixed; z-index: 20; left: 50%; bottom: clamp(70px, 12vh, 120px);
  transform: translate(-50%, 16px);
  width: min(560px, calc(100vw - 32px));
  background: var(--ink); color: var(--paper);
  border-radius: 16px; padding: 18px 20px;
  display: flex; align-items: center; gap: 16px;
  opacity: 0; visibility: hidden;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease), visibility 0.4s;
}
.tour.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.tour p { flex: 1; font-size: 0.95rem; }
.tour__meta { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.6; display: block; margin-bottom: 4px; }
.tour__actions { display: flex; gap: 6px; }
.tour .chip { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); color: var(--paper); }
.tour .chip:hover { background: rgba(255,255,255,0.2); }

/* ---------- Panel ---------- */
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 30;
  width: var(--panel-w);
  background: var(--paper);
  border-left: 1px solid var(--line);
  transform: translateX(105%);
  transition: transform 0.6s var(--ease);
  display: flex; flex-direction: column;
  box-shadow: -30px 0 60px -40px rgba(60, 40, 10, 0.4);
}
.panel.is-open { transform: translateX(0); }
.panel__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 12px; border-bottom: 1px solid var(--line);
}
.project__note { font-size: 0.85rem; color: var(--ink-2); font-style: italic; margin: 6px 0 14px; }
.panel__kicker { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brand-red); }
.panel__close {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  display: grid; place-items: center; transition: background 0.2s, transform 0.2s var(--ease);
}
.panel__close:hover { background: #fff; transform: rotate(90deg); }
.panel__body { flex: 1; overflow-y: auto; padding: 24px 26px 60px; overscroll-behavior: contain; }
.panel__body::-webkit-scrollbar { width: 8px; }
.panel__body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.panel h2 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2rem, 4vw, 2.6rem); line-height: 1.02; letter-spacing: -0.02em;
  font-variation-settings: "opsz" 144, "SOFT" 60; margin-bottom: 12px;
}
.panel .lede { color: var(--ink-2); font-size: 1rem; margin-bottom: 26px; }
.panel h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.3rem; letter-spacing: -0.01em; line-height: 1.2; }
.panel p { font-size: 0.95rem; }
.panel__body > * { animation: rise 0.6s var(--ease) both; }
.panel__body > *:nth-child(2) { animation-delay: 0.05s; }
.panel__body > *:nth-child(3) { animation-delay: 0.1s; }
.panel__body > *:nth-child(4) { animation-delay: 0.15s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.tabs { display: flex; gap: 4px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.tabs button {
  padding: 8px 12px; font-size: 0.85rem; color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.2s, border-color 0.2s;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--amber); }

.placeholder-note {
  font-size: 0.75rem; color: var(--ink-2); background: var(--paper-2);
  border: 1px dashed rgba(35,32,27,0.25); border-radius: 8px; padding: 8px 12px; margin-bottom: 18px;
}

/* Work */
.project { padding: 18px 0; border-top: 1px solid var(--line); }
.project__meta { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 6px; display: flex; gap: 10px; flex-wrap: wrap; }
.project__meta b { color: var(--ink); font-weight: 600; }
.project__toggle { width: 100%; text-align: left; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.project__toggle svg { flex: none; width: 18px; height: 18px; margin-top: 6px; transition: transform 0.3s var(--ease); }
.project.is-open .project__toggle svg { transform: rotate(45deg); }
.project__more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.5s var(--ease); }
.project.is-open .project__more { grid-template-rows: 1fr; }
.project__more > div { overflow: hidden; }
.project__more p { margin: 12px 0 14px; color: var(--ink-2); }
.results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.results div { background: var(--paper-2); border-radius: 10px; padding: 12px 12px 10px; }
.results b { display: block; font-family: var(--font-display); font-size: 1.8rem; line-height: 1; letter-spacing: -0.02em; color: var(--clay); }
.results span { font-size: 0.72rem; color: var(--ink-2); line-height: 1.3; display: block; margin-top: 4px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { font-size: 0.72rem; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill-list span { font-size: 0.8rem; padding: 6px 11px; border-radius: 999px; background: var(--paper-2); }
.section-title { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); margin: 30px 0 8px; }
.small-list { list-style: none; font-size: 0.85rem; color: var(--ink-2); }
.small-list li { padding: 6px 0; border-top: 1px solid var(--line); }

/* Notes */
.note { padding: 16px 0; border-top: 1px solid var(--line); cursor: pointer; }
.note:hover h3 { color: var(--clay); }
.note time { font-size: 0.75rem; color: var(--ink-2); letter-spacing: 0.05em; display: block; margin-bottom: 4px; }
.note h3 { transition: color 0.2s; }
.note__body { display: none; margin-top: 10px; }
.note.is-open .note__body { display: block; }
.note__body p { color: var(--ink-2); margin-bottom: 10px; }
.sample { padding: 18px 0; border-top: 1px solid var(--line); }
.sample small { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--amber); }
.sample blockquote { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.15; letter-spacing: -0.01em; margin: 6px 0 8px; font-variation-settings: "opsz" 96, "SOFT" 40; }
.sample p { color: var(--ink-2); font-size: 0.85rem; }

/* Photos */
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-grid button { border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--paper-2); }
.photo-grid button:nth-child(1) { grid-column: span 2; aspect-ratio: 16 / 9; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.photo-grid button:hover img { transform: scale(1.04); }
.photo-view img { width: 100%; border-radius: 12px; margin-bottom: 14px; }
.photo-view h3 { margin-bottom: 6px; }
.photo-view p { color: var(--ink-2); }
.photo-view__nav { display: flex; justify-content: space-between; margin-top: 18px; }

/* Radio */
.dial { background: var(--ink); color: var(--paper); border-radius: 14px; padding: 18px 20px 20px; margin-bottom: 20px; }
.dial__freq { font-family: var(--font-display); font-size: 3rem; line-height: 1; letter-spacing: -0.03em; color: var(--amber-2); }
.dial__name { font-size: 0.85rem; opacity: 0.7; margin-top: 4px; }
.dial__scale { position: relative; height: 22px; margin-top: 14px; border-top: 1px solid rgba(255,255,255,0.25); }
.dial__scale i { position: absolute; top: 0; width: 1px; height: 8px; background: rgba(255,255,255,0.3); }
.dial__scale i:nth-child(5n+1) { height: 14px; }
.dial__needle { position: absolute; top: -6px; width: 2px; height: 22px; background: var(--clay); transition: left 0.6s var(--ease); }
.station { width: 100%; text-align: left; display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.station__freq { font-family: var(--font-display); font-size: 1.3rem; width: 62px; color: var(--ink-2); }
.station.is-active .station__freq { color: var(--clay); }
.station div { flex: 1; }
.station b { font-weight: 600; display: block; font-size: 0.95rem; }
.station span { font-size: 0.83rem; color: var(--ink-2); }
.station a { font-size: 0.8rem; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; white-space: nowrap; }
.station a:hover { background: #fff; }

/* Lists */
.item { padding: 12px 0; border-top: 1px solid var(--line); }
.item b { font-weight: 600; }
.item small { color: var(--ink-2); font-size: 0.8rem; margin-left: 6px; }
.item p { color: var(--ink-2); font-size: 0.88rem; margin-top: 2px; }

/* Contact */
.contact-big { font-family: var(--font-display); font-size: clamp(1.4rem, 3.5vw, 1.9rem); line-height: 1.15; letter-spacing: -0.02em; text-decoration: none; display: block; margin: 8px 0 20px; word-break: break-all; }
.contact-big:hover { color: var(--clay); }
.contact-lines { list-style: none; color: var(--ink-2); font-size: 0.92rem; margin-bottom: 22px; }
.contact-lines li { padding: 6px 0; border-top: 1px solid var(--line); }
.contact-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Mobile / fallback ---------- */
@media (max-width: 720px) {
  .hud { padding: 14px; }
  .hud__brand small { display: none; }
  .hud__bottom { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
  .hud__nav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .hud__nav::-webkit-scrollbar { display: none; }
  .hud__nav .chip { flex: none; }
  .hud__hint { align-self: flex-end; }
  .hud__actions .chip span { display: none; }
  .hud__actions .chip { padding: 9px; }
  .welcome { bottom: 16px; padding: 20px; }
  .welcome h1 { font-size: 1.7rem; }
  .tour { bottom: 16px; flex-direction: column; align-items: stretch; }
  .panel { width: 100vw; }
  .results { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .results b { font-size: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .panel, .welcome, .tour { transition-duration: 0.01s; }
}

/* Screen-reader only */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
