/* FIELDWORK — style. Deep-space navy field, cool white labels, one electric iris accent. */

:root {
  --field-0: #070a1a;
  --field-1: #0c1030;
  --ink: #e8ecff;
  --ink-dim: rgba(232, 236, 255, 0.62);
  --ink-faint: rgba(232, 236, 255, 0.34);
  --accent: #7b7cff;
  --accent-soft: rgba(123, 124, 255, 0.16);
  --teal: #3fd8d2;
  --sans: "Avenir Next", "Futura", "Century Gothic", "URW Gothic", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--field-0);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); letter-spacing: 0.04em; }

body {
  background:
    radial-gradient(120% 90% at 50% 0%, var(--field-1) 0%, var(--field-0) 62%);
  touch-action: none;
  overscroll-behavior: none;
}

#field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
#field:active { cursor: grabbing; }

/* overlays scroll normally on touch even though the field itself takes over gestures */
.veil, .veil-scroll, .drawer, .drawer-list, .trail-panel, .trail-list, .contact-form textarea {
  touch-action: pan-y;
}

.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(115% 100% at 50% 45%, transparent 55%, rgba(4, 6, 16, 0.75) 100%);
}

button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:focus-visible, a:focus-visible, textarea:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------------- HUD corners ---------------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.hud-corner { position: absolute; pointer-events: auto; }
.hud-tl { top: max(18px, env(safe-area-inset-top)); left: max(20px, env(safe-area-inset-left)); }
.hud-tr {
  top: max(20px, env(safe-area-inset-top)); right: max(22px, env(safe-area-inset-right));
  display: flex; flex-direction: column; align-items: flex-end; gap: 5px;
}
.hud-bl { bottom: max(18px, env(safe-area-inset-bottom)); left: max(20px, env(safe-area-inset-left)); }

#hud-wordmark {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left;
  gap: 1px; padding: 2px 0;
}
.wm-mark { color: var(--accent); font-size: 15px; line-height: 1; }
.wm-name {
  font-weight: 700; font-size: 17px; letter-spacing: 0.34em; color: var(--ink);
}
.wm-sub { font-size: 9.5px; color: var(--ink-faint); letter-spacing: 0.14em; margin-top: 3px; }
#hud-wordmark:hover .wm-name { color: var(--accent); transition: color 0.25s; }

#hud-coords { font-size: 10px; color: var(--ink-faint); }
#hud-progress { font-size: 10px; color: var(--accent); }

#hud-trail { display: flex; gap: 6px; flex-wrap: wrap; max-width: 46vw; align-items: center; }
.trail-none { font-size: 10px; color: var(--ink-faint); }
.trail-chip {
  font-size: 10px; color: var(--ink-dim);
  border: 1px solid rgba(232, 236, 255, 0.16);
  border-radius: 999px; padding: 4px 11px;
  background: rgba(9, 12, 30, 0.6);
  backdrop-filter: blur(6px);
  transition: border-color 0.2s, color 0.2s, transform 0.3s var(--spring);
}
.trail-chip:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.trail-more { color: var(--accent); border-color: rgba(123, 124, 255, 0.4); }

/* ---------------- edge tab ---------------- */
#edge-tab {
  position: fixed; z-index: 11;
  right: 0; top: 50%;
  transform: translateY(-50%);
  writing-mode: horizontal-tb;
  background: rgba(12, 16, 44, 0.85);
  border: 1px solid rgba(232, 236, 255, 0.18);
  border-right: none;
  border-radius: 10px 0 0 10px;
  color: var(--ink-dim);
  font-size: 9.5px; letter-spacing: 0.22em; line-height: 1.7;
  padding: 14px 9px 14px 12px;
  transition: transform 0.35s var(--spring), color 0.2s, border-color 0.2s;
}
#edge-tab:hover {
  transform: translateY(-50%) translateX(-6px);
  color: var(--accent); border-color: var(--accent);
}

/* ---------------- onboarding hint ---------------- */
#hint {
  position: fixed; z-index: 12;
  left: 50%; bottom: max(64px, calc(env(safe-area-inset-bottom) + 56px));
  transform: translate(-50%, 16px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; padding: 0 24px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  max-width: 560px;
}
#hint.show { opacity: 1; transform: translate(-50%, 0); }
.hint-line { font-size: 15px; color: var(--ink); letter-spacing: 0.02em; }
.hint-line em { color: var(--accent); font-style: normal; }
.hint-keys { font-size: 10px; color: var(--ink-faint); line-height: 1.8; }
.hint-keys strong { color: var(--ink-dim); }

/* ---------------- node preview card ---------------- */
.node-preview {
  position: fixed; z-index: 20; left: 0; top: 0;
  width: 200px;
  background: rgba(10, 13, 34, 0.92);
  border: 1px solid rgba(123, 124, 255, 0.35);
  border-radius: 10px;
  overflow: hidden;
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 40px rgba(0, 0, 10, 0.6);
  transition: opacity 0.22s var(--ease-out);
  pointer-events: auto;
  cursor: pointer;
}
.node-preview.gone { opacity: 0; pointer-events: none; }
.node-preview canvas { display: block; width: 200px; height: 112px; }
.np-meta { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px 4px; }
.np-title { font-weight: 700; font-size: 13px; letter-spacing: 0.06em; }
.np-sub { font-family: var(--mono); font-size: 9.5px; color: var(--ink-faint); }
.np-hint {
  font-family: var(--mono); font-size: 9.5px; color: var(--accent);
  padding: 5px 12px 10px;
}
.node-preview.pinned { border-color: var(--accent); }

/* ---------------- radial menu ---------------- */
.radial {
  position: fixed; z-index: 40;
  width: 0; height: 0;
  visibility: hidden;
}
.radial.open { visibility: visible; }
.radial-centre {
  position: absolute; left: 0; top: 0;
  width: 46px; height: 46px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px dashed rgba(232, 236, 255, 0.35);
  display: grid; place-items: center;
  color: var(--ink-faint); font-size: 18px;
  background: rgba(9, 12, 30, 0.75);
  animation: radial-breathe 1.6s ease-in-out infinite;
}
@keyframes radial-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(123, 124, 255, 0.25); }
  50% { box-shadow: 0 0 0 12px rgba(123, 124, 255, 0); }
}
.radial-wedge {
  position: absolute; left: 0; top: 0;
  width: 86px; height: 86px;
  margin: -43px 0 0 -43px;
  border-radius: 50%;
  background: rgba(12, 16, 44, 0.92);
  border: 1px solid rgba(232, 236, 255, 0.2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  transition: transform 0.38s var(--spring), border-color 0.15s, background 0.15s, box-shadow 0.15s;
  backdrop-filter: blur(8px);
}
.rw-icon { font-size: 16px; color: var(--ink-dim); line-height: 1; }
.rw-label { font-size: 10px; font-weight: 700; letter-spacing: 0.16em; }
.rw-sub { font-family: var(--mono); font-size: 8px; color: var(--ink-faint); }
.radial-wedge.active {
  border-color: var(--accent);
  background: rgba(31, 34, 84, 0.95);
  box-shadow: 0 0 26px rgba(123, 124, 255, 0.45);
}
.radial-wedge.active .rw-icon,
.radial-wedge.active .rw-label { color: var(--accent); }
.radial-wedge.active .rw-sub { color: var(--ink-dim); }

/* ---------------- veil (case studies & surfaces) ---------------- */
.veil {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(5, 7, 18, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
}
.veil.in { opacity: 1; }
.veil-inner {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #0a0e26 0%, #070a1a 100%);
  transform: translateY(4vh) scale(0.985);
  opacity: 0;
  transition: transform 0.45s var(--spring), opacity 0.35s var(--ease-out);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.veil.in .veil-inner { transform: none; opacity: 1; }

.veil-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top)) 24px 14px;
  border-bottom: 1px solid rgba(232, 236, 255, 0.09);
  flex: none;
}
.veil-back {
  font-size: 12px; font-weight: 700; letter-spacing: 0.18em;
  color: var(--ink-dim);
  padding: 8px 14px 8px 0;
  transition: color 0.2s, transform 0.3s var(--spring);
}
.veil-back:hover { color: var(--accent); transform: translateX(-4px); }
.veil-crumb { font-size: 10px; color: var(--ink-faint); }

.veil-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 0 24px calc(48px + env(safe-area-inset-bottom));
  scrollbar-width: thin;
  scrollbar-color: rgba(123, 124, 255, 0.4) transparent;
}
.veil-text { max-width: 720px; margin: 0 auto; width: 100%; }

/* case study */
.cs-hero {
  margin: 22px auto 0; max-width: 960px;
  border: 1px solid rgba(232, 236, 255, 0.12);
  border-radius: 14px; overflow: hidden;
  background: #090c22;
}
.cs-canvas { display: block; width: 100%; height: min(46vh, 420px); }
.cs-head { max-width: 720px; margin: 30px auto 0; }
.cs-title { font-size: clamp(30px, 6vw, 54px); font-weight: 700; letter-spacing: -0.01em; line-height: 1.02; }
.cs-brief { margin-top: 12px; font-size: 16px; color: var(--ink-dim); line-height: 1.55; }
.cs-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px; font-size: 10.5px; color: var(--accent); }
.cs-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.cs-tag {
  font-size: 9.5px; color: var(--ink-faint);
  border: 1px solid rgba(232, 236, 255, 0.15); border-radius: 999px;
  padding: 3px 10px;
}
.cs-process, .cs-credits, .cs-related { max-width: 720px; margin: 44px auto 0; }
.cs-h2 { font-size: 10.5px; color: var(--accent); letter-spacing: 0.24em; margin-bottom: 18px; }
.cs-para { display: flex; gap: 18px; margin-bottom: 20px; }
.cs-num { flex: none; font-size: 10px; color: var(--ink-faint); padding-top: 5px; }
.cs-para p { font-size: 15px; line-height: 1.7; color: rgba(232, 236, 255, 0.82); }
.cs-credit-list { display: grid; grid-template-columns: minmax(110px, 0.6fr) 1.4fr; gap: 8px 20px; }
.cs-credit-list dt { font-size: 10px; color: var(--ink-faint); padding-top: 3px; }
.cs-credit-list dd { font-size: 14px; color: var(--ink-dim); }
.cs-related-row { display: flex; gap: 10px; flex-wrap: wrap; }
.cs-rel-link {
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.05em;
  color: var(--ink-dim);
  border: 1px solid rgba(123, 124, 255, 0.35);
  border-radius: 999px; padding: 9px 16px;
  transition: all 0.25s var(--ease-out);
}
.cs-rel-link:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.cs-foot {
  max-width: 720px; margin: 56px auto 0; padding-top: 18px;
  border-top: 1px solid rgba(232, 236, 255, 0.09);
  font-size: 9.5px; color: var(--ink-faint);
}

/* surfaces */
.surf-title {
  font-size: clamp(34px, 7vw, 62px); font-weight: 700; line-height: 1.04;
  letter-spacing: -0.015em;
  margin: 40px auto 34px; max-width: 720px;
}
.manifesto-list { max-width: 720px; margin: 0 auto; }
.journal-list { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.journal-card {
  border: 1px solid rgba(232, 236, 255, 0.11);
  border-radius: 12px; padding: 20px 22px;
  background: rgba(12, 16, 44, 0.4);
}
.journal-date { font-size: 9.5px; color: var(--accent); margin-bottom: 8px; }
.journal-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.journal-body { font-size: 14.5px; line-height: 1.65; color: rgba(232, 236, 255, 0.78); margin-bottom: 12px; }
.contact-note { max-width: 720px; margin: 0 auto 26px; font-size: 16px; line-height: 1.6; color: var(--ink-dim); }
.contact-list { max-width: 720px; margin: 0 auto 36px; }
.contact-mail { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(123, 124, 255, 0.4); }
.contact-form { max-width: 720px; margin: 0 auto 40px; display: flex; flex-direction: column; gap: 14px; }
.contact-form label { display: flex; flex-direction: column; gap: 8px; font-size: 9.5px; color: var(--ink-faint); letter-spacing: 0.2em; }
.contact-form textarea {
  background: rgba(12, 16, 44, 0.5);
  border: 1px solid rgba(232, 236, 255, 0.16);
  border-radius: 10px;
  color: var(--ink); font-family: var(--sans); font-size: 15px;
  padding: 14px 16px; resize: vertical; min-height: 110px;
}
.contact-form textarea:focus { border-color: var(--accent); outline: none; }
.contact-send {
  align-self: flex-start;
  font-weight: 700; font-size: 13px; letter-spacing: 0.1em;
  color: #070a1a; background: var(--accent);
  border-radius: 999px; padding: 12px 26px;
  transition: transform 0.3s var(--spring), box-shadow 0.25s;
}
.contact-send:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(123, 124, 255, 0.4); }

/* ---------------- wander mode ---------------- */
.wander {
  position: fixed; inset: 0; z-index: 32;
  background: #05060f;
  display: flex; flex-direction: column;
  animation: wander-in 0.6s var(--ease-out);
}
@keyframes wander-in { from { opacity: 0; } to { opacity: 1; } }
.wander-stage { position: relative; flex: 1; overflow: hidden; }
.wander-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.wander-stage::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(5,6,15,0.5) 0%, transparent 26%, transparent 55%, rgba(5,6,15,0.88) 100%);
}
.wander-stage.sweep-r::before, .wander-stage.sweep-l::before {
  content: ''; position: absolute; top: 0; bottom: 0; width: 2px; z-index: 2;
  background: var(--accent);
  box-shadow: 0 0 30px var(--accent);
  animation: sweep 0.55s var(--ease-out) forwards;
}
.wander-stage.sweep-r::before { left: 0; }
.wander-stage.sweep-l::before { right: 0; }
@keyframes sweep {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100vw); opacity: 0.4; }
}
.wander-stage.sweep-l::before { animation-name: sweep-l-k; }
@keyframes sweep-l-k {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-100vw); opacity: 0.4; }
}
.wander-cap {
  position: absolute; z-index: 3;
  left: 24px; right: 24px; bottom: 26px;
  max-width: 640px;
  opacity: 0; transform: translateY(14px);
}
.wander-cap.cap-in { opacity: 1; transform: none; transition: opacity 0.5s var(--ease-out) 0.15s, transform 0.55s var(--spring) 0.15s; }
.wander-count { font-size: 10px; color: var(--accent); letter-spacing: 0.22em; margin-bottom: 8px; }
.wander-title { font-size: clamp(30px, 6.5vw, 58px); font-weight: 700; letter-spacing: -0.01em; line-height: 1; }
.wander-note { margin-top: 10px; font-size: 14.5px; line-height: 1.55; color: var(--ink-dim); }
.wander-open {
  margin-top: 16px;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid rgba(123, 124, 255, 0.5);
  border-radius: 999px; padding: 10px 18px;
  transition: all 0.25s var(--ease-out);
}
.wander-open:hover { background: var(--accent-soft); transform: translateY(-2px); }
.wander-bar {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(232, 236, 255, 0.09);
}
.wander-nav { font-size: 13px; font-weight: 700; letter-spacing: 0.1em; color: var(--ink-dim); padding: 10px 14px; transition: color 0.2s; }
.wander-nav:hover { color: var(--accent); }
.wander-exit { font-size: 10px; color: var(--ink-faint); padding: 10px; transition: color 0.2s; }
.wander-exit:hover { color: var(--ink); }
.wander-hint {
  position: absolute; top: max(16px, env(safe-area-inset-top)); left: 0; right: 0;
  text-align: center; font-size: 9.5px; color: var(--ink-faint);
  pointer-events: none;
}

/* ---------------- drawer ---------------- */
.drawer {
  position: fixed; z-index: 34;
  top: 0; right: 0; bottom: 0;
  width: min(400px, 92vw);
  background: rgba(9, 12, 30, 0.96);
  border-left: 1px solid rgba(123, 124, 255, 0.25);
  backdrop-filter: blur(12px);
  transform: translateX(102%);
  transition: transform 0.45s var(--spring);
  display: flex; flex-direction: column;
}
.drawer.in { transform: none; }
.drawer-head {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) 20px 14px;
  border-bottom: 1px solid rgba(232, 236, 255, 0.09);
}
.drawer-title { font-size: 9.5px; color: var(--accent); letter-spacing: 0.2em; }
.drawer-close { font-size: 15px; color: var(--ink-dim); padding: 6px 10px; }
.drawer-close:hover { color: var(--ink); }
.drawer-list { flex: 1; overflow-y: auto; padding: 10px 12px; -webkit-overflow-scrolling: touch; }
.drawer-sect { font-size: 9px; color: var(--ink-faint); letter-spacing: 0.24em; padding: 14px 10px 6px; }
.drawer-item {
  display: flex; align-items: baseline; gap: 10px;
  width: 100%; text-align: left;
  padding: 11px 10px; border-radius: 8px;
  transition: background 0.2s, transform 0.25s var(--spring);
}
.drawer-item:hover { background: var(--accent-soft); transform: translateX(-3px); }
.di-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); align-self: center; }
.di-dot-new { background: transparent; border: 1px solid var(--ink-faint); }
.di-name { font-size: 14.5px; font-weight: 600; letter-spacing: 0.03em; }
.di-sub { margin-left: auto; font-size: 9px; color: var(--ink-faint); flex: none; }
.drawer-foot {
  flex: none; padding: 14px 20px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(232, 236, 255, 0.09);
  display: flex; flex-wrap: wrap; gap: 10px;
}
.drawer-util {
  font-size: 9.5px; color: var(--ink-dim); letter-spacing: 0.12em;
  border: 1px solid rgba(232, 236, 255, 0.16); border-radius: 999px;
  padding: 7px 13px; transition: all 0.2s;
}
.drawer-util:hover { color: var(--accent); border-color: var(--accent); }
.drawer-hint { width: 100%; font-size: 8.5px; color: var(--ink-faint); margin-top: 4px; }

/* ---------------- trail panel ---------------- */
.trail-panel {
  position: fixed; z-index: 34;
  left: 50%; bottom: max(66px, calc(env(safe-area-inset-bottom) + 58px));
  transform: translate(-50%, 18px);
  width: min(440px, calc(100vw - 32px));
  max-height: 55vh;
  background: rgba(9, 12, 30, 0.96);
  border: 1px solid rgba(123, 124, 255, 0.3);
  border-radius: 14px;
  backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.3s var(--ease-out), transform 0.35s var(--spring);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.trail-panel.in { opacity: 1; transform: translate(-50%, 0); }
.trail-head { flex: none; font-size: 9.5px; color: var(--accent); letter-spacing: 0.2em; padding: 15px 18px 11px; border-bottom: 1px solid rgba(232, 236, 255, 0.09); }
.trail-list { flex: 1; overflow-y: auto; padding: 6px 10px; }
.trail-empty { font-size: 13px; color: var(--ink-dim); padding: 18px 12px; }
.trail-item {
  display: flex; align-items: baseline; gap: 12px;
  width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 8px;
  transition: background 0.2s;
}
.trail-item:hover { background: var(--accent-soft); }
.ti-n { font-size: 9px; color: var(--ink-faint); flex: none; }
.ti-name { font-size: 13.5px; font-weight: 600; }
.ti-kind { margin-left: auto; font-size: 9px; color: var(--ink-faint); flex: none; }
.trail-close {
  flex: none; font-size: 9.5px; color: var(--ink-faint); letter-spacing: 0.14em;
  padding: 13px; border-top: 1px solid rgba(232, 236, 255, 0.09);
  transition: color 0.2s;
}
.trail-close:hover { color: var(--ink); }

/* ---------------- noscript ---------------- */
.noscript {
  position: fixed; inset: 0; z-index: 99;
  background: var(--field-0);
  display: grid; place-content: center; gap: 14px;
  text-align: center; padding: 30px;
}

/* ---------------- small screens ---------------- */
@media (max-width: 700px) {
  #hint { max-width: 86vw; }
  .wm-sub { display: none; }
  #hud-coords { font-size: 9px; }
  #hud-trail { max-width: 62vw; }
  .trail-chip { font-size: 9px; padding: 3px 9px; }
  #edge-tab { padding: 12px 7px 12px 10px; font-size: 8.5px; }
  .cs-para { flex-direction: column; gap: 4px; }
  .cs-credit-list { grid-template-columns: 1fr; gap: 2px 0; }
  .cs-credit-list dd { margin-bottom: 8px; }
  .cs-canvas { height: 34vh; }
  .radial-wedge { width: 78px; height: 78px; margin: -39px 0 0 -39px; }
  .veil-bar { padding-left: 16px; padding-right: 16px; }
  .veil-scroll { padding-left: 16px; padding-right: 16px; }
  .node-preview { width: 176px; }
  .node-preview canvas { width: 176px; height: 100px; }
}

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