/* Anatomy of an Affair — site styles
   Clean, modern palette: warm white, charcoal, and a single wine-red accent. */
:root {
  --ink: #111317;
  --charcoal: #1a1d23;
  --graphite: #2b2f38;
  --mist: #a8aeb9;
  --paper: #faf9f7;
  --stone: #f0eeea;
  --line: #e3e0da;
  --accent: #b3263e;
  --accent-deep: #8f1d31;
  --accent-soft: #f2d9dd;
  --accent-light: #f0788a;   /* accent on dark backgrounds */
  --text: #1c1f26;
  --muted: #5d636e;
  --radius: 12px;
  --shadow: 0 20px 44px -22px rgba(17, 19, 23, .45);
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; font-family: var(--sans); font-size: 1.0625rem; line-height: 1.7;
  color: var(--text); background: var(--paper); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-deep); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }
.narrow { width: min(760px, 100% - 2.5rem); margin-inline: auto; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.1; margin: 0 0 .5em; }
h2 { font-size: clamp(2.3rem, 5vw, 3.6rem); font-style: italic; letter-spacing: -.01em; }
h3 { font-size: 1.6rem; }
p { margin: 0 0 1.1em; }

.eyebrow {
  display: inline-block; font: 500 .78rem/1 var(--sans); letter-spacing: .26em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 1rem;
}
.on-dark .eyebrow { color: var(--accent-light); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .85rem 1.6rem; border-radius: 999px; border: 2px solid transparent;
  font: 500 .92rem/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; text-decoration: none; cursor: pointer;
  transition: transform .2s, background .2s, color .2s, border-color .2s;
}
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-deep); color: #fff; transform: translateY(-2px); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--accent); color: #fff; transform: translateY(-2px); }
.btn-outline { border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: #fff; }
.on-dark .btn-outline { border-color: rgba(255,255,255,.5); color: #fff; }
.on-dark .btn-outline:hover { background: #fff; color: var(--ink); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(250, 249, 247, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 68px; }
.brand img { height: 28px; width: auto; }
.nav { display: flex; gap: 2rem; align-items: center; }
.nav a {
  color: var(--ink); text-decoration: none; font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 500;
  padding: .4rem 0; border-bottom: 2px solid transparent;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); border-color: var(--accent); }
.nav .btn { padding: .7rem 1.25rem; color: #fff; border-bottom: 2px solid transparent; }
.nav .btn:hover { color: #fff; border-color: transparent; }
.menu-btn { display: none; background: none; border: 0; color: var(--ink); padding: .5rem; cursor: pointer; }
.menu-btn span, .menu-btn span::before, .menu-btn span::after { display: block; width: 24px; height: 2px; background: currentColor; position: relative; content: ""; }
.menu-btn span::before { position: absolute; top: -7px; }
.menu-btn span::after { position: absolute; top: 7px; }

/* ---------- Hero ---------- */
.hero { background: var(--paper); padding: clamp(3rem, 7vw, 6rem) 0; }
.hero .wrap { display: grid; grid-template-columns: 1fr 1.05fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.hero h1 { margin: 0 0 1.6rem; }
.hero h1 img { width: min(520px, 100%); }
.hero h2 {
  font: 500 clamp(.85rem, 1.5vw, 1rem)/1.7 var(--sans); font-style: normal; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 1.4rem;
}
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 36em; }
.hero .cta { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 2rem; }
.book-stage { background: var(--stone); border-radius: 24px; padding: clamp(1rem, 3vw, 2.2rem); }
.book-stage img { mix-blend-mode: multiply; width: 100%; height: auto; }

/* ---------- Stat strip ---------- */
.stats { background: #fff; border-block: 1px solid var(--line); }
.stats ul { list-style: none; margin: 0; padding: 2rem 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; text-align: center; }
.stats li + li { border-left: 1px solid var(--line); }
.stats strong { display: block; font: italic 600 clamp(2rem, 4vw, 2.8rem)/1 var(--serif); color: var(--accent); margin-bottom: .3rem; }
.stats span { font-size: .76rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }

/* ---------- Sections ---------- */
section { padding: clamp(4rem, 9vw, 7rem) 0; }
.on-dark { background: var(--charcoal); color: #d9dde4; }
.on-dark h2, .on-dark h3 { color: #fff; }
.on-stone { background: var(--stone); }
.split { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; }

.mosaic { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.mosaic figure { margin: 0; overflow: hidden; border-radius: var(--radius); background: var(--ink); }
.mosaic img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.mosaic figure:hover img { transform: scale(1.05); }
.mosaic .a { grid-column: 1 / 5; grid-row: 1 / 3; aspect-ratio: 1; }
.mosaic .b, .mosaic .c, .mosaic .f { grid-column: 5 / 7; aspect-ratio: 1; }
.mosaic .d { grid-column: 1 / 3; aspect-ratio: 1; }
.mosaic .e { grid-column: 3 / 5; aspect-ratio: 1; }

.music .cols { columns: 2; column-gap: 3rem; }
.music .cols p { break-inside: avoid-column; }
.hear { margin-top: 1.6rem; }

.author { padding: 0; background: var(--charcoal); }
.author-banner { height: clamp(220px, 34vw, 420px); background: url("../images/author-banner.jpg") center 30% / cover; position: relative; }
.author-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(26,29,35,0), var(--charcoal)); }
.author-card { position: relative; margin-top: -6rem; z-index: 2; background: var(--paper); color: var(--text); border-radius: 20px; padding: clamp(1.8rem, 5vw, 3.6rem); box-shadow: var(--shadow); }
.author-card h2 { color: var(--ink); }
.author-card p { font-family: var(--serif); font-size: clamp(1.2rem, 2vw, 1.4rem); line-height: 1.65; }
.author-card .sig { font-style: italic; font-size: 1.5rem; color: var(--accent); margin: 1.5rem 0 0; }
.author-wrap { padding-bottom: clamp(4rem, 8vw, 6rem); }

/* Buy */
.buy h2 { text-align: center; }
.buy .eyebrow { display: block; text-align: center; }
.buy .sub { text-align: center; max-width: 34em; margin: 0 auto 3rem; color: var(--muted); }
.shelf-title { font: 500 .8rem/1 var(--sans); letter-spacing: .26em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 1rem; margin: 2.5rem 0 1.2rem; }
.shelf-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.3rem; }
.cards.one { grid-template-columns: minmax(260px, 380px); }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.8rem 1.6rem 1.6rem; display: flex; flex-direction: column; position: relative; transition: transform .25s, box-shadow .25s; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card.featured { border: 2px solid var(--accent); }
.card .flag { position: absolute; top: -.8rem; left: 1.4rem; background: var(--accent); color: #fff; font: 600 .68rem/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; padding: .45rem .8rem; border-radius: 999px; }
.card .price { font: 600 2.7rem/1 var(--serif); color: var(--ink); margin-bottom: .7rem; }
.card .price sup { font-size: 1.1rem; vertical-align: super; margin-right: 2px; }
.card .price.none { font-size: 1.5rem; font-style: italic; color: var(--muted); padding: .7rem 0 .35rem; }
.card h3 { font: 600 .9rem/1.4 var(--sans); letter-spacing: .12em; text-transform: uppercase; margin-bottom: .6rem; }
.card p { font-size: .95rem; color: var(--muted); margin-bottom: 1rem; }
.card .isbn { font-size: .8rem; letter-spacing: .06em; color: var(--muted); margin-top: auto; padding-bottom: 1rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--mist); padding: 3.2rem 0 2.2rem; text-align: center; }
.site-footer img { height: 32px; width: auto; margin: 0 auto 1rem; }
.site-footer .tag { font-size: .78rem; letter-spacing: .22em; text-transform: uppercase; color: var(--accent-light); margin-bottom: 1.4rem; }
.site-footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: .4rem 1.6rem; margin-bottom: 1.6rem; }
.site-footer nav a { color: #e4e7ec; text-decoration: none; font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; }
.site-footer nav a:hover { color: var(--accent-light); }
.site-footer small { display: block; font-size: .85rem; opacity: .75; }

/* ---------- Contents page ---------- */
.page-head { background: var(--charcoal); color: #fff; padding: clamp(3.5rem, 8vw, 6rem) 0 clamp(3rem, 6vw, 4.5rem); text-align: center; }
.page-head .eyebrow { color: var(--accent-light); }
.page-head h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); font-style: italic; margin-bottom: 1rem; }
.page-head p { max-width: 46em; margin: 0 auto; color: #cfd4dc; font-size: 1.1rem; }
.page-head .jump { margin-top: 1.8rem; display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }

.toc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.toc-col { background: #fff; border-radius: var(--radius); padding: 1.8rem 1.6rem; border: 1px solid var(--line); }
.toc-col h3 { font: 500 .78rem/1 var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--accent); padding-bottom: 1rem; margin-bottom: .6rem; border-bottom: 1px solid var(--line); }
.toc-col ol { list-style: none; margin: 0; padding: 0; }
.toc-col li { display: flex; align-items: baseline; gap: .8rem; padding: .32rem 0; }
.toc-col .pg { flex: 0 0 4.2rem; white-space: nowrap; font: italic 600 1.35rem/1 var(--serif); color: var(--accent); text-align: right; }
.toc-col .t { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; line-height: 1.25; flex: 1; }
.toc-col li.coda-label { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); font: 500 .78rem/1 var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--accent); }
.toc-col li.has-sample { background: var(--accent-soft); border-radius: 8px; margin-inline: -.5rem; padding-inline: .5rem; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .35rem; background: var(--ink); color: #fff; border: 0; border-radius: 999px; cursor: pointer; font: 500 .66rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; padding: .45rem .7rem; transition: background .2s; }
.chip:hover { background: var(--accent); }
.chip svg { width: 10px; height: 10px; fill: currentColor; }
.legend { display: flex; align-items: center; gap: .6rem; margin: 0 0 1.6rem; color: var(--muted); font-size: .95rem; }

.sample-block + .sample-block { margin-top: 4.5rem; }
.sample-block h2 { font-size: clamp(2rem, 4vw, 2.9rem); }
.sample-block > p { max-width: 44em; color: var(--muted); font-size: 1.1rem; }
.samples { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.4rem; margin-top: 2rem; }
.sample { background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); display: flex; flex-direction: column; transition: transform .25s, box-shadow .25s; }
.sample:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.sample .art { position: relative; display: block; border: 0; padding: 0; cursor: pointer; background: var(--ink); aspect-ratio: 1 / 1; overflow: hidden; }
.sample .art img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.sample:hover .art img { transform: scale(1.06); }
.sample .play { position: absolute; right: .8rem; bottom: .8rem; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0,0,0,.4); }
.sample .play svg { width: 20px; height: 20px; fill: #fff; margin-left: 3px; }
.sample .meta { padding: 1.1rem 1.3rem 1.4rem; }
.sample .pageno { font: 500 .72rem/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--accent); }
.sample h3 { margin: .45rem 0 .9rem; font-size: 1.7rem; }

dialog.player { border: 0; padding: 0; border-radius: 20px; width: min(560px, 94vw); background: var(--charcoal); color: #fff; box-shadow: 0 30px 80px rgba(0,0,0,.6); overflow: hidden; }
dialog.player::backdrop { background: rgba(10, 11, 14, .8); backdrop-filter: blur(4px); }
dialog.player img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; max-height: 62vh; }
dialog.player .body { padding: 1.4rem 1.6rem 1.7rem; }
dialog.player .pageno { font: 500 .72rem/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--accent-light); }
dialog.player h3 { color: #fff; font-size: 2rem; margin: .4rem 0 1rem; }
dialog.player audio { width: 100%; }
dialog.player .close { position: absolute; top: .8rem; right: .8rem; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(17,19,23,.8); color: #fff; font-size: 1.4rem; cursor: pointer; line-height: 1; }
dialog.player .close:hover { background: var(--accent); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { transition-duration: .01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero .wrap, .split { grid-template-columns: 1fr; }
  .toc-grid { grid-template-columns: 1fr; }
  .music .cols { columns: 1; }
}
@media (max-width: 820px) {
  .menu-btn { display: block; }
  .nav { position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; gap: 0; align-items: stretch; background: var(--paper); padding: .5rem 1.25rem 1.2rem; border-bottom: 1px solid var(--line); display: none; }
  .nav.open { display: flex; }
  .nav a { padding: .95rem 0; border-bottom: 1px solid var(--line); }
  .nav .btn { margin-top: 1rem; }
  .stats ul { grid-template-columns: repeat(2, 1fr); row-gap: 1.8rem; }
  .stats li:nth-child(3) { border-left: 0; }
  .author-card { margin-top: -3rem; }
}
