/* Sprinting Nowhere — site styles
   Palette and type are taken from the book cover:
   off-white paper, terracotta track, black ink, condensed grotesque titles,
   Garamond for reading text (the typeface of the print edition). */

:root {
  --paper: #eaebe5;
  --paper-deep: #dfe0d9;
  --ink: #000000;
  --muted: #55564f;
  --rule: #c4c5bd;
  --track: #b85440;      /* track graphics only */
  --track-ink: #9e4330;  /* text and buttons on paper (5.3:1) */

  --display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --text: "EB Garamond", Garamond, "Iowan Old Style", Palatino, Georgia, serif;

  --measure: 34rem;
  --gutter: clamp(1rem, 4vw, 3rem);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.25rem;          /* 20px: Garamond reads small */
  line-height: 1.55;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  text-rendering: optimizeLegibility;
}

a { color: var(--track-ink); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--track-ink);
  outline-offset: 3px;
}

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--paper); padding: 0.5rem 1rem;
}
.skip:focus { left: 1rem; top: 1rem; z-index: 10; }

.wrap {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Hero ---------- */

.hero {
  padding: clamp(2.5rem, 7vw, 6rem) 0 clamp(3rem, 7vw, 5.5rem);
}

.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  grid-template-areas: "head track" "end track";
  column-gap: clamp(2rem, 5vw, 5rem);
  row-gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: center;
}
.hero-text { grid-area: head; align-self: end; container-type: inline-size; }
.hero-text-end { grid-area: end; align-self: start; }
.hero .track { grid-area: track; }
.hero-text-end .tagline { margin-top: 0; }

.title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 3.4rem;
  font-size: clamp(3rem, 16cqw, 9rem);  /* sized to its column, so it never runs into the track */
  line-height: 0.86;
  letter-spacing: -0.005em;
  text-transform: uppercase;
}
.title span { display: block; }

.subtitle {
  margin: 1.4rem 0 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  line-height: 1.2;
  max-width: 26ch;
}

.tagline {
  margin: 1.8rem 0 0;
  max-width: 30rem;
  font-size: 1.3rem;
}

.byline {
  margin: 1.6rem 0 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.14em;
}

.actions {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1rem;
  margin-top: 2.2rem;
}

.button {
  display: inline-block;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 0.85rem 1.4rem 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 999px;            /* the shape of a track */
  text-decoration: none;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}
.button:hover { background: var(--ink); color: var(--paper); }
.button.primary { background: var(--track-ink); border-color: var(--track-ink); color: var(--paper); }
.button.primary:hover { background: var(--ink); border-color: var(--ink); }

/* The track: the one moving thing on the page */
.track {
  position: relative;
  width: 100%;
  max-width: 26rem;
  justify-self: center;
  margin: 0;
  container-type: inline-size;
}
.track svg { display: block; width: 100%; height: auto; }

.lap {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}
.lap-number {
  font-family: var(--display);
  font-weight: 700;
  font-size: 2.6rem;
  font-size: 9cqw;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.lap-note {
  margin-top: 0.35rem;
  font-size: 1rem;
  font-size: clamp(0.9rem, 4.2cqw, 1.1rem);
  font-style: italic;
  color: var(--muted);
}

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

section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
section + section { border-top: 1px solid var(--rule); }

h2 {
  margin: 0 0 1.6rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.1rem, 4.2vw, 3rem);
  line-height: 1;
}

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1em; }

/* Opening scene: set like a book page */
.excerpt { background: var(--paper-deep); }
.excerpt .page {
  max-width: var(--measure);
  margin: 0 auto;
}
.excerpt .page p { margin: 0; text-indent: 1.5em; hyphens: auto; }
.excerpt .page p:first-of-type { text-indent: 0; }
.excerpt .chapter {
  margin: 0 0 2rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.2;
}
.excerpt .page .scene-time { text-indent: 0; font-style: italic; margin-bottom: 0.4em; }
.excerpt .more {
  margin-top: 2.2rem;
  text-indent: 0;
  font-style: italic;
  color: var(--muted);
}

/* The book: four illusions, in order */
.book .wrap {
  display: grid;
  grid-template-columns: minmax(0, 16rem) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}
.cover-img {
  width: 100%;
  height: auto;
  display: block;
  box-shadow: 0 1px 0 var(--rule), 0 18px 40px -22px rgba(0, 0, 0, 0.45);
}
.buy-cover { margin-top: 1.4rem; }
.formats {
  margin: 1rem 0 0;
  font-size: 1.05rem;
  color: var(--muted);
}
.availability {
  margin: 0.8rem 0 0;
  font-size: 1.05rem;
  color: var(--muted);
}

.parts {
  list-style: none;
  margin: 0 0 2.2rem;
  padding: 0;
  max-width: 38rem;
}
.parts li {
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1fr);
  gap: 0 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}
.parts li:last-child { border-bottom: 1px solid var(--rule); }
.parts .part {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--track-ink);
  padding-top: 0.15rem;
  white-space: nowrap;
}
.parts h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.45rem;
  line-height: 1.15;
}
.parts p { margin: 0.25rem 0 0; }

.runbook { max-width: 38rem; }
.runbook p { margin: 0 0 0.9em; }

/* Dictionary: set like a dictionary */
.dictionary .intro { max-width: var(--measure); margin: 0 0 2.4rem; }
.entries {
  margin: 0;
  columns: 2 22rem;
  column-gap: clamp(2rem, 5vw, 4rem);
  column-rule: 1px solid var(--rule);
}
.entry {
  break-inside: avoid;
  margin: 0 0 1.3rem;
  padding-left: 1.2em;
  text-indent: -1.2em;           /* hanging indent, as in print dictionaries */
}
.entry dt { display: inline; font-weight: 700; }
.entry dt .pos { font-weight: 400; font-style: italic; color: var(--muted); }
.entry dd { display: inline; margin: 0; }
.dictionary .source {
  margin: 1.2rem 0 0;
  font-size: 1.05rem;
  color: var(--muted);
  font-style: italic;
}

/* Contact */
.contact-address {
  margin: 1.4rem 0 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.45rem, 4.6vw, 2.3rem);
  line-height: 1.15;
  overflow-wrap: break-word;
}
.contact-address a { color: var(--ink); text-decoration-color: var(--track); text-decoration-thickness: 3px; text-underline-offset: 0.2em; }
.contact-address a:hover { color: var(--track-ink); }

/* Author */
.author .prose p:last-child { margin-bottom: 0; }

/* Footer */
footer {
  border-top: 1px solid var(--rule);
  padding: 2.2rem 0 3rem;
  font-size: 1rem;
  color: var(--muted);
}
footer .wrap {
  display: flex; flex-wrap: wrap; gap: 0.5rem 2rem;
  justify-content: space-between;
}
footer p { margin: 0; }

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

/* ---------- Simple pages (privacy, thanks) ---------- */

.page-head { padding: 2rem 0 0; }
.page-head a.home {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}
.doc { padding: 2.5rem 0 4rem; }
.doc h1 {
  margin: 0 0 0.6rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 1;
}
.doc h2 { font-size: 1.7rem; margin: 2.2rem 0 0.8rem; }
.doc .updated { color: var(--muted); font-style: italic; margin: 0 0 2rem; }
.doc ul { padding-left: 1.2em; margin: 0 0 1em; }
.doc li { margin: 0 0 0.4em; }

/* ---------- Responsive ---------- */

@media (max-width: 52rem) {
  .hero .wrap { grid-template-columns: 1fr; grid-template-areas: "head" "track" "end"; row-gap: 2rem; }
  .track { max-width: 22rem; }
  .book .wrap { grid-template-columns: 1fr; }
  .book .cover-col { max-width: 13rem; }
}

@media (max-width: 30rem) {
  body { font-size: 1.15rem; }
  .parts li { grid-template-columns: 1fr; }
  .parts .part { padding: 0 0 0.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

html { scroll-behavior: smooth; }
