:root {
  --night: #070b1c;
  --night-2: #0d1330;
  --blue: #4f8dff;
  --red: #ff3b30;
  --gold: #e9c98a;
  --gold-deep: #b98f4e;
  --wheat: #c9973f;
  --text: #ece5d6;
  --muted: #a9a79f;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, "URW Palladio L", Georgia, serif;
  --measure: 36rem;
  --gutter: clamp(16px, 5vw, 56px);
  --top-height: 4rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top-height) + 1rem); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--night);
  color: var(--text);
  font: 400 1.125rem/1.75 var(--serif);
  overflow-x: hidden;
}
main { flex: 1; position: relative; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--gold); text-underline-offset: 0.2em; }
a:hover { color: #fff; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 10; background: var(--night); padding: 0.5rem 1rem; }

/* Blue heaven on one side, red ember on the other: the cover's split, fixed behind everything. */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff, transparent),
    radial-gradient(1px 1px at 27% 62%, #cfe0ff, transparent),
    radial-gradient(1.5px 1.5px at 38% 28%, #fff, transparent),
    radial-gradient(1px 1px at 8% 80%, #cfe0ff, transparent),
    radial-gradient(1px 1px at 55% 12%, #fff, transparent),
    radial-gradient(1px 1px at 68% 44%, #ffd9d4, transparent),
    radial-gradient(1.5px 1.5px at 84% 22%, #ffd9d4, transparent),
    radial-gradient(1px 1px at 92% 70%, #ffd9d4, transparent),
    radial-gradient(60vw 80vh at 0% 25%, rgba(79, 141, 255, 0.2), transparent 70%),
    radial-gradient(60vw 80vh at 100% 40%, rgba(255, 59, 48, 0.15), transparent 70%),
    var(--night);
}

.sky canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.top {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1.5rem;
  min-height: var(--top-height);
  padding: 0.3rem var(--gutter);
  background: rgba(7, 11, 28, 0.84);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
/* The cover's split once more, as a thin line under the header. */
.top::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--blue) 18%, var(--gold) 50%, var(--red) 82%, transparent);
  opacity: 0.55;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--gold);
  text-decoration: none;
  font-variant: small-caps;
  letter-spacing: 0.06em;
}
.nav { display: flex; flex-wrap: wrap; gap: 0 1.6rem; }
.nav a, .foot-links a {
  position: relative;
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  line-height: 2.75rem;
  transition: color 0.25s, text-shadow 0.25s;
}
.foot-links a { font-size: 1rem; letter-spacing: 0.06em; }
.nav .lang-switch { color: var(--muted); }
.nav .lang-switch:hover, .nav .lang-switch:focus-visible { color: var(--gold); }
/* Hover: a blue and red thread grows from the middle, with the amulet at its heart. */
.nav a::before, .foot-links a::before {
  content: "";
  position: absolute;
  inset: auto 0 0.4rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--blue) 25%, var(--blue) 50%, var(--red) 50%, var(--red) 75%, transparent);
  transform: scaleX(0);
  transition: transform 0.3s ease-out;
}
.nav a::after, .foot-links a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(0.4rem - 2px);
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  background: linear-gradient(90deg, var(--blue) 50%, var(--red) 50%);
  box-shadow: -2px 2px 6px rgba(79, 141, 255, 0.9), 2px -2px 6px rgba(255, 59, 48, 0.9);
  transform: rotate(45deg) scale(0);
  transition: transform 0.3s ease-out;
}
.nav a:hover, .nav a:focus-visible, .nav a[aria-current="page"],
.foot-links a:hover, .foot-links a:focus-visible, .foot-links a[aria-current="page"] {
  color: var(--gold);
  text-shadow: 0 0 14px rgba(233, 201, 138, 0.45);
}
.nav a:hover::before, .nav a:focus-visible::before, .nav a[aria-current="page"]::before,
.foot-links a:hover::before, .foot-links a:focus-visible::before, .foot-links a[aria-current="page"]::before { transform: scaleX(1); }
.nav a:hover::after, .nav a:focus-visible::after, .nav a[aria-current="page"]::after,
.foot-links a:hover::after, .foot-links a:focus-visible::after, .foot-links a[aria-current="page"]::after { transform: rotate(45deg) scale(1); }

/* The necklace from the book: half blue, half red, breathing slowly. */
.amulet {
  position: relative;
  display: inline-block;
  flex: none;
  width: 0.7rem;
  height: 0.7rem;
  transform: rotate(45deg);
  background: linear-gradient(90deg, var(--blue) 50%, var(--red) 50%);
  box-shadow: -4px 4px 10px rgba(79, 141, 255, 0.7), 4px -4px 10px rgba(255, 59, 48, 0.7);
}
/* The stronger glow sits on its own layer and only fades, so the browser need not repaint the shadow every frame. */
.amulet::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: -6px 6px 18px rgba(79, 141, 255, 0.8), 6px -6px 18px rgba(255, 59, 48, 0.8);
  opacity: 0;
  animation: pulse 4.5s ease-in-out infinite;
  will-change: opacity;
}
@keyframes pulse {
  50% { opacity: 1; }
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 26rem) minmax(0, 34rem);
  justify-content: center;
  align-items: center;
  gap: clamp(2rem, 6vw, 5.5rem);
  padding: clamp(1.5rem, 5vh, 4rem) var(--gutter) clamp(2.5rem, 6vh, 5rem);
}
.cover { margin: 0; }
.cover img {
  width: 100%;
  border-radius: 3px;
  box-shadow: -22px 14px 70px rgba(79, 141, 255, 0.3), 22px 14px 70px rgba(255, 59, 48, 0.28), 0 24px 50px rgba(0, 0, 0, 0.6);
}
.kicker {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-variant: small-caps;
  letter-spacing: 0.14em;
}
h1, h2 { font-weight: 400; color: var(--gold); text-wrap: balance; }
h1 {
  margin: 0;
  font-size: clamp(2.5rem, 5.5vw, 4.5rem);
  line-height: 1.08;
  font-variant: small-caps;
  letter-spacing: 0.01em;
}
h2 { margin: 2.5rem 0 0.5rem; font-size: 1.6rem; line-height: 1.25; }
.volume { margin: 1rem 0 0; font-size: clamp(1.3rem, 2.2vw, 1.75rem); font-style: italic; }
.byline { margin: 0.25rem 0 0; color: var(--muted); }
.lead { margin: 2rem 0 0; font-size: 1.3rem; line-height: 1.5; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem; margin: 2rem 0 0; }

.btn {
  display: inline-block;
  padding: 0.7rem 1.6rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: var(--night);
  background: var(--gold);
  text-decoration: none;
  line-height: 1.5;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.btn:hover {
  background: transparent;
  color: var(--gold);
  box-shadow: -8px 0 22px rgba(79, 141, 255, 0.4), 8px 0 22px rgba(255, 59, 48, 0.4);
}
.btn-ghost { background: transparent; color: var(--gold); }

.rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 0 auto;
  max-width: var(--measure);
  padding: 0 var(--gutter);
}
.rule::before, .rule::after { content: ""; flex: 1; height: 1px; }
.rule::before { background: linear-gradient(90deg, transparent, var(--blue)); }
.rule::after { background: linear-gradient(90deg, var(--red), transparent); }

.prose { max-width: calc(var(--measure) + 2 * var(--gutter)); margin: 0 auto; padding: 2.5rem var(--gutter); }
.prose p { margin: 0 0 1.1em; }
.prose .actions { margin-top: 2rem; justify-content: center; }
.page .rule { padding: 0; margin: 2.5rem 0; }
.page .kicker { margin-bottom: 0.5rem; }
.page h1 { font-size: clamp(2.25rem, 5vw, 3.25rem); }
.page .byline { margin-bottom: 1.75rem; }
.intro { font-size: 1.25rem; line-height: 1.6; }
.opening { color: var(--gold); font-size: 1.5rem; line-height: 1.35; }
.closing { margin-top: 2rem !important; color: var(--gold); font-style: italic; text-align: center; font-size: 1.25rem; }

.legal h3 { margin: 1.5rem 0 0.25rem; font-size: 1.15rem; font-weight: 400; color: var(--gold); }
.legal ul { margin: 0 0 1.1em; padding-left: 1.25rem; }
.legal li { margin-bottom: 0.5em; }
.legal h2 { overflow-wrap: anywhere; }
.fold { border-top: 1px solid rgba(233, 201, 138, 0.25); }
.fold:last-of-type { border-bottom: 1px solid rgba(233, 201, 138, 0.25); margin-bottom: 1.5rem; }
.fold summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 2.75rem; padding: 0.6rem 0; cursor: pointer; list-style: none; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: "+"; flex: none; color: var(--gold); font-size: 1.5rem; line-height: 1; }
.fold[open] summary::after { content: "–"; }
.fold summary h2 { margin: 0; font-size: 1.25rem; }
.fold summary:hover h2 { color: #fff; }
.fold[open] { padding-bottom: 1rem; }

.threshold {
  margin: 1.5rem auto 4rem;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  padding: 0 var(--gutter);
  text-align: center;
}
.threshold h2 { margin-top: 0; font-size: clamp(1.6rem, 3vw, 2.1rem); }

.foot { color: var(--muted); font-size: 0.95rem; }
.wheat {
  height: 90px;
  background:
    repeating-linear-gradient(82deg, transparent 0 7px, rgba(201, 151, 63, 0.3) 7px 8px),
    repeating-linear-gradient(98deg, transparent 0 11px, rgba(233, 201, 138, 0.22) 11px 12px);
  mask-image: linear-gradient(transparent, #000);
}
.foot-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 2rem;
  padding: 1rem var(--gutter) 1.25rem;
  background: linear-gradient(90deg, rgba(201, 151, 63, 0.16), rgba(201, 151, 63, 0.3), rgba(201, 151, 63, 0.16));
  color: var(--text);
}
.foot-links { display: flex; gap: 1.25rem; }
.foot-links a { line-height: 2.75rem; }
.foot-row > span:first-child { line-height: 2.75rem; }

@media (max-width: 820px) {
  :root { --top-height: 5.5rem; }
  .brand { line-height: 2.25rem; }
  .nav { width: 100%; justify-content: space-between; gap: 0 0.75rem; }
  .nav a { font-size: 0.95rem; letter-spacing: 0.03em; }
  .hero { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .cover { width: min(68vw, 20rem); }
  .brand { font-size: 0.95rem; }
  .actions { justify-content: center; }
}

/* On a phone held sideways a fixed header would take up too much of the screen. */
@media (max-height: 480px) {
  .top { position: relative; }
  html { scroll-padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .amulet::after { animation: none; }
  .btn, .nav a, .nav a::before, .nav a::after, .foot-links a, .foot-links a::before, .foot-links a::after { transition: none; }
}
