:root {
  --bg: #0b1424;
  --bg-alt: #101d33;
  --panel: rgba(24, 36, 61, 0.84);
  --panel-strong: rgba(18, 29, 51, 0.96);
  --panel-soft: rgba(34, 49, 79, 0.72);
  --text: #eff7ff;
  --muted: #9bb6d3;
  --cyan: #3bc7ff;
  --cyan-soft: rgba(59, 199, 255, 0.16);
  --green: #22c58b;
  --amber: #ffb347;
  --red: #ff6f7b;
  --line: rgba(141, 179, 219, 0.18);
  --shadow: 0 22px 80px rgba(4, 12, 24, 0.42);
  --radius: 24px;
  --radius-sm: 16px;
  --max: 1440px;
  --mono: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
  --display: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  --page-gradient:
    radial-gradient(circle at top left, rgba(58, 132, 255, 0.18), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(34, 197, 139, 0.12), transparent 22%),
    linear-gradient(180deg, #09101d 0%, #0b1424 40%, #0d1730 100%);
  --grid-line: rgba(140, 177, 214, 0.05);
  --card-bg: rgba(10, 20, 36, 0.7);
  --card-bg-soft: rgba(12, 22, 40, 0.58);
  --card-bg-strong: rgba(16, 28, 48, 0.75);
  --field-bg: rgba(10, 18, 33, 0.8);
  --theme-toggle-width: 118px;
}

html[data-theme="light"] {
  --bg: #eef3f8;
  --bg-alt: #f6f9fc;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: rgba(255, 255, 255, 0.98);
  --panel-soft: rgba(245, 249, 253, 0.96);
  --text: #24354d;
  --muted: #637792;
  --cyan: #1a9fd8;
  --cyan-soft: rgba(26, 159, 216, 0.12);
  --green: #0dbb78;
  --amber: #ff9b2f;
  --red: #d95967;
  --line: rgba(96, 127, 164, 0.2);
  --shadow: 0 18px 50px rgba(49, 76, 112, 0.12);
  --page-gradient:
    radial-gradient(circle at top left, rgba(72, 164, 212, 0.08), transparent 28%),
    radial-gradient(circle at 80% 10%, rgba(13, 187, 120, 0.05), transparent 18%),
    linear-gradient(180deg, #f7f9fc 0%, #edf2f7 42%, #eef3f8 100%);
  --grid-line: rgba(96, 127, 164, 0.08);
  --card-bg: rgba(255, 255, 255, 0.96);
  --card-bg-soft: rgba(247, 250, 253, 0.96);
  --card-bg-strong: rgba(250, 252, 255, 0.98);
  --field-bg: rgba(244, 248, 252, 0.92);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--display);
  color: var(--text);
  background: var(--page-gradient);
}

.grid-shell {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent 90%);
  pointer-events: none;
}

.topbar,
.page {
  position: relative;
  z-index: 1;
}

.topbar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px 24px 10px;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: center;
}

.brand-block,
.status-cluster,
.hero-actions,
.metric-head,
.section-heading,
.service-stat-row,
.artifact-link,
.gallery-card-footer,
.api-card-header {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 16px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #072033;
  background: linear-gradient(135deg, #8df8ff 0%, #43d3ff 48%, #18a6ff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 16px 40px rgba(24, 166, 255, 0.25);
}

.topbar h1,
.hero h2,
.section-heading h3,
.mission-band h3,
.service-detail h3,
.library-column h4,
.api-card h4 {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(1.25rem, 1.8vw, 1.75rem);
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-family: var(--mono);
}

.status-cluster {
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search-wrap {
  min-width: min(340px, 100%);
}

.search-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.search-wrap input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(98, 139, 183, 0.22);
  background: var(--field-bg);
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.search-wrap input:focus {
  border-color: rgba(59, 199, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(59, 199, 255, 0.14);
}

.status-pill,
.chip,
.tag {
  border: 1px solid var(--line);
  background: var(--card-bg);
  border-radius: 999px;
}

.theme-toggle {
  min-width: var(--theme-toggle-width);
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 14px rgba(34, 197, 139, 0.7);
}

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px 24px 64px;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.inset {
  background: var(--panel-strong);
}

.hero,
.service-layout,
.library-grid {
  display: grid;
  gap: 24px;
}

.hero {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.95fr);
  padding: 30px;
}

.hero-copy h2 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1;
  max-width: 14ch;
}

.lede,
.section-note,
.service-copy,
.artifact-meta,
.library-column p,
.api-description {
  color: var(--muted);
  line-height: 1.65;
}

.hero-actions {
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.button,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  font-weight: 700;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.98rem;
}

.button:hover,
.chip:hover,
.artifact-link:hover,
.service-button:hover {
  transform: translateY(-2px);
}

.button.primary {
  color: #041726;
  background: linear-gradient(135deg, #8ff3ff 0%, #39c7ff 50%, #0fb0ff 100%);
}

.button.ghost,
.chip {
  color: var(--text);
  background: rgba(16, 29, 51, 0.78);
  border-color: rgba(67, 122, 180, 0.28);
}

.hero-visual {
  padding: 20px;
  display: grid;
  align-content: start;
  gap: 18px;
}

.hero-visual img,
.gallery-card img,
.lightbox img {
  width: 100%;
  display: block;
  border-radius: 18px;
  border: 1px solid rgba(121, 164, 210, 0.18);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.metric {
  padding: 18px;
}

.metric-value {
  margin: 10px 0 0;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  font-weight: 800;
}

.metric-copy {
  margin: 6px 0 0;
  color: var(--muted);
}

.mission-band,
.section-block {
  padding: 24px;
  margin-top: 24px;
}

.mission-band {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
}

.decision-list,
.service-rail,
.artifact-list {
  display: grid;
  gap: 12px;
}

.decision-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card-bg-soft);
}

.decision-card strong,
.service-button strong,
.artifact-link strong,
.gallery-card h4,
.api-card h4 {
  display: block;
  margin-bottom: 6px;
}

.service-layout {
  grid-template-columns: 280px minmax(0, 1fr);
}

.service-button {
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.service-button.active {
  border-color: rgba(59, 199, 255, 0.65);
  background: linear-gradient(180deg, rgba(24, 43, 71, 0.95), rgba(12, 21, 37, 0.95));
  box-shadow: inset 0 0 0 1px rgba(59, 199, 255, 0.18);
}

.service-detail {
  padding: 24px;
}

.service-topline,
.service-stat-row,
.service-tags,
.service-links,
.api-meta,
.library-column {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.service-topline {
  justify-content: space-between;
  align-items: flex-start;
}

.service-title-block {
  max-width: 640px;
}

.service-title-block h3 {
  font-size: clamp(1.6rem, 2.4vw, 2.3rem);
}

.tag {
  padding: 8px 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.service-copy {
  margin: 12px 0 24px;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.service-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--card-bg-strong);
}

.service-card ul,
.api-card ul {
  padding-left: 18px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.service-links {
  margin-top: 24px;
}

.artifact-link {
  justify-content: space-between;
  width: 100%;
  text-decoration: none;
  color: var(--text);
  padding: 15px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card-bg);
}

.artifact-link span:last-child {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.gallery-grid,
.api-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.gallery-card,
.api-card {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  overflow: hidden;
}

.gallery-card-body,
.api-card-body {
  padding: 18px;
}

.gallery-card-footer {
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
}

.api-card-header {
  justify-content: space-between;
  gap: 16px;
}

.api-count {
  color: var(--amber);
  font-family: var(--mono);
}

.endpoint-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid rgba(141, 179, 219, 0.12);
}

.method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 10px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.endpoint-path {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: #c7dbef;
}

.endpoint-summary {
  margin-top: 4px;
  color: var(--muted);
}

.library-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.library-column {
  flex-direction: column;
  align-items: stretch;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(4, 9, 18, 0.88);
  display: grid;
  place-items: center;
  padding: 24px;
}

.lightbox.hidden {
  display: none;
}

.lightbox-body {
  width: min(1200px, 100%);
}

.lightbox-toolbar,
.zoom-controls {
  display: flex;
  align-items: center;
}

.lightbox-toolbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.zoom-controls {
  gap: 10px;
  flex-wrap: wrap;
}

.zoom-readout {
  min-width: 60px;
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
}

.lightbox-canvas {
  overflow: auto;
  max-height: calc(100vh - 120px);
  border-radius: 18px;
  border: 1px solid rgba(121, 164, 210, 0.18);
  background: var(--panel-strong);
  padding: 12px;
}

.lightbox-canvas img {
  transform-origin: top center;
  transition: transform 140ms ease;
  margin: 0 auto;
}

.term {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #dff5ff;
  border-bottom: 1px dashed rgba(59, 199, 255, 0.5);
  cursor: help;
}

.term::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(59, 199, 255, 0.85);
  box-shadow: 0 0 10px rgba(59, 199, 255, 0.55);
}

.term-tooltip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  width: min(320px, 75vw);
  padding: 14px 15px;
  border-radius: 14px;
  border: 1px solid rgba(59, 199, 255, 0.26);
  background: var(--panel-strong);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 8;
}

.term:hover .term-tooltip,
.term:focus-within .term-tooltip {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.term-tooltip strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.term-tooltip p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.5;
}

.term-tooltip a {
  color: var(--cyan);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(14, 24, 43, 0.86);
  color: var(--text);
  font-size: 1.7rem;
  cursor: pointer;
}

.hidden-by-search {
  display: none !important;
}

.yaml-viewer {
  position: fixed;
  inset: 0;
  z-index: 22;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 9, 18, 0.88);
}

.yaml-viewer.hidden {
  display: none;
}

.yaml-viewer-body {
  width: min(1240px, 100%);
  max-height: calc(100vh - 48px);
  padding: 22px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 14px;
}

.yaml-viewer-toolbar,
.yaml-viewer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.yaml-viewer-toolbar {
  justify-content: space-between;
}

.yaml-viewer-toolbar h3 {
  margin: 0;
}

.yaml-viewer-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.yaml-viewer-actions a {
  color: var(--text);
}

.yaml-filter {
  display: block;
}

.yaml-filter input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(98, 139, 183, 0.22);
  background: var(--field-bg);
  color: var(--text);
  outline: none;
}

.yaml-status {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.yaml-code-wrap {
  min-height: 320px;
  max-height: 100%;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(5, 12, 23, 0.88);
  color: #dcecff;
}

html[data-theme="light"] .yaml-code-wrap {
  background: #f8fbff;
  color: #22334b;
}

.yaml-code {
  display: block;
  min-width: max-content;
  padding: 14px 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.65;
}

.yaml-line {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  min-height: 1.65em;
}

.yaml-line:hover {
  background: rgba(59, 199, 255, 0.08);
}

.yaml-line-no {
  user-select: none;
  text-align: right;
  padding: 0 14px 0 10px;
  color: rgba(155, 182, 211, 0.65);
  border-right: 1px solid rgba(141, 179, 219, 0.14);
}

.yaml-line-code {
  white-space: pre;
  padding: 0 18px;
}

.yaml-key {
  color: #67d7ff;
  font-weight: 700;
}

.yaml-string {
  color: #8ee7b6;
}

.yaml-number {
  color: #ffca7a;
}

.yaml-bool {
  color: #c8a5ff;
}

.yaml-comment {
  color: #7e91aa;
  font-style: italic;
}

html[data-theme="light"] .yaml-key {
  color: #087fb5;
}

html[data-theme="light"] .yaml-string {
  color: #0b8355;
}

html[data-theme="light"] .yaml-number {
  color: #a15b00;
}

html[data-theme="light"] .yaml-bool {
  color: #7a4abb;
}

html[data-theme="light"] .yaml-comment {
  color: #8492a6;
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 420ms ease forwards;
}

.reveal-delay-1 { animation-delay: 40ms; }
.reveal-delay-2 { animation-delay: 90ms; }
.reveal-delay-3 { animation-delay: 140ms; }

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dossier-page {
  padding-top: 10px;
}

.dossier-hero,
.dossier-layout {
  display: grid;
  gap: 24px;
}

.dossier-hero {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.9fr);
  padding: 30px;
}

.dossier-layout {
  grid-template-columns: 320px minmax(0, 1fr);
  margin-top: 24px;
  align-items: start;
}

.dossier-sidebar {
  position: sticky;
  top: 18px;
  padding: 20px;
}

.dossier-sidebar-block + .dossier-sidebar-block {
  margin-top: 20px;
}

.dossier-nav {
  display: grid;
  gap: 10px;
}

.dossier-nav-link {
  display: block;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  background: var(--card-bg-soft);
}

.dossier-nav-link:hover {
  border-color: rgba(59, 199, 255, 0.5);
  transform: translateY(-1px);
}

.dossier-content {
  display: grid;
  gap: 18px;
}

.dossier-section {
  padding: 24px;
}

.dossier-richtext p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.7;
}

.dossier-richtext p:last-child {
  margin-bottom: 0;
}

.table-scroll {
  overflow-x: auto;
}

.dossier-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.dossier-table th,
.dossier-table td {
  padding: 14px 14px;
  border-bottom: 1px solid rgba(141, 179, 219, 0.12);
  vertical-align: top;
  text-align: left;
}

.dossier-table th {
  color: #d9ecff;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dossier-table td {
  color: var(--muted);
  line-height: 1.6;
}

.screenshot-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.screenshot-thumb {
  appearance: none;
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 7px;
  border: 1px solid rgba(74, 198, 239, 0.28);
  border-radius: 8px;
  background: rgba(8, 20, 39, 0.55);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.screenshot-thumb:hover,
.screenshot-thumb:focus-visible {
  border-color: rgba(74, 198, 239, 0.78);
  background: rgba(74, 198, 239, 0.08);
  transform: translateY(-1px);
  outline: none;
}

.screenshot-thumb img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top left;
  border-radius: 5px;
  border: 1px solid rgba(141, 179, 219, 0.18);
  background: var(--surface);
}

.screenshot-thumb span {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1120px) {
  .hero,
  .dossier-hero,
  .mission-band,
  .service-layout,
  .dossier-layout,
  .library-grid,
  .gallery-grid,
  .api-grid,
  .metrics,
  .service-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .topbar,
  .page {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero,
  .dossier-hero,
  .mission-band,
  .section-block,
  .service-detail,
  .dossier-section,
  .dossier-sidebar {
    padding: 18px;
  }

  .brand-block,
  .status-cluster,
  .section-heading,
  .gallery-card-footer,
  .service-topline,
  .lightbox-toolbar,
  .yaml-viewer-toolbar {
    align-items: flex-start;
  }

  .topbar,
  .status-cluster,
  .service-topline,
  .lightbox-toolbar,
  .yaml-viewer-toolbar {
    flex-direction: column;
  }

  .dossier-sidebar {
    position: static;
  }

  .search-wrap {
    min-width: 100%;
  }

  .yaml-viewer {
    padding: 14px;
  }

  .yaml-viewer-body {
    padding: 16px;
  }

  .yaml-line {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .yaml-line-code {
    padding: 0 12px;
  }
}
