/* Between the Door and the Deadbolt: one-page book site */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin-800-normal.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin-500-italic.woff2") format("woff2");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-latin-wght-italic.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  /* from the cover */
  --night: #1e2733;
  --night-deep: #151b24;
  --line: #66707c;
  --sky: #6fa6d6;
  --sky-ink: #2c5a83;
  --cream: #efe7d8;
  --cream-deep: #e4d8c3;
  --cream-muted: #bdb5a6;
  --ink: #1e2733;
  --ink-soft: #46505c;

  --grot: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;

  --gutter: clamp(1.25rem, 5vw, 5rem);
  --wide: 84rem;
  --pad: max(var(--gutter), calc((100% - var(--wide)) / 2 + var(--gutter)));
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--night);
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.0625rem, 0.98rem + 0.35vw, 1.25rem);
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

/* paper grain over everything, like the cover stock */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: url("../images/grain.png") repeat;
  background-size: 180px 180px;
  opacity: .1;
}

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

a { color: inherit; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 3px; }

p { margin: 0 0 1em; }
h1, h2 { margin: 0; font-weight: 800; }
cite { font-style: italic; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 60;
  padding: .75rem 1rem;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--grot);
  font-weight: 800;
  text-decoration: none;
}
.skip:focus { top: 1rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  min-height: 3.25rem;
  padding: .85rem 1.6rem;
  border-radius: 2px;
  background: var(--cream);
  color: var(--night);
  font-family: var(--grot);
  font-weight: 800;
  font-size: 1.0625rem;
  letter-spacing: -.01em;
  text-decoration: none;
  transition: background-color .2s ease, color .2s ease;
}
.btn:hover { background: var(--sky); color: var(--night-deep); }
.btn--dark { background: var(--night); color: var(--cream); }
.btn--dark:hover { background: var(--sky-ink); color: var(--cream); }

/* =========================================================
   THE DOOR: hero. Final state is the default (no JS, reduced motion).
   With motion, html.intro plays the keyhole zoom once on load.
   ========================================================= */
.door {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  color: var(--cream);
  background: var(--night);
  isolation: isolate;
  overflow: hidden;
}
.door__bg {
  position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(120% 90% at 50% 45%, #273241 0%, var(--night) 48%, var(--night-deep) 100%);
}
.door__sky {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 62% 40%;
}
/* the overlay behind the words: deep on the text side, open over the book */
.door__veil {
  position: absolute; inset: 0; z-index: 2;
  background:
    linear-gradient(to bottom, rgba(239, 231, 216, 0) 78%, var(--cream) 100%),
    linear-gradient(100deg, rgba(21, 27, 36, .9) 0%, rgba(21, 27, 36, .78) 36%, rgba(21, 27, 36, .2) 62%, rgba(21, 27, 36, 0) 88%);
}
.door__lock {
  position: absolute; z-index: 3;
  left: 50%; top: 50%;
  height: min(64svh, 34rem);
  aspect-ratio: 120 / 380;
  translate: -50% -50%;
  display: none;
}
.door__svg { width: 100%; height: 100%; overflow: visible; }
.door__lines { stroke: var(--line); }
.door__hole { filter: drop-shadow(0 0 3px rgba(111, 166, 214, .8)); }

.door__content {
  position: relative; z-index: 4;
  width: 100%;
  max-width: var(--wide);
  margin-inline: auto;
  padding: clamp(3rem, 9vh, 6rem) var(--gutter) clamp(4rem, 12vh, 7rem);
  display: grid;
  align-content: center;
  gap: clamp(2.5rem, 6vh, 4rem);
}

.title {
  font-family: var(--grot);
  font-weight: 800;
  font-size: max(3rem, min(17vw, 10vh));
  line-height: .9;
  letter-spacing: -.045em;
  color: var(--cream);
  margin-bottom: clamp(1.25rem, 3vh, 2rem);
}
.title span { display: block; }

.tagline {
  font-family: var(--grot);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.25rem, 1rem + 1.1vw, 1.9rem);
  line-height: 1.15;
  letter-spacing: -.02em;
  margin-bottom: 1.4em;
}
.byline {
  font-family: var(--grot);
  font-weight: 800;
  font-size: clamp(1.2rem, 1rem + .7vw, 1.6rem);
  letter-spacing: -.025em;
  line-height: 1.15;
  margin-bottom: 1rem;
}
.byline__small {
  display: block;
  font-weight: 400;
  font-size: .8125rem;
  letter-spacing: .02em;
  text-transform: uppercase;
  margin-bottom: .2rem;
  color: var(--cream-muted);
}
.launch {
  font-family: var(--grot);
  font-size: 1rem;
  line-height: 1.4;
  color: var(--cream-muted);
  margin-bottom: 1.25rem;
}

.door__book { margin: 0; justify-self: center; width: min(58vw, 15rem); }
.door__book img {
  width: 100%; height: auto;
  border-radius: 1px 3px 3px 1px;
  box-shadow: 0 2px 2px rgba(10, 14, 20, .35), 0 30px 60px -18px rgba(10, 14, 20, .75);
}

.door__skip {
  position: absolute; z-index: 6;
  right: var(--gutter); bottom: clamp(1rem, 4vh, 2rem);
  min-height: 44px; padding: .5rem 1rem;
  font: 500 .875rem/1 var(--grot);
  letter-spacing: .04em;
  color: var(--cream-muted);
  background: transparent;
  border: 1px solid rgba(189, 181, 166, .45);
  border-radius: 2px;
  cursor: pointer;
}
.door__skip:hover { color: var(--cream); border-color: var(--cream-muted); }

@media (min-width: 48em) {
  .door__content {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
    align-items: center;
  }
  .title { font-size: min(8.6vw, 13vh); }
  .door__text { max-width: 36rem; }
  .door__book { width: min(24vw, 21rem); justify-self: end; margin-right: clamp(0rem, 4vw, 4rem); }
}
@media (max-width: 47.99em) {
  .door__veil {
    background:
      linear-gradient(to bottom, rgba(239, 231, 216, 0) 86%, var(--cream) 100%),
      linear-gradient(to bottom, rgba(21, 27, 36, .9) 0%, rgba(21, 27, 36, .78) 50%, rgba(21, 27, 36, .35) 78%, rgba(21, 27, 36, .2) 100%);
  }
}
/* short landscape phones */
@media (max-height: 30em) and (orientation: landscape) {
  .title { font-size: max(2.4rem, min(7vw, 14vh)); }
  .door__content { padding-block: 2rem 3rem; }
  .door__book { width: min(20vw, 11rem); }
}

/* ---------- the intro: door in the dark, through the keyhole, into the morning ---------- */
.intro .door__lock { display: block; }
.intro .door__hole { display: none; }
.intro .door__sky { clip-path: circle(0 at 50% 50%); }
.intro .door__veil,
.intro .door__text > *,
.intro .door__book { opacity: 0; }
.intro .door__lock { opacity: 0; animation: lock-in .9s cubic-bezier(.2, .7, .2, 1) .15s forwards; }
@keyframes lock-in { from { opacity: 0; scale: .94; } to { opacity: 1; scale: 1; } }

/* after the zoom: the hero settles in */
.opened .door__lock { display: none; }
.opened .door__sky { clip-path: none; }
.opened .door__veil { opacity: 1; transition: opacity 1.1s ease; }
.opened .door__text > * {
  opacity: 1;
  translate: 0 0;
  transition: opacity .8s ease, translate .9s cubic-bezier(.2, .7, .2, 1);
}
.intro:not(.opened) .door__text > * { translate: 0 1.25rem; }
.opened .door__text > :nth-child(1) { transition-delay: .15s; }
.opened .door__text > :nth-child(2) { transition-delay: .35s; }
.opened .door__text > :nth-child(3) { transition-delay: .5s; }
.opened .door__text > :nth-child(4),
.opened .door__text > :nth-child(5) { transition-delay: .62s; }
.intro:not(.opened) .door__book { translate: 2.5rem 0; }
.opened .door__book {
  opacity: 1; translate: 0 0;
  transition: opacity 1s ease .45s, translate 1.2s cubic-bezier(.2, .7, .2, 1) .45s;
}

/* =========================================================
   THE LIGHT (hopeful half)
   ========================================================= */
.light {
  position: relative;
  background: var(--cream);
  color: var(--ink);
  overflow-x: clip;
}

.quote {
  margin: 0;
  padding: clamp(3rem, 8vw, 7rem) var(--pad) clamp(4rem, 9vw, 8rem);
}
.quote blockquote {
  margin: 0;
  max-width: 31ch;
  font-family: var(--serif);
  font-weight: 380;
  font-size: clamp(1.6rem, 1.05rem + 2.4vw, 3.15rem);
  line-height: 1.2;
  letter-spacing: -.012em;
  text-wrap: pretty;
}
.quote blockquote p { margin: 0 0 .6em; }
.quote blockquote p:first-child { text-indent: -.42em; }
.quote blockquote p:first-child::before { content: "\201C"; }
.quote__year {
  font-family: var(--grot);
  font-weight: 800;
  font-size: .82em;
  letter-spacing: -.035em;
}
.quote__turn {
  font-style: italic;
  color: var(--sky-ink);
}
.quote__turn::after { content: "\201D"; }
.quote figcaption {
  font-family: var(--grot);
  font-size: .9375rem;
  color: var(--ink-soft);
}

/* ---------- description ---------- */
.about {
  padding: clamp(3rem, 7vw, 6rem) var(--pad) clamp(3rem, 6vw, 5.5rem);
  display: grid;
  gap: clamp(1.75rem, 4vw, 3.5rem);
  background:
    linear-gradient(rgba(30, 39, 51, .18), rgba(30, 39, 51, .18)) var(--pad) 0 / calc(100% - 2 * var(--pad)) 1px no-repeat;
}
.about__h {
  font-family: var(--grot);
  font-size: clamp(2rem, 1.2rem + 3.4vw, 4.4rem);
  line-height: .98;
  letter-spacing: -.04em;
  max-width: 15ch;
  text-wrap: balance;
}
.about__text { max-width: 36rem; }
.about__text p { hyphens: manual; }
.about__last { font-style: italic; }

/* the facts sit in one ruled strip; the cover lives in the hero */
.book {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem 3rem;
  padding-top: clamp(1.5rem, 3vw, 2rem);
  border-top: 1px solid rgba(30, 39, 51, .18);
}
.book__facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, auto));
  gap: 1rem 2.5rem;
  font-family: var(--grot);
}
.book__facts dt {
  font-size: .8125rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-soft);
}
.book__facts dd {
  margin: .15rem 0 0;
  font-weight: 800;
  font-size: 1.0625rem;
  letter-spacing: -.015em;
}
@media (min-width: 48em) {
  .book__facts { grid-template-columns: repeat(4, auto); column-gap: clamp(2rem, 4vw, 4rem); }
}

/* ---------- author ---------- */
.author {
  background: var(--cream-deep);
  padding: clamp(3.5rem, 8vw, 7rem) var(--pad);
  display: grid;
  gap: clamp(1.75rem, 4vw, 3rem);
}
.author > * { max-width: var(--wide); }
.author__head { max-width: 40rem; }
.kicker {
  font-family: var(--grot);
  font-size: .875rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--sky-ink);
  margin-bottom: .8rem;
}
.author h2 {
  font-family: var(--grot);
  font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3.6rem);
  line-height: 1;
  letter-spacing: -.04em;
  text-wrap: balance;
}
.author__text { max-width: 38rem; }
.author__lead {
  font-size: 1.18em;
  line-height: 1.5;
}
.author__years {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.1rem;
  align-items: start;
  margin: 2rem 0;
  padding: 1.4rem 0;
  border-top: 1px solid rgba(30, 39, 51, .2);
  border-bottom: 1px solid rgba(30, 39, 51, .2);
}
.author__years p { margin: 0; }
.author__num {
  font-family: var(--grot);
  font-weight: 800;
  font-size: clamp(3.5rem, 2.5rem + 3vw, 5.5rem);
  line-height: .8;
  letter-spacing: -.05em;
  color: var(--sky-ink);
}
.author__photo { margin: 0; max-width: 18rem; }
.author__photo img {
  display: block; width: 100%; height: auto; border-radius: 2px;
  box-shadow: 0 24px 50px -28px rgba(30, 39, 51, .55);
}

/* ---------- the ending: freedom ---------- */
.free {
  position: relative;
  min-height: min(62vh, 38rem);
  display: grid;
  align-items: center;
  padding: clamp(3.5rem, 8vw, 6rem) var(--pad);
  isolation: isolate;
}
.free__sky {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, var(--cream-deep) 0%, rgba(228, 216, 195, .35) 22%, rgba(239, 231, 216, .35) 70%, rgba(239, 231, 216, .85) 100%),
    url("../images/sky-band-1600.webp") 30% 50% / cover no-repeat;
}
.free__line {
  max-width: 22ch;
  font-family: var(--grot);
  font-weight: 800;
  font-size: clamp(2rem, 1rem + 4.2vw, 5.4rem);
  line-height: .98;
  letter-spacing: -.045em;
  color: var(--night);
  text-wrap: balance;
}

/* ---------- footer ---------- */
.foot {
  position: relative;
  background: var(--night);
  color: var(--cream-muted);
  font-family: var(--grot);
  font-size: .9375rem;
  line-height: 1.5;
  padding: 3rem var(--pad) max(3rem, env(safe-area-inset-bottom));
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}
.foot__lock { width: 1.6rem; height: auto; color: var(--line); flex: none; }
.foot p { margin: 0 0 .35rem; }
.foot__title { color: var(--cream); font-weight: 800; letter-spacing: -.01em; }
.foot a {
  color: var(--cream);
  text-decoration-color: var(--sky);
  text-underline-offset: .2em;
  display: inline-block;
  padding: .55rem 0;
  margin: -.55rem 0;
}
.foot a:hover { color: var(--sky); }

/* =========================================================
   LAYOUT: small screens
   ========================================================= */
@media (max-width: 47.99em) {
  .tagline { margin-bottom: 1.2em; }
  .btn { width: auto; }
}

/* short landscape phones */


/* =========================================================
   LAYOUT: wider screens
   ========================================================= */
@media (min-width: 48em) {
  .about {
    grid-template-columns: repeat(12, 1fr);
    column-gap: 2rem;
  }
  .about__h { grid-column: 1 / span 6; align-self: start; }
  .about__text { grid-column: 7 / span 6; padding-top: .4rem; }
  .book { grid-column: 1 / -1; }

  .author {
    grid-template-columns: repeat(12, 1fr);
    column-gap: 2rem;
  }
  .author > * { max-width: none; }
  .author__head { grid-column: 1 / span 5; grid-row: 1; align-self: start; }
  .author__photo { grid-column: 1 / span 4; grid-row: 2; align-self: start; margin-top: 2rem; }
  .author__text { grid-column: 6 / span 7; grid-row: 1 / span 2; }
}


/* =========================================================
   Reduced motion: two halves, no zoom
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}
