@font-face {
  font-family: "Permanent Marker";
  src: url("assets/PermanentMarker-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #070b14;
  --ink-soft: #0d1421;
  --panel: rgba(8, 16, 28, 0.76);
  --panel-strong: rgba(13, 23, 38, 0.94);
  --cream: #ffe8c8;
  --cream-soft: #e8d4bd;
  --muted: #aa9aa0;
  --lavender: #b89aff;
  --violet: #865eea;
  --aqua: #63d7d6;
  --pink: #f48fb9;
  --peach: #f6b280;
  --yellow: #f6d77c;
  --line: rgba(211, 184, 162, 0.46);
  --line-soft: rgba(211, 184, 162, 0.30);
  --display: "Permanent Marker", "Segoe Print", cursive;
  --body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--cream);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.65;
  background: #0b0d11 url("assets/storybook-background.png") center center / cover fixed no-repeat;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

body::before {
  opacity: 0;
  background-image:
    radial-gradient(circle, rgba(255, 232, 200, 0.8) 0 1px, transparent 1.4px),
    radial-gradient(circle, rgba(113, 212, 221, 0.5) 0 1px, transparent 1.3px),
    radial-gradient(circle, rgba(236, 138, 184, 0.45) 0 1px, transparent 1.2px);
  background-size: 97px 97px, 151px 151px, 211px 211px;
  background-position: 11px 23px, 54px 82px, 103px 37px;
}

body::after {
  opacity: 0;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.72'/%3E%3C/svg%3E");
}

img {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration-color: rgba(255, 232, 200, 0.5);
  text-underline-offset: 0.22em;
}

a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 3px solid var(--aqua);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 99;
  padding: 0.65rem 0.9rem;
  border-radius: 0.7rem;
  color: #071018;
  background: var(--cream);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: none;
}

.home-stage {
  position: relative;
  isolation: isolate;
  width: min(100%, 1680px);
  min-height: 100svh;
  margin: 0 auto;
  padding: 5.4rem clamp(1.25rem, 3vw, 3rem) 2rem;
  display: grid;
  grid-template-columns: minmax(270px, 320px) minmax(500px, 640px) minmax(140px, 190px);
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 2.2vw, 2.7rem);
}

.home-title {
  position: absolute;
  top: 1.1rem;
  left: 50%;
  margin: 0;
  transform: translateX(-50%) rotate(-1deg);
  font-family: var(--display);
  font-size: clamp(2.25rem, 3.5vw, 3.5rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 3px 24px rgba(246, 178, 128, 0.2);
}

.home-title::after {
  content: "";
  display: block;
  width: 78%;
  height: 0.16rem;
  margin: 0.45rem auto 0;
  border-radius: 99px;
  background: var(--cream);
  transform: rotate(1.5deg);
  opacity: 0.9;
}

.home-title::before {
  content: "✧  ✦";
  position: absolute;
  right: calc(100% + 1.3rem);
  top: 0.3rem;
  font-size: 1.3rem;
  white-space: nowrap;
  color: var(--cream-soft);
  transform: rotate(-12deg);
}

.recent-panel {
  align-self: start;
  margin-top: 1.6rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 17px 21px 16px 19px / 20px 15px 22px 16px;
  background: rgba(10, 17, 23, 0.73);
  box-shadow: inset 0 0 0 2px rgba(211, 184, 162, 0.035);
}

.panel-heading {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.8rem;
  padding: 0.1rem 0.45rem 0.6rem;
  border-bottom: 1px solid var(--line-soft);
}

.panel-heading h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.08rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.panel-heading > span:first-child {
  color: var(--yellow);
}

.panel-dots {
  color: var(--lavender);
  letter-spacing: 0.2em;
}

.recent-list {
  display: grid;
  gap: 0.72rem;
  padding-top: 0.85rem;
}

.recent-card {
  min-width: 0;
  min-height: 6.3rem;
  display: grid;
  grid-template-columns: 5.9rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem 0.3rem 0.1rem;
  border: 1px solid var(--line-soft);
  border-radius: 13px 16px 12px 16px / 15px 12px 17px 12px;
  color: var(--cream);
  background: rgba(22, 31, 36, 0.39);
  text-decoration: none;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.recent-card:hover {
  border-color: rgba(120, 216, 213, 0.48);
  background: rgba(16, 33, 50, 0.78);
  transform: translateX(0.22rem);
}

.recent-card img {
  width: 5.9rem;
  height: 5.9rem;
  object-fit: contain;
  filter: drop-shadow(0 7px 10px rgba(0, 0, 0, 0.28));
}

.recent-copy {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}

.recent-copy strong {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.recent-copy small {
  display: none;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-arrow {
  color: var(--cream-soft);
  font-size: 1.8rem;
  line-height: 1;
}

.panel-link {
  display: inline-block;
  margin: 0.72rem 0.35rem 0.2rem;
  color: var(--cream-soft);
  font-family: var(--display);
  font-size: 0.9rem;
}

.cosmos-column {
  width: 100%;
  align-self: center;
}

.cosmos-art-shell {
  position: relative;
  width: 100%;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.32));
}

.cosmology-art {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.cosmos-callout {
  position: absolute;
  z-index: 2;
  padding: 0.2rem 0.35rem;
  font-family: var(--display);
  font-size: clamp(0.76rem, 1.25vw, 1.13rem);
  line-height: 1.28;
  text-decoration: none;
  text-shadow: 0 2px 5px #050913, 0 0 14px #050913;
  transition: color 180ms ease, transform 180ms ease;
}

.cosmos-callout::before {
  content: "✦";
  margin-right: 0.4rem;
  color: var(--yellow);
  font-size: 0.72em;
}

.cosmos-callout:hover {
  color: var(--aqua);
  transform: translateY(-2px);
}

.callout-spirit {
  top: 14%;
  right: -7%;
}

.callout-limbo {
  top: 39%;
  left: -2%;
}

.callout-interplan {
  top: 74%;
  right: -3%;
}

.callout-material {
  top: 84%;
  right: -7%;
}

.world-marker {
  position: absolute;
  z-index: 3;
  width: 1.75rem;
  height: 1.75rem;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--cream);
  background: rgba(12, 13, 23, 0.3);
  text-shadow: 0 1px 4px #000;
  font-family: var(--display);
  font-size: 0.82rem;
  text-decoration: none;
  transform: translate(-50%, -50%);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.world-marker::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.55rem);
  width: max-content;
  max-width: 10rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  color: var(--cream);
  background: rgba(6, 12, 22, 0.94);
  font-family: var(--body);
  font-size: 0.74rem;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0.3rem);
  transition: opacity 160ms ease, transform 160ms ease;
}

.world-marker:hover,
.world-marker:focus-visible {
  border-color: var(--aqua);
  background: rgba(31, 68, 79, 0.95);
  transform: translate(-50%, -50%) scale(1.08);
}

.world-marker:hover::after,
.world-marker:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.world-1 { left: 24%; top: 43%; }
.world-2 { left: 48%; top: 44%; }
.world-3 { left: 79%; top: 43%; }
.world-4 { left: 11%; top: 56%; }
.world-5 { left: 65%; top: 60%; }
.world-7 { left: 37%; top: 58%; }
.world-8 { left: 90%; top: 58%; }

.planet-nav {
  position: relative;
  z-index: 4;
  margin-top: -0.4rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(1.1rem, 4vw, 3.5rem);
}

.planet-link {
  width: clamp(6rem, 9vw, 8.2rem);
  display: grid;
  justify-items: center;
  color: var(--cream);
  font-family: var(--display);
  font-size: clamp(0.82rem, 1.15vw, 1.05rem);
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.planet-link img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.34));
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), filter 220ms ease;
}

.planet-link:hover img,
.planet-link:focus-visible img {
  transform: translateY(-0.35rem) rotate(-2deg) scale(1.05);
  filter: drop-shadow(0 15px 24px rgba(97, 216, 214, 0.24));
}

.planet-link span {
  margin-top: -0.45rem;
}

.planet-link + .planet-link { position: relative; }
.planet-link + .planet-link::before {
  content: "✧";
  position: absolute;
  right: calc(100% + 0.8rem);
  top: 45%;
  color: #d9bb94;
  font-size: 1.4rem;
}

.home-footer {
  align-self: end;
  padding-bottom: 1rem;
  color: var(--cream-soft);
  text-align: right;
}

.home-footer p {
  margin: 0;
}

.home-footer p:first-child {
  font-family: var(--display);
  font-size: 1.15rem;
}

.home-footer p:last-child {
  max-width: 14rem;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

/* Внутренние страницы */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(7, 12, 21, 0.8);
  backdrop-filter: blur(14px);
}

.site-header-inner {
  width: min(100% - 2rem, 1120px);
  min-height: 4.5rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-brand {
  font-family: var(--display);
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.site-nav a {
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  color: var(--cream-soft);
  font-size: 0.9rem;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--cream);
  background: rgba(123, 205, 206, 0.12);
}

.content-page {
  width: min(100% - 2rem, 1000px);
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) 0 5rem;
}

.page-kicker {
  margin: 0 0 0.6rem;
  color: var(--aqua);
  font-family: var(--display);
  font-size: 0.9rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.page-title {
  max-width: 16ch;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.3rem, 7vw, 5.2rem);
  font-weight: 400;
  line-height: 1.06;
}

.page-intro {
  max-width: 43rem;
  margin: 1.2rem 0 0;
  color: var(--cream-soft);
  font-size: clamp(1rem, 2vw, 1.15rem);
}

.content-panel {
  margin-top: 2.5rem;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  background: rgba(15, 20, 28, 0.80);
  box-shadow: var(--shadow);
}

.content-panel h2,
.article-body h2,
.article-body h3 {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.2;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.5rem;
}

.article-list-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line-soft);
  border-radius: 1.15rem;
  color: inherit;
  background: rgba(11, 21, 36, 0.74);
  text-decoration: none;
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.article-list-card:hover {
  border-color: rgba(99, 215, 214, 0.45);
  background: rgba(17, 34, 50, 0.9);
  transform: translateY(-3px);
}

.article-list-card img {
  width: 5.5rem;
  height: 5.5rem;
  object-fit: contain;
}

.article-list-copy {
  min-width: 0;
}

.article-list-copy h2 {
  margin: 0.15rem 0 0.3rem;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.25;
}

.article-list-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.article-meta {
  color: var(--aqua);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
}

.term-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.term-card {
  padding: 1.15rem;
  border: 1px solid var(--line-soft);
  border-radius: 1rem;
  background: rgba(10, 20, 34, 0.64);
}

.term-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.term-card p {
  margin: 0.6rem 0 0;
  color: var(--cream-soft);
}

.placeholder-note {
  padding: 0.8rem 1rem;
  border-left: 3px solid var(--pink);
  color: var(--cream-soft);
  background: rgba(244, 143, 185, 0.07);
}

.article-shell {
  width: min(100% - 2rem, 820px);
  margin: 0 auto;
  padding: 3.5rem 0 6rem;
}

.breadcrumbs {
  margin-bottom: 2rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.article-header h1 {
  margin: 0.5rem 0;
  font-family: var(--display);
  font-size: clamp(2.3rem, 8vw, 5rem);
  font-weight: 400;
  line-height: 1.08;
}

.article-lead {
  margin: 1rem 0 0;
  color: var(--cream-soft);
  font-size: 1.12rem;
}

.article-body {
  margin-top: 2.5rem;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 1.3rem;
  background: rgba(11, 21, 35, 0.78);
  box-shadow: var(--shadow);
}

.article-body img {
  width: 100%;
  border-radius: 1rem;
}

.article-body blockquote {
  margin: 1.5rem 0;
  padding: 0.7rem 1.1rem;
  border-left: 3px solid var(--aqua);
  color: var(--cream-soft);
  background: rgba(99, 215, 214, 0.07);
}

.page-footer {
  width: min(100% - 2rem, 1120px);
  margin: 0 auto;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.page-footer p {
  margin: 0.2rem 0;
}

@media (max-width: 1180px) {
  .home-stage {
    grid-template-columns: minmax(250px, 310px) minmax(500px, 620px);
  }

  .home-footer {
    position: absolute;
    right: 2rem;
    bottom: 0.5rem;
  }
}

@media (max-width: 900px) {
  .home-stage {
    min-height: auto;
    padding-top: 6.5rem;
    grid-template-columns: minmax(0, 42rem);
    gap: 2rem;
  }

  .recent-panel {
    width: min(100%, 34rem);
    margin: 0 auto;
  }

  .cosmos-column {
    grid-row: 2;
  }

  .home-footer {
    position: static;
    justify-self: center;
    padding-bottom: 0;
    text-align: center;
  }

  .home-footer p:last-child {
    max-width: 25rem;
  }

  .callout-spirit,
  .callout-interplan,
  .callout-material {
    right: 0;
  }

  .callout-limbo {
    left: 0;
  }
}

@media (max-width: 680px) {
  .home-stage {
    padding-inline: 0.8rem;
  }

  .home-title {
    font-size: clamp(2.1rem, 12vw, 3.2rem);
  }

  .recent-panel {
    border-radius: 1rem;
  }

  .cosmos-callout {
    font-size: 0.72rem;
  }

  .world-marker {
    width: 1.55rem;
    height: 1.55rem;
    font-size: 0.72rem;
  }

  .planet-nav {
    gap: 0.6rem;
    margin-top: 0;
  }

  .planet-link + .planet-link::before { display: none; }

  .planet-link {
    width: min(29vw, 7rem);
    font-size: 0.75rem;
  }

  .site-header-inner {
    padding-block: 0.7rem;
    align-items: flex-start;
    flex-direction: column;
  }

  .article-grid,
  .term-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .recent-card {
    grid-template-columns: 3.5rem minmax(0, 1fr) auto;
    min-height: 5.3rem;
  }

  .recent-card img {
    width: 3.5rem;
    height: 3.5rem;
  }

  .cosmos-callout::before {
    display: none;
  }

  .world-marker {
    border-color: rgba(255, 232, 200, 0.5);
  }

  .article-list-card {
    grid-template-columns: 4.5rem minmax(0, 1fr);
  }

  .article-list-card img {
    width: 4.5rem;
    height: 4.5rem;
  }
}

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

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