@font-face { font-family: "Galmuri11"; src: url(../fonts/Galmuri11.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Galmuri11"; src: url(../fonts/Galmuri11-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "GalmuriMono11"; src: url(../fonts/GalmuriMono11.woff2) format("woff2"); font-display: block; }

:root {
  --ground: #03060c;
  --ink: #dbe8f2;
  --ink-2: #8aa0b4;
  --ink-3: #3c4d5f;
  --panel: #070d16;
  --panel-2: #0e1724;
  --cyan: #5fe1ff;
  --hot: #ff3d9a;
  --mono: "GalmuriMono11", ui-monospace, monospace;
  --notch: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  --notch-s: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
  --ac: var(--ink);
  --pixel: "Galmuri11", "GalmuriMono11", ui-monospace, monospace;
  --text: "Pretendard Variable", Pretendard, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --gut: clamp(16px, 3vw, 40px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ground); color: var(--ink); }
body {
  font: 16px/1.6 var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
img, video { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--ac, var(--ink)); outline-offset: 3px; }

.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: #000; padding: 8px 12px; font-family: var(--pixel); text-decoration: none; }
.skip:focus { top: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- world canvas ---------- */
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; opacity: 0; transition: opacity 0.8s; }
body.ready #world { opacity: 1; }
#world.grabbing { cursor: grabbing; }
body[data-mode="intro"] #world { cursor: pointer; }

/* ---------- HUD frame ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 4; opacity: 0; transition: opacity 1.2s 0.4s; }
body.ready .hud { opacity: 1; }
.hud .c { position: absolute; width: 22px; height: 22px; border: 0 solid rgba(95, 225, 255, 0.45); }
.hud .tl { left: 12px; top: 12px; border-left-width: 1px; border-top-width: 1px; }
.hud .tr { right: 12px; top: 12px; border-right-width: 1px; border-top-width: 1px; }
.hud .bl { left: 12px; bottom: 12px; border-left-width: 1px; border-bottom-width: 1px; }
.hud .br { right: 12px; bottom: 12px; border-right-width: 1px; border-bottom-width: 1px; }
.readout-hud { position: absolute; right: var(--gut); bottom: 20px; margin: 0; display: flex; gap: 18px; font-family: var(--mono); font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
body[data-mode="intro"] .readout-hud, body[data-mode="detail"] .readout-hud { opacity: 0; }
.readout-hud { transition: opacity 0.6s; }

/* ---------- top bar ---------- */
.bar { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 18px var(--gut); z-index: 20; pointer-events: none; }
.bar > * { pointer-events: auto; }
.mark { background: none; border: 0; padding: 4px 0; font-family: var(--pixel); font-weight: 700; font-size: 20px; letter-spacing: 0; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.mark span { font-weight: 400; font-size: 13px; color: var(--ink-2); }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.mail { font-family: var(--mono); font-size: 12px; color: var(--ink-2); text-decoration: none; transition: color 0.2s; }
.mail:hover, .mail:focus-visible { color: var(--cyan); }
.bar-right { display: flex; align-items: center; gap: 14px; }
.lang { display: flex; padding: 3px; gap: 2px; background: rgba(7, 13, 22, 0.8); clip-path: var(--notch-s);
  box-shadow: inset 0 0 0 1px rgba(95, 225, 255, 0.35); }
.lang[hidden] { display: none; }
.lang button { background: none; border: 0; padding: 5px 10px; font-family: var(--mono); font-size: 12px; color: var(--ink-2); cursor: pointer; transition: color 0.2s, background 0.2s; }
.lang button:hover { color: var(--ink); }
.lang button[aria-pressed="true"] { background: var(--cyan); color: #021018; }
.lang button:focus-visible { outline: 1px solid var(--cyan); outline-offset: -3px; }
.list-toggle { background: none; border: 0; font-family: var(--pixel); font-size: 15px; color: var(--ink-2); padding: 8px 4px; cursor: pointer; }
.list-toggle:hover, .list-toggle[aria-expanded="true"] { color: var(--ink); }
body[data-mode="intro"] .list-toggle { opacity: 0.6; }

/* ---------- intro ---------- */
.intro { position: fixed; left: var(--gut); right: var(--gut); bottom: clamp(24px, 6vh, 64px); z-index: 10; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px 32px; pointer-events: none; transition: opacity 0.7s var(--ease), transform 0.9s var(--ease); }
.intro > * { pointer-events: auto; }
.boot { grid-column: 1 / -1; list-style: none; margin: 0 0 6px; padding: 0; font-family: var(--mono); font-size: 13px; line-height: 1.7; color: var(--cyan); opacity: 0.85; min-height: 5.1em; }
.boot li::after { content: attr(data-shown); }
.boot li.typing::after { content: attr(data-shown) "▌"; }
.intro h1 { grid-column: 1 / -1; margin: 0; font-family: var(--pixel); font-weight: 700; font-size: clamp(56px, 10.5vw, 168px); line-height: 1; letter-spacing: -0.02em; text-shadow: 0 0 32px rgba(95, 225, 255, 0.25); }
.intro .tagline { margin: 0; max-width: none; font-family: var(--pixel); font-size: clamp(18px, 2.1vw, 30px); line-height: 1.3; color: #a6f0ff; letter-spacing: 0.02em; text-shadow: 0 0 18px rgba(95, 225, 255, 0.35); }
.intro p { margin: 0; max-width: 34em; color: var(--ink-2); font-size: clamp(15px, 1.25vw, 18px); }
.enter { justify-self: end; background: var(--cyan); color: #021018; border: 0; padding: 15px 30px; font-family: var(--pixel); font-weight: 700; font-size: 16px; cursor: pointer; clip-path: var(--notch); transition: transform 0.2s var(--ease), background 0.2s, box-shadow 0.2s; }
.enter:hover { background: #a6f0ff; transform: translateY(-2px); }
.enter:active { transform: translateY(0); }
body:not([data-mode="intro"]) .intro { opacity: 0; transform: translateY(24px); pointer-events: none; visibility: hidden; transition: opacity 0.5s, transform 0.6s var(--ease), visibility 0s 0.6s; }
body:not([data-mode="intro"]) .intro > * { pointer-events: none; }

/* ---------- globe tags, spotlight panel, dock ---------- */
.tags { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.tag { position: absolute; left: 0; top: 0; translate: -50% calc(-100% - 4px); opacity: 0; will-change: transform, opacity;
  font-family: var(--pixel); font-size: 12px; color: var(--ink-2); text-decoration: none; white-space: nowrap;
  padding: 4px 9px; background: rgba(3, 6, 12, 0.72); border-left: 2px solid var(--ac); transition: color 0.2s, background 0.2s; }
.tag.on, .tag:hover { color: var(--ink); background: color-mix(in srgb, var(--ac) 22%, rgba(3, 6, 12, 0.8)); }

.spot { position: fixed; right: var(--gut); top: 50%; translate: 0 -50%; z-index: 6; width: clamp(280px, 24vw, 360px);
  background: rgba(7, 13, 22, 0.9); clip-path: var(--notch); transition: opacity 0.5s var(--ease); }
.spot::before { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; clip-path: var(--notch);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ac) 50%, transparent); }
.spot-media { aspect-ratio: 16 / 10; background: #02050a; overflow: hidden; }
.spot-media img, .spot-media video { width: 100%; height: 100%; object-fit: cover; }
.spot-body { padding: 14px 18px 18px; border-top: 2px solid var(--ac); }
.spot-name { margin: 0; font-family: var(--pixel); font-weight: 700; font-size: 22px; line-height: 1.2; }
.spot-line { margin: 6px 0 0; font-size: 15px; line-height: 1.5; color: var(--ink); }
.spot-meta { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); }
.spot-go { display: inline-block; margin-top: 14px; padding: 9px 16px; background: var(--ac); color: #021018; text-decoration: none;
  font-family: var(--pixel); font-weight: 700; font-size: 14px; clip-path: var(--notch); transition: filter 0.2s; }
.spot-go:hover { filter: brightness(1.15); }
.spot.swap .spot-media, .spot.swap .spot-body { animation: swapIn 0.45s var(--ease); }
@keyframes swapIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.dock { position: fixed; left: 50%; bottom: 22px; translate: -50% 0; z-index: 6; display: flex; gap: 2px; padding: 5px;
  background: rgba(7, 13, 22, 0.88); clip-path: var(--notch); box-shadow: inset 0 0 0 1px rgba(95, 225, 255, 0.18); transition: opacity 0.5s; }
.dock-item { display: flex; align-items: center; gap: 8px; padding: 9px 14px; text-decoration: none; white-space: nowrap;
  font-family: var(--pixel); font-size: 14px; color: var(--ink-2); transition: color 0.2s, background 0.2s; }
.dock-item i { width: 7px; height: 7px; background: var(--ac); box-shadow: 0 0 8px var(--ac); }
.dock-item:hover, .dock-item.on, .dock-item:focus-visible { color: var(--ink); background: var(--panel-2); outline: none; }
.dock-item.on { box-shadow: inset 0 -2px 0 var(--ac); }

body:not([data-mode="world"]) .tags, body:not([data-mode="world"]) .spot, body:not([data-mode="world"]) .dock { opacity: 0; pointer-events: none; visibility: hidden; }

.hint { position: fixed; left: var(--gut); bottom: 20px; margin: 0; font-family: var(--pixel); font-size: 13px; color: var(--ink-2); z-index: 6; opacity: 0; transition: opacity 0.6s 1.4s; pointer-events: none; }
body[data-mode="world"] .hint { opacity: 1; }

/* ---------- list ---------- */
.list { position: fixed; top: 64px; right: var(--gut); z-index: 30; width: min(420px, calc(100vw - 2 * var(--gut))); background: rgba(7, 13, 22, 0.96); padding: 20px 22px 12px; clip-path: var(--notch); box-shadow: inset 0 0 0 1px rgba(95, 225, 255, 0.25); }
.list-title { margin: 0 0 8px; font-family: var(--pixel); font-size: 13px; font-weight: 400; color: var(--ink-2); }
.list ul { list-style: none; margin: 0; padding: 0; }
.list li a { display: block; padding: 12px 0 12px 14px; text-decoration: none; border-left: 3px solid var(--ac); margin-bottom: 8px; transition: background 0.2s; }
.list li a:hover, .list li a:focus-visible { background: var(--panel-2); outline: none; }
.list li b { display: block; font-family: var(--pixel); font-size: 16px; }
.list li span { display: block; font-size: 14px; color: var(--ink-2); }
body.no-gl { overflow: auto; }
body.no-gl .list { position: static; margin: 120px var(--gut) 40px; width: auto; max-width: 720px; box-shadow: none; }
body.no-gl .intro { position: static; margin: 96px var(--gut) 0; }
body.no-gl .enter, body.no-gl .hint, body.no-gl #world, body.no-gl .list-toggle { display: none; }

/* ---------- detail panel ---------- */
.detail {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40;
  width: min(100vw, max(62vw, 720px));
  background: var(--panel);
  transform: translateX(104%); transition: transform 0.6s var(--ease);
  display: flex; flex-direction: column;
}
.detail.open { transform: none; }
.detail::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--ac); box-shadow: 0 0 18px var(--ac); }
.detail-scroll { overflow-y: auto; overscroll-behavior: contain; height: calc(100% - 64px); margin-top: 64px; padding: 8px clamp(20px, 4vw, 64px) 96px; scrollbar-color: var(--ink-3) transparent; }
.close { position: absolute; top: 18px; right: clamp(20px, 4vw, 64px); z-index: 2; background: var(--panel-2); border: 0; padding: 8px 16px; font-family: var(--pixel); font-size: 14px; cursor: pointer; clip-path: var(--notch); }
.close:hover { background: var(--cyan); color: #021018; }

#detail-content { max-width: 1040px; }
#detail-content h2 { margin: 0; font-family: var(--pixel); font-weight: 700; font-size: clamp(36px, 4.6vw, 72px); line-height: 1.05; letter-spacing: -0.02em; outline: none; }
#detail-content h2 .alias { display: block; font-size: 15px; font-weight: 400; color: var(--ink-2); letter-spacing: 0; margin-top: 10px; }
#detail-content .lead { margin: 18px 0 0; font-size: clamp(19px, 1.7vw, 24px); line-height: 1.45; color: var(--ac); font-weight: 600; max-width: 30em; }
#detail-content .meta { margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; color: var(--ink-2); font-size: 15px; }
.go { font-family: var(--pixel); font-size: 14px; text-decoration: none; background: var(--ac); color: #000; padding: 8px 16px; font-weight: 700; clip-path: var(--notch); transition: transform 0.2s var(--ease); }
.go:hover { transform: translateY(-2px); }
#detail-content h3 { font-family: var(--pixel); font-weight: 700; font-size: 20px; line-height: 1.3; margin: 0 0 12px; }
:where(#detail-content) :where(section, figure) { margin: 0; }
#detail-content > * + * { margin-top: 56px; }
#detail-content > .d-head + * { margin-top: 40px; }
figcaption { font-size: 14px; color: var(--ink-2); margin-top: 10px; }
figcaption small { display: block; font-size: 12px; color: var(--ink-2); opacity: 0.8; margin-top: 4px; }

.film video, .hero-media video, .hero-media img { width: 100%; background: #000; }
.chapters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chapters button { background: var(--panel-2); border: 0; padding: 7px 12px; font-family: var(--pixel); font-size: 13px; color: var(--ink-2); cursor: pointer; transition: background 0.2s, color 0.2s; }
.chapters button:hover { color: var(--ink); }
.chapters button.on { background: var(--ac); color: #000; }

.summary { font-size: 18px; line-height: 1.75; max-width: 40em; }

.readout dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 2px; background: var(--ground); }
.readout dl > div { background: var(--panel-2); padding: 18px 18px 16px; }
.readout dt { font-family: var(--pixel); font-weight: 700; font-size: clamp(24px, 2.4vw, 34px); color: var(--ac); line-height: 1.1; }
.readout dd { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.readout .note { margin: 10px 0 0; font-size: 14px; color: var(--ink-2); }

.prose { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 36px 48px; }
.prose p { margin: 0; color: var(--ink); opacity: 0.88; }

.gallery .stage img { width: 100%; aspect-ratio: 16 / 10; object-fit: contain; background: #000; }
.thumbs { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-color: var(--ink-3) transparent; }
.thumb { flex: 0 0 auto; width: 112px; padding: 0; border: 0; background: #000; cursor: pointer; opacity: 0.5; transition: opacity 0.2s, box-shadow 0.2s; }
.thumb img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.thumb:hover { opacity: 0.85; }
.thumb[aria-pressed="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--ac); }

.viewer-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.concept img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.viewer-stage { position: relative; aspect-ratio: 4 / 3; background: #15140f; cursor: grab; touch-action: none; }
.viewer-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.viewer-stage .loading { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--pixel); color: var(--ink-2); font-size: 14px; }
.viewer-tools, .tabs { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.viewer-tools button, .tabs button { background: var(--panel-2); border: 0; padding: 8px 14px; font-family: var(--pixel); font-size: 14px; color: var(--ink-2); cursor: pointer; transition: background 0.2s, color 0.2s; }
.viewer-tools button[aria-pressed="true"], .tabs button[aria-selected="true"] { background: var(--ac); color: #000; }
.viewer-tools button:hover, .tabs button:hover { color: var(--ink); }
.viewer-tools button[aria-pressed="true"]:hover, .tabs button[aria-selected="true"]:hover { color: #000; }

.players .sub, .parts .sub { margin: -4px 0 12px; color: var(--ink-2); font-size: 15px; }
.players .tabs { margin: 0 0 10px; }
.player { background: #fff; }
.player iframe { display: block; width: 100%; height: min(78vh, 720px); border: 0; background: #fff; }
.player-d { margin: 10px 0 0; font-size: 15px; color: var(--ink-2); }

.loops { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; }
.loops h3 { width: 100%; }
.loops figure.tall video { width: min(280px, 60vw); aspect-ratio: 9 / 16; object-fit: cover; background: #000; }

.shelf-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.shelf-row img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; background: #ddd; }

.parts-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; background: #15171c; padding: 24px; }
.parts-row img { height: 92px; width: auto; object-fit: contain; }

.browser { background: var(--panel-2); }
.browser-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; gap: 12px; font-family: var(--pixel); font-size: 13px; color: var(--ink-2); }
.browser-bar a { color: var(--ink); }
.browser iframe { display: block; width: 100%; height: min(80vh, 760px); border: 0; background: #fff; }

#detail-content > .credit { margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.stack ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.stack li { background: var(--panel-2); padding: 6px 12px; font-size: 14px; color: var(--ink); }

.next { display: flex; flex-direction: column; text-decoration: none; padding: 28px 0 0; border-top: 3px solid var(--ac); }
.next span { font-size: 14px; color: var(--ink-2); }
.next b { font-family: var(--pixel); font-size: clamp(28px, 3.4vw, 48px); color: var(--ac); transition: transform 0.3s var(--ease); }
.next:hover b { transform: translateX(8px); }

.noscript { position: fixed; left: 24px; right: 24px; top: 40%; font-family: var(--pixel); }

@media (max-width: 1200px) {
  .hint, .readout-hud { display: none; }
}

/* ---------- phones ---------- */
@media (max-width: 900px) {
  .detail { width: 100vw; }
  .viewer-row { grid-template-columns: 1fr; }
  .concept { max-width: 220px; }
}
@media (max-width: 640px) {
  .intro { grid-template-columns: 1fr; }
  .enter { justify-self: start; }
  .spot { top: auto; bottom: 76px; translate: none; left: var(--gut); right: var(--gut); width: auto; display: flex; }
  .spot-media { width: 112px; flex: none; aspect-ratio: auto; }
  .spot-body { border-top: 0; border-left: 2px solid var(--ac); padding: 10px 12px; min-width: 0; }
  .spot-name { font-size: 16px; }
  .spot-line { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .spot-meta { display: none; }
  .spot-go { margin-top: 8px; padding: 6px 12px; font-size: 13px; }
  .dock { left: var(--gut); right: var(--gut); translate: none; bottom: 14px; overflow-x: auto; scrollbar-width: none; }
  .dock-item { padding: 9px 11px; font-size: 13px; }
  .hint { display: none; }
  .summary { font-size: 16px; }
  .hint { bottom: 14px; }
  .readout-hud { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; transition-delay: 0s !important; animation: none !important; }
}
