:root {
  --bg-0: #06080f;
  --bg-1: #0a1020;
  --ink: #e4e9f5;
  --ink-dim: #9aa6c0;
  --accent: #e0a98e;
  --panel-bg: rgba(9, 12, 24, 0.9);
  --line: rgba(228, 233, 245, 0.16);
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --col-w: 380px;
  --group: var(--accent);
}
html[data-theme="blueprint"] {
  --bg-0: #f4f1e8;
  --bg-1: #fbf9f2;
  --ink: #1f2a36;
  --ink-dim: #55606f;
  --accent: #a2492b;
  --panel-bg: rgba(251, 249, 242, 0.94);
  --line: rgba(31, 42, 54, 0.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; }
body {
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 0.5s ease, color 0.5s ease;
}
a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--group); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#stage { position: fixed; inset: 0; }
#space { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#space.dragging { cursor: grabbing; }
#space.hot { cursor: pointer; }
#space.inlens { cursor: zoom-in; }
#space.exploring { cursor: crosshair; }

.hud { position: fixed; z-index: 20; }
.hud-top {
  top: max(14px, env(safe-area-inset-top)); left: max(18px, env(safe-area-inset-left)); right: max(18px, env(safe-area-inset-right));
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  pointer-events: none;
}
.hud-top > * { pointer-events: auto; }
.brand { font-family: var(--serif); font-size: 22px; letter-spacing: -0.02em; padding: 4px 2px; }
.brand:hover { color: var(--accent); }
.hud-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.hud-link {
  font-size: 15px; text-decoration: none; color: var(--ink-dim);
  padding: 7px 12px; border: 1px solid transparent; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 8px;
}
.hud-link:hover { color: var(--ink); border-color: var(--line); }
.tt-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); opacity: 0.75; }

.hud-status {
  left: max(18px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom));
  max-width: min(520px, 42vw); font-size: 15px; line-height: 1.5; color: var(--ink-dim);
  text-shadow: 0 0 12px var(--bg-0), 0 0 4px var(--bg-0);
}
.hud-hints {
  right: max(18px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  font-size: 14px; color: var(--ink-dim); text-align: right; max-width: 40vw;
  transition: opacity 0.4s ease;
}
body.open .hud-hints, body.open .hud-status { opacity: 0; pointer-events: none; }

/* words set inside the cell nearest the middle */
.center-text {
  position: fixed; left: 0; top: 0; z-index: 10;
  text-align: center; opacity: 0; transition: opacity 0.2s linear;
  pointer-events: none;
  font-size: var(--fs, 15px); line-height: 1.45;
  text-shadow: 0 0 10px var(--bg-1), 0 0 3px var(--bg-1);
}
.center-text h1, .center-text h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; line-height: 1.05; color: var(--group); }
.center-text h1 { font-size: 2.15em; color: var(--ink); }
.center-text h2 { font-size: 1.55em; }
.center-text p { margin-top: 0.5em; color: var(--ink); }
.center-text .center-role { margin-top: 0.3em; color: var(--accent); }
.center-text .center-list { color: var(--ink-dim); }
.center-text .more { display: none; }
.center-text.roomy .more { display: inline; }
.center-text .center-link { display: inline-block; margin-top: 0.6em; color: var(--group); pointer-events: auto; }

/* the project's text, in two columns either side of the opened cell */
.dossier { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.dossier-head, .dossier-body {
  position: absolute; pointer-events: auto;
  width: var(--col-w);
  opacity: 0;
  transition: opacity 0.55s ease 0.3s, transform 0.75s cubic-bezier(0.22, 1, 0.3, 1) 0.3s;
}
.dossier-head { left: max(20px, env(safe-area-inset-left)); top: 50%; transform: translate(-18px, -50%); text-shadow: 0 0 18px var(--bg-0), 0 0 6px var(--bg-0); }
.dossier-body {
  right: max(20px, env(safe-area-inset-right)); top: 76px; bottom: 20px; transform: translateX(18px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel-bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px 22px;
  scrollbar-width: thin;
}
.dossier.open .dossier-head { opacity: 1; transform: translate(0, -50%); }
.dossier.open .dossier-body { opacity: 1; transform: translateX(0); }
.dossier:not(.open) .dossier-head, .dossier:not(.open) .dossier-body { transition-delay: 0s; transition-duration: 0.3s; }
.dossier.swap .dossier-head, .dossier.swap .dossier-body { opacity: 0.15; transition: opacity 0.18s ease; }

.dossier-group { font-size: 15px; color: var(--group); }
.dossier h2 { margin-top: 6px; font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 3.4vw, 54px); letter-spacing: -0.03em; line-height: 1.02; }
.dossier-kind { margin-top: 12px; font-size: 16px; color: var(--ink-dim); }
.dossier-close {
  position: sticky; top: 0; float: right; margin: -6px -8px 0 8px;
  font-size: 26px; line-height: 1; width: 40px; height: 40px; border-radius: 50%; color: var(--ink-dim);
  background: var(--panel-bg);
}
.dossier-close:hover { color: var(--ink); background: var(--line); }
.dossier-shot { display: block; width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--line); background: var(--bg-1); }
.dossier-summary { margin-top: 14px; font-size: 17px; line-height: 1.55; }
.dossier-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 16px; }
.go-btn {
  background: var(--group); color: var(--bg-0); font-weight: 600; font-size: 16px;
  padding: 10px 18px; border-radius: 24px; min-height: 44px;
}
.go-btn:hover { filter: brightness(1.08); }
.explore-btn {
  font-size: 15px; padding: 8px 16px; min-height: 44px; border-radius: 24px;
  border: 1px solid var(--line); color: var(--ink);
}
.explore-btn:hover, .explore-btn[aria-pressed="true"] { border-color: var(--group); }
.explore-btn[aria-pressed="true"] { color: var(--group); }
.dossier-link { font-size: 15px; color: var(--ink-dim); }
.dossier-hint { margin-top: 8px; font-size: 14px; color: var(--ink-dim); }
.dossier-hint:empty { display: none; }
.dossier-story { margin-top: 18px; border-top: 1px solid var(--line); }
.dossier-story h3 { margin-top: 16px; font-family: var(--serif); font-weight: 400; font-size: 21px; letter-spacing: -0.01em; }
.dossier-story p, .dossier-story li { margin-top: 6px; font-size: 16px; line-height: 1.6; color: var(--ink); }
.dossier-story ul { padding-left: 18px; }
.dossier-limit { margin-top: 16px; font-size: 16px; line-height: 1.55; color: var(--ink-dim); border-left: 2px solid var(--group); padding-left: 10px; }
.dossier-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.dossier-tags li { font-size: 14px; color: var(--ink-dim); border: 1px solid var(--line); border-radius: 14px; padding: 3px 10px; }

/* going into a project */
.veil { position: fixed; inset: 0; z-index: 60; background: var(--bg-0); opacity: 0; pointer-events: none; transition: opacity 0.45s ease; }
.veil.on { opacity: 1; pointer-events: auto; }
.frame { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; background: var(--bg-0); opacity: 0; transition: opacity 0.45s ease; }
.frame.on { opacity: 1; }
.frame-bar {
  display: flex; align-items: center; gap: 16px; padding: 8px max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line); min-height: 54px;
}
.frame-bar h2 { flex: 1; font-family: var(--serif); font-weight: 400; font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frame-back { font-size: 15px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 20px; min-height: 40px; }
.frame-back:hover { border-color: var(--ink-dim); }
.frame-bar a { font-size: 15px; color: var(--ink-dim); white-space: nowrap; }
.frame iframe { flex: 1; width: 100%; border: 0; background: #fff; }

.panel-close {
  position: absolute; top: 12px; right: 12px;
  font-size: 26px; line-height: 1; width: 40px; height: 40px; border-radius: 50%; color: var(--ink-dim);
}
.panel-close:hover { color: var(--ink); background: var(--line); }
.about {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg-0) 60%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.about-card {
  position: relative; width: min(640px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--panel-bg); border: 1px solid var(--line); border-radius: 12px; padding: 30px 32px;
}
.about-card h2 { font-family: var(--serif); font-weight: 400; font-size: 30px; letter-spacing: -0.02em; margin-bottom: 14px; }
.about-card p { font-size: 16px; line-height: 1.65; margin-bottom: 12px; }
.about-alt { color: var(--ink-dim); }

@media (max-width: 899px) {
  .dossier-head { top: 66px; left: 16px; right: 16px; width: auto; transform: translateY(-10px); }
  .dossier.open .dossier-head { transform: none; }
  .dossier h2 { font-size: clamp(28px, 8vw, 38px); }
  .dossier-kind { margin-top: 6px; font-size: 15px; }
  .dossier-body {
    top: auto; bottom: 0; left: 0; right: 0; width: auto;
    max-height: 37vh; border-radius: 14px 14px 0 0; border-bottom: 0;
    padding: 16px 16px max(18px, env(safe-area-inset-bottom));
    transform: translateY(18px);
  }
  .dossier.open .dossier-body { transform: none; }
  .dossier-shot { max-height: 150px; object-fit: cover; object-position: top; }
}

@media (max-width: 719px) {
  .brand { font-size: 20px; }
  .hud-link { padding: 6px 8px; font-size: 14px; }
  #about-open { display: none; }
  .hud-status { display: none; }
  .hud-hints, .center-text { display: none; }
  .about-card { padding: 24px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .dossier-head, .dossier-body, .veil, .frame { transition-duration: 0.01s; transition-delay: 0s; }
}
