:root {
  --bg: #071018;
  --ink: #f3f7fb;
  --muted: #c5d0dc;
  --faint: #8ea0b3;
  --copper: #d7b48a;
  --ice: rgba(186, 220, 255, 0.22);
  --stroke: rgba(210, 230, 255, 0.22);
  --frost: rgba(14, 28, 42, 0.42);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ribbon: 42px;
  --max: 1080px;
}

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

html, body {
  background: var(--bg);
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.frost {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.03)),
    var(--frost);
  backdrop-filter: blur(34px) saturate(1.25);
  -webkit-backdrop-filter: blur(34px) saturate(1.25);
  border: 1px solid var(--stroke);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.28),
    inset 0 -1px 0 rgba(120, 170, 220, 0.08);
}

.frost::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(255,255,255,0.03) 0 1px,
    transparent 1px 3px
  );
  opacity: 0.35;
}

.ribbon {
  position: relative;
  z-index: 60;
  height: var(--ribbon);
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  padding: 0 8px 0 4px;
  border-left: 0;
  border-right: 0;
  border-top: 0;
}

.ribbon-info {
  overflow: hidden;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--copper);
  white-space: nowrap;
}

.ribbon-info span {
  display: inline-block;
  padding: 0 2em;
  animation: ticker 28s linear infinite;
}

@keyframes ticker {
  from { transform: translateX(18%); }
  to { transform: translateX(-18%); }
}

.icon-btn {
  width: 36px;
  height: 32px;
  display: grid;
  place-items: center;
  gap: 4px;
  border-radius: 8px;
}

.icon-btn:hover { background: rgba(255,255,255,0.08); }

.burger span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  box-shadow: 0 0 6px rgba(180, 220, 255, 0.4);
}

.lang {
  display: flex;
  gap: 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.lang button {
  padding: 6px 8px;
  border-radius: 999px;
  color: var(--faint);
}

.lang button[aria-pressed="true"] {
  color: #2a1a0c;
  background: linear-gradient(180deg, #efe0cc, var(--copper));
}

.drawer {
  position: fixed;
  inset: var(--ribbon) auto 0 0;
  width: min(320px, 86vw);
  z-index: 55;
  padding: 28px 22px 40px;
  transform: translateX(-105%);
  transition: transform 0.45s var(--ease);
  border-radius: 0 20px 20px 0;
  overflow: auto;
}

.drawer.open { transform: none; }

.drawer img { width: 56px; height: 56px; border-radius: 50%; margin-bottom: 12px; }
.drawer strong { display: block; letter-spacing: 0.16em; font-size: 13px; }
.drawer p { color: var(--muted); font-size: 14px; }
.drawer a { display: block; padding: 8px 0; color: var(--copper); font-weight: 600; }
.drawer-label {
  margin: 18px 0 4px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}

.scrim {
  position: fixed;
  inset: var(--ribbon) 0 0 0;
  background: rgba(0,0,0,0.45);
  z-index: 54;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.scrim.on { opacity: 1; pointer-events: auto; }

.stage {
  position: relative;
  min-height: calc(100svh - var(--ribbon) - 48px);
  display: flex;
  flex-direction: column;
  isolation: isolate;
}

.world {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.space {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 70% at 50% 88%, rgba(70, 130, 220, 0.18), transparent 55%),
    radial-gradient(ellipse 50% 40% at 18% 30%, rgba(80, 120, 180, 0.16), transparent 60%),
    radial-gradient(ellipse 40% 40% at 82% 24%, rgba(40, 70, 140, 0.2), transparent 60%),
    #071018;
  filter: blur(8px);
  transform: scale(1.04);
}

.space::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.2px 1.2px at 20% 30%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 70% 20%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 40% 70%, rgba(255,255,255,.4), transparent),
    radial-gradient(1.4px 1.4px at 88% 48%, rgba(255,255,255,.55), transparent),
    radial-gradient(1px 1px at 10% 80%, rgba(255,255,255,.35), transparent);
  opacity: 0.65;
}

.planet {
  position: absolute;
  left: 50%;
  bottom: 52px;
  width: min(72vw, 560px);
  height: min(36vw, 280px);
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  transition: bottom 0.9s var(--ease), height 0.9s var(--ease), width 0.9s var(--ease);
  z-index: 1;
}

.atmosphere {
  position: absolute;
  left: 50%;
  bottom: -8%;
  width: 118%;
  height: 210%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 58%, transparent 46%, rgba(170, 215, 255, 0.22) 54%, rgba(90, 140, 255, 0.08) 62%, transparent 70%);
  filter: blur(8px);
  pointer-events: none;
}

.earth {
  width: 100%;
  height: 100%;
  border-radius: 280px 280px 0 0;
  overflow: hidden;
  position: relative;
  box-shadow:
    inset 0 -20px 40px rgba(0,0,0,0.35),
    0 0 80px rgba(140, 190, 255, 0.22);
  transition: border-radius 0.9s var(--ease);
}

.earth-tex {
  position: absolute;
  inset: auto 0 0 0;
  height: 200%;
  background-image: url("assets/earth.jpg");
  background-repeat: repeat-x;
  background-size: auto 50%;
  animation: earth-turn 90s linear infinite;
}

@keyframes earth-turn {
  from { background-position: 0 0; }
  to { background-position: -200% 0; }
}

.earth::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(220,240,255,0.14), transparent 30%, rgba(0,0,0,0.28) 100%);
  pointer-events: none;
}

.layers {
  position: relative;
  z-index: 2;
  flex: 1;
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 12px;
  min-height: 42vh;
}

.layer {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 8px 4px 24px;
  opacity: 0;
  transform: translateY(-18px);
  pointer-events: none;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.layer.active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  position: relative;
}

.view-heritage .layer-ehtti,
.view-heritage .layer-rnd {
  opacity: 0;
  transform: translateY(-28px);
  pointer-events: none;
}

.view-heritage .planet {
  bottom: 28%;
  width: min(78vw, 620px);
  height: min(78vw, 620px);
}

.view-heritage .earth { border-radius: 50%; }

.view-heritage .layers {
  min-height: 0;
  max-height: 28vh;
}

.horizon {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  align-items: end;
  width: min(var(--max), calc(100% - 24px));
  margin: 0 auto;
  border-bottom: 1px solid var(--stroke);
}

.tab {
  text-align: center;
  letter-spacing: 0.16em;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 12px 8px 14px;
  position: relative;
}

.tab.bump {
  border: 1px solid var(--stroke);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.03));
  backdrop-filter: blur(18px);
}

.tab[aria-selected="true"] { color: var(--ink); }

.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 8px;
  height: 2px;
  background: var(--copper);
  border-radius: 2px;
}

.tab:hover { color: var(--ink); }

.topic {
  display: grid;
  grid-template-columns: 1fr minmax(0, 220px);
  gap: 28px;
  align-items: start;
  padding: 22px 18px;
  margin-bottom: 14px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.03)),
    rgba(8, 18, 28, 0.45);
  backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--stroke);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}

.topic.no-img { grid-template-columns: 1fr; }

.topic h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}

.topic h2 span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--copper);
  margin-right: 10px;
  transform: translateY(-2px);
}

.topic p { margin: 0 0 12px; color: var(--muted); max-width: 62ch; }

.ph {
  min-height: 140px;
  border-radius: 16px;
  border: 1px dashed rgba(212, 176, 138, 0.35);
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.03);
}

footer {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 28px;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.06em;
}

@media (max-width: 720px) {
  .ribbon-info { font-size: 10px; letter-spacing: 0.1em; }
  .planet { width: 88vw; height: 44vw; }
  .view-heritage .planet { width: 86vw; height: 86vw; bottom: 22%; }
  .topic { grid-template-columns: 1fr; }
  .ph { min-height: 110px; }
  .tab { letter-spacing: 0.1em; font-size: 11px; padding-inline: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .earth-tex, .ribbon-info span { animation: none; }
  .layer, .planet, .earth { transition: none; }
}
