:root {
  color-scheme: light;
  --night: #111127;
  --violet: #252345;
  --ivory: #f9f4e9;
  --ink: #22213a;
  --lavender: #e4d9fa;
  --soft: #e2daea;
  --amber: #ffc18b;
  --line: rgba(227, 214, 249, .22);
  --shadow: 0 24px 65px rgba(8, 5, 20, .33);
  --display: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ivory);
  background:
    radial-gradient(ellipse at 11% 15%, #30406d 0, transparent 48rem),
    radial-gradient(ellipse at 90% 29%, #493060 0, transparent 42rem),
    linear-gradient(150deg, #1d1c3b, var(--night) 72%);
  font: 1rem/1.6 system-ui, sans-serif;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: .22em; }
:is(a, button, input):focus-visible { outline: 3px solid #ad85f2; outline-offset: 4px; }
cite { font-style: italic; }

.skip-link {
  position: fixed;
  z-index: 2;
  top: .8rem;
  left: .8rem;
  padding: .6rem 1rem;
  color: var(--ink);
  background: var(--ivory);
  transform: translateY(-200%);
}

.skip-link:focus { transform: none; }
.page-shell { width: min(1160px, calc(100% - 3.5rem)); margin-inline: auto; }

.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-bar { min-height: 84px; border-bottom: 1px solid var(--line); }
.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  font: 700 1rem/1.1 var(--display);
  letter-spacing: .085em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand img {
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  box-shadow: 0 3px 16px rgba(9, 6, 23, .36);
}

.reader-note, .eyebrow {
  font-size: .73rem;
  font-weight: 750;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.reader-note { color: var(--lavender); text-align: right; }
.eyebrow { margin: 0 0 .85rem; color: var(--amber); }
.eyebrow span { margin-right: .25rem; }

h1, h2 {
  margin: 0;
  font-family: var(--display);
  text-wrap: balance;
  line-height: 1.06;
  letter-spacing: -.035em;
}

h1 { font-size: clamp(2.5rem, 5.4vw, 4.9rem); }
.primary-button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .8rem;
  min-height: 52px;
  padding: .7rem .9rem;
  border-radius: .55rem;
  color: #211425;
  background: linear-gradient(130deg, #ffd4a6, #ffac69);
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background-color .18s, box-shadow .18s, transform .18s;
}

.primary-button span { font-size: 1.35em; line-height: 1; }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 5px 13px rgba(90, 47, 46, .23); }
.footer {
  display: grid;
  justify-items: start;
  gap: .6rem;
  margin-top: 2.8rem;
  padding-block: 1.1rem 5rem;
  border-top: 1px solid var(--line);
  color: var(--soft);
  font-size: .83rem;
}

.footer p { margin: 0; }
.footer nav { display: flex; flex-wrap: wrap; justify-content: flex-start; column-gap: 1.3rem; row-gap: .45rem; }
.footer a:hover, .footer a[aria-current] { color: white; }

.legal-wrap { padding-top: clamp(1.5rem, 5vw, 4rem); }
.legal-card {
  max-width: 790px;
  margin-inline: auto;
  padding: clamp(1.25rem, 5vw, 3.35rem);
  border: 1px solid rgba(255, 255, 255, .66);
  border-radius: 1.4rem;
  color: var(--ink);
  background: var(--ivory);
  box-shadow: var(--shadow);
}

.legal-card h1 { margin-top: 1.35rem; font-size: clamp(2.1rem, 5vw, 4rem); overflow-wrap: anywhere; }
.back-link { color: #543483; font-weight: 700; }
.back-link span { margin-right: .2rem; }

.legal-date { margin-bottom: 1.8rem; color: #61586d; font-size: .9rem; }
.legal-card h2 { margin-top: 1.6rem; font-size: clamp(1.35rem, 3vw, 1.8rem); }
.legal-card p { margin-top: .6rem; }
.legal-card a { overflow-wrap: anywhere; }

.catalog-page { background: var(--ivory); color: var(--ink); }
.catalog-banner {
  color: var(--ivory);
  background:
    radial-gradient(ellipse at 14% 5%, #334672, transparent 57%),
    radial-gradient(ellipse at 85% 18%, #55356b, transparent 62%),
    var(--night);
}

.catalog-intro { padding-block: clamp(2.1rem, 5.2vw, 4.1rem); text-align: center; }
.catalog-intro h1 { font-size: clamp(2.5rem, 6.2vw, 4.65rem); }
.catalog-intro h1 em { color: var(--lavender); font-weight: 500; }
.catalog-intro p:not(.eyebrow, .edition-label) { max-width: 53ch; margin: 1rem auto .65rem; color: var(--soft); }
.edition-label { margin: 0; color: var(--lavender); font-size: .8rem; }
.catalog-main { padding-top: clamp(1.7rem, 4vw, 3rem); }
.catalog-heading { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .85rem; }
.catalog-heading .eyebrow, .catalog-copy .eyebrow, .catalog-brand .eyebrow { margin: 0; color: #65428d; }
.catalog-heading h2 { font-family: inherit; line-height: 1.5; }
.catalog-heading > span { color: #514b64; font-size: .84rem; white-space: nowrap; }
.catalog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1rem, 3vw, 1.75rem); }
.catalog-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1rem;
  min-width: 0;
  padding: clamp(1rem, 3vw, 1.55rem);
  border: 1px solid #e0d5e9;
  border-radius: 1rem;
  background: #fffdf9;
  box-shadow: 0 9px 25px rgba(44, 30, 65, .07);
}

.catalog-cover {
  display: grid;
  place-items: center;
  min-width: 0;
  height: clamp(190px, 29vw, 310px);
  padding: 1rem;
  border-radius: .65rem;
}

.math-cover { background: radial-gradient(ellipse at 72% 80%, #fff0c5, transparent 60%), #e4edf9; }
.history-cover { background: radial-gradient(ellipse at 73% 76%, #f5dbc9, transparent 68%), #e0ebe7; }
.catalog-cover img { height: 100%; width: auto; min-height: 0; border-radius: 2px; box-shadow: 5px 9px 18px #25213b35; transition: transform .18s; }
a.catalog-cover:hover img { transform: translateY(-3px); }
.catalog-copy h3 { margin: .45rem 0; font: 700 clamp(1.35rem, 3.2vw, 2rem)/1.14 var(--display); letter-spacing: -.025em; }
.catalog-copy p:last-child { margin: 0; color: #514b64; font-size: .94rem; }
.catalog-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; min-height: 52px; }
.catalog-actions .primary-button { width: 100%; justify-content: space-between; text-align: left; }
.catalog-brand {
  display: flex;
  align-items: center;
  gap: clamp(.8rem, 3vw, 1.6rem);
  max-width: 720px;
  margin: 2.7rem auto 0;
  padding: 1.35rem 0;
  border-block: 1px solid #ddd0e6;
}

.catalog-brand img { width: clamp(60px, 15vw, 96px); border-radius: 50%; }
.catalog-brand h2 { margin-top: .3rem; font-size: 1.65rem; }
.catalog-brand p:last-child { margin: .4rem 0 0; color: #514b64; font-size: .91rem; }
.catalog-page .footer { color: #514b64; border-color: #ddd0e6; }
.catalog-page .footer a:hover { color: #543483; }

@media (max-width: 750px) {
  .page-shell { width: calc(100% - 2.25rem); }
  .brand-bar { min-height: 70px; }
  .brand { gap: .45rem; font-size: .85rem; }
  .brand img { width: 38px; }
  .reader-note { font-size: .63rem; }
}

@media (max-width: 640px) {
  .footer nav { flex-direction: column; align-items: flex-start; }
  .catalog-grid { grid-template-columns: minmax(0, 1fr); }
  .catalog-card {
    grid-template-columns: minmax(70px, 27%) minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: start;
  }
  .catalog-cover { height: auto; aspect-ratio: .78; padding: .26rem; }
  .catalog-cover img { width: 100%; height: auto; }
  .catalog-copy .eyebrow { font-size: .65rem; }
  .catalog-copy p:last-child { font-size: .86rem; }
  .catalog-actions { grid-column: 1 / -1; min-height: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .primary-button, .catalog-cover img { transition: none; }
}
