/* Shop: checkout, downloads and notices.
   Visual language: a small independent publisher. Warm paper, ink type, hairline rules, one serif.
   No gradients, glows or card shadows, and no icons standing in for words. */

@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif-latin.woff2") format("woff2");
  font-weight: 400; 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: "Instrument Serif";
  src: url("fonts/instrument-serif-latin-ext.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif-latin-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; 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: "Instrument Sans";
  src: url("fonts/instrument-sans-latin.woff2") format("woff2");
  font-weight: 400 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;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/instrument-sans-latin-ext.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #f4f1ea;
  --paper-raised: #fbfaf6;
  --paper-sunk: #e9e4d8;
  --ink: #1b1a17;
  --ink-soft: #4a453d;
  --muted: #7a7266;
  --rule: #e2dccf;
  --rule-strong: #cbc3b2;
  --accent: #7c2d1e;
  --danger: #9b2c1f;
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Instrument Sans", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141311;
    --paper-raised: #1b1a17;
    --paper-sunk: #23211d;
    --ink: #ece7dc;
    --ink-soft: #c9c2b4;
    --muted: #918a7d;
    --rule: #2d2a25;
    --rule-strong: #403c35;
    --accent: #d39176;
    --danger: #e08a7a;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
main { flex: 1; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; text-decoration-color: var(--rule-strong); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 3px; }
strong { font-weight: 600; }

/* ---------- masthead and colophon ---------- */

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 22px var(--gutter);
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  font-family: var(--serif);
  font-size: 1.45rem;
  letter-spacing: -0.005em;
  text-decoration: none;
}
.masthead-note, .label, .kicker, .facts dt {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.colophon {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 28px var(--gutter) 36px;
  border-top: 1px solid var(--rule);
  font-size: 0.82rem;
  color: var(--muted);
}
.colophon nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.colophon a { text-decoration: none; }
.colophon a:hover { color: var(--ink); }

/* ---------- shared type ---------- */

.label { display: block; margin: 0 0 12px; }
.kicker { margin: 0 0 18px; }
.title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.5rem, 6vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}
.byline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--ink-soft);
  margin: 12px 0 0;
}
.tagline, .lede {
  font-size: 1.12rem;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 34em;
  margin: 20px 0 0;
  text-wrap: pretty;
}
.figure, .price, .num { font-variant-numeric: lining-nums tabular-nums; }

/* ---------- checkout layout ---------- */

.checkout {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  grid-template-areas: "intro order" "details order";
  grid-template-rows: auto 1fr;
  column-gap: clamp(32px, 6vw, 96px);
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(40px, 7vw, 88px) var(--gutter) 88px;
}
.intro { grid-area: intro; }
.details { grid-area: details; padding-top: 48px; }
.order { grid-area: order; }

.price-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
  margin: 28px 0 0;
}
.price { font-family: var(--serif); font-size: 2rem; line-height: 1; }
.price-note { font-size: 0.86rem; color: var(--muted); }

/* cover */
.cover { margin: 0 0 48px; max-width: 420px; }
.cover img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  background: var(--paper-sunk);
}
.cover--set {
  position: relative;
  aspect-ratio: 4 / 5;
  display: flex;
  flex-direction: column;
  padding: 11% 10%;
  background: var(--paper-sunk);
  border: 1px solid var(--rule-strong);
  outline: 1px solid var(--rule-strong);
  outline-offset: -10px;
}
.cover-brand { font-size: 0.66rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.cover-title {
  margin-top: auto;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3.6vw, 2.7rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.cover-rule { display: block; width: 44px; height: 1px; background: var(--ink); margin: 22px 0 14px; }
.cover-kicker { font-family: var(--serif); font-style: italic; font-size: 1.05rem; color: var(--ink-soft); }

/* contents + facts */
.block { margin: 0 0 40px; max-width: 36em; }
.contents { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.contents li {
  display: grid;
  grid-template-columns: 2.6em 1fr;
  gap: 8px;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-soft);
}
.contents .num { font-size: 0.8rem; color: var(--muted); padding-top: 0.15em; }
.prose p { margin: 0; color: var(--ink-soft); max-width: 36em; }
.facts { margin: 0; max-width: 36em; display: grid; gap: 0; border-top: 1px solid var(--rule); }
.facts > div {
  display: grid;
  grid-template-columns: 8.5em 1fr;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
}
.facts dt { padding-top: 0.2em; }
.facts dd { margin: 0; font-size: 0.94rem; color: var(--ink-soft); }

/* ---------- order panel ---------- */

.order-panel {
  position: sticky;
  top: 32px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  padding: clamp(24px, 3vw, 36px);
}
.ledger { margin: 0 0 32px; }
.ledger-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.95rem;
}
.ledger-row:first-child { border-top: 1px solid var(--rule); }
.ledger-row[hidden] { display: none; }
.ledger-tax { color: var(--muted); }
.ledger-total { border-bottom: 0; padding-top: 16px; align-items: baseline; }
.ledger-total span:first-child { font-weight: 500; }
.ledger-total .figure { font-family: var(--serif); font-size: 1.7rem; line-height: 1; }

.pay-form { display: grid; gap: 22px; }
.field { display: grid; }
.field .label { margin-bottom: 10px; }
.element-slot { min-height: 46px; }
.hint { margin: 8px 0 0; font-size: 0.8rem; color: var(--muted); }

.consent {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  align-items: start;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-soft);
  cursor: pointer;
}
.consent input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  border-radius: 0;
  display: grid;
  place-content: center;
  cursor: pointer;
}
.consent input::before {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 1.5px solid var(--paper);
  border-bottom: 1.5px solid var(--paper);
  transform: translateY(-1px) rotate(-45deg);
  opacity: 0;
}
.consent input:checked { background: var(--ink); border-color: var(--ink); }
.consent input:checked::before { opacity: 1; }

.pay {
  appearance: none;
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  font: 500 0.98rem/1 var(--sans);
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, opacity 160ms ease;
}
.pay:hover:not(:disabled) { background: transparent; color: var(--ink); }
.pay:disabled { opacity: 0.38; cursor: not-allowed; }
.pay[aria-busy="true"] { opacity: 0.7; cursor: progress; }

.message {
  margin: 0;
  padding: 12px 14px;
  border-left: 2px solid var(--danger);
  background: var(--paper);
  color: var(--danger);
  font-size: 0.88rem;
}
.message[hidden] { display: none; }
.assurance {
  margin: 24px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--muted);
}

/* demo-mode stand-ins for Stripe's iframes */
.demo-input {
  height: 46px;
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 0.92rem;
  color: var(--muted);
}
.demo-input + .demo-input { margin-top: 10px; }
.demo-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.demo-row .demo-input { margin: 0; }

/* ---------- notes: thanks, errors ---------- */

.note {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(56px, 10vw, 120px) var(--gutter) 96px;
}
.note .title { font-size: clamp(2.6rem, 7vw, 4rem); }
.downloads { list-style: none; margin: 44px 0 0; padding: 0; border-top: 1px solid var(--ink); }
.download-group { padding: 26px 0 8px; border-bottom: 1px solid var(--rule); }
.download-name { margin: 0 0 6px; font-family: var(--serif); font-weight: 400; font-size: 1.55rem; line-height: 1.2; }
.download-files { list-style: none; margin: 0; padding: 0; }
.download {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 12px 0;
}
.download + .download { border-top: 1px dashed var(--rule); }
.download-file { font-size: 0.92rem; color: var(--ink-soft); overflow-wrap: anywhere; min-width: 0; }
.download-link, .text-button {
  flex: none;
  display: inline-block;
  padding: 12px 20px;
  border: 1px solid var(--ink);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}
.download-link:hover, .text-button:hover { background: var(--ink); color: var(--paper); }
.fineprint { margin: 32px 0 0; font-size: 0.85rem; color: var(--muted); max-width: 38em; }

/* ---------- shop index ---------- */

.shelf { width: 100%; max-width: 980px; margin: 0 auto; padding: clamp(56px, 9vw, 112px) var(--gutter) 96px; }
.shelf-head { margin-bottom: 56px; }
.shelf-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.shelf-item {
  display: grid;
  grid-template-columns: 3.2em 1fr auto;
  gap: 8px 20px;
  align-items: baseline;
  padding: 26px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}
.shelf-num { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.shelf-text { display: grid; gap: 6px; }
.shelf-name { font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.1; }
.shelf-tagline { color: var(--ink-soft); max-width: 40em; }
.shelf-format { font-size: 0.8rem; color: var(--muted); }
.shelf-price { font-family: var(--serif); font-size: 1.5rem; font-variant-numeric: lining-nums tabular-nums; }
.shelf-item:hover .shelf-name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.12em; }

/* ---------- responsive ---------- */

@media (max-width: 960px) {
  .checkout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "intro" "order" "details";
    grid-template-rows: auto;
    padding-top: 36px;
  }
  .order { margin-top: 32px; }
  .order-panel { position: static; }
  .details { padding-top: 56px; }
  .cover { max-width: 300px; }
}
@media (max-width: 520px) {
  .masthead-note { display: none; }
  .order-panel { padding: 22px 18px; margin: 0 -2px; }
  .facts > div { grid-template-columns: 1fr; gap: 4px; }
  .download-link { padding: 10px 14px; }
  .shelf-item { grid-template-columns: 2.4em 1fr; }
  .shelf-price { grid-column: 2; font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
