/*
CAELIX — Constructive Algorithmics for Emergent Lattice Interaction eXperiments
SPDX-License-Identifier: AGPL-3.0-or-later
Copyright (C) 2026 Alan Ball

*/

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700&family=Raleway:wght@300;400&family=Inter:wght@300;400;500&family=JetBrains+Mono:wght@300&display=swap');

:root {
  --col-bg:       #000000;
  --col-surface:  #1c0e0e;
  --col-text:     #ffffff;
  --col-muted:    #bdbdca;
  --col-grey:     #a0a0a0;
  --col-accent:   #9245de;
  --col-cool:     #c493f5;
  --col-links:    #8aacf6;
  --col-title:    #6a90e3;
  --col-vacuum:   #3d3333;
  --col-pale:     #d7d08e;

  --font-display: 'Orbitron', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-tagline: 'Raleway', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --stage-max-w: 430px;
  --stage-side-pad: 4px;
  --header-safe-top: env(safe-area-inset-top, 0px);
  --footer-safe-bottom: env(safe-area-inset-bottom, 0px);
  --col-line:     rgba(255,255,255,0.08);
  --col-panel:    rgba(20,12,18,0.96);
  --col-panel-2:  rgba(36,18,18,0.92);
  --page-radius:  18px;
  --page-shadow:  0 0 28px rgba(125,50,230,0.12);
  --anim-overlay-top-pad: 56px;
  --anim-stage-top-nudge: 48px;
  --anim-ui-button-h: 24px;
  --anim-ui-button-gap: 8px;
  --anim-ui-button-radius: 0px;
  --anim-ui-box-pad-x: 8px;
  --anim-ui-box-pad-y: 6px;
  --anim-ui-line-gap: 15px;
  --anim-ui-font-size: 12px;
  --anim-ui-desc-min-lines: 2;
  --anim-ui-panel-fill: rgba(20,12,18,0.88);
  --anim-ui-panel-stroke: rgba(255,255,255,0.08);
  --anim-ui-button-on-fill: rgba(255,255,255,0.16);
  --anim-ui-button-on-stroke: rgba(255,255,255,0.30);
  --anim-ui-button-off-fill: rgba(20,12,18,0.88);
  --anim-ui-button-off-stroke: rgba(255,255,255,0.10);
}

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

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

body {
  overflow: hidden;
}

body.document-page {
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(125,50,230,0.16), transparent 34%),
    linear-gradient(180deg, #050505 0%, #000000 100%);
}

body.document-page.document-phone-shell {
  display: flex;
  justify-content: center;
}

/* ---- Header ---- */

.site-header {
  position: relative;
  z-index: 10;
  padding: 0.18rem 1.5rem 0.28rem;
  text-align: center;
  background: linear-gradient(180deg, var(--col-bg) 60%, transparent);
  pointer-events: auto;
  cursor: pointer;
}

.logo {
  font-family: var(--font-display);
  font-size: 72px;
  letter-spacing: clamp(3px, 1.5vw, 10px);
  background: linear-gradient(
    90deg,
    #ededf1 0%,
    #9785c1 20%,
    #ffffff 42%,
    #86acd6 61%,
    #ffffff 78%,
    #ad9acd 100%
  );
  background-size: 260% 100%;
  background-position: 12% 50%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 60s linear infinite;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(125,50,230,0.10));
}

@keyframes shimmer {
  0%   { background-position: 12% 50%; }
  23%  { background-position: 66% 50%; }
  49%  { background-position: 31% 50%; }
  74%  { background-position: 84% 50%; }
  100% { background-position: 12% 50%; }
}

.tagline {
  font-family: var(--font-tagline);
  font-weight: 300;
  font-size: clamp(0.4rem, 2.5vw, 0.8rem);
  color: var(--col-text);
  margin-top: 0.08rem;
  letter-spacing: 0.5px;
  text-shadow: 0 0 8px rgba(255,255,255,0.06);
}

/* ---- Animation area ---- */

.anim-container {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, calc(var(--stage-max-w) + (var(--stage-side-pad) * 2)));
  height: 100%;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: calc(4rem + var(--header-safe-top));
  padding-right: var(--stage-side-pad);
  padding-bottom: calc(2rem + var(--footer-safe-bottom));
  padding-left: var(--stage-side-pad);
}

#anim-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

#anim-canvas.anim-fade {
  opacity: 0;
}

/* ---- Animation label + hint ---- */

.anim-meta {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, calc(var(--stage-max-w) + (var(--stage-side-pad) * 2)));
  z-index: 10;
  padding: 0.1rem var(--stage-side-pad) var(--footer-safe-bottom);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  pointer-events: none;
  background: linear-gradient(0deg, var(--col-bg) 28%, transparent);
}

.anim-progress {
  width: 100%;
  height: 2px;
  background: transparent;
  overflow: hidden;
}

.anim-progress-fill {
  width: 0%;
  height: 100%;
  background: rgba(160,160,160,0.72);
  transition: width 120ms linear;
}

.anim-progress.hidden {
  opacity: 0;
}

.anim-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

#anim-label {
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 0.9rem;
  color: var(--col-cool);
  letter-spacing: 0.3px;
  text-align: center;
}

#anim-hint.visible {
  color: rgba(255,255,255,0.25);
}

/* ---- Post-suite documents panel ---- */

.suite-summary[hidden] {
  display: none !important;
}

.suite-summary {
  position: absolute;
  inset: 0;
  z-index: 30;
  overflow-y: auto;
  background:
    radial-gradient(circle at top, rgba(125,50,230,0.16), transparent 34%),
    linear-gradient(180deg, #050505 0%, #000000 100%);
}

.suite-summary-inner {
  width: min(100%, var(--stage-max-w));
  margin: 0 auto;
  padding:
    calc(0.95rem + var(--header-safe-top))
    calc(0.75rem + var(--stage-side-pad))
    calc(1rem + var(--footer-safe-bottom));
}

.suite-documents-header {
  margin: 0 0 0.75rem;
}

.suite-documents-kicker {
  font-family: var(--font-tagline);
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--col-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.suite-summary h2 {
  font-family: var(--font-tagline);
  margin: 0 0 0.6rem;
  font-size: 1.0rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--col-cool);
  letter-spacing: 0.01em;
}

.suite-summary h3 {
  font-family: var(--font-tagline);
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--col-pale);
  letter-spacing: 0.01em;
}

.suite-summary p {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 400;
  line-height: 1.52;
  color: rgba(232,232,236,0.96);
}

.suite-summary p + p {
  margin-top: 0.65rem;
}

.suite-summary h2 + p,
.suite-summary h2 + .suite-documents-group,
.suite-summary h3 + p,
.suite-summary h3 + ul {
  margin-top: 0;
}

.suite-documents-links {
  margin: 0.9rem 0 0;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--col-line);
  border-radius: var(--page-radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.018), rgba(255,255,255,0.01));
}

.suite-documents-group + .suite-documents-group,
.suite-documents-group + .suite-documents-actions {
  margin-top: 0.8rem;
}

.suite-summary a {
  color: var(--col-links);
  text-decoration: none;
}

.suite-summary a:hover {
  text-decoration: underline;
}

.suite-summary ul {
  margin: 0.5rem 0 0 1.1rem;
  padding: 0;
}

.suite-summary li {
  margin: 0.28rem 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: rgba(232,232,236,0.96);
}

.suite-restart-button {
  appearance: none;
  border: 1px solid rgba(106,164,236,0.28);
  border-radius: 999px;
  background: rgba(106,164,236,0.08);
  color: var(--col-text);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.72rem 1rem;
  cursor: pointer;
}

.suite-restart-button:hover {
  background: rgba(106,164,236,0.14);
}

/* ---- Document pages ---- */

.document-main {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

body.document-page.document-phone-shell .document-main-phone-shell {
  width: min(100%, calc(var(--stage-max-w) + (var(--stage-side-pad) * 2)));
  margin: 0 auto;
}

@media (min-width: 481px) {
  body.document-page.document-phone-shell .document-main-phone-shell,
  body.document-page.document-phone-shell .document-nav-inner {
    width: min(100%, 446px);
  }
}

.document-header {
  padding: calc(0.95rem + var(--header-safe-top)) 1rem 0.9rem;
  border: 1px solid var(--col-line);
  border-radius: var(--page-radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
}

.document-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 5vw, 1.25rem);
  color: var(--col-title);
  line-height: 1.02;
  letter-spacing: 0.02em;
}

.document-subtitle {
  margin: 0;
  font-family: var(--font-tagline);
  font-size: clamp(0.9rem, 5vw, 0.9rem);
  color: var(--col-text);
  line-height: 1.02;
  letter-spacing: 0.02em;
}

.document-section {
  margin: 0.75rem 0.75rem 0;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--col-line);
  border-radius: var(--page-radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.018), rgba(255,255,255,0.01));
}

.document-heading {
  font-family: var(--font-tagline);
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--col-cool);
  letter-spacing: 0.01em;
}
.document-page h3 {
  font-family: var(--font-tagline);
  margin: 0.75rem 0 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--col-pale);
  letter-spacing: 0.01em;
}

.document-page .ref-lite {
  color: var(--col-grey);
  font-size: 0.75em;
}

.document-page p {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 400;
  line-height: 1.52;
  color: rgba(232,232,236,0.96);
}

.document-page p + p {
  margin-top: 0.65rem;
}

.document-page ul,
.document-page ol {
  margin: 0.55rem 0 0 1.15rem;
  padding: 0;
}

.document-page li {
  margin: 0.28rem 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: rgba(232,232,236,0.96);
}

.document-page table {
  width: 100%;
  margin-top: 0.7rem;
  border-collapse: collapse;
  border: 1px solid var(--col-line);
  font-size: 0.78rem;
  line-height: 1.45;
  background: rgba(255,255,255,0.015);
}

.document-page thead {
  background: rgba(106,164,236,0.08);
}

.document-page th,
.document-page td {
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--col-line);
  text-align: left;
  vertical-align: top;
}

.document-page th {
  font-weight: 600;
  color: var(--col-cool);
}

.document-page td {
  color: rgba(232,232,236,0.96);
}

.document-page a {
  color: var(--col-links);
  text-decoration: none;
}

.document-page a:hover {
  text-decoration: underline;
}

.document-page blockquote {
  margin: 0;
  padding: 0.2rem 0 0.2rem 0.9rem;
  border-left: 2px solid rgba(186,149,255,0.32);
}

.document-page hr {
  border: 0;
  border-top: 1px solid rgba(255,255,255,0.14);
  margin: 0;
}

.document-page mjx-container[display="true"] {
  display: block;
  margin: 0.55rem 0 0.25rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.2rem;
}

/* ---- Document nav (future markup) ---- */

body.document-page.has-doc-nav .document-main {
  padding-top: calc(66px + var(--header-safe-top));
}

.document-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 40;
  background: linear-gradient(180deg, rgba(0,0,0,0.96) 0%, rgba(0,0,0,0.82) 72%, rgba(0,0,0,0.0) 100%);
}

.document-nav-inner {
  width: min(100%, calc(var(--stage-max-w) + (var(--stage-side-pad) * 2)));
  margin: 0 auto;
  padding:
    calc(0.55rem + var(--header-safe-top))
    0
    0.7rem;
}

.document-nav-grid {
  display: grid;
  grid-template-columns: repeat(4, 105px);
  justify-content: center;
  gap: 0.4rem 0.4rem;
}

.document-nav-item {
  position: relative;
  display: block;
  width: 105px;
  height: 51px;
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none;
  background: #ffffff;
  isolation: isolate;
  filter: drop-shadow(0 0px 8px rgba(0,0,0,1.0));
}


.document-nav-art {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  opacity: 1.0;

}


.document-nav-label {
  position: absolute;
  inset: 0;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0.03em;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-shadow:
    -3px -3px 0 rgba(0,0,0,0.75),
     3px -3px 0 rgba(0,0,0,0.75),
    -3px  3px 0 rgba(0,0,0,0.75),
     3px  3px 0 rgba(0,0,0,0.75),
     0 0 8px rgba(0,0,0,0.30);
}


.document-nav-item:active {
  transform: translateY(1px);
}

/* ---- Utilities ---- */

@media (max-width: 480px) {
  :root {
    --anim-overlay-top-pad: 40px;
    --anim-stage-top-nudge: 30px;
    --anim-ui-button-h: 22px;
    --anim-ui-button-gap: 7px;
    --anim-ui-box-pad-x: 8px;
    --anim-ui-box-pad-y: 6px;
    --anim-ui-line-gap: 15px;
    --anim-ui-font-size: 12px;
    --anim-ui-desc-min-lines: 2;
  }
  .site-header {
    padding: 0.14rem 1rem 0.24rem;
  }
  .anim-container {
    padding-top: calc(5.5rem + var(--header-safe-top));
    padding-bottom: calc(1.5rem + var(--footer-safe-bottom));
  }
  .suite-summary-inner {
    width: 100%;
    padding:
      calc(0.85rem + var(--header-safe-top))
      calc(0.65rem + var(--stage-side-pad))
      calc(0.9rem + var(--footer-safe-bottom));
  }
  .suite-summary p,
  .suite-summary li {
    font-size: 0.82rem;
    line-height: 1.48;
  }
  .suite-documents-links {
    margin-top: 0.8rem;
    padding: 0.8rem 0.85rem;
  }
  .document-main {
    width: 100%;
    margin: 0;
  }
  .document-header {
    padding: 0.85rem 0.9rem 0.8rem;
    border-radius: var(--page-radius);
  }
  .document-page h3 {
    font-size: 0.76rem;
    margin: 0.7rem 0 0.4rem;
  }
  .document-section {
    margin: 0.65rem;
    padding: 0.8rem 0.85rem;
  }
  .document-page p {
    font-size: 0.82rem;
    line-height: 1.48;
  }
  .document-page li {
    font-size: 0.81rem;
    line-height: 1.46;
  }
  .document-page table {
    font-size: 0.73rem;
  }
  .document-page th,
  .document-page td {
    padding: 0.42rem 0.45rem;
  }
  .document-page mjx-container[display="true"] {
    margin: 0.5rem 0 0.2rem;
  }
  .document-nav-inner {
    width: 100%;
    margin: 0;
    padding:
      calc(0.45rem + var(--header-safe-top))
      0
      0.65rem;
  }
  .document-nav-grid {
    gap: 0.4rem;
  }
}