/* RE Program Wiki — Part 6 premium reading platform.
   A dark Kaspload-style frame surrounds calm, high-contrast reading surfaces.
   The layer is additive: old components remain functional if this file is absent. */

:root {
  --color-frame-950: #050914;
  --color-frame-900: #081222;
  --color-frame-850: #0b182b;
  --color-frame-line: #1b2b43;
  --color-frame-text: #edf5ff;
  --color-frame-muted: #a9b9cf;
  --color-dragon: #f0445e;
  --color-dragon-soft: #ffe9ed;
  --font-display: "Segoe UI Variable Display", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  --shadow-premium: 0 28px 80px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.12);
  --shadow-card-hover: 0 18px 42px rgba(5, 9, 20, 0.13);
  --radius-premium: 1.25rem;
}

html {
  background: var(--color-frame-950);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 88% 4%, rgba(240, 68, 94, 0.09), transparent 26rem),
    radial-gradient(circle at 14% 20%, rgba(47, 140, 255, 0.13), transparent 30rem),
    linear-gradient(180deg, var(--color-frame-950), var(--color-frame-900) 52%, var(--color-frame-950));
  font-kerning: normal;
  font-synthesis: none;
  font-variant-numeric: proportional-nums;
}

h1,
h2,
h3,
.site-brand__name {
  font-family: var(--font-display);
  text-wrap: balance;
}

p,
li,
dd {
  text-wrap: pretty;
}

/* Stable, always-visible focus: outline survives forced-color mode. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 1px;
  box-shadow: 0 0 0 5px var(--color-blue-700);
}

/* Stateful light-surface controls must not replace the visible focus cue. */
.search-result:focus-visible,
.article-toc-inline .article-toc__link[aria-current="location"]:focus-visible {
  outline: var(--focus-width) solid var(--color-blue-700);
  outline-offset: 2px;
}

/* App frame */
.site-header {
  border-bottom-color: rgba(143, 194, 255, 0.16);
  background: rgba(5, 9, 20, 0.9);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.16);
}

.site-brand,
.site-brand:visited,
.site-brand__name {
  color: var(--color-frame-text);
}

.site-brand__descriptor {
  color: var(--color-blue-300);
}

.site-header .search-trigger,
.site-header .search-trigger:visited,
.site-header .icon-button {
  border-color: var(--color-frame-line);
  color: var(--color-frame-muted);
  background: var(--color-frame-850);
  text-decoration: none;
}

.site-header .search-trigger:hover,
.site-header .icon-button:hover {
  border-color: rgba(143, 194, 255, 0.55);
  color: var(--color-frame-text);
  background: #10213a;
}

.site-header .search-trigger__hint {
  border-color: var(--color-frame-line);
  color: var(--color-frame-muted);
  background: var(--color-frame-900);
}

.site-header .button--primary {
  border-color: var(--color-blue-500);
  color: #ffffff;
  background: linear-gradient(135deg, var(--color-blue-700), #176fe7);
  box-shadow: 0 8px 22px rgba(47, 140, 255, 0.22);
}

.reading-progress {
  position: fixed;
  z-index: calc(var(--z-sticky) + 1);
  top: calc(var(--header-height) - 2px);
  left: 0;
  width: 100%;
  height: 2px;
  overflow: hidden;
  pointer-events: none;
}

.reading-progress > span {
  width: 100%;
  height: 100%;
  display: block;
  background: linear-gradient(90deg, var(--color-blue-500), var(--color-dragon));
  box-shadow: 0 0 10px rgba(47, 140, 255, 0.55);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

.site-sidebar {
  border-color: var(--color-frame-line);
  background: rgba(8, 18, 34, 0.88);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(0.75rem);
}

.site-nav__group + .site-nav__group {
  border-top-color: var(--color-frame-line);
}

.site-nav__label {
  color: #7186a3;
}

.site-nav__link,
.site-nav__link:visited {
  color: var(--color-frame-muted);
}

.site-nav__link:hover {
  color: var(--color-frame-text);
  background: rgba(47, 140, 255, 0.08);
}

.site-nav__link[aria-current="page"] {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(47, 140, 255, 0.2), rgba(47, 140, 255, 0.07));
  box-shadow: inset 3px 0 var(--color-blue-500);
}

.article-rail {
  border-left-color: var(--color-frame-line);
}

.article-rail .article-toc__title {
  color: var(--color-frame-text);
}

.article-rail .article-toc__link,
.article-rail .article-toc__link:visited {
  color: var(--color-frame-muted);
}

.article-rail .article-toc__link:hover,
.article-rail .article-toc__link[aria-current="location"] {
  color: #ffffff;
}

.article-card {
  border-color: rgba(215, 226, 240, 0.9);
  border-radius: var(--radius-premium);
  box-shadow: var(--shadow-premium);
}

.page-header::before {
  background: linear-gradient(180deg, var(--color-blue-500), var(--color-dragon));
}

.page-header h1 {
  max-width: 18ch;
  font-weight: 800;
}

.article-body > section + section {
  border-image: linear-gradient(90deg, var(--color-blue-100), transparent) 1;
}

.article-body h2 {
  font-weight: 700;
}

.quick-answer {
  overflow: hidden;
  border-color: rgba(47, 140, 255, 0.3);
  background: linear-gradient(135deg, #eef6ff, #ffffff 62%);
  box-shadow: inset 4px 0 var(--color-blue-500);
}

.release-entry,
.roadmap-card {
  transition: border-color var(--duration-base) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard);
}

.release-entry {
  border-radius: 1rem;
  background: linear-gradient(145deg, #ffffff, #fbfdff);
}

.release-entry--current {
  border-color: rgba(240, 68, 94, 0.42);
  box-shadow: inset 4px 0 var(--color-dragon), 0 16px 42px rgba(240, 68, 94, 0.08);
}

.release-entry__meta .badge {
  margin-bottom: var(--space-4);
}

.release-entry__meta code {
  font-size: var(--font-size-lg);
  letter-spacing: -0.03em;
}

.section-heading {
  margin-bottom: var(--space-6);
}

.section-heading h2 {
  margin: var(--space-2) 0 var(--space-3);
}

.section-heading p {
  max-width: var(--measure-lead);
  margin-bottom: 0;
  color: var(--color-muted);
  font-size: var(--font-size-lg);
  line-height: var(--line-height-lead);
}

/* Roadmap */
.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-6) 0;
}

.status-legend > span {
  min-height: var(--target-min);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-full);
  color: var(--color-muted);
  background: var(--color-surface);
  font-size: var(--font-size-sm);
}

.status-dot {
  width: 0.65rem;
  height: 0.65rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--color-blue-500);
  box-shadow: 0 0 0 4px rgba(47, 140, 255, 0.12);
}

.status-dot--live {
  background: var(--color-success);
  box-shadow: 0 0 0 4px rgba(20, 108, 67, 0.12);
}

.status-dot--gate {
  background: var(--color-dragon);
  box-shadow: 0 0 0 4px rgba(240, 68, 94, 0.12);
}

.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.roadmap-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  border: 1px solid var(--color-line);
  border-radius: 1rem;
  background: linear-gradient(155deg, #ffffff, #f8fbff);
}

.roadmap-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.roadmap-card__top code {
  color: var(--color-blue-800);
  font-size: var(--font-size-lg);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.roadmap-card h3 {
  margin-bottom: var(--space-3);
  font-size: var(--font-size-h3);
}

.roadmap-card > p {
  flex: 1;
  color: var(--color-muted);
}

.roadmap-card__gate {
  display: grid;
  gap: var(--space-1);
  margin-top: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-line);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-compact);
}

.roadmap-card__gate strong {
  color: var(--color-blue-700);
  font-size: var(--font-size-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.roadmap-card__gate span {
  color: var(--color-muted);
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.source-card,
.source-card:visited {
  min-height: 8rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-5);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  color: var(--color-navy-950);
  background: var(--color-surface);
  text-decoration: none;
}

.source-card > span {
  color: var(--color-blue-700);
  font-size: var(--font-size-xs);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.source-card > strong {
  margin: var(--space-1) 0;
  font-size: var(--font-size-lg);
}

.source-card > small {
  color: var(--color-muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-compact);
}

/* Homepage inside the dark knowledge frame */
.home-hero {
  border-color: rgba(143, 194, 255, 0.22);
  background:
    radial-gradient(circle at 86% 18%, rgba(240, 68, 94, 0.17), transparent 14rem),
    radial-gradient(circle at 68% 72%, rgba(47, 140, 255, 0.18), transparent 18rem),
    linear-gradient(145deg, #07111f, #0a1a30 60%, #101226);
  box-shadow: 0 36px 90px rgba(0, 0, 0, 0.34);
}

.home-hero::before {
  background: linear-gradient(180deg, var(--color-blue-500), var(--color-dragon));
}

.home-hero h1 {
  max-width: 14ch;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.home-section__head h2 {
  color: var(--color-frame-text);
}

.home-section__head p {
  color: var(--color-frame-muted);
}

.home-section__head .page-kicker {
  color: var(--color-blue-300);
}

.journey-card,
.capability-ledger,
.home-flow-panel,
.trust-panel,
.directory-group,
.contact-card,
.home-version-strip {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09);
}

.journey-card::before {
  background: linear-gradient(90deg, var(--color-blue-500), var(--color-dragon));
}

.release-card {
  border-color: rgba(240, 68, 94, 0.34);
  background: linear-gradient(145deg, #fff7f8, #f3f8ff 64%, #ffffff);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.16);
}

.release-card::before {
  background: var(--color-dragon);
}

.history-portal {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.history-door,
.history-door:visited {
  min-width: 0;
  min-height: 9rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-5);
  align-items: center;
  padding: var(--space-6);
  border: 1px solid var(--color-frame-line);
  border-radius: var(--radius-premium);
  color: var(--color-frame-text);
  background: linear-gradient(145deg, rgba(15, 34, 60, 0.96), rgba(8, 18, 34, 0.96));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  text-decoration: none;
}

.history-door--future {
  background:
    radial-gradient(circle at 100% 0, rgba(240, 68, 94, 0.15), transparent 12rem),
    linear-gradient(145deg, rgba(15, 34, 60, 0.96), rgba(8, 18, 34, 0.96));
}

.history-door__number {
  color: var(--color-blue-300);
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.07em;
  line-height: 1;
}

.history-door--future .history-door__number {
  color: #ff8295;
}

.history-door strong,
.history-door small {
  display: block;
}

.history-door strong {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-heading);
}

.history-door small {
  margin-top: var(--space-1);
  color: var(--color-frame-muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-compact);
}

.history-door > .icon {
  color: var(--color-blue-300);
}

.home-closing {
  border: 1px solid rgba(143, 194, 255, 0.2);
  background: linear-gradient(135deg, #07111f, #0b203c);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.site-footer {
  border-top: 1px solid var(--color-frame-line);
  background: #03070f;
}

.mobile-drawer {
  border-right-color: var(--color-frame-line);
  background: var(--color-frame-900);
}

.mobile-drawer__header {
  border-bottom-color: var(--color-frame-line);
  background: var(--color-frame-900);
}

.mobile-drawer__header h2 {
  color: var(--color-frame-text);
}

.mobile-drawer__header .page-kicker {
  color: var(--color-blue-300);
}

.mobile-drawer__header .icon-button {
  border-color: var(--color-frame-line);
  color: var(--color-frame-text);
  background: var(--color-frame-850);
}

/* Protect reading content and footer controls in standalone/fullscreen layouts.
   The regular gutter remains the minimum when a device has no display cutout. */
@supports (padding: max(0px)) {
  .home-layout,
  .wiki-layout,
  .site-footer__inner {
    padding-left: max(var(--page-gutter), env(safe-area-inset-left));
    padding-right: max(var(--page-gutter), env(safe-area-inset-right));
  }

  .site-footer__inner {
    padding-bottom: max(var(--space-10), env(safe-area-inset-bottom));
  }

  .mobile-drawer {
    padding-left: max(var(--space-4), env(safe-area-inset-left));
  }
}

/* Keep the only destination in each capability row available on phones. */
@media (max-width: 44.999rem) {
  .capability-row__link {
    min-width: 7rem;
    display: inline-flex;
    grid-column: 1 / -1;
    justify-self: start;
    gap: var(--space-2);
    padding-inline: var(--space-3);
    border: 1px solid var(--color-blue-300);
    border-radius: var(--radius-full);
  }

  .capability-row__link::before {
    content: "Открыть";
    font-size: var(--font-size-sm);
    font-weight: 700;
  }

  .roadmap-grid,
  .source-grid,
  .history-portal {
    grid-template-columns: 1fr;
  }

  .history-door {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .history-door > .icon {
    display: none;
  }

  .roadmap-card,
  .release-entry {
    padding: var(--space-5);
  }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .source-card,
  .history-door {
    transition: transform var(--duration-base) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard), border-color var(--duration-base) var(--ease-standard);
  }

  .source-card:hover,
  .history-door:hover {
    border-color: rgba(47, 140, 255, 0.44);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: more) {
  .article-card,
  .release-entry,
  .roadmap-card,
  .source-card,
  .journey-card,
  .directory-group {
    border-width: 2px;
  }
}

@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0s;
  }
}
