:root {
  --bg: #050505;
  --panel: #080808;
  --soft-line: rgba(255, 255, 255, 0.18);
  --text: #f2f0ea;
  --muted: rgba(242, 240, 234, 0.68);
  --magenta: #ff38d1;
  --shadow: 0 30px 70px rgba(0, 0, 0, 0.42);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.hex-background {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.82;
}

.landing-shell {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(480px, 1fr);
  gap: clamp(48px, 5vw, 88px);
  align-items: center;
  padding: clamp(28px, 4vw, 54px);
}

.landing-shell::before {
  content: none;
}

.landing-copy {
  position: relative;
  z-index: 3;
  width: min(100%, 31rem);
  max-width: 31rem;
  padding-left: clamp(8px, 1.6vw, 28px);
  align-self: center;
}

.landing-copy,
.landing-copy * {
  text-align: left !important;
  text-align-last: auto !important;
  text-justify: auto;
  hyphens: none;
  word-spacing: normal;
}

.landing-copy h1 {
  margin: 0 1.3rem;
  width: calc(100% - 2.6rem);
  max-width: none;
  font-size: clamp(3.35rem, 5.25vw, 5.5rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
  text-wrap: balance;
  color: #f0f0f0;
  font-weight: 560;
  text-align: left;
}

.brand-accent {
  color: var(--magenta);
}

.lede {
  margin: 1.6rem 1.3rem 0;
  width: calc(100% - 2.6rem);
  max-width: none;
  font-size: clamp(1.06rem, 1.22vw, 1.2rem);
  line-height: 1.62;
  color: rgba(240, 240, 240, 0.8);
  font-weight: 400;
  text-align: left;
}

.topic-glass {
  margin-top: 1.25rem;
  width: 100%;
  max-width: none;
  padding: 1.1rem 1.3rem 1.05rem;
  border-radius: 20px;
  background: rgba(8, 8, 8, 0.68);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 22px 40px rgba(0, 0, 0, 0.26);
  position: relative;
}

.topic-glass::before {
  content: none;
}

.topic-kicker {
  margin: 0;
  padding-left: 0;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}

.topic-glass h2 {
  margin: 0.32rem 0 0;
  padding-left: 0;
  font-size: clamp(1.8rem, 2.4vw, 2.5rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
  color: #fff;
  transition: color 180ms ease, text-shadow 180ms ease;
}

body.topic-title-dark .topic-glass h2 {
  color: #fff8fd;
  text-shadow:
    0 0 10px rgba(255, 56, 209, 0.22),
    0 0 22px rgba(255, 56, 209, 0.14);
}

.topic-body {
  margin: 0.68rem 0 0;
  padding-left: 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.92rem;
  line-height: 1.48;
  text-align: left;
}

.topic-meta {
  margin: 0.82rem 0 0;
  padding-left: 0;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.44);
}

.radial-stage {
  position: relative;
  z-index: 2;
  min-height: min(86vh, 960px);
  display: grid;
  align-content: center;
  justify-items: center;
  transform:
    translate(var(--stage-x, 0px), var(--stage-y, 0px))
    rotate(var(--stage-r, 0deg));
  transition: transform 650ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.stage-surface {
  position: relative;
  width: min(82%, 780px);
  aspect-ratio: 1 / 1.08;
  border-radius: 44px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), var(--shadow);
  overflow: hidden;
  animation: stage-breathe 10s ease-in-out infinite alternate;
  opacity: 0.91;
}

@keyframes stage-breathe {
  from {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), var(--shadow);
  }
  to {
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.1),
      0 34px 82px rgba(0, 0, 0, 0.5),
      0 0 54px rgba(255, 56, 209, 0.03);
  }
}

.stage-surface::before {
  content: "";
  position: absolute;
  left: -6%;
  top: -3%;
  width: 116%;
  height: 116%;
  border-radius: 50%;
  background: #f5f2eb;
  box-shadow: 0 0 0 0.8px rgba(255, 255, 255, 0.08);
}

.stage-surface::after {
  content: "";
  position: absolute;
  right: -20%;
  bottom: -20%;
  width: 84%;
  height: 84%;
  border-radius: 50%;
  background: #080808;
}

.radial-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  touch-action: none;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .landing-shell {
    grid-template-columns: 1fr;
    min-height: 100vh;
    gap: 24px;
    align-items: start;
  }

  .landing-shell::before {
    content: none;
  }

  .landing-copy {
    order: 1;
    width: 100%;
    max-width: none;
    padding-left: 0;
    padding-top: 24px;
    transform: none;
  }

  .landing-copy h1,
  .lede {
    margin-left: 1.3rem;
    margin-right: 1.3rem;
    width: calc(100% - 2.6rem);
    text-align: left;
  }

  .radial-stage {
    order: 2;
    transform: none;
    min-height: auto;
  }

  .topic-glass {
    max-height: none;
    max-width: none;
  }
}

@media (max-width: 700px) {
  .landing-shell {
    padding: 18px;
  }

  .stage-surface {
    border-radius: 28px;
  }
}

/* Footer */
.lithos-footer {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 2.75rem 1.5rem 2.25rem;
  margin-top: 2.25rem;
  font-size: clamp(1.06rem, 1.2vw, 1.2rem);
  line-height: 1.6;
  color: rgba(242, 240, 234, 0.82);
  font-weight: 430;
  letter-spacing: -0.008em;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  grid-column: 1 / -1;
}

@media (prefers-reduced-motion: reduce) {
  .radial-stage {
    transition: none;
  }

  .stage-surface {
    animation: none;
  }
}

.lithos-footer p {
  max-width: 56rem;
  margin: 0 auto;
  text-wrap: balance;
}

.calyrai-brand {
  display: inline-block;
  font-weight: 720;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: inherit;
  font-kerning: normal;
  text-decoration: none;
  text-underline-offset: 0.2em;
  transition: opacity 180ms ease, text-decoration-color 180ms ease;
}

.calyrai-brand:hover,
.calyrai-brand:focus-visible {
  opacity: 0.82;
  text-decoration: underline;
  text-decoration-color: var(--magenta);
}

.calyrai-brand .accent-i {
  color: var(--magenta) !important;
  font-style: normal !important;
}

/* Theme Toggle Button */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--soft-line);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 300ms ease;
  backdrop-filter: blur(12px);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-icon {
  display: inline-block;
  transition: transform 300ms ease;
}

.theme-toggle:hover .theme-icon {
  transform: rotate(20deg);
}

/* High Contrast Text */
h1, h2, h3, p {
  transition: color 300ms ease, text-shadow 300ms ease;
}

/* Ensure readability with text shadows on complex backgrounds */
.landing-copy h1 {
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.lede {
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.topic-body {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Adapt to light mode */
html.light-mode h1,
html.light-mode h2 {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

html.light-mode .lede,
html.light-mode .topic-body {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
  .theme-toggle {
    width: 40px;
    height: 40px;
    top: 16px;
    right: 16px;
    font-size: 1rem;
  }
}

/* Footer */
.lithos-footer {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 3rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
  border-top: 1px solid var(--soft-line);
}

.lithos-footer p {
  max-width: 50rem;
  margin: 0 auto;
}
