/* ORACLE — black, chrome, and a voice in italic serif. */

:root {
  --ink: #000;
  --text: rgba(255, 255, 255, 0.92);
  --dim: rgba(255, 255, 255, 0.46);
  --faint: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.14);
  --up: #3ddc84;
  --down: #ff5a52;
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --chrome: linear-gradient(180deg, #ffffff 0%, #c9ced6 38%, #6d747e 52%, #e9ecf0 70%, #8e959f 100%);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { background: #000; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; background: none; border: 0; }
button { cursor: pointer; }

#metal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

/* without WebGL the room is still dark and still answers */
body.no-gl {
  background: radial-gradient(60% 45% at 50% 58%, #2a2d33 0%, #0b0c0e 55%, #000 100%);
}

/* ─── header ─────────────────────────────────────────────────────────────── */

.top {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 26px;
  pointer-events: none;
}

.mark { display: grid; gap: 4px; }

.mark b {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5em;
  background: var(--chrome);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mark span { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--dim); }

.top nav { display: flex; gap: 6px; pointer-events: auto; }

.top nav button {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.top nav button:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.4); }
.top nav button:disabled { cursor: default; color: rgba(255, 255, 255, 0.24); border-color: rgba(255, 255, 255, 0.08); }
.top nav button.off { color: rgba(255, 255, 255, 0.28); }

/* ─── the token you gave it ──────────────────────────────────────────────── */

.token {
  position: fixed;
  top: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: none;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 11.5px;
  color: var(--dim);
  white-space: nowrap;
}

.token img { border-radius: 50%; }
.token b { color: var(--text); letter-spacing: 0.06em; }
.token .up { color: var(--up); }
.token .down { color: var(--down); }

body[data-stage='ready'] .token { display: flex; }

/* ─── what it says ───────────────────────────────────────────────────────── */

.subs {
  position: fixed;
  left: 50%;
  bottom: 190px;
  transform: translateX(-50%);
  z-index: 4;
  width: min(820px, calc(100vw - 40px));
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.subs.on { opacity: 1; }

.asked {
  margin: 0 0 12px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  min-height: 1em;
}

.line {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 2.6vw, 34px);
  line-height: 1.3;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.8);
}

.line span { opacity: 0.08; transition: opacity 0.35s ease; }
.line span.on { opacity: 1; }

/* ─── controls ───────────────────────────────────────────────────────────── */

.controls {
  position: fixed;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%);
  z-index: 5;
  width: min(760px, calc(100vw - 32px));
}

.find, .ask {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.find:focus-within, .ask:focus-within {
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05), 0 0 40px rgba(200, 215, 235, 0.08);
}

.find input, .ask input {
  flex: 1;
  min-width: 0;
  height: 40px;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
}

.find input::placeholder, .ask input::placeholder { color: rgba(255, 255, 255, 0.32); }

.find button, .ask button {
  height: 40px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--chrome);
  color: #0b0b0c;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: filter 0.2s ease;
}

.find button:hover, .ask button:hover { filter: brightness(1.12); }

.status { margin: 12px 0 0; text-align: center; font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--dim); min-height: 1.2em; }

.asking { display: none; }

body[data-stage='ready'] .find { display: none; }
body[data-stage='ready'] .asking { display: grid; gap: 12px; }
body[data-stage='reading'] .find button { opacity: 0.4; pointer-events: none; }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }

.chips button {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--text);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.chips button:hover { border-color: rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.06); }

/* while it answers: a state on <body> must never share a name with an
   element's class, or that element's rules land on the whole page */
body.is-asking .chips button, body.is-asking .ask button { opacity: 0.35; pointer-events: none; }

.change {
  justify-self: center;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.34);
}

.change:hover { color: var(--text); }

.fine {
  position: fixed;
  bottom: 14px; left: 0; right: 0;
  z-index: 4;
  text-align: center;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.26);
  pointer-events: none;
}

/* ─── about ──────────────────────────────────────────────────────────────── */

.about {
  position: fixed;
  top: 70px; right: 26px;
  z-index: 10;
  width: min(380px, calc(100vw - 32px));
  padding: 20px 22px 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(8, 8, 10, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.about h2 { margin: 0 0 8px; font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 22px; }
.about p { margin: 0 0 14px; font-size: 12px; line-height: 1.65; color: rgba(255, 255, 255, 0.7); }
.about b { color: #fff; font-weight: 500; }
.about .close { position: absolute; top: 10px; right: 14px; font-size: 20px; color: var(--dim); }

/* ─── small screens ──────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .top { padding: 16px; }
  .mark span { display: none; }
  .token { top: 58px; gap: 10px; font-size: 10.5px; }
  .subs { bottom: 250px; }
  .chips button { font-size: 13.5px; padding: 7px 11px; }
  .controls { bottom: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .line span { transition: none; }
}

/* a floor of shadow under the words, so they read over bright chrome */
body::after {
  content: '';
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 46vh;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.55) 45%, rgba(0, 0, 0, 0.85) 100%);
}

/* while it speaks the stage belongs to the face and its chart: the controls
   step aside, the words drop to the bottom edge, the shadow floor thins */
.controls, .fine { transition: opacity 0.45s ease, transform 0.45s ease; }
.subs { transition: opacity 0.5s ease, bottom 0.5s ease; }
body::after { transition: height 0.6s ease, opacity 0.6s ease; }
body.is-asking .controls { opacity: 0; transform: translate(-50%, 14px); pointer-events: none; }
body.is-asking .fine { opacity: 0; }
body.is-asking .subs { bottom: 34px; }
body.is-asking::after { height: 24vh; }

@media (max-aspect-ratio: 6/5) {
  body.is-asking .subs { bottom: 20px; }
  body.is-asking .line { font-size: 17px; line-height: 1.32; }
  body.is-asking .asked { margin-bottom: 6px; }
}

/* on a wide screen the chart takes the right, and the words sit under the face */
@media (min-aspect-ratio: 6/5) {
  .subs { transition: opacity 0.5s ease, bottom 0.5s ease, left 0.6s ease, width 0.6s ease; }
  body.is-asking .subs { left: var(--face-x, 33%); width: min(38vw, 560px); bottom: 38px; }
  body.is-asking .line { font-size: clamp(19px, 1.65vw, 27px); }
}
