/* Frontier Four Press: Escape Velocity
   Colors and type mirror the Newtonian Graph cover.
   Font families are set in site.config.json and injected as
   --font-display and --font-sans in the page head. */

:root {
  --coral: #DF5555;         /* cover field */
  --coral-deep: #B84646;    /* flat offset shadow only, never text */
  --white: #FFFFFF;
  --ink: #14110F;           /* near-black */
  --paper: #F6F0E4;         /* cream book paper */
  --rule: 1px;
  --column: 34rem;
  --gutter: clamp(1.25rem, 6vw, 3rem);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.1875rem;
  line-height: 1.6;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  text-rendering: optimizeLegibility;
}

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

.column {
  max-width: calc(var(--column) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

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

/* ---------- Labels: geometric sans capitals, like the Stack logo ---------- */

.label {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.3;
  margin: 0;
}

.label--ruled {
  display: table;              /* shrink to text width, stay centred */
  margin-left: auto;
  margin-right: auto;
  padding: 0.55em 0.2em 0.5em;
  border-top: var(--rule) solid currentColor;
  border-bottom: var(--rule) solid currentColor;
  text-align: center;
}

h2.label { font-size: 0.875rem; }

/* ---------- Buttons: label between two rules ---------- */

.button {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1.2;
  color: var(--ink);
  padding: 0.95em 1.6em 0.9em;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  min-height: 44px;
}

.button:hover {
  background: var(--ink);
  color: var(--white);
}

.button--quiet {
  font-size: 0.8125rem;
  border-width: var(--rule);
  padding: 0.8em 1.2em 0.75em;
}

.button--closed {
  cursor: default;
  border-top-style: dotted;
  border-bottom-style: dotted;
}

.button--closed:hover { background: transparent; color: var(--ink); }

a:focus-visible, .button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: no-preference) {
  .button { transition: background-color 160ms ease, color 160ms ease; }
}

/* ---------- Title page (coral) ---------- */

.title-page {
  background: var(--coral);
  color: var(--ink);
  text-align: center;
  padding: clamp(2.5rem, 8vw, 4.5rem) 0 clamp(3rem, 9vw, 5rem);
}

.category { margin-bottom: clamp(2.25rem, 7vw, 3.5rem); }

.cover {
  margin: 0 auto clamp(2.5rem, 8vw, 3.75rem);
  width: min(17.5rem, 72vw);
}

.cover img {
  width: 100%;
  border: var(--rule) solid var(--ink);
  box-shadow: 0.6rem 0.6rem 0 var(--coral-deep);
}

/* Title set like the cover: Escape roman, Velocity italic below, offset right. */
.title {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--white);
  font-size: clamp(3.4rem, 15vw, 6.75rem);
  line-height: 0.92;
  letter-spacing: -0.01em;
  margin: 0 auto;
  width: max-content;
  max-width: 100%;
  text-align: left;
}

.title__roman,
.title__italic { display: block; }

.title__italic {
  font-style: italic;
  padding-left: 0.62em;
}

/* White on coral only at large display size: never below 24px. */
.subtitle {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--white);
  font-size: clamp(1.5rem, 4.6vw, 1.875rem);
  line-height: 1.25;
  margin: 1.1rem 0 0;
}

.author {
  margin-top: 1.75rem;
  font-size: 0.9375rem;
}

.on-sale {
  margin: 2.25rem 0 1.5rem;
  font-size: 1.1875rem;
}

.preorder { min-height: 3.25rem; }

/* ---------- Paper sections (cream) ---------- */

.paper {
  background: var(--paper);
  padding: clamp(3rem, 9vw, 5rem) 0 0;
}

.paper:last-of-type { padding-bottom: clamp(3.5rem, 10vw, 6rem); }

.plate {
  width: 9.5rem;
  margin: 0 auto clamp(2.25rem, 7vw, 3rem);
  mix-blend-mode: multiply;    /* white paper of the scan drops out */
  opacity: 0.92;
}

.divider {
  display: block;
  width: 15rem;
  max-width: 70%;
  height: auto;
  margin: 0 auto clamp(2.5rem, 7vw, 3.25rem);
  color: var(--ink);
}

.book-text p {
  margin: 0;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.book-text p + p { text-indent: 1.5em; }

.description .book-text > p:first-child::first-letter {
  float: left;
  font-size: 3.55em;
  line-height: 0.84;
  padding: 0.06em 0.09em 0 0;
  color: var(--ink);
}

.paper h2.label { margin-bottom: 2rem; }

/* ---------- Endorsement ---------- */

.endorsement blockquote {
  margin: 0;
  text-align: center;
}

.endorsement blockquote p {
  font-style: italic;
  font-size: clamp(1.375rem, 4vw, 1.625rem);
  line-height: 1.45;
  margin: 0;
}

.endorsement figcaption {
  margin-top: 1.5rem;
  text-align: center;
}

.endorsement figcaption .detail {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--font-display);
  font-style: italic;
  letter-spacing: 0;
  text-transform: none;
  font-size: 1rem;
}

/* ---------- For teams ---------- */

.teams { text-align: center; }

.lede {
  font-size: clamp(1.375rem, 4vw, 1.625rem);
  font-style: italic;
  line-height: 1.35;
  margin: 0 0 2rem;
}

/* Items labelled like the parts of an engraved figure: A, B, C. */
.figure-list {
  list-style: none;
  counter-reset: fig;
  margin: 0 auto 2.5rem;
  padding: 0;
  max-width: 22rem;
  text-align: left;
}

.figure-list li {
  counter-increment: fig;
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  align-items: baseline;
  padding: 0.7rem 0;
  border-bottom: var(--rule) dotted var(--ink);
}

.figure-list li:first-child { border-top: var(--rule) dotted var(--ink); }

.figure-list li::before {
  content: counter(fig, upper-alpha) ".";
  font-style: italic;
  font-size: 0.95em;
}

/* ---------- About ---------- */

.more { margin: 2.25rem 0 0; text-align: center; }

/* ---------- Colophon (coral, like the back cover) ---------- */

.colophon {
  background: var(--coral);
  color: var(--ink);
  text-align: center;
  padding: clamp(3rem, 9vw, 4.5rem) 0 clamp(3rem, 9vw, 4rem);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.colophon a { color: var(--ink); text-underline-offset: 0.2em; }

.stack {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  font-family: var(--font-sans);
  color: var(--white);
  font-size: 1.75rem;
  line-height: 1.15;
  margin: 0 auto 2rem;
}

.stack span { display: block; padding: 0.12em 0; }

.stack .stack__four {
  letter-spacing: 0.08em;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

/* The designer's one-colour Stack logo, shown white on the coral footer like the
   coral version of the logo. filter turns the black artwork white. */
.logo-img { width: 7rem; margin: 0 auto 2rem; filter: brightness(0) invert(1); }

.colophon__line { margin: 0 0 0.35rem; }

.isbns {
  margin: 1.5rem 0 0;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
}

.isbns div { margin: 0.15rem 0; }
.isbns dt, .isbns dd { display: inline; margin: 0; }
.isbns dt::after { content: " "; }

/* ---------- Placeholders: deliberately loud so they cannot ship by accident ---------- */

.placeholder {
  display: inline-block;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  letter-spacing: 0;
  text-transform: none;
  background: var(--white);
  color: var(--ink);
  border: 2px dashed var(--ink);
  padding: 0.3em 0.6em;
}

/* ---------- Wider screens: a little more air, same single column ---------- */

@media (min-width: 48rem) {
  body { font-size: 1.25rem; }
  .cover { width: 19rem; }
}

@media print {
  .title-page, .colophon { background: none; }
  .title, .subtitle, .stack { color: var(--ink); }
  .cover img { box-shadow: none; }
}

/* Even line breaks on short display lines; no single-word last lines in body text. */
.subtitle, .lede, .on-sale, .button, .endorsement blockquote p { text-wrap: balance; }
.book-text p { text-wrap: pretty; }
