/* The Conviction of Covenant: one page. Palette and type pulled from the cover. */

@font-face {
  font-family: "Marcellus";
  src: url("/fonts/marcellus-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Crimson Pro";
  src: url("/fonts/crimson-pro-var.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Crimson Pro";
  src: url("/fonts/crimson-pro-var-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  /* neutral: the stone gray the mockups sit on (exact match, so the book melts in) */
  --stone: #e7e1dc;
  --stone-deep: #dcd5ce;
  /* color 1: powder blue cover paper */
  --powder-hi: #c6d3e1;
  --powder: #b4c6da;
  --powder-lo: #a9bcd2;
  /* color 2: navy ink */
  --navy: #2b3a5a;
  --navy-deep: #222e48;
  --ink-soft: #4a5b7c;
  --study-band: #517295;
  --paper-on-navy: #e7e1dc;

  --display: "Marcellus", "Optima", "Candara", serif;
  --text: "Crimson Pro", "Iowan Old Style", "Georgia", serif;

  --gutter: clamp(1rem, 5vw, 4.5rem);
  --measure: 34rem;
  --step-0: clamp(1.1875rem, 1.05rem + 0.45vw, 1.375rem);
  --step-1: clamp(1.375rem, 1.15rem + 0.9vw, 1.75rem);
  --step-2: clamp(1.75rem, 1.3rem + 1.9vw, 2.75rem);
  --step-3: clamp(2.1rem, 1.4rem + 3vw, 3.75rem);
}

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

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

body {
  margin: 0;
  background: var(--stone);
  color: var(--navy);
  font-family: var(--text);
  font-size: var(--step-0);
  line-height: 1.55;
  font-optical-sizing: auto;
  overflow-x: clip;
}

/* paper grain over everything; tile is a tiny transparent PNG */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: url("/images/grain.png") repeat;
  background-size: 200px 200px;
  opacity: 0.75;
  z-index: 50;
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

h1, h2, h3 { font-weight: 400; margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; text-wrap: pretty; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--navy);
  color: var(--stone);
  padding: 0.75rem 1rem;
  z-index: 60;
}
.skip:focus { top: 1rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- HERO ---------- */

.hero {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  padding: clamp(2rem, 6vw, 3rem) var(--gutter) 0;
  position: relative;
}

.hero__imprint {
  font-family: var(--display);
  font-size: 0.8125rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: clamp(1.75rem, 5vw, 2.75rem);
}

.wordmark {
  font-family: var(--display);
  color: var(--navy);
  line-height: 0.92;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.wordmark__big {
  font-size: clamp(2.75rem, 12.4vw, 6.4rem);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.wordmark__small {
  font-family: var(--text);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.6rem, 6.2vw, 3rem);
  line-height: 1;
  color: var(--ink-soft);
  margin-left: 0.35em;
  margin-bottom: 0.08em;
}
.wordmark__small--of {
  margin: 0.06em 0 0.1em 2.6em;
}

.hero__tagline {
  font-family: var(--display);
  font-size: var(--step-1);
  margin: clamp(1.4rem, 4vw, 2rem) 0 0.6rem;
  letter-spacing: 0.02em;
}

.hero__launch {
  max-width: 27rem;
  color: var(--ink-soft);
  margin-bottom: 1.75rem;
}
.hero__launch [data-launch] { color: var(--navy); font-weight: 600; }

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0.7rem 1.6rem;
  background: var(--navy);
  color: var(--stone);
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 2px;
  transition: background-color 0.2s ease;
}
.button:hover { background: var(--navy-deep); }

.textlink {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-style: italic;
  color: var(--navy);
}

.hero__book {
  margin: clamp(0.5rem, 3vw, 1.5rem) calc(var(--gutter) * -1) 0;
}
.hero__book img { width: 100%; }

@media (min-width: 960px) {
  .hero {
    grid-template-columns: minmax(0, 40fr) minmax(0, 60fr);
    min-height: min(100svh, 980px);
    padding-top: 2.5rem;
    padding-right: 0;
  }
  .hero__text { padding-bottom: 3rem; position: relative; z-index: 1; }
  .hero__book { margin: 0 0 0 -3vw; }
  .wordmark__big { font-size: clamp(3.4rem, 6vw, 6.6rem); }
  .wordmark__small { font-size: clamp(2rem, 3vw, 3.2rem); }
}

/* landscape phones: keep the hero side by side and short */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 959px) {
  .hero { grid-template-columns: 1fr 1fr; padding-right: 0; }
  .hero__imprint { margin-bottom: 1rem; }
  .wordmark__big { font-size: clamp(2.2rem, 6.4vw, 3.4rem); }
  .wordmark__small { font-size: clamp(1.3rem, 3.2vw, 1.8rem); }
  .hero__book { margin: 0; }
}

/* ---------- COVENANT (description + rings) ---------- */

.covenant {
  /* the cover paper: soft vertical fade of powder blue */
  background: linear-gradient(180deg, var(--powder-hi) 0%, var(--powder) 45%, var(--powder-lo) 100%);
  padding: clamp(4rem, 12vw, 9rem) var(--gutter) clamp(4rem, 10vw, 8rem);
  position: relative;
}
/* soft hand-off from the stone hero into the blue paper */
.covenant::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: clamp(3rem, 8vw, 6rem);
  background: linear-gradient(180deg, var(--stone), rgba(231, 225, 220, 0));
  pointer-events: none;
}

.covenant__lead {
  position: relative;
  font-family: var(--display);
  font-size: var(--step-3);
  line-height: 1.12;
  max-width: 19ch;
  margin: 0 auto clamp(2.5rem, 7vw, 5rem);
  text-align: center;
  color: var(--navy);
}

.covenant__body {
  display: grid;
  gap: clamp(1.5rem, 5vw, 3rem);
  max-width: 64rem;
  margin: 0 auto;
}

.covenant__text {
  max-width: var(--measure);
  font-size: calc(var(--step-0) * 1.06);
  line-height: 1.62;
}
.covenant__text p:last-child { margin-bottom: 0; }

.rings {
  text-align: center;
  align-self: start;
}
.rings__svg {
  width: min(15rem, 62vw);
  height: auto;
  overflow: visible;
  display: block;
  margin: 0 auto;
}
.ring__halo { fill: none; stroke: var(--powder); stroke-width: 13; }
.ring__band { fill: none; stroke: var(--powder-hi); stroke-width: 6; }
.ring__edge { fill: none; stroke: var(--navy); stroke-width: 1.7; }
.ring__edge--in { stroke-width: 1.3; }

/* The rings. Interlocked is the default (no JS, reduced motion). With motion, JS adds
   .rings-wait to <html> so they start apart, then .is-on when the rings are reached:
   they roll in from either side, link with a small settle, a light runs round the
   bands, and the line comes up. After that a slow glint passes every few seconds. */
.ring-a, .ring-b { transform-box: view-box; }
.ring__shine { fill: none; stroke: #f4f7fb; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 22 300; stroke-dashoffset: 0; opacity: 0; }

.rings-wait .rings:not(.is-on) .ring-a { transform: translateX(-140px) rotate(-200deg); opacity: 0; }
.rings-wait .rings:not(.is-on) .ring-b { transform: translateX(140px) rotate(200deg); opacity: 0; }
.rings-wait .rings:not(.is-on) .rings__line span { opacity: 0; translate: 0 .6rem; }

.rings.is-on .ring-a { animation: roll-a 1.5s cubic-bezier(.22, .8, .25, 1) both; transform-origin: 104px 75px; }
.rings.is-on .ring-b { animation: roll-b 1.5s cubic-bezier(.22, .8, .25, 1) both; transform-origin: 156px 75px; }
@keyframes roll-a {
  0% { transform: translateX(-140px) rotate(-200deg); opacity: 0; }
  20% { opacity: 1; }
  78% { transform: translateX(5px) rotate(4deg); }
  100% { transform: none; opacity: 1; }
}
@keyframes roll-b {
  0% { transform: translateX(140px) rotate(200deg); opacity: 0; }
  20% { opacity: 1; }
  78% { transform: translateX(-5px) rotate(-4deg); }
  100% { transform: none; opacity: 1; }
}
.rings.is-on .ring__shine { animation: shine 1.4s ease-out 1.35s, glint 7s ease-in-out 4s infinite; }
@keyframes shine {
  0% { opacity: 0; stroke-dashoffset: 0; }
  20% { opacity: .9; }
  100% { opacity: 0; stroke-dashoffset: -276; }
}
@keyframes glint {
  0%, 82%, 100% { opacity: 0; stroke-dashoffset: 0; }
  86% { opacity: .75; }
  96% { opacity: 0; stroke-dashoffset: -150; }
}
.rings.is-on .rings__line span { opacity: 1; translate: 0 0; transition: opacity .8s ease, translate .9s cubic-bezier(.2, .7, .2, 1); }
.rings.is-on .rings__line span:nth-child(1) { transition-delay: 1.2s; }
.rings.is-on .rings__line span:nth-child(2) { transition-delay: 1.45s; }

.rings__line {
  font-family: var(--display);
  font-size: var(--step-1);
  line-height: 1.25;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 1rem 0 0;
}
.rings__line span { display: block; }

@media (min-width: 860px) {
  .covenant__body {
    grid-template-columns: minmax(15rem, 1fr) minmax(0, var(--measure));
    gap: clamp(3rem, 7vw, 7rem);
    align-items: start;
  }
  .rings {
    position: sticky;
    top: clamp(6rem, 22vh, 12rem);
  }
  .rings__svg { width: 16rem; }
}

/* ---------- THE SET ---------- */

.set {
  padding: clamp(4rem, 11vw, 8rem) 0 clamp(3.5rem, 9vw, 6rem);
}
.set__intro {
  padding: 0 var(--gutter);
  max-width: 72rem;
  margin: 0 auto;
  display: grid;
  gap: 1rem 4rem;
}
.set__title {
  font-family: var(--display);
  font-size: var(--step-2);
  line-height: 1.15;
  max-width: 16ch;
}
.set__intro p { max-width: 32rem; margin: 0; color: var(--ink-soft); }

@media (min-width: 860px) {
  .set__intro { grid-template-columns: 1.1fr 1fr; align-items: end; }
}

.set__figure {
  margin: clamp(1.5rem, 4vw, 2.5rem) auto 0;
  max-width: 1240px;
}
.set__figure img { width: 100%; }

.set__captions {
  display: grid;
  gap: 2rem;
  padding: 0 var(--gutter);
  margin-top: clamp(1rem, 3vw, 2rem);
}
.set__item {
  border-top: 5px solid var(--navy);
  padding-top: 0.9rem;
}
.set__item:nth-child(2) { border-top-color: var(--study-band); }
.set__item:nth-child(3) { border-top-color: var(--powder-lo); }
.set__item h3 {
  font-family: var(--display);
  font-size: 1.125rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.set__line {
  font-style: italic;
  margin: 0.3rem 0 0.6rem;
}
.set__item ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 1rem;
  color: var(--ink-soft);
}
.set__item li + li::before { content: none; }

@media (min-width: 700px) {
  /* captions line up under each book in the photograph (Leader, Study, book) */
  /* book edges in the photo sit at 2-35%, 38.5-68.5% and 71.5-98% of its width */
  .set__captions {
    grid-template-columns: 33.4fr 30fr 26.5fr;
    column-gap: 3.1%;
    padding: 0 2% 0 2%;
  }
}

.set__ask {
  padding: 0 var(--gutter);
  max-width: 72rem;
  margin: clamp(2.5rem, 6vw, 4rem) auto 0;
  font-size: var(--step-1);
  font-family: var(--text);
  line-height: 1.35;
}
.set__ask a { font-style: italic; }

/* ---------- AUTHOR ---------- */

.author {
  background-color: var(--navy);
  /* fine engraving hatch on the navy */
  background-image:
    repeating-linear-gradient(115deg, rgba(231, 225, 220, 0.035) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(25deg, rgba(10, 16, 30, 0.12) 0 1px, transparent 1px 9px);
  color: var(--paper-on-navy);
  padding: clamp(4.5rem, 12vw, 9rem) var(--gutter);
}
.author__inner {
  max-width: 72rem;
  margin: 0 auto;
  display: grid;
  gap: clamp(2.5rem, 7vw, 5rem);
}
.author__kicker {
  font-family: var(--display);
  font-size: 0.8125rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--powder);
  margin-bottom: 0.9rem;
}
.author__title {
  font-family: var(--display);
  font-size: var(--step-2);
  line-height: 1.15;
  margin-bottom: 1.75rem;
  max-width: 18ch;
}
.author__text { max-width: var(--measure); }
.author__text p:last-child { margin-bottom: 0; }

.author__photo { margin: 0; }
.author__photo img { width: 100%; filter: saturate(0.85); }

.mantra {
  margin: 0;
  position: relative;
}
.mantra p {
  font-family: var(--display);
  font-size: clamp(2.75rem, 11vw, 7rem);
  line-height: 1.02;
  color: var(--powder-hi);
  margin: 0;
  max-width: 9ch;
}
.mantra::before {
  content: "";
  display: block;
  width: 4.5rem;
  height: 1px;
  background: var(--powder);
  margin-bottom: 1.5rem;
}

@media (min-width: 960px) {
  .author__inner {
    grid-template-columns: minmax(0, var(--measure)) minmax(0, 1fr);
    align-items: center;
  }
  .author__photo { grid-column: 1 / -1; max-width: 22rem; }
  .mantra { padding-left: clamp(1rem, 4vw, 4rem); }
}

/* ---------- MORE FROM VJ ---------- */

.more {
  padding: clamp(4rem, 10vw, 7rem) var(--gutter) clamp(2rem, 5vw, 3rem);
  max-width: 72rem;
  margin: 0 auto;
}
.more__title {
  font-family: var(--display);
  font-size: var(--step-1);
  margin-bottom: 1.5rem;
}
.more__list { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgba(43, 58, 90, 0.35); }
.more__list li { border-bottom: 1px solid rgba(43, 58, 90, 0.35); }
.more__list a {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0.15rem 1.5rem;
  padding: 1.25rem 0;
  min-height: 44px;
  text-decoration: none;
}
.more__name {
  font-family: var(--display);
  font-size: var(--step-2);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.more__sub { grid-column: 1; font-style: italic; color: var(--ink-soft); }
.more__go {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-family: var(--display);
  font-size: 0.875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.more__go::after { content: " \2197"; }
.more__list a:hover .more__name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
.more__later { margin: 1.25rem 0 0; color: var(--ink-soft); font-size: 1.0625rem; }

@media (min-width: 860px) {
  .more { display: grid; grid-template-columns: 1fr 2fr; gap: 0 4rem; align-items: start; }
  .more__title { max-width: 12ch; grid-row: span 2; }
  .more__later { grid-column: 2; }
}

/* ---------- FOOTER ---------- */

.footer {
  text-align: center;
  padding: clamp(2.5rem, 6vw, 4rem) var(--gutter) 3rem;
  font-size: 1.0625rem;
  color: var(--ink-soft);
}
.footer__engraving {
  width: min(19rem, 72vw);
  margin: 0 auto 1.5rem;
}
.footer__pub { font-family: var(--display); color: var(--navy); letter-spacing: 0.04em; margin-bottom: 0.4rem; }
.footer__meta { margin: 0; overflow-wrap: anywhere; }
.footer a { display: inline-block; padding: 0.55rem 0; }

/* ---------- 404 ---------- */
.lost {
  min-height: 100svh;
  display: grid;
  place-content: center;
  justify-items: start;
  padding: 2rem var(--gutter);
  max-width: 40rem;
  margin: 0 auto;
}
.lost h1 { font-family: var(--display); font-size: var(--step-3); line-height: 1.1; margin-bottom: 1rem; }
.lost img { width: min(18rem, 70vw); margin-bottom: 2rem; }

/* ---------- hero intro on load: the title inks in, the paperback is set down beside it ---------- */
@media (prefers-reduced-motion: no-preference) {
  .intro .hero__imprint { animation: cov-fade .9s ease .1s both; }
  .intro .wordmark__big { animation: cov-ink 1.4s cubic-bezier(.2, .7, .2, 1) both; }
  .intro .wordmark__big:nth-of-type(2) { animation-delay: .25s; }
  .intro .wordmark__big:nth-of-type(4) { animation-delay: .55s; }
  .intro .wordmark__small { animation: cov-fade 1s ease .95s both; }
  .intro .wordmark__small--of { animation-delay: 1.1s; }
  .intro .hero__tagline { animation: cov-up .9s cubic-bezier(.2, .7, .2, 1) 1.25s both; }
  .intro .hero__launch { animation: cov-up .9s cubic-bezier(.2, .7, .2, 1) 1.4s both; }
  .intro .hero__actions { animation: cov-up .9s cubic-bezier(.2, .7, .2, 1) 1.55s both; }
  .intro .hero__book img { animation: cov-set 1.8s cubic-bezier(.2, .75, .2, 1) .35s both; transform-origin: 60% 70%; }
}
@keyframes cov-ink {
  from { opacity: 0; letter-spacing: .08em; filter: blur(6px); }
  to { opacity: 1; filter: none; }
}
@keyframes cov-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cov-up { from { opacity: 0; transform: translateY(.9rem); } to { opacity: 1; transform: none; } }
@keyframes cov-set {
  0% { opacity: 0; transform: translate(9%, -7%) rotate(-5deg) scale(1.05); }
  35% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rings * { animation: none !important; transition: none !important; }
  .button { transition: none; }
}
