/* ==========================================================================
   Dr George Klenowski — The Prophecy for Eternal Human Survival
   Hand-written CSS. No framework, no build step.

   The palette is sampled from the book cover: the page is the cover's black,
   so the cover art has no edges, and the three accents are the three colours
   in the cover's sky. They appear once, as the spine of the argument.
   ========================================================================== */

/* --------------------------------------------------------------- fonts -- */

@font-face {
  font-family: 'Archivo';
  src: url('/assets/fonts/archivo-latin-var.woff2') format('woff2');
  font-weight: 400 800;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Source Serif 4';
  src: url('/assets/fonts/sourceserif4-latin-var.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* -------------------------------------------------------------- tokens -- */

:root {
  --black:     #000000;
  --surface:   #0c0e13;
  --line:      rgba(237, 238, 242, 0.14);

  --text:      #edeef2;
  --muted:     #9297a3;

  --amber:     #f0a33c;   /* glow at the left of the cover's horizon  */
  --rose:      #d8628a;   /* the magenta band above the astronaut     */
  --teal:      #4fc0b0;   /* the green-blue at the horizon's right    */
  --amber-lit: #f7b457;

  --display: 'Archivo', Arial, 'Helvetica Neue', Helvetica, sans-serif;
  --body:    'Source Serif 4', Georgia, 'Times New Roman', serif;

  --gutter: 1.25rem;
  --band:   clamp(3.5rem, 9vw, 6.5rem);
}

/* --------------------------------------------------------------- reset -- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  /* Keeps the footer rule at the bottom of short pages, such as the 404. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--black);
  color: var(--text);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

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

h1, h2, h3 {
  font-family: var(--display);
  line-height: 1.1;
  margin: 0;
  /* Headings never break inside a word — body copy may. */
  overflow-wrap: normal;
  hyphens: none;
}

h2, h3 { text-wrap: balance; }

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--amber); text-underline-offset: 0.18em; }
a:hover { color: var(--amber-lit); }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ------------------------------------------------------------- shell ---- */

.wrap {
  width: min(100% - (var(--gutter) * 2), 1180px);
  margin-inline: auto;
}

/* A reading column. It is always a child of .wrap, never the same element,
   so it starts on the page's single left rail instead of centring itself. */
.measure { max-width: 40rem; }

main { flex: 1 0 auto; }

.band { padding-block: var(--band); }

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.7rem 1.1rem;
  background: var(--amber);
  color: #000;
  font-family: var(--display);
  font-weight: 700;
  text-decoration: none;
  transition: top 120ms ease-out;
}
.skip:focus { top: 0.75rem; color: #000; }

/* ------------------------------------------------------------- header --- */

.site-head {
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.site-head__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
}

.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-stretch: 85%;
  font-size: 1.1875rem;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
}
.wordmark:hover { color: var(--amber); }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--display);
  font-size: 0.9375rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding-block: 0.15rem;
}
.nav a:hover { color: var(--text); }

/* --------------------------------------------------------------- hero --- */

.hero { padding-block: clamp(2.75rem, 7vw, 5rem) var(--band); }

.hero__grid {
  display: grid;
  gap: clamp(2.5rem, 6vw, 4.5rem);
  align-items: center;
}

.display {
  font-weight: 800;
  font-stretch: 75%;
  font-size: clamp(2.5rem, 7.2vw, 4.5rem);
  letter-spacing: -0.005em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.deck {
  font-size: clamp(1.1875rem, 2.2vw, 1.4375rem);
  line-height: 1.5;
  max-width: 32ch;
  margin-bottom: 0.9rem;
}

.byline {
  font-family: var(--display);
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.hero__cover img {
  width: 100%;
  max-width: 340px;
}

/* ---------------------------------------------------------- buy links --- */

.buy { margin-bottom: 2.25rem; }

.btn {
  display: inline-block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 1.2;
  padding: 0.95rem 1.7rem;
  border-radius: 3px;
  text-decoration: none;
  transition: background-color 140ms ease-out, border-color 140ms ease-out,
              color 140ms ease-out;
}

.btn--primary {
  background: var(--amber);
  color: #000;
  border: 1px solid var(--amber);
}
.btn--primary:hover { background: var(--amber-lit); border-color: var(--amber-lit); color: #000; }

.btn--quiet {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn--quiet:hover { border-color: var(--amber); color: var(--amber); }

.buy__alt {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--display);
  font-size: 0.9375rem;
}

.buy__alt a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--line); }
.buy__alt a:hover { color: var(--text); text-decoration-color: currentColor; }

[data-pending='true'] {
  cursor: not-allowed;
  text-decoration-style: dotted;
}
[data-pending='true']:hover { color: var(--muted); }

/* --------------------------------------------------------------- specs -- */

.specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem 1.75rem;
  margin: 0;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
  max-width: 26rem;
}

.specs__pair { min-width: 0; }

.specs dt {
  font-family: var(--display);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.specs dd {
  margin: 0;
  font-family: var(--display);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- bands --- */

h2 {
  font-weight: 700;
  font-stretch: 88%;
  font-size: clamp(1.75rem, 4.2vw, 2.5rem);
  margin-bottom: 1.5rem;
}

.lede { color: var(--muted); margin-bottom: 2.5rem; }

/* --------------------------------------------------------------- spine -- */

.spine {
  position: relative;
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0 0 0 3.25rem;
  max-width: 44rem;
}

.spine::before {
  content: '';
  position: absolute;
  left: 1.75rem;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 2px;
  border-radius: 1px;
  background: linear-gradient(180deg, var(--amber), var(--rose) 50%, var(--teal));
}

.spine > li {
  position: relative;
  counter-increment: step;
  padding-block: 1rem;
}

.spine > li::before {
  content: counter(step);
  position: absolute;
  left: -3.25rem;
  width: 1.25rem;
  text-align: right;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  line-height: 1.85;
}

.spine h3 {
  font-weight: 700;
  font-stretch: 92%;
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
}

.spine p { color: var(--muted); margin: 0; }

/* ---------------------------------------------------------- book card --- */

.book {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  max-width: 46rem;
}

.book__cover { width: 100%; }

.book h3 {
  font-weight: 700;
  font-stretch: 90%;
  font-size: 1.375rem;
  margin-bottom: 0.3rem;
}

.book__meta {
  font-family: var(--display);
  font-size: 0.9375rem;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.book__body p { font-size: 1.0625rem; }

.book__buy {
  font-family: var(--display);
  font-size: 1rem;
  margin: 1.1rem 0 0;
}

/* ------------------------------------------------------------ contact --- */

.contact-line { margin-top: 1.6rem; }

.portrait { margin: 2rem 0 0; max-width: 20rem; }
.portrait img { border-radius: 4px; }

/* ------------------------------------------------------------- footer --- */

.site-foot {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
  font-family: var(--display);
  font-size: 0.9375rem;
  color: var(--muted);
}

.site-foot__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: space-between;
}

.site-foot p { margin: 0; }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--text); }

/* ----------------------------------------------------------- 404 page --- */

.notfound { padding-block: clamp(4rem, 14vw, 9rem); }
.notfound h1 {
  font-weight: 800;
  font-stretch: 78%;
  font-size: clamp(2.25rem, 7vw, 4rem);
  text-transform: uppercase;
  margin-bottom: 1.1rem;
}
.notfound .btn { margin-top: 1.5rem; }

/* -------------------------------------------------------- breakpoints --- */

@media (min-width: 56rem) {
  :root { --gutter: 2.5rem; }

  .hero__grid {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: center;
  }

  .hero__cover { justify-self: end; }

  .spine { padding-left: 4.5rem; }
  .spine::before { left: 2.75rem; }
  .spine > li::before { left: -4.5rem; width: 2rem; }
}

@media (max-width: 34rem) {
  .book {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }
  .book__cover { max-width: 130px; }
}

/* ------------------------------------------------------------- motion --- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
