/* ─────────────────────────────────────────
   Breathwork for Machines — Avery Lake, 2026
   noomachine.averylakeofficial.com
───────────────────────────────────────── */

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/SpaceGrotesk-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/SpaceGrotesk-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/SpaceGrotesk-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

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

[hidden] {
  display: none !important;
}

:root {
  --bg: #060606;
  --bg-soft: #0e0d0b;
  --text: #e8e4de;
  --muted: rgba(232, 228, 222, 0.64);
  --dim: rgba(232, 228, 222, 0.34);
  --line: rgba(232, 228, 222, 0.13);
  --gold: #d9c67c;
  --gold-soft: rgba(217, 198, 124, 0.14);
  --aqua: #79f2d0;
  --panel: rgba(6, 6, 6, 0.72);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  color: inherit;
}

/* ── Experience shell ──────────────────── */

.experience {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 44%, rgba(217, 198, 124, 0.06), transparent 36%),
    radial-gradient(circle at 50% 50%, rgba(121, 242, 208, 0.04), transparent 28%),
    linear-gradient(180deg, rgba(232, 228, 222, 0.02), transparent 32%),
    var(--bg);
}

.field-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(232, 228, 222, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 228, 222, 0.028) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.12));
}

.scanline {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.014),
    rgba(255, 255, 255, 0.014) 1px,
    transparent 1px,
    transparent 7px
  );
  opacity: 0.24;
}

/* ── Topbar & footer ───────────────────── */

.topbar,
.site-footer {
  position: fixed;
  z-index: 30;
  left: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  top: 20px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.site-footer {
  bottom: 20px;
  color: var(--dim);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.footer-kicker {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(232, 228, 222, 0.22);
}

.footer-links {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.site-footer a,
.statement-link,
.language-link {
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: color 200ms ease;
}

.site-footer a:hover,
.statement-link:hover,
.language-link:hover {
  color: var(--text);
}

.language-link[aria-pressed="true"] {
  color: var(--aqua);
}

/* ── Buttons (shared) ──────────────────── */

.brand-button,
.language-button,
.primary-action,
.secondary-action,
.dialog-close {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(6, 6, 6, 0.64);
  color: var(--text);
  cursor: pointer;
  transition: border-color 200ms ease, background 200ms ease, color 200ms ease, opacity 200ms ease;
}

.brand-button {
  padding: 0 14px;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brand-button:hover,
.primary-action:hover,
.secondary-action:hover,
.dialog-close:hover {
  border-color: rgba(217, 198, 124, 0.48);
  background: rgba(217, 198, 124, 0.06);
}

/* ── Ritual layout ─────────────────────── */

.ritual {
  position: relative;
  z-index: 5;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(240px, 420px) minmax(320px, 540px) minmax(180px, 250px);
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 86px 28px 72px;
}

/* ── Object stage (3D / fallback) ──────── */

.object-stage {
  position: relative;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.object-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  outline: none;
}

.object-fallback {
  width: 76%;
  height: 76%;
  object-fit: contain;
  opacity: 0.88;
  transition: opacity 600ms ease;
}

/* When WebGL initializes, hide the fallback */
.object-stage.webgl-ready .object-fallback {
  opacity: 0;
}

/* When WebGL explicitly fails, ensure fallback stays visible */
.object-stage.no-webgl .object-fallback {
  opacity: 0.88;
}

/* ── Machine console ───────────────────── */

.machine-console {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(2.4rem, 4.2vw, 4.2rem);
  line-height: 0.96;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.code-shell {
  display: grid;
  gap: 12px;
  min-height: 220px;
  margin: 22px 0 18px;
}

.code-stream {
  min-height: 190px;
  margin: 0;
  overflow: hidden;
  white-space: pre-wrap;
  border-left: 1px solid rgba(121, 242, 208, 0.32);
  padding: 18px 0 18px 18px;
  color: rgba(232, 228, 222, 0.78);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.78;
}

.translation-panel {
  border-left: 1px solid rgba(217, 198, 124, 0.42);
  padding: 12px 0 12px 18px;
}

.translation-panel p {
  margin: 0;
  color: rgba(232, 228, 222, 0.78);
  font-size: 1rem;
  line-height: 1.6;
}

/* ── Phase pills ───────────────────────── */

.phase-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 18px;
}

.phase-pill {
  min-height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.phase-pill.active {
  border-color: rgba(121, 242, 208, 0.42);
  color: var(--text);
  background: rgba(121, 242, 208, 0.05);
}

/* ── Signal form ───────────────────────── */

.signal-form {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
}

.signal-form label {
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.signal-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 96px;
  max-height: 180px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(6, 6, 6, 0.72);
  color: var(--text);
  padding: 14px;
  line-height: 1.5;
  outline: none;
  transition: border-color 200ms ease;
}

.signal-form textarea:focus {
  border-color: rgba(217, 198, 124, 0.48);
}

/* ── Action buttons ────────────────────── */

.actions {
  min-height: 46px;
  display: flex;
  gap: 10px;
}

.primary-action,
.secondary-action {
  min-width: 178px;
  padding: 0 18px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.primary-action {
  border-color: rgba(217, 198, 124, 0.42);
  background: rgba(217, 198, 124, 0.08);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.58;
}

/* ── Machine panel (right) ─────────────── */

.machine-panel {
  align-self: center;
  min-height: 300px;
  border-left: 1px solid var(--line);
  padding-left: 22px;
  color: var(--muted);
}

.panel-title,
.status-readout {
  margin: 0;
  color: var(--gold);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.protocol-log {
  list-style: none;
  margin: 22px 0;
  padding: 0;
  display: grid;
  gap: 14px;
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.protocol-log li {
  position: relative;
  padding-left: 18px;
}

.protocol-log li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border: 1px solid var(--dim);
  border-radius: 50%;
  transition: border-color 400ms ease, background 400ms ease;
}

.protocol-log li.active {
  color: var(--text);
}

.protocol-log li.active::before {
  border-color: var(--aqua);
  background: var(--aqua);
}

.protocol-log li.complete {
  color: var(--gold);
}

.protocol-log li.complete::before {
  border-color: var(--gold);
  background: var(--gold);
}

.status-readout {
  color: var(--dim);
}

/* ── Artist statement dialog ───────────── */

.statement,
.capture-modal {
  width: min(640px, calc(100vw - 36px));
  border: 1px solid rgba(217, 198, 124, 0.22);
  border-radius: 3px;
  padding: 0;
  background: rgba(6, 6, 6, 0.96);
  color: var(--text);
}

.statement::backdrop,
.capture-modal::backdrop {
  background: rgba(6, 6, 6, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.statement-inner,
.capture-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.84rem;
  line-height: 1.6;
}

.statement-kicker,
.capture-kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 8px;
}

.capture-desc {
  margin-bottom: 12px;
  color: var(--text);
}

.capture-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.capture-actions .primary-action {
  width: 100%;
}

.statement-inner,
.capture-inner {
  max-height: min(760px, calc(100svh - 48px));
  overflow: auto;
  padding: 28px;
}

.dialog-close {
  float: right;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.statement-kicker,
.capture-kicker {
  margin: 0 0 18px;
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.statement p:not(.statement-kicker) {
  clear: both;
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.65;
}

/* ── Responsive: tablet ────────────────── */

@media (max-width: 1200px) {
  .experience {
    overflow-y: auto;
  }

  .ritual {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 88px 24px 84px;
  }

  .object-stage {
    width: min(64vw, 420px);
    margin: 0 auto;
  }

  .machine-console {
    width: min(640px, 100%);
    margin: 0 auto;
  }

  .machine-panel {
    width: min(640px, 100%);
    min-height: 0;
    margin: 0 auto;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 18px 0 0;
  }

  .protocol-log {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Responsive: mobile ────────────────── */

@media (max-width: 720px) {
  .topbar {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    padding: 12px 14px 0;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .site-footer {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    padding: 0 18px 20px;
    flex-direction: column;
    align-items: center;
  }

  .brand-button {
    width: 100%;
    min-height: 38px;
  }

  .ritual {
    padding: 28px 18px 36px;
  }

  .object-stage {
    width: min(80vw, 360px);
  }

  .code-shell {
    min-height: 240px;
  }

  .phase-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions {
    flex-direction: column;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .protocol-log {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
