:root {
  --bg: #050505;
  --panel: rgba(8, 8, 8, 0.72);
  --panel-solid: #0d0d0d;
  --border: rgba(255, 255, 255, 0.18);
  --text: #f5f5f2;
  --muted: rgba(245, 245, 242, 0.72);
  --accent: #ffffff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --font-serif: Georgia, "Times New Roman", serif;
  --font-sans: "Helvetica Neue", Arial, sans-serif;
  --site-width: 70rem;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.55;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 4px;
}

code {
  font-family: monospace;
  font-size: 0.95em;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: #ffffff;
  color: #000000;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

.site-header {
  position: relative;
  z-index: 3;
  width: min(100% - 2rem, var(--site-width));
  margin: 0 auto;
  padding: 1rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.solid-header {
  border-bottom: 1px solid var(--border);
}

.brand {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  text-decoration: none;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0;
  padding: 0;
}

.nav-list a {
  text-decoration: none;
}

.nav-list a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.home-page {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: #000000;
}

.formula-depth-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  perspective: 2600px;
  perspective-origin: 50% 58%;
  transform-style: preserve-3d;
}

.formula-depth-track {
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: formula-depth-glide 26s cubic-bezier(0.18, 0.7, 0.18, 1) 1 both;
  transform-style: preserve-3d;
}

.formula-depth-formula {
  position: absolute;
  top: 52%;
  left: 50%;
  display: block;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.12);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(8rem, 28vh, 18rem);
  font-style: italic;
  line-height: 0.9;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.08);
  transform: translate3d(-50%, -50%, -540px) rotateX(79deg) rotateY(0deg) scale(1.18);
  transform-origin: center center;
}

.formula-subscript,
.formula-depth-formula sup,
.formula-depth-formula sub {
  position: relative;
  font-size: 0.42em;
}

.formula-subscript,
.formula-depth-formula sub {
  bottom: -0.28em;
}

.formula-depth-formula sup {
  top: -0.62em;
}

.formula-copy {
  display: inline-block;
  margin-left: 0.08em;
}

.home-stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 3rem;
}

.page-shell {
  position: relative;
  transform-origin: 50% 58%;
  transform-style: preserve-3d;
  will-change: transform, filter;
  animation: page-shell-rise 26s cubic-bezier(0.18, 0.7, 0.18, 1) 1 both;
}

.home-cover-link {
  display: block;
  line-height: 0;
}

.home-cover-image {
  display: block;
  width: min(20rem, 64vw, calc(70svh * 2 / 3));
  height: auto;
}

@keyframes formula-depth-glide {
  0% {
    opacity: 0;
    transform: translate3d(132vw, 0, 0);
  }

  8% {
    opacity: 0.1;
  }

  52% {
    opacity: 0.12;
    transform: translate3d(0, 0, 0);
  }

  92% {
    opacity: 0.1;
  }

  100% {
    opacity: 0;
    transform: translate3d(-132vw, 0, 0);
  }
}

@keyframes page-shell-rise {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
    filter: drop-shadow(0 14px 32px rgba(0, 0, 0, 0.08));
  }

  47%,
  61% {
    transform: translate3d(0, -10px, 44px) scale(1.006);
    filter: drop-shadow(0 32px 90px rgba(0, 0, 0, 0.22));
  }
}

@media (prefers-reduced-motion: reduce) {
  .formula-depth-scene {
    display: none;
  }

  .page-shell {
    animation: none;
    filter: none;
    transform: none;
  }
}

.panel {
  width: min(100%, 56rem);
  padding: 1.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 1rem;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.05;
}

p {
  margin: 0 0 1rem;
}

.panel p {
  color: var(--muted);
}

.cover-art {
  display: block;
  width: min(18rem, 70vw);
  aspect-ratio: 2 / 3;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(0, 0, 0, 0.18)),
    url("assets/book-cover.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4);
  transition: transform 180ms ease;
}

.cover-art-medium {
  width: min(14rem, 60vw);
}

.simple-page {
  background:
    linear-gradient(180deg, #090909 0%, #050505 100%);
}

.simple-shell {
  width: min(100% - 2rem, var(--site-width));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem;
  align-items: center;
}

.cover-preview {
  display: flex;
  justify-content: center;
}

.primary-button,
.text-link {
  display: inline-block;
  color: var(--text);
}

.primary-button {
  padding: 0.85rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
}

.primary-button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.cart-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.cart-copy h1 {
  margin-bottom: 0.75rem;
}

.cart-meta {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.6rem 1rem;
  margin: 1.5rem 0;
}

.cart-meta dt {
  color: var(--muted);
}

.cart-meta dd {
  margin: 0;
}

.notice {
  margin-top: 1rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.secondary-link {
  align-self: center;
  color: var(--muted);
}

@media (max-width: 48rem) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-grid,
  .cart-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 1.25rem;
  }

  .home-cover-image {
    width: min(16rem, 68vw, calc(60svh * 2 / 3));
  }

  .formula-depth-formula {
    font-size: clamp(6rem, 18vh, 11rem);
    transform: translate3d(-50%, -50%, -420px) rotateX(79deg) rotateY(0deg) scale(1.12);
  }
}
