:root {
  color-scheme: light;
  --ink: #10204e;
  --ink-soft: #34446f;
  --muted: #6b779b;
  --accent: #6558ef;
  --accent-rgb: 101, 88, 239;
  --accent-2: #50bde7;
  --accent-glow: #b8a6ff;
  --brand-accent: #6558ef;
  --brand-accent-2: #50bde7;
  --brand-accent-glow: #b8a6ff;
  --glass: rgba(248, 252, 255, 0.64);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-line: rgba(255, 255, 255, 0.86);
  --hairline: rgba(53, 75, 127, 0.11);
  --control-height: 42px;
  --radius-control: 13px;
  --radius-card: 22px;
  --radius-feature: 30px;
  --shadow-control: 0 8px 22px rgba(33, 64, 125, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  --shadow-card: 0 20px 55px rgba(46, 79, 143, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.86);
  --font-head: "Rubik", "Segoe UI", system-ui, sans-serif;
  --font-body: "Golos Text", "Segoe UI", system-ui, sans-serif;
  font-family: var(--font-body);
  font-synthesis: none;
}

@property --brand-accent {
  syntax: "<color>";
  inherits: true;
  initial-value: #6558ef;
}

@property --brand-accent-2 {
  syntax: "<color>";
  inherits: true;
  initial-value: #50bde7;
}

@property --brand-accent-glow {
  syntax: "<color>";
  inherits: true;
  initial-value: #b8a6ff;
}

:root.brand-palette-motion {
  transition:
    --brand-accent var(--brand-palette-duration, 820ms) cubic-bezier(0.22, 0.61, 0.36, 1),
    --brand-accent-2 var(--brand-palette-duration, 820ms) cubic-bezier(0.22, 0.61, 0.36, 1),
    --brand-accent-glow var(--brand-palette-duration, 820ms) cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #d7edff;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 4%, rgba(255, 255, 255, 0.94), transparent 29rem),
    radial-gradient(circle at 88% 18%, rgba(var(--accent-rgb), 0.13), transparent 32rem),
    linear-gradient(145deg, #eef8ff 0%, #cde9ff 50%, #e8f5ff 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  z-index: -3;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.23) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), transparent 58%);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

h1,
h2,
h3 {
  font-family: var(--font-head);
  scroll-margin-top: 72px;
  text-wrap: balance;
}

button,
kbd,
.eyebrow,
.topic-card__number {
  font-family: var(--font-head);
}

#mainContent {
  scroll-margin-top: 20px;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 72%, #112958 28%);
  outline-offset: 3px;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.app-shell {
  width: min(1740px, calc(100% - 64px));
  margin: 0 auto;
  padding: 16px 0 42px;
}

.app-shell--wide {
  width: min(1740px, calc(100% - 64px));
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 50%;
  padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  background: #112052;
  box-shadow: 0 12px 32px rgba(20, 36, 82, 0.25);
  color: #fff;
  font-size: 13px;
  font-weight: 720;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -140%);
  transition: opacity 140ms ease, transform 140ms ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.glass-control,
.glass-panel {
  position: relative;
  border: 1px solid var(--glass-line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(242, 249, 255, 0.42)),
    rgba(220, 239, 255, 0.34);
  box-shadow: var(--shadow-control);
  backdrop-filter: blur(24px) saturate(1.32);
  -webkit-backdrop-filter: blur(24px) saturate(1.32);
}

.glass-control::before,
.glass-panel::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.55), transparent 28%, transparent 72%, rgba(255, 255, 255, 0.18));
  pointer-events: none;
}

.glass-control > *,
.glass-panel > * {
  position: relative;
  z-index: 1;
}

.topbar {
  position: relative;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}

.topbar__left,
.topbar__actions {
  display: flex;
  align-items: center;
}

.topbar__left {
  gap: 18px;
}

.topbar__actions {
  gap: 9px;
}

.icon-button,
.action-button {
  height: var(--control-height);
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.icon-button {
  display: grid;
  width: var(--control-height);
  padding: 0;
  place-items: center;
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.action-button {
  display: inline-flex;
  min-width: 102px;
  padding: 0 14px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 720;
  letter-spacing: -0.01em;
}

.action-button--wide {
  min-width: 154px;
}

.action-button svg {
  width: 18px;
  height: 18px;
}

.action-button .sound-off {
  display: none;
}

.action-button[aria-pressed="false"] .sound-on {
  display: none;
}

.action-button[aria-pressed="false"] .sound-off {
  display: block;
}

.control-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #45c99a;
  box-shadow: 0 0 0 4px rgba(69, 201, 154, 0.13);
}

.action-button[aria-pressed="false"] .control-dot {
  background: #a8b0c5;
  box-shadow: none;
}

.icon-button:hover,
.action-button:hover,
.language-switch:hover {
  border-color: #fff;
  box-shadow: 0 12px 26px rgba(43, 73, 139, 0.14), inset 0 1px 0 #fff;
  transform: translateY(-1px);
}

.icon-button:active,
.action-button:active {
  transform: translateY(0) scale(0.98);
}

.brand {
  position: relative;
  display: flex;
  height: 34px;
  align-items: center;
}

.brand img {
  display: block;
  width: auto;
  height: 29px;
  object-fit: contain;
}

.brand::before {
  content: "";
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
}

@supports ((-webkit-mask-image: url("../assets/brand/ecliption-logo.png")) or (mask-image: url("../assets/brand/ecliption-logo.png"))) {
  .brand img {
    opacity: 0;
  }

  .brand::before {
    display: block;
    background:
      linear-gradient(
        102deg,
        color-mix(in srgb, var(--brand-accent) 68%, #0d214f 32%) 0%,
        color-mix(in srgb, var(--brand-accent-2) 62%, #0d214f 38%) 27%,
        color-mix(in srgb, var(--brand-accent-glow) 54%, #0d214f 46%) 50%,
        color-mix(in srgb, var(--brand-accent) 66%, #0d214f 34%) 73%,
        color-mix(in srgb, var(--brand-accent-2) 60%, #0d214f 40%) 100%
      );
    background-position: 0% 50%;
    background-size: 240% 100%;
    filter:
      saturate(1.08)
      contrast(1.05)
      drop-shadow(0 1px 1px rgba(8, 22, 57, 0.24))
      drop-shadow(0 3px 9px rgba(16, 32, 78, 0.13));
    -webkit-mask-image: url("../assets/brand/ecliption-logo.png");
    mask-image: url("../assets/brand/ecliption-logo.png");
    -webkit-mask-position: left center;
    mask-position: left center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
    animation: brand-gradient-flow 8.5s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    will-change: background-position;
  }
}

@keyframes brand-gradient-flow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.language-switch {
  isolation: isolate;
  display: grid;
  width: 150px;
  height: var(--control-height);
  padding: 3px;
  border-radius: var(--radius-control);
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.language-switch::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / 3);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 5px 14px rgba(43, 74, 143, 0.14);
  transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.language-switch[data-language="kz"]::after {
  transform: translateX(100%);
}

.language-switch[data-language="en"]::after {
  transform: translateX(200%);
}

.language-switch button {
  position: relative;
  z-index: 2;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #7681a1;
  cursor: pointer;
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.04em;
  transition: color 180ms ease;
}

.language-switch button[aria-pressed="true"] {
  color: var(--ink);
}

.eyebrow {
  display: flex;
  margin: 0 0 10px;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0.17em;
  line-height: 1.3;
}

.eyebrow > span:first-child {
  width: 28px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.eyebrow--small {
  margin-bottom: 8px;
  font-size: 10px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(25px, 2vw, 34px);
  font-weight: 780;
  letter-spacing: -0.045em;
}

.section-heading > p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.page-scene-backdrop {
  position: fixed;
  z-index: -2;
  inset: -40px;
  background-image: var(--page-scene);
  background-position: center;
  background-size: cover;
  filter: blur(34px) saturate(0.72);
  opacity: 0.16;
  transform: scale(1.06);
  pointer-events: none;
}

.page-scene-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(222, 241, 255, 0.68);
}

/* Optional, independently positioned alpha artwork for inner subject pages. */
.kz-history-atmosphere {
  display: none;
}

:is(.page--subject, .page--scientists)[data-subject="kazakhstan-history"] {
  position: relative;
  isolation: isolate;
}

:is(.page--subject, .page--scientists)[data-subject="kazakhstan-history"] .app-shell {
  position: relative;
  z-index: 1;
}

:is(.page--subject, .page--scientists)[data-subject="kazakhstan-history"] .kz-history-atmosphere:not([hidden]) {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.kz-history-atmosphere__item {
  position: absolute;
  display: block;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.instruction-modal {
  width: min(590px, calc(100% - 32px));
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overscroll-behavior: contain;
}

.instruction-modal::backdrop {
  background: rgba(21, 34, 76, 0.28);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  padding: 32px;
  border-radius: 28px;
  box-shadow: 0 32px 90px rgba(27, 47, 100, 0.3), inset 0 1px 0 #fff;
}

.modal-close {
  position: absolute;
  z-index: 3;
  top: 16px;
  right: 16px;
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 11px;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  place-items: center;
}

.modal-icon {
  display: grid;
  width: 50px;
  height: 50px;
  margin-bottom: 20px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: 0 13px 30px rgba(var(--accent-rgb), 0.28);
  color: #fff;
  font-size: 24px;
  font-weight: 760;
  place-items: center;
}

.modal-card h2 {
  margin: 0 0 22px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.modal-card ol {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 11px;
  list-style: none;
}

.modal-card li {
  display: grid;
  padding: 13px 14px;
  border: 1px solid rgba(77, 97, 145, 0.1);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.54);
  grid-template-columns: 36px 1fr;
  gap: 12px;
}

.modal-card li > span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 820;
}

.modal-card li p,
.modal-card li strong,
.modal-card li small {
  display: block;
  margin: 0;
}

.modal-card li strong {
  margin-bottom: 3px;
  font-size: 14px;
}

.modal-card li small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  z-index: 500;
  left: 50%;
  bottom: 26px;
  max-width: min(480px, calc(100% - 32px));
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 13px;
  background: rgba(18, 33, 74, 0.9);
  box-shadow: 0 16px 45px rgba(24, 41, 89, 0.28);
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .app-shell,
  .app-shell--wide {
    width: min(100% - 28px, 900px);
  }

  .action-button span:not(.control-dot),
  .action-button--wide span {
    display: none;
  }

  .action-button,
  .action-button--wide {
    min-width: var(--control-height);
    width: var(--control-height);
    padding: 0;
  }

  .control-dot {
    position: absolute;
    right: 7px;
    bottom: 7px;
  }

  .language-switch {
    width: 132px;
  }
}

@media (max-width: 620px) {
  .app-shell,
  .app-shell--wide {
    width: calc(100% - 20px);
    padding-top: 10px;
  }

  .topbar__left {
    gap: 10px;
  }

  .topbar__actions {
    gap: 6px;
  }

  .brand img {
    width: 108px;
    height: auto;
  }

  .topbar [data-sound] {
    display: none;
  }

  .language-switch {
    width: 116px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .brand::before {
    animation: none !important;
    background-position: 50% 50%;
    will-change: auto;
  }
}

@media (forced-colors: active) {
  .brand img {
    opacity: 1;
  }

  .brand::before {
    display: none;
  }
}
