/* The Ledger of Last Words · landing page
   Matte black, bone linework, one arterial red. */

@font-face {
  font-family: "Fell";
  src: url("../fonts/fell-english.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fell";
  src: url("../fonts/fell-english-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --black: #000;
  --bone: #eee2ce;
  --bone-2: rgba(238, 226, 206, .82);
  --bone-3: rgba(238, 226, 206, .56);
  --bone-4: rgba(238, 226, 206, .16);
  --red: #a32420;
  --red-hot: #dc3a2f;
  --bar-h: 0px;
  --col: 33rem;
  --pad: 1.25rem;
  color-scheme: dark;
}
html.has-player { --bar-h: 4.25rem; }

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

html {
  background: var(--black);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
  scrollbar-color: #2b2722 #000;
}

body {
  margin: 0;
  background: var(--black);
  color: var(--bone-2);
  font-family: "Fell", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: clamp(1.14rem, .95rem + .9vw, 1.34rem);
  line-height: 1.62;
  font-weight: 400;
  font-synthesis: none;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, p, ol { margin: 0; }
h1, h2 { font-weight: 400; }
img { max-width: 100%; }

::selection { background: var(--red); color: var(--bone); }

:focus-visible {
  outline: 1px solid var(--bone);
  outline-offset: 4px;
}

.skip {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -120%);
  padding: .6em 1.2em;
  background: var(--black);
  color: var(--bone);
  border: 1px solid var(--bone-3);
  font-size: .9rem;
  text-decoration: none;
  z-index: 50;
}
.skip:focus { transform: translate(-50%, .6rem); }

/* Small tracked capitals, as on the cover's top and bottom lines. */
.caps {
  font-size: .72rem;
  line-height: 1.5;
  letter-spacing: .4em;
  text-transform: uppercase;
  color: var(--bone-3);
}

/* The red thread. */
.thread {
  display: block;
  width: 1.5px;
  background: var(--red);
  margin: 0 auto;
  border-radius: 1px;
}
@supports (background: color-mix(in srgb, red 10%, blue)) {
  .thread, .play::before {
    background: color-mix(in srgb, var(--red-hot) calc(var(--pulse, 0) * 100%), var(--red));
    box-shadow: 0 0 calc(var(--pulse, 0) * 10px) rgba(220, 58, 47, calc(var(--pulse, 0) * .8));
  }
}

/* ---------- Hero: the cover, at the size of the screen ---------- */

.hero {
  --helm-h: clamp(11rem, 38vh, 27rem);
  --gap: clamp(1.9rem, 6vh, 4rem);
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(1.5rem, env(safe-area-inset-top)) var(--pad) 0;
  text-align: center;
}
@supports (height: 100svh) {
  .hero {
    --room: calc(100svh - var(--bar-h));
    --helm-h: clamp(11rem, calc(var(--room) * .385), 27rem);
    --gap: clamp(1.9rem, calc(var(--room) * .06), 4rem);
    min-height: 100svh;
  }
  .hero .title { font-size: clamp(2.5rem, min(11.2vw, calc(var(--room) * .122)), 7.4rem); }
}

.series {
  color: var(--bone-2);
  padding-left: .4em;
}
.series span { display: block; }
.series .dot { display: none; }

.helm {
  position: relative;
  flex: none;
  width: min(64vw, calc(var(--helm-h) * 464 / 478));
  margin: auto 0 var(--gap);
}
.helm picture { display: block; }
.helm-art {
  display: block;
  width: 100%;
  height: auto;
  mix-blend-mode: lighten;
  filter: brightness(calc(1 + var(--flare, 0) * .5));
}
.helm-glow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: screen;
  opacity: calc(.1 + var(--pulse, 0) * .9);
  pointer-events: none;
}
.thread-helm {
  position: absolute;
  left: 50.4%;
  top: 99.2%;
  height: calc(.8% + var(--gap) - .55rem);
  margin: 0;
  transform: translateX(-50%);
}

.title {
  font-size: clamp(2.5rem, min(11.2vw, 12.5vh), 7.4rem);
  line-height: .98;
  letter-spacing: .014em;
  text-transform: uppercase;
  color: var(--bone);
}
.title span { display: block; }

.author {
  color: var(--bone);
  font-size: .78rem;
  letter-spacing: .5em;
  padding-left: .5em;
}
.hero .author { margin-top: clamp(1.1rem, 3.2vh, 2rem); }

.refusal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
}
.refusal-n { padding-left: .4em; }
.refusal-t {
  font-style: italic;
  font-size: clamp(2.1rem, 7.6vw, 3.5rem);
  line-height: 1.1;
  color: var(--bone);
}
.refusal-cue {
  margin-top: auto;
  padding-top: 1.6rem;
  gap: .35rem;
}
.refusal-cue .refusal-t {
  font-size: clamp(1.3rem, 4.8vw, 1.65rem);
  color: var(--bone-2);
}
.thread-cue {
  flex: none;
  height: calc(1.5rem + var(--bar-h));
  margin-top: .9rem;
}

/* ---------- Sections ---------- */

.sect {
  padding: 0 var(--pad) clamp(3.2rem, 9vh, 6rem);
  text-align: center;
}
.sect > .thread { height: clamp(4.5rem, 15vh, 8.5rem); }
.sect > .refusal { margin-top: 2.3rem; }

.prose {
  max-width: var(--col);
  margin: 2.5rem auto 0;
  text-align: left;
}
.prose p { text-wrap: pretty; }
.prose p + p { margin-top: 1.15em; }

.lead::first-letter {
  float: left;
  font-size: 3.5em;
  line-height: .8;
  padding: .07em .05em 0 0;
  color: var(--bone);
}

.prose .beat {
  margin: 1.5em 0 1.45em;
  text-align: center;
  font-style: italic;
  font-size: 1.75em;
  line-height: 1.15;
  color: var(--bone);
}

/* ---------- The Ledger ---------- */

.ledger {
  list-style: none;
  max-width: var(--col);
  margin: 2.6rem auto 0;
  padding: 0;
  text-align: left;
  border-top: 1px solid var(--bone-4);
}
.entry {
  display: grid;
  gap: .45rem;
  padding: 1.15rem 0 1.3rem;
  border-bottom: 1px solid var(--bone-4);
}
.entry-ref, .blank-n {
  display: block;
  font-size: .8em;
  line-height: 1.4;
  letter-spacing: .05em;
  color: var(--bone-3);
}
.entry-ref .dot { margin: 0 .3em; }
.entry-words {
  display: block;
  text-indent: -.42em;
  font-style: italic;
  font-size: clamp(1.5rem, 5.6vw, 2.05rem);
  line-height: 1.2;
  color: var(--bone);
  quotes: "\201C" "\201D" "\2018" "\2019";
  text-wrap: balance;
}

/* The forty-two lines still blank. The last one is the red one. */
.blank {
  max-width: var(--col);
  margin: 0 auto;
  padding-top: 1.05rem;
  text-align: left;
}
.blank-lines {
  display: grid;
  gap: 7px;
  margin-top: .8rem;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, rgba(0, 0, 0, .28) 100%);
  mask-image: linear-gradient(to bottom, #000 0, rgba(0, 0, 0, .28) 100%);
}
.blank-lines i {
  display: block;
  height: 1px;
  background: var(--bone-4);
}
.blank-end {
  display: block;
  height: 2px;
  margin-top: 7px;
  background: var(--red);
}
.blank-last {
  margin-top: .75rem;
  color: var(--bone-2);
}

.prose .count {
  text-align: center;
  color: var(--bone);
}
.count span { display: block; }
.blank + .prose { margin-top: 2.4rem; }

/* ---------- Coming soon ---------- */

.coming { padding-bottom: clamp(4rem, 12vh, 7rem); }
.coming .series { margin-top: 2.5rem; }
.title-again {
  margin-top: 1.1rem;
  font-size: clamp(2.2rem, min(9.6vw, 10vh), 5rem);
}
.soon {
  display: inline-block;
  margin-top: 2rem;
  padding: .85em 1.5em .85em 2em;
  border: 1px solid var(--bone-3);
  color: var(--bone);
  font-size: .8rem;
  letter-spacing: .5em;
}
.note {
  max-width: 31rem;
  margin: 2rem auto 0;
  font-size: .9em;
  font-style: italic;
  color: var(--bone-3);
  text-wrap: balance;
}
.note-2 { margin-top: .3rem; }

/* ---------- The theme song ---------- */

.player {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: var(--black);
  padding-bottom: env(safe-area-inset-bottom);
}
.player[hidden] { display: none; }

.seek {
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  height: 21px;
}
.seek::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 1px;
  background: var(--bone-4);
}
.seek-fill {
  position: absolute;
  left: 0;
  top: 9.5px;
  width: 100%;
  height: 2px;
  background: var(--red);
  transform: scaleX(var(--progress, 0));
  transform-origin: left center;
}
.seek-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.seek-thumb {
  position: absolute;
  top: 6px;
  left: calc(var(--progress, 0) * 100%);
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  border-radius: 50%;
  background: var(--bone);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.seek:hover .seek-thumb,
.seek-input:focus-visible + .seek-thumb { opacity: 1; }
.seek-input:focus-visible + .seek-thumb { outline: 1px solid var(--bone); outline-offset: 3px; }

.player-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 1.1rem;
  height: 4.25rem;
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1rem;
}
.player-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: right;
  line-height: 1.25;
}
.player-label {
  font-size: .56rem;
  letter-spacing: .32em;
  white-space: nowrap;
}
.player-title {
  font-style: italic;
  font-size: 1rem;
  color: var(--bone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-time {
  min-width: 0;
  font-size: .92rem;
  color: var(--bone-3);
  white-space: nowrap;
}
#time-now { color: var(--bone-2); }

.play {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  padding: 0;
  border: 1px solid var(--bone-2);
  border-radius: 50%;
  background: var(--black);
  color: var(--bone);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .25s, color .25s;
}
.play:hover { border-color: var(--bone); }
.play::before {
  /* the thread ends here */
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 1.5px;
  height: calc((4.25rem - 2.9rem) / 2);
  margin-left: -.75px;
  background: var(--red);
}
.play::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid var(--red-hot);
  border-radius: 50%;
  opacity: calc(var(--pulse, 0) * .95);
  transform: scale(calc(1 + var(--pulse, 0) * .2));
  pointer-events: none;
}
.icon { display: block; fill: currentColor; }
.icon-pause { display: none; }
html.playing .icon-play { display: none; }
html.playing .icon-pause { display: block; }
html.loading .play { border-color: var(--bone-3); color: var(--bone-3); }

/* ---------- Footer ---------- */

.foot {
  padding: clamp(2rem, 6vh, 3.5rem) var(--pad) calc(2.4rem + env(safe-area-inset-bottom));
  text-align: center;
}
.foot picture { display: block; }
.frieze {
  display: block;
  width: min(100%, 56rem);
  height: auto;
  margin: 0 auto;
  mix-blend-mode: lighten;
}
.foot-author { margin-top: 1.9rem; }
.legal {
  margin-top: 1.4rem;
  font-size: .76rem;
  letter-spacing: .05em;
  color: var(--bone-3);
}

/* ---------- Not found ---------- */

.lost {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 2rem var(--pad);
  text-align: center;
}
.lost a {
  color: var(--bone);
  text-decoration: none;
  border-bottom: 1px solid var(--red);
  padding-bottom: .15em;
}
.lost a:hover { border-bottom-color: var(--red-hot); }

/* ---------- Wider screens ---------- */

@media (min-width: 40em) {
  .caps { letter-spacing: .44em; }
  .series { padding-left: .44em; }
  .series span { display: inline; }
  .series .dot { display: inline; margin: 0 .35em; }
  .author { font-size: .84rem; }
  .player-label { font-size: .6rem; }
  .player-row { column-gap: 1.5rem; }
}

/* ---------- Short, wide screens: a phone on its side ---------- */

@media (orientation: landscape) and (max-height: 30em) {
  .hero {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-rows: auto 1fr auto auto 1fr;
    justify-content: center;
    align-items: center;
    column-gap: clamp(1.5rem, 5vw, 3.5rem);
    padding-bottom: calc(var(--bar-h) + .75rem);
  }
  .hero .series { grid-column: 1 / -1; justify-self: center; }
  .helm {
    grid-column: 1;
    grid-row: 2 / 6;
    width: min(30vw, calc((100vh - var(--bar-h) - 5rem) * 464 / 478));
    margin: .75rem 0 0;
  }
  .hero .title {
    grid-column: 2;
    grid-row: 3;
    font-size: clamp(2rem, min(7.2vw, 17vh), 4.2rem);
    text-align: left;
  }
  .hero .author {
    grid-column: 2;
    grid-row: 4;
    justify-self: start;
    margin-top: .9rem;
    padding-left: 0;
  }
  .thread-helm, .thread-cue, .refusal-cue { display: none; }
}

/* ---------- Motion ---------- */

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes emerge {
  from { opacity: 0; transform: scale(.985); }
  to { opacity: 1; transform: none; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(.3em); }
  to { opacity: 1; transform: none; }
}
@keyframes drip-centered {
  from { transform: translateX(-50%) scaleY(0); }
  to { transform: translateX(-50%) scaleY(1); }
}
@keyframes drip {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}
@keyframes breathe {
  0%, 100% { opacity: .04; }
  50% { opacity: .46; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero .series { animation: fade 1.4s .1s both; }
  .helm-art { animation: emerge 1.9s .15s both cubic-bezier(.2, .7, .2, 1); }
  .thread-helm { transform-origin: top center; animation: drip-centered 1s 1.3s both cubic-bezier(.5, 0, .2, 1); }
  .hero .title { animation: rise 1.3s 1.8s both cubic-bezier(.2, .7, .2, 1); }
  .hero .author { animation: fade 1.3s 2.3s both; }
  .refusal-cue { animation: fade 1.5s 2.8s both; }
  .thread-cue { transform-origin: top center; animation: drip 1.1s 3.2s both cubic-bezier(.5, 0, .2, 1); }

  html:not(.playing) .helm-glow { animation: breathe 6.5s 2.2s ease-in-out infinite both; }

  /* Sections arrive as they are scrolled to. Only when the script is running. */
  html.js .reveal {
    opacity: 0;
    transform: translateY(.9rem);
    transition: opacity 1.1s ease, transform 1.1s cubic-bezier(.2, .7, .2, 1);
  }
  html.js .reveal.in {
    opacity: 1;
    transform: none;
  }
  html.js .thread.reveal {
    opacity: 1;
    transform: scaleY(0);
    transform-origin: top center;
    transition: transform 1.3s cubic-bezier(.5, 0, .2, 1);
  }
  html.js .thread.reveal.in { transform: scaleY(1); }
}

@media print {
  .player, .thread, .helm-glow { display: none; }
  body { background: #fff; color: #000; }
}
