/* A(DAI) Brand Identity — The Field */

@font-face {
  font-family: 'Brand Mono';
  src: local('SF Mono'), local('Menlo'), local('Consolas'), local('monospace');
}

:root {
  --void: #0C0C0E;
  --field-bg: var(--void);
  --text: #E8E6E1;
  --muted: #3A3A3C;
  --brand-color: #4169B0;
  --brand-color-rgb: 65, 105, 176;
  --signal: var(--brand-color);
  --signal-rgb: var(--brand-color-rgb);
  --mono: 'SF Mono', 'Menlo', 'Consolas', 'Courier New', monospace;
  --bottom-control-bottom: 28px;
  --bottom-control-height: 44px;
  --bottom-control-radius: 0px;
  --bottom-control-bg: rgba(6, 6, 8, 0.22);
  --bottom-control-border: rgba(255, 255, 255, 0.07);
  --bottom-control-shadow: 0 8px 22px rgba(0, 0, 0, 0.1);
  --bottom-control-blur: blur(18px);
}

/* ---- Light Mode ---- */
:root[data-mode="light"] {
  --void: #F5F3EF;
  --text: #1a1a1e;
  --muted: #8a8a8c;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--field-bg, var(--void));
  color: var(--text);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

/* ---- Shape of Time canvas ---- */
#mopey {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--field-bg, var(--void));
}
:root[data-mode="light"] #myCanvas {
  filter: invert(1) hue-rotate(180deg) brightness(1.08);
  opacity: 0.18;
}
:root:not([data-mode="light"]) #myCanvas {
  opacity: 1;
}
#mopey canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
}

#myCanvas,
#myCanvasOverlay,
#field-detail-canvas {
  transition: none;
  will-change: transform, opacity;
}

#graph-canvas {
  transition: opacity 250ms ease;
  will-change: transform, opacity;
}

#field-detail-canvas {
  position: fixed;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

/* Hide the SVG element sketch.js appends */
#myFinalSVG {
  display: none !important;
}

/* ---- Chrome ---- */
#chrome {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
#chrome > * { pointer-events: auto; }

/* ---- Logotype ---- */
#logotype {
  position: fixed;
  top: 28px;
  left: 32px;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  opacity: 0.98;
  z-index: 10;
  display: inline-flex;
  align-items: baseline;
  min-width: calc(var(--logotype-char-count, 6) * 0.78ch + 1.15ch);
  color: #FFFFFF;
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.12),
    0 0 24px rgba(255, 255, 255, 0.05);
}
#logotype-text {
  display: inline-flex;
  align-items: baseline;
  flex: 0 0 auto;
  min-width: 0;
  white-space: pre;
}
.logotype__char {
  display: inline-block;
  position: relative;
}
.logotype__char.is-selected {
  color: var(--void);
  background: var(--signal);
  box-shadow: 0 0 12px rgba(var(--signal-rgb), 0.22);
  padding: 0 0.03em;
  margin: 0 -0.03em;
}
.logotype__cursor {
  display: inline-block;
  position: relative;
  width: 0.65ch;
  height: 0.95em;
  margin-left: 0.08em;
  background: var(--signal);
  vertical-align: -0.1em;
  opacity: 0.95;
  box-shadow: 0 0 10px rgba(var(--signal-rgb), 0.2);
  animation: logotypeCursorBlink 0.95s steps(1, end) infinite;
}
.logotype__cursor::before,
.logotype__cursor::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.logotype--deleting .logotype__cursor {
  opacity: 0;
  animation: none;
}
@keyframes logotypeCursorBlink {
  0%, 54% { opacity: 0.95; }
  55%, 100% { opacity: 0.18; }
}

#logotype[data-cursor-case="0"] .logotype__char.is-selected {
  color: var(--void);
  background: var(--signal);
  box-shadow: 0 0 12px rgba(var(--signal-rgb), 0.22);
  padding: 0 0.03em;
  margin: 0 -0.03em;
}

#logotype[data-cursor-case="1"] .logotype__cursor {
  width: 0.92ch;
  height: 0.14em;
  margin-left: 0.04em;
  vertical-align: 0.16em;
  box-shadow: none;
}
#logotype[data-cursor-case="1"] .logotype__char.is-selected {
  color: var(--text);
  background: transparent;
  box-shadow: none;
  padding: 0;
  margin: 0;
  text-decoration-line: underline;
  text-decoration-color: var(--signal);
  text-decoration-thickness: 0.13em;
  text-underline-offset: 0.16em;
}

#logotype[data-cursor-case="2"] .logotype__cursor {
  width: 0.76ch;
  height: 1.02em;
  margin-left: 0.04em;
  box-shadow: 0 0 14px rgba(var(--signal-rgb), 0.28);
}
#logotype[data-cursor-case="2"] .logotype__char.is-selected {
  color: var(--void);
  background: var(--signal);
  box-shadow: 0 0 16px rgba(var(--signal-rgb), 0.28);
  padding: 0 0.04em;
  margin: 0 -0.04em;
}

#logotype[data-cursor-case="3"] .logotype__cursor {
  width: 0.74ch;
  height: 1em;
  background: transparent;
  border: 1px solid var(--signal);
  box-shadow: none;
}
#logotype[data-cursor-case="3"] .logotype__char.is-selected {
  color: var(--text);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--signal);
  padding: 0 0.05em;
  margin: 0 -0.05em;
}

#logotype[data-cursor-case="4"] .logotype__cursor {
  width: 0.12em;
  height: 1.02em;
  margin-left: 0.12em;
  border-radius: 999px;
}
#logotype[data-cursor-case="4"] .logotype__char.is-selected {
  color: var(--text);
  background: rgba(var(--signal-rgb), 0.14);
  box-shadow: inset 2px 0 0 var(--signal);
  padding: 0 0.05em 0 0.12em;
  margin: 0 -0.05em 0 -0.08em;
}

#logotype[data-cursor-case="5"] .logotype__cursor {
  width: 0.12em;
  height: 1.02em;
  margin-left: 0.12em;
  border-radius: 999px;
}
#logotype[data-cursor-case="5"] .logotype__cursor::before,
#logotype[data-cursor-case="5"] .logotype__cursor::after {
  opacity: 1;
  width: 0.7ch;
  height: 1px;
  background: var(--signal);
}
#logotype[data-cursor-case="5"] .logotype__cursor::before {
  top: 0;
  transform: translate(-50%, 0);
}
#logotype[data-cursor-case="5"] .logotype__cursor::after {
  top: auto;
  bottom: 0;
  transform: translate(-50%, 0);
}
#logotype[data-cursor-case="5"] .logotype__char.is-selected {
  color: var(--text);
  background: rgba(var(--signal-rgb), 0.12);
  box-shadow: inset 0 0 0 1px rgba(var(--signal-rgb), 0.45);
  border-radius: 0.12em;
  padding: 0 0.06em;
  margin: 0 -0.03em;
}

#logotype[data-cursor-case="6"] .logotype__cursor {
  width: 0.1em;
  height: 1.02em;
  margin-left: 0.14em;
  border-radius: 999px;
  box-shadow:
    0 0 0 1px rgba(var(--signal-rgb), 0.22),
    0 0 16px rgba(var(--signal-rgb), 0.24);
}
#logotype[data-cursor-case="6"] .logotype__char.is-selected {
  color: var(--text);
  background: linear-gradient(180deg, rgba(var(--signal-rgb), 0.16), rgba(var(--signal-rgb), 0.06));
  box-shadow: inset 0 -1px 0 rgba(var(--signal-rgb), 0.55);
  border-radius: 0.08em;
  padding: 0 0.05em;
  margin: 0 -0.02em;
}

.adai-regenerate-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 18px;
  padding: 0 4px;
  background: transparent;
  border: 0;
  color: #8a8a8c;
  font: inherit;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-transform: lowercase;
}
.adai-regenerate-btn:hover {
  color: var(--text);
}
.adai-regenerate-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05em;
  color: var(--signal);
  font-size: 12px;
  line-height: 1;
}

/* ---- Coordinates ---- */
#coordinates {
  position: fixed;
  top: 28px;
  right: 32px;
  font-size: 11px;
  letter-spacing: 0.06em;
  opacity: 0.25;
  display: flex;
  gap: 16px;
  z-index: 10;
}

/* ---- Vitals ---- */
#vitals {
  position: fixed;
  bottom: 28px;
  left: 32px;
  font-size: 11px;
  letter-spacing: 0.06em;
  opacity: 0.4;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
}
.vital-row {
  display: flex;
  gap: 12px;
}
.vital-label {
  opacity: 0.5;
  min-width: 48px;
}
.vital-value {
  opacity: 0.9;
}
/* ---- Room Nav ---- */
#rooms {
  position: fixed;
  bottom: var(--bottom-control-bottom);
  right: 32px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  max-width: 380px;
  height: var(--bottom-control-height);
  row-gap: 6px;
  column-gap: 12px;
  padding: 0 14px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  z-index: 10;
  background: var(--bottom-control-bg);
  border: 1px solid var(--bottom-control-border);
  border-radius: var(--bottom-control-radius);
  box-shadow: var(--bottom-control-shadow);
  backdrop-filter: var(--bottom-control-blur);
}
.room-link {
  color: var(--text);
  text-decoration: none;
  opacity: 0.58;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.42);
  transition: opacity 0.35s ease, color 0.35s ease;
  cursor: pointer;
}
.room-link:hover {
  opacity: 0.9;
}
.room-link.active {
  opacity: 1;
  color: var(--signal);
  text-shadow: 0 0 10px rgba(var(--signal-rgb), 0.22);
}

/* Option B: the semantic constellation is the browsable base view, so the
   graph overlay stays visible and interactive at base zoom. Reveal/focus draw
   over it; the body-class rules below only keep it lit during focus/reveal. */
#graph-canvas {
  opacity: 1;
  pointer-events: auto;
}

#adai-breadcrumb,
#adai-edge-filter,
#adai-embed-strip {
  transition: opacity 520ms ease;
}

body.field-graph-focused #graph-canvas {
  opacity: 1;
  pointer-events: auto !important;
}

body.field-graph-revealing #graph-canvas {
  opacity: 1;
  pointer-events: none !important;
}

body.field-graph-revealing #mopey,
body.field-graph-focused #mopey,
body.field-graph-revealing #field-detail-canvas,
body.field-graph-focused #field-detail-canvas {
  transition: opacity 620ms ease !important;
}

body.field-graph-revealing #adai-breadcrumb,
body.field-graph-revealing #adai-edge-filter,
body.field-graph-revealing #adai-embed-strip {
  opacity: 0 !important;
  pointer-events: none !important;
}

body.field-graph-focused #adai-breadcrumb,
body.field-graph-focused #adai-edge-filter,
body.field-graph-focused #adai-embed-strip {
  opacity: 1;
}

body.field-graph-revealing #mopey {
  opacity: 0.32 !important;
}

body.field-graph-revealing #field-detail-canvas {
  opacity: 0.24 !important;
}

body.field-graph-focused #mopey {
  opacity: 0.14 !important;
}

body.field-graph-focused #field-detail-canvas {
  opacity: 0.055 !important;
}

/* While drag-panning the zoomed field (field.js sets the class) */
body.field-panning, body.field-panning * { cursor: grabbing !important; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  :root {
    --bottom-control-bottom: 16px;
    --bottom-control-height: 40px;
  }
  #logotype { font-size: 15px; top: 16px; left: 16px; }
  #coordinates { top: 16px; right: 16px; font-size: 10px; }
  #vitals { bottom: 16px; left: 16px; font-size: 10px; }
  #rooms {
    bottom: var(--bottom-control-bottom);
    right: 16px;
    gap: 12px;
    height: var(--bottom-control-height);
    padding: 0 12px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #mopey canvas {
    transform: none !important;
  }
}

/* ---- Field loading indicator ----
   Visible until graph-loader.js dispatches `adai:graph` (or errors).
   The graph payload is ~560 KB; first-visit cold fetch can be a few
   seconds before any dots appear on the field, hence the cue. */
#field-loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: var(--text);
  background: rgba(6, 6, 8, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  backdrop-filter: blur(14px);
  pointer-events: none;
  opacity: 0.7;
  visibility: visible;
  transition: opacity 800ms ease, color 400ms ease, visibility 0s linear 0s;
}
#field-loading[data-state="ready"] {
  opacity: 0;
  visibility: hidden;
  transition: opacity 800ms ease, visibility 0s linear 800ms;
}
#field-loading[data-state="error"] {
  color: #d68585;
  opacity: 0.85;
}
.field-loading__pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 14px rgba(var(--signal-rgb), 0.55);
  animation: field-loading-pulse 1.4s ease-in-out infinite;
}
#field-loading[data-state="error"] .field-loading__pip {
  background: #d68585;
  box-shadow: 0 0 14px rgba(214, 133, 133, 0.55);
  animation: none;
}
.field-loading__dots {
  display: inline-block;
  width: 1.4em;
  text-align: left;
}
@keyframes field-loading-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
  .field-loading__pip { animation: none; opacity: 0.85; }
}
