/* =============================================================
   L. R. VOSS — The Between Trilogy
   Holding page. Palette and proportion derive from the
   BETWEEN MINDS cover artwork.
   ============================================================= */

:root {
  /* --- Ground ------------------------------------------------ */
  --bg:            #04050a;
  --bg-lift:       #070915;

  /* --- Ink (all pass WCAG AA on --bg) ------------------------ */
  --ink:           #eaeef8;
  --ink-2:         #a8b0c8;
  --ink-3:         #7a83a0;
  --rule:          rgba(138, 152, 196, 0.16);
  --rule-strong:   rgba(150, 180, 255, 0.42);

  /* --- Luminosity borrowed from the cover -------------------- */
  --glow-blue:     #86b6ff;
  --glow-violet:   #a48cff;

  /* --- Type -------------------------------------------------- */
  --font-display: "Avenir Next", Avenir, Futura, "Century Gothic",
                  "URW Gothic", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-serif:   "Iowan Old Style", "Palatino Linotype", Palatino, Palladio,
                  Georgia, "Times New Roman", serif;

  /* --- Measure ----------------------------------------------- */
  --shell:        1180px;
  --gutter:       clamp(1.5rem, 5vw, 4rem);
  --section-gap:  clamp(6rem, 14vh, 11rem);
}

/* =============================================================
   Reset
   ============================================================= */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }

:focus-visible {
  outline: 2px solid var(--glow-blue);
  outline-offset: 4px;
  border-radius: 2px;
}

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  z-index: 10;
  padding: 0.75rem 1.25rem;
  background: var(--bg-lift);
  color: var(--ink);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--rule);
}
.skip-link:focus {
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  left: 1rem;
  top: 1rem;
}

/* =============================================================
   Atmosphere — programmatic, no imagery. Sits behind everything
   and must never compete with the cover.
   ============================================================= */

.atmosphere,
.grain {
  position: fixed;
  inset: 0;
  overflow: hidden;      /* the drift may never widen the document */
  pointer-events: none;
  z-index: 0;
}

.atmosphere__drift {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(48rem 40rem at 22% 26%, rgba(64, 104, 200, 0.16), transparent 62%),
    radial-gradient(42rem 36rem at 74% 18%, rgba(116, 86, 210, 0.13), transparent 60%),
    radial-gradient(60rem 44rem at 50% 104%, rgba(58, 78, 170, 0.12), transparent 64%);
  will-change: transform;
  animation: drift 96s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(-1.2%, -0.8%, 0) scale(1); }
  to   { transform: translate3d(1.2%,  0.9%, 0) scale(1.05); }
}

/* Fine tonal grain — keeps the deep blacks from banding. */
.grain {
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

main, .footer { position: relative; z-index: 1; }

/* =============================================================
   Shared type
   ============================================================= */

.eyebrow,
.section-heading,
.status,
.book__num,
.book__key,
.copyright {
  font-size: clamp(0.66rem, 1.4vw, 0.74rem);
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* Trailing letter-spacing would otherwise offset optical centring. */
.eyebrow, .section-heading, .status, .book__num, .book__key, .copyright,
.book-title, .book__title, .author-name, .byline { margin-right: -0.32em; }

.eyebrow .dot { margin-inline: 0.5em; opacity: 0.7; }

/* The series line sits beneath the title, as it does on the cover. */
.book-title + .eyebrow { margin-top: clamp(1.1rem, 2.2vw, 1.5rem); }

/* =============================================================
   Hero
   ============================================================= */

.hero {
  padding-block: clamp(4.5rem, 13vh, 9rem) clamp(4rem, 10vh, 7rem);
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: clamp(3rem, 7vw, 7.5rem);
  align-items: center;
}

/* --- Cover -------------------------------------------------- */

.cover {
  position: relative;
  width: min(72vw, 320px);
}

@media (min-width: 861px) {
  .cover { width: 400px; }
}

/* Ambient halo: defines the cover's edge against a near-black
   page without touching a single pixel of the artwork. */
.cover::before {
  content: "";
  position: absolute;
  inset: -14%;
  z-index: -1;
  background: radial-gradient(closest-side,
              rgba(108, 142, 236, 0.30), rgba(108, 142, 236, 0) 76%);
  filter: blur(6px);
}

.cover img {
  width: 100%;
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(154, 176, 232, 0.16),
    0 28px 60px -20px rgba(0, 0, 0, 0.9),
    0 0 90px -30px rgba(120, 150, 255, 0.5);
}

/* --- Hero typography ---------------------------------------- */

.book-title {
  font-size: clamp(2.5rem, 6.2vw, 4.25rem);
  font-weight: 250;
  line-height: 1.04;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #fff;
}

/* Two lines, as on the cover itself. */
.book-title span { display: block; }

.tagline {
  margin-top: clamp(1.6rem, 3.5vw, 2.4rem);
  font-family: var(--font-serif);
  font-size: clamp(1.18rem, 2.1vw, 1.5rem);
  line-height: 1.5;
  color: var(--ink);
}
.tagline span { display: block; }
.tagline span + span { color: var(--ink-2); }

.intro {
  margin-top: clamp(1.6rem, 3.5vw, 2.3rem);
  max-width: min(44ch, 100%);
  font-family: var(--font-serif);
  font-size: clamp(1rem, 1.35vw, 1.075rem);
  line-height: 1.78;
  color: var(--ink-2);
}

.vessel { font-style: italic; color: var(--ink); }

.threshold {
  margin-top: clamp(1.4rem, 3vw, 2rem);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  color: var(--ink-2);
}

.byline {
  margin-top: clamp(2.2rem, 5vw, 3.2rem);
  font-size: clamp(0.8rem, 1.6vw, 0.92rem);
  font-weight: 400;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--ink);
}

.status {
  margin-top: 1.1rem;
  letter-spacing: 0.26em;
  color: var(--ink-3);
}
.status:empty { display: none; }

/* --- Purchase ----------------------------------------------- */

.purchase {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: clamp(1.6rem, 3.5vw, 2.2rem);
}

.buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.85rem 1.4rem 0.85rem calc(1.4rem + 0.28em);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  background: rgba(134, 182, 255, 0.06);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  box-shadow: 0 0 40px -18px rgba(120, 150, 255, 0.6);
  transition: color 0.35s ease, background-color 0.35s ease,
              border-color 0.35s ease, box-shadow 0.35s ease;
}

.buy:hover,
.buy:focus-visible {
  color: #fff;
  background: rgba(134, 182, 255, 0.12);
  border-color: var(--glow-blue);
  box-shadow: 0 0 48px -14px rgba(120, 150, 255, 0.8);
}

/* Cleared in config.js → no dead button, and no empty row. */
.buy:not([href]),
.purchase li:not(:has(.buy[href])),
.purchase:not(:has(.buy[href])) { display: none; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* =============================================================
   Series
   ============================================================= */

.series { padding-block: var(--section-gap); }

.section-heading { margin-bottom: clamp(2.5rem, 6vw, 4rem); }

.books {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(2rem, 4.5vw, 3.5rem);
}

.book {
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  transition: color 0.6s ease, border-color 0.6s ease;
}

.book__num {
  display: block;
  margin-bottom: 1.1rem;
  font-size: 0.68rem;
  letter-spacing: 0.34em;
  color: inherit;
}

.book__title {
  font-size: clamp(0.95rem, 1.9vw, 1.12rem);
  font-weight: 300;
  letter-spacing: 0.2em;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--ink-2);
  transition: color 0.6s ease;
}

.book__key {
  margin-top: 0.7rem;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-style: italic;
  letter-spacing: 0;
  text-transform: none;
  color: inherit;
}

/* The published-first volume carries the light. */
.book--current {
  border-top-color: var(--rule-strong);
  color: var(--ink-2);
}
.book--current .book__title {
  color: #fff;
  font-weight: 400;
}
.book--current .book__num { color: var(--glow-blue); }

/* =============================================================
   Closing identity
   ============================================================= */

.closing {
  padding-block: 0 var(--section-gap);
}

.closing__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
}

.author-name {
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  font-weight: 300;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--ink);
}

.author-line {
  margin-top: 1.6rem;
  max-width: min(34ch, 100%);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.02rem, 1.7vw, 1.18rem);
  line-height: 1.6;
  color: var(--ink-2);
}

/* --- Social ------------------------------------------------- */

.social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(1.75rem, 5vw, 2.75rem);
  margin-top: clamp(2.5rem, 6vw, 3.5rem);
}

.social__link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-3);
  transition: color 0.35s ease;
}

/* Only an element that actually links behaves like one. */
.social__link[href]:hover,
.social__link[href]:focus-visible { color: var(--ink); }

.social__icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.social__icon .dotfill { fill: currentColor; stroke: none; }

/* =============================================================
   Footer
   ============================================================= */

.footer {
  padding-block: clamp(2.5rem, 6vw, 3.5rem) clamp(2.5rem, 6vw, 4rem);
  border-top: 1px solid var(--rule);
}

.copyright {
  text-align: center;
  font-size: 0.66rem;
  letter-spacing: 0.28em;
  color: var(--ink-3);
}

/* =============================================================
   Reveal — a single slow settle, once, on first sight.
   ============================================================= */

.js .reveal {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition:
    opacity 1.25s cubic-bezier(0.22, 0.61, 0.36, 1) var(--delay, 0ms),
    transform 1.25s cubic-bezier(0.22, 0.61, 0.36, 1) var(--delay, 0ms);
}

/* =============================================================
   Responsive — a re-composition, not a reduction.
   ============================================================= */

@media (max-width: 860px) {
  .hero { padding-block: clamp(3rem, 9vh, 4.5rem) clamp(3rem, 8vh, 4rem); }

  .hero__grid {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: clamp(2.75rem, 9vw, 4rem);
  }

  .hero__text {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .intro { max-width: min(40ch, 100%); }

  .purchase { justify-content: center; }

  .books {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .book { padding-block: 1.6rem; }
  .book:last-child { border-bottom: 1px solid var(--rule); }
  .book__num { margin-bottom: 0.9rem; }
}

@media (max-width: 400px) {
  :root { --gutter: 1.35rem; }
  .book-title { letter-spacing: 0.1em; }
  .byline { letter-spacing: 0.3em; }
  .author-name { letter-spacing: 0.3em; }
}

/* =============================================================
   Reduced motion — everything still arrives, nothing moves.
   ============================================================= */

@media (prefers-reduced-motion: reduce) {
  .atmosphere__drift { animation: none; }

  .js .reveal { opacity: 1; transform: none; }
  .js .reveal.is-visible { transition: none; }

  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Never let a print request produce a black page. */
@media print {
  .atmosphere, .grain, .skip-link, .purchase { display: none; }
  body { background: #fff; color: #000; }
}
