/* mind-web UI v2
 *
 * Keeps the existing header language, protects the identity title from the
 * ambient field, and turns the rest of the page into one quieter spatial
 * surface instead of a stack of competing cards.
 */

:root {
  --background: #07090b;
  --surface: rgba(255, 255, 255, 0.038);
  --surface-strong: rgba(255, 255, 255, 0.075);
  --border: rgba(255, 255, 255, 0.105);
  --text: #f5f7fa;
  --muted: #9ca2ad;
  --hero-ink: #f3f6fb;
  --hero-depth: #697887;
  --content-gutter: clamp(0.75rem, 3vw, 1.5rem);
}

body {
  background:
    radial-gradient(circle at 78% 18%, color-mix(in srgb, var(--accent), transparent 95%), transparent 32rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 28rem),
    var(--background);
}

#app {
  background: linear-gradient(180deg, transparent 0 76%, rgba(0, 0, 0, 0.16));
}

.topbar,
main,
footer {
  position: relative;
  z-index: 2;
}

/* Preserve the header composition, only strengthen its spatial contract. */
.topbar {
  width: min(calc(100% - (2 * var(--content-gutter))), var(--max-width));
  border-bottom-color: transparent;
}

.brand-mark {
  text-shadow: 0 0 1.2rem color-mix(in srgb, var(--accent), transparent 38%);
}

.fork-switcher a {
  border: 1px solid transparent;
  background: transparent;
}

.fork-switcher a:hover,
.fork-switcher a:focus-visible,
.fork-switcher a[aria-current] {
  border-color: color-mix(in srgb, var(--border), transparent 25%);
  background: color-mix(in srgb, var(--surface-strong), transparent 12%);
  outline: none;
}

.session-control {
  display: inline-flex;
  min-height: 2.35rem;
  padding: 0.5rem 0.72rem;
  align-items: center;
  gap: 0.55rem;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--border), transparent 25%);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(8, 11, 15, 0.52);
  font: 0.7rem ui-monospace, "SFMono-Regular", Menlo, monospace;
  white-space: nowrap;
}

.session-control a,
.session-control button {
  color: inherit;
}

.session-control form {
  display: inline-flex;
}

.session-control button {
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.session-control:hover,
.session-control:focus-visible,
.session-control button:hover,
.session-control button:focus-visible {
  color: var(--text);
  outline: none;
}

.session-control--disabled {
  opacity: 0.55;
}

.runtime-banner--mind {
  width: min(calc(100% - (2 * var(--content-gutter))), var(--max-width));
  margin: -2rem auto 2rem;
}

.runtime-banner--mind a,
.runtime-banner--error a {
  color: var(--text);
  font: 0.72rem ui-monospace, "SFMono-Regular", Menlo, monospace;
  white-space: nowrap;
}

/* Keep the ambient field alive, but move its visual mass away from the title. */
.entity-field--wasm {
  z-index: -4;
  contain: strict;
  opacity: 0.9;
}

.entity-field__orb {
  top: 40%;
  left: 79%;
  width: min(94vw, 72rem);
  opacity: 0.3;
  filter: blur(0.7px);
}

.entity-field__grid {
  inset: -14%;
  background-size: 54px 54px;
  opacity: 0.42;
  mask-image: radial-gradient(circle at 80% 39%, #000 0 14%, rgba(0, 0, 0, 0.78) 34%, transparent 67%);
  -webkit-mask-image: radial-gradient(circle at 80% 39%, #000 0 14%, rgba(0, 0, 0, 0.78) 34%, transparent 67%);
}

.ambient {
  opacity: 0.085;
}

.shell-intro {
  position: relative;
  z-index: 1;
  width: min(calc(100% - (2 * var(--content-gutter))), var(--max-width));
  max-width: calc(100% - (2 * var(--content-gutter)));
  min-height: min(76dvh, 51rem);
  padding: clamp(3.5rem, 11vw, 7.75rem) 0 clamp(3.25rem, 8vw, 6rem);
  align-content: end;
  gap: clamp(2rem, 6vw, 4.5rem);
}

.shell-intro::before {
  inset: 18% auto 3% -18%;
  width: min(58rem, 92vw);
  border-radius: 48%;
  background: radial-gradient(circle at 42% 56%, rgba(7, 9, 11, 0.96) 0 24%, rgba(7, 9, 11, 0.76) 46%, transparent 76%);
  filter: blur(20px);
}

.shell-intro > div:first-child {
  position: relative;
  z-index: 3;
  min-width: 0;
  isolation: isolate;
}

/* A local veil prevents the fixed texture/WebGPU layer from bleeding through
   the title on iOS compositing paths. */
.shell-intro > div:first-child::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -1.6rem -2rem -2.25rem -2.25rem;
  background: radial-gradient(ellipse at 34% 62%, rgba(7, 9, 11, 0.98) 0 31%, rgba(7, 9, 11, 0.88) 48%, transparent 76%);
  filter: blur(10px);
  pointer-events: none;
}

.route {
  color: color-mix(in srgb, var(--muted), white 7%);
  font-size: clamp(0.74rem, 2.8vw, 0.9rem);
  letter-spacing: 0.11em;
}

.hero__signal {
  margin-top: 1.2rem;
  color: color-mix(in srgb, var(--muted), white 6%);
  font-size: clamp(0.66rem, 2.6vw, 0.77rem);
  letter-spacing: 0.18em;
}

.pulse {
  width: 0.46rem;
  height: 0.46rem;
  box-shadow:
    0 0 0 0.34rem color-mix(in srgb, var(--accent), transparent 82%),
    0 0 1.5rem color-mix(in srgb, var(--accent), transparent 28%);
}

.shell-intro h1 {
  position: relative;
  z-index: 2;
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  margin-top: 1.05rem;
  color: transparent;
  background: linear-gradient(180deg, #ffffff 0%, #eef2f7 55%, color-mix(in srgb, var(--accent), #8793a0 74%) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: clamp(4rem, 17.4vw, 8.8rem);
  font-weight: 770;
  letter-spacing: -0.085em;
  line-height: 0.84;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2),
    0 5px 0 rgba(87, 102, 117, 0.32),
    0 24px 62px color-mix(in srgb, var(--accent), transparent 80%);
  transform: none;
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
  contain: paint;
}

.shell-intro h1::after {
  left: 0.04em;
  bottom: -0.18em;
  width: min(2.05em, 62vw);
  height: 0.035em;
  opacity: 0.56;
  filter: blur(0.8px);
}

.shell-intro__copy {
  position: relative;
  z-index: 3;
  max-width: 39rem;
}

.statement {
  max-width: 24ch;
  font-size: clamp(1.45rem, 5.6vw, 2.15rem);
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.description {
  max-width: 42rem;
  margin-top: 1.35rem;
  color: color-mix(in srgb, var(--muted), white 2%);
  font-size: clamp(1rem, 3.5vw, 1.13rem);
  line-height: 1.72;
}

.primary-action {
  min-height: 4.15rem;
  margin-top: 1.8rem;
  padding: 1rem 1.15rem;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 48%);
  border-radius: 1.1rem;
  color: #07101a;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent), white 12%), var(--accent));
  box-shadow:
    0 1rem 3.2rem color-mix(in srgb, var(--accent), transparent 84%),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
  font-size: clamp(0.9rem, 3.4vw, 1rem);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.primary-action:hover,
.primary-action:focus-visible {
  transform: translateY(-2px);
  box-shadow:
    0 1.3rem 3.8rem color-mix(in srgb, var(--accent), transparent 78%),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  outline: none;
}

.primary-action span {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid rgba(7, 16, 26, 0.22);
  border-radius: 50%;
}

/* The graph continues the same surface instead of starting a second page. */
.graph-section {
  position: relative;
  z-index: 2;
  padding-top: clamp(3rem, 8vw, 6rem);
}

.section-heading {
  width: min(calc(100% - (2 * var(--content-gutter))), var(--max-width));
  max-width: calc(100% - (2 * var(--content-gutter)));
}

.section-heading h2 {
  max-width: 12ch;
  font-size: clamp(2.5rem, 10vw, 5.25rem);
  line-height: 0.92;
}

.graph-status span,
.graph-status button {
  border-color: color-mix(in srgb, var(--border), transparent 20%);
  background: rgba(8, 11, 15, 0.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.renderer-surface {
  background:
    radial-gradient(circle at 50% 44%, color-mix(in srgb, var(--accent), transparent 87%), transparent 38%),
    linear-gradient(rgba(255, 255, 255, 0.009) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.009) 1px, transparent 1px),
    #07090b;
  background-size: auto, 48px 48px, 48px 48px, auto;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    inset 0 -5rem 9rem rgba(0, 0, 0, 0.28);
}

.node-details {
  padding-top: 0.25rem;
}

.node-details__header,
.node-metadata,
.document-tabs {
  border-color: color-mix(in srgb, var(--border), transparent 48%);
}

.runtime-footer {
  width: min(calc(100% - (2 * var(--content-gutter))), var(--max-width));
  max-width: calc(100% - (2 * var(--content-gutter)));
}

/* WebKit/iOS uses a solid foreground rather than background-clipped text.
   This avoids the known fixed-layer + clipped-text compositing bleed while
   preserving depth through restrained extrusion shadows. */
@supports (-webkit-touch-callout: none) {
  .shell-intro h1 {
    color: var(--hero-ink);
    background: none;
    -webkit-text-fill-color: var(--hero-ink);
    text-shadow:
      0 1px 0 rgba(255, 255, 255, 0.2),
      0 4px 0 rgba(103, 118, 132, 0.52),
      0 9px 0 rgba(52, 63, 74, 0.28),
      0 25px 64px color-mix(in srgb, var(--accent), transparent 78%);
  }
}

@media (min-width: 720px) {
  .entity-field__orb {
    left: 70%;
    top: 43%;
  }

  .entity-field__grid {
    mask-image: radial-gradient(circle at 70% 43%, #000 0 18%, rgba(0, 0, 0, 0.74) 39%, transparent 72%);
    -webkit-mask-image: radial-gradient(circle at 70% 43%, #000 0 18%, rgba(0, 0, 0, 0.74) 39%, transparent 72%);
  }

  .shell-intro {
    min-height: min(82dvh, 55rem);
    grid-template-columns: minmax(0, 1.12fr) minmax(18rem, 0.88fr);
    align-items: end;
  }

  .session-control {
    margin-left: auto;
  }

  .primary-action {
    min-width: 16rem;
  }
}

@media (max-width: 719px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .fork-switcher {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .session-control {
    grid-column: 2;
    grid-row: 1;
  }

  .shell-intro {
    min-height: min(78dvh, 48rem);
  }

  .shell-intro__copy {
    margin-top: 0.4rem;
  }

  .entity-field__grid {
    background-size: 58px 58px;
  }
}

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