/*
  Aletheos vanilla skin
  Scope: ordinary public pages.
  P900 observatory keeps its own app stylesheet.
*/

:root {
  --bg: #fafafa;
  --panel: #ffffff;
  --panel-soft: #f6f7f8;
  --text: #18181b;
  --muted: #5f6368;
  --soft: #8a8f98;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --accent: #1f2937;
  --accent-soft: #f1f5f9;
  --link: #1d4ed8;
  --max: 1120px;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  font-size: 16px;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

img,
svg,
canvas {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--link);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: #0f172a;
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  margin: 0 0 1.25rem;
  padding-left: 1.3rem;
}

li + li {
  margin-top: 0.35rem;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

pre,
.research-code {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fafc;
}

/* Header */

.global-header {
  background: rgba(250, 250, 250, 0.96);
  border-bottom: 1px solid var(--border);
}

.global-header__inner {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.85rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.brand-mark__sigil {
  width: 2rem;
  height: 2rem;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.95rem;
}

.brand-mark__text {
  letter-spacing: -0.02em;
}

.global-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem;
}

.global-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.global-nav__link:hover {
  background: var(--accent-soft);
  color: var(--text);
}

/* Layout */

.site-shell,
.research-page,
.labs-page,
.fct-page,
.collapse-tool-page {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.hero,
.research-hero,
.fct-hero,
.tool-header,
.index-section,
.research-section,
.fct-section,
.mission-section,
.approach-section,
.scope-section,
.archive-section,
.artifacts-section,
.constructor-section,
.papers-section,
.labs-page section,
.collapse-panel,
.tool-panel {
  margin: 0 0 1.5rem;
  padding: clamp(1.25rem, 2vw, 2rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero {
  padding-top: clamp(2rem, 6vw, 4rem);
  padding-bottom: clamp(2rem, 6vw, 4rem);
}

.hero-grid,
.prose-grid,
.comparison-grid,
.principle-grid,
.card-grid,
.artifacts-grid,
.paper-grid,
.cw-detail-grid,
.collapse-grid,
.collapse-grid--tool,
.cw-readout-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.hero-copy,
.section-head,
.hero-text,
.fct-intro,
.constructor-feature__copy {
  grid-column: span 7;
}

.hero-emblem,
.fct-intro-graphic,
.constructor-feature__media {
  grid-column: span 5;
}

.feature-card,
.index-card,
.principle-card,
.comparison-card,
.lens-card,
.tool-panel,
.collapse-panel,
.cw-readout {
  grid-column: span 4;
}

.collapse-panel--featured,
.collapse-panel--bubble {
  grid-column: span 6;
}

.artifact-list,
.link-list,
.compact-list {
  list-style: none;
  padding-left: 0;
}

.artifact-list li,
.link-list li,
.compact-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.artifact-list li:last-child,
.link-list li:last-child,
.compact-list li:last-child {
  border-bottom: 0;
}

/* Type */

.eyebrow,
.section-kicker,
.card-label,
.fct-kicker {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0 0 0.75rem;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

h1,
.hero-title {
  font-size: clamp(2.25rem, 6vw, 4.75rem);
  max-width: 12ch;
}

h2 {
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

h3 {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.hero-text,
.hero-text--secondary,
.section-text,
.section-text--spaced,
.fct-subtitle,
.closing-line {
  max-width: 68ch;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.12rem);
}

.section-text--spaced p + p {
  margin-top: 1rem;
}

/* Cards */

.feature-card,
.index-card,
.principle-card,
.comparison-card,
.lens-card,
.archive-placeholder,
.fct-callout,
.fct-diagram-card,
.tool-notes,
.cw-howto,
.cw-status,
.cw-provenance,
.cw-details,
.controls-panel {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.comparison-card--accent {
  background: #f8fafc;
  border-color: var(--border-strong);
}

.card-label {
  display: block;
}

/* Buttons */

.hero-actions,
.tool-header__actions,
.constructor-feature__cta,
.fct-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.button,
.button-secondary,
.button--primary,
.button--secondary,
.cw-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.55rem;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.button--primary,
.button.primary,
.cw-button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.button:hover,
.button-secondary:hover,
.button--secondary:hover,
.cw-button:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.button--primary:hover,
.button.primary:hover,
.cw-button.primary:hover {
  background: #111827;
  color: #ffffff;
}

/* Forms and controls */

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea,
.cw-control input,
.cw-control select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
}

.cw-control {
  display: grid;
  gap: 0.35rem;
}

.cw-control label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

/* Visual odds and ends */

.hero-emblem,
.orbital-mark,
.intro-graph,
.fct-diagram-card {
  display: grid;
  place-items: center;
}

.orbital-mark {
  min-height: 220px;
}

.orbital-mark__ring,
.orbital-mark__point {
  border-color: var(--border-strong);
}

.fct-caption,
.emblem-caption,
.doi-line,
.cw-readout__label {
  color: var(--muted);
  font-size: 0.9rem;
}

.collapse-svg {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.current-state-json,
#current-state-json {
  max-height: 260px;
  overflow: auto;
}

/* Footer */

.site-footer,
.global-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  background: var(--bg);
}

.site-footer__inner,
.global-footer__inner {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0;
}

/* Responsive */

@media (max-width: 820px) {
  .global-header__inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .global-nav {
    justify-content: flex-start;
  }

  .hero-grid,
  .prose-grid,
  .comparison-grid,
  .principle-grid,
  .card-grid,
  .artifacts-grid,
  .paper-grid,
  .cw-detail-grid,
  .collapse-grid,
  .collapse-grid--tool,
  .cw-readout-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .section-head,
  .hero-text,
  .fct-intro,
  .constructor-feature__copy,
  .hero-emblem,
  .fct-intro-graphic,
  .constructor-feature__media,
  .feature-card,
  .index-card,
  .principle-card,
  .comparison-card,
  .lens-card,
  .tool-panel,
  .collapse-panel,
  .collapse-panel--featured,
  .collapse-panel--bubble,
  .cw-readout {
    grid-column: auto;
  }

  h1,
  .hero-title {
    max-width: none;
  }
}

/* Homepage AT4val desktop composition */

@media (min-width: 980px) {
  .hero.home-hero,
  .hero:has(.intro-graph--at4val) {
    position: relative;
    min-height: 560px;
    overflow: hidden;
  }

  .hero.home-hero .home-hero__copy,
  .hero:has(.intro-graph--at4val) .home-hero__copy {
    max-width: 58%;
  }

  .hero .intro-graph--at4val {
    float: none;
    position: absolute;
    top: 4.5rem;
    right: clamp(2rem, 6vw, 6rem);
    width: min(38vw, 520px);
    max-width: 520px;
    margin: 0;
    opacity: 0.92;
  }

  .hero .intro-graph--at4val canvas {
    width: 100%;
    height: auto;
    min-height: 380px;
  }

  .hero:has(.intro-graph--at4val) .hero-text,
  .hero:has(.intro-graph--at4val) .hero-actions {
    max-width: 58ch;
  }
}

@media (max-width: 979px) {
  .hero .intro-graph--at4val {
    position: static;
    float: none;
    width: 100%;
    margin: 1.25rem 0;
  }
}

/* Thalean graph page AT4val viewer */

.graph-page-viewer {
  margin: 1.5rem 0 2rem;
}

@media (min-width: 980px) {
  .graph-page-viewer {
    float: right;
    width: min(42vw, 560px);
    max-width: 560px;
    margin: -0.75rem 0 2rem 3rem;
  }

  .graph-page-viewer canvas {
    width: 100%;
    height: auto;
    min-height: 390px;
  }

  .graph-page-viewer + p,
  .graph-page-viewer ~ p {
    max-width: 66ch;
  }
}

@media (max-width: 979px) {
  .graph-page-viewer {
    float: none;
    width: 100%;
    margin: 1.25rem 0 2rem;
  }

  .graph-page-viewer canvas {
    width: 100%;
    min-height: 300px;
  }
}

/* Gentle global style pass */

:root {
  --page-bg: #f7f6f2;
  --surface: #ffffff;
  --surface-soft: #fbfaf7;
  --ink: #15171d;
  --muted: #5f6670;
  --line: #e3e0d8;
  --line-strong: #d2cec3;
  --button-ink: #1e2937;
  --shadow-soft: 0 18px 48px rgba(21, 23, 29, 0.07);
  --shadow-card: 0 10px 30px rgba(21, 23, 29, 0.055);
}

body {
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.95), rgba(247,246,242,0) 34rem),
    var(--page-bg);
  color: var(--ink);
}

.site-shell {
  padding-top: clamp(1.25rem, 3vw, 2.5rem);
  padding-bottom: clamp(3rem, 7vw, 6rem);
}

.hero,
.index-section,
.panel,
.fct-hero,
.fct-section {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

.hero,
.fct-hero {
  padding-top: clamp(2rem, 5vw, 4.75rem);
  padding-bottom: clamp(2rem, 5vw, 4.75rem);
}

.index-section,
.panel,
.fct-section {
  padding-top: clamp(1.75rem, 4vw, 3rem);
  padding-bottom: clamp(1.75rem, 4vw, 3rem);
}

.eyebrow,
.card-label,
.fct-kicker {
  color: var(--muted);
  letter-spacing: 0.14em;
  font-weight: 760;
}

h1,
h2,
h3 {
  letter-spacing: -0.055em;
}

.hero-text,
.section-text,
.index-card p,
.fct-intro p,
.fct-section p {
  color: var(--muted);
  line-height: 1.62;
}

.hero-text,
.section-text,
.fct-intro p {
  max-width: 72ch;
}

.index-card,
.fct-diagram-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-soft));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}

.index-card {
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.index-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 16px 38px rgba(21, 23, 29, 0.08);
}

.button {
  border-radius: 999px;
  font-weight: 760;
  letter-spacing: -0.025em;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, background 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: var(--button-ink);
  box-shadow: 0 10px 24px rgba(30, 41, 55, 0.16);
}

.button--secondary {
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line-strong);
}

.fct-callout {
  background: #f2efe7;
  border-color: var(--line-strong);
  color: var(--ink);
}

.fct-caption,
.fct-intro-graphic .fct-visually-hidden {
  color: var(--muted);
}

@media (max-width: 720px) {
  .site-shell {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .hero,
  .index-section,
  .panel,
  .fct-hero,
  .fct-section {
    border-radius: 1.1rem;
  }

  h1 {
    letter-spacing: -0.06em;
  }
}
