/* ==========================================================================
   See It Coming: site styles
   Palette taken from the cover: graphite pencil, drawing paper, red pencil.
   ========================================================================== */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Courgette";
  src: url("../fonts/Courgette-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --graphite: #2f3134;
  --graphite-deep: #25272a;
  --graphite-line: #464a4e;
  --paper: #f1f1ee;
  --paper-bright: #fafaf8;
  --sketch: #d6d7d3;
  --pencil: #61656a;
  --ink: #26282b;
  --red: #b3312d;
  --red-deep: #922520;
  --on-dark: #ececea;
  --on-dark-soft: #a9adb1;

  --display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --text: "Newsreader", "Iowan Old Style", Georgia, serif;
  --script: "Courgette", "Brush Script MT", cursive;

  --measure: 66ch;
  --wrap: 1180px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --header-h: 84px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.1875rem;          /* 19px: comfortable for long reading */
  line-height: 1.65;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  min-height: 100vh; display: flex; flex-direction: column;
}
body > main { flex: 1 0 auto; }

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--red); }
button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 2px; }
.on-dark :focus-visible { outline-color: #fff; }

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

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--paper-bright); color: var(--ink); padding: 0.6rem 1rem; border-radius: 4px;
}
.skip-link:focus { top: 1rem; }

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

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3.1rem; padding: 0.7rem 1.5rem;
  border: 1px solid transparent; border-radius: 4px;
  font-family: var(--text); font-size: 1.05rem; font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn--red { background: var(--red); color: #fff; }
.btn--red:hover { background: var(--red-deep); }
.btn--dark { background: var(--graphite); color: var(--on-dark); }
.btn--dark:hover { background: var(--graphite-deep); }
.btn--light { background: var(--paper); color: var(--graphite); }
.btn--light:hover { background: #fff; }
.btn--outline { background: transparent; border-color: currentColor; }
.btn--outline:hover { background: rgba(0,0,0,.04); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.text-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-weight: 600; text-decoration: underline; text-decoration-color: var(--red);
  text-decoration-thickness: 2px; text-underline-offset: 0.3em;
}

/* ---------- Header ---------- */

.site-header {
  position: relative; z-index: 20;
  background: var(--graphite); color: var(--on-dark);
}
.site-header--overlay { position: absolute; inset: 0 0 auto 0; background: transparent; }

.nav {
  display: flex; align-items: center; gap: 1.5rem;
  min-height: var(--header-h);
}
.brand {
  display: inline-flex; align-items: center; gap: 0.7rem;
  font-family: var(--display); font-weight: 600; font-size: 1.05rem;
  letter-spacing: 0.24em; text-transform: uppercase; text-decoration: none;
  margin-right: auto; white-space: nowrap;
}
.brand svg { width: 26px; height: 26px; flex: none; }

.nav__links { display: flex; gap: 2.1rem; list-style: none; margin: 0; padding: 0; }
.nav__links a {
  font-size: 0.8rem; letter-spacing: 0.18em; text-transform: uppercase; text-decoration: none;
  padding-block: 0.4rem; border-bottom: 1px solid transparent;
}
.nav__links a:hover, .nav__links a[aria-current="page"] { border-bottom-color: var(--red); }

.nav__cart {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 2.9rem; height: 2.9rem; border-radius: 50%;
  background: transparent; border: 1px solid rgba(255,255,255,.28); cursor: pointer;
}
.nav__cart:hover { border-color: rgba(255,255,255,.6); }
.nav__cart svg { width: 22px; height: 22px; }
.nav__count {
  position: absolute; top: -4px; right: -4px; min-width: 1.35rem; height: 1.35rem; padding: 0 .3rem;
  border-radius: 999px; background: var(--red); color: #fff;
  font-size: 0.78rem; font-weight: 700; line-height: 1.35rem; text-align: center;
}
.nav__count[hidden] { display: none; }
.nav__cta { min-height: 2.9rem; padding-inline: 1.2rem; font-size: 0.98rem; }

.nav__menu-btn {
  display: none; background: none; border: 1px solid rgba(255,255,255,.28); border-radius: 4px;
  height: 2.9rem; padding: 0 0.9rem; cursor: pointer; font-size: 0.95rem;
}

@media (max-width: 860px) {
  .nav { gap: 0.75rem; flex-wrap: wrap; }
  .nav__menu-btn { display: inline-flex; align-items: center; }
  .nav__links {
    display: none; order: 10; width: 100%; flex-direction: column; gap: 0;
    padding-bottom: 1rem; border-top: 1px solid rgba(255,255,255,.15);
  }
  .nav--open .nav__links { display: flex; }
  .nav__links a { display: block; padding: 0.9rem 0; font-size: 0.9rem; border-bottom: 1px solid rgba(255,255,255,.08); }
  .site-header--overlay .nav--open { background: var(--graphite); margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  .nav__cta { display: none; }
}
@media (max-width: 420px) {
  .brand { gap: 0.5rem; letter-spacing: 0.1em; font-size: 0.8rem; }
  .brand svg { width: 22px; height: 22px; }
}

/* ---------- Dark surfaces: pencil-on-graphite texture ---------- */

.graphite {
  background-color: var(--graphite);
  background-image:
    radial-gradient(ellipse 60% 70% at 82% 12%, rgba(255,255,255,.11), transparent 70%),
    repeating-linear-gradient(118deg, rgba(255,255,255,.022) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(28deg, rgba(0,0,0,.05) 0 1px, transparent 1px 9px);
  color: var(--on-dark);
}

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

.hero { position: relative; overflow: hidden; padding: calc(var(--header-h) + clamp(2rem, 6vw, 5rem)) 0 clamp(3.5rem, 8vw, 6.5rem); }
.hero__grid {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center; gap: clamp(2rem, 5vw, 5rem);
}
.hero__kicker { margin: 0 0 1.4rem; color: var(--on-dark-soft); font-size: 1.05rem; font-style: italic; }

/* Title lockup echoes the cover: LINES / from a / COUNTRY JUDGE / script */
.lockup { margin: 0; font-weight: 400; display: inline-grid; justify-items: start; }
.lockup__lines {
  display: block; font-family: var(--display); font-weight: 600;
  font-size: clamp(4.4rem, 10.5vw, 9.6rem); line-height: 0.82; letter-spacing: 0.16em;
  margin-right: -0.16em;  /* trailing tracking */
  color: #f4f4f2; text-transform: uppercase;
}
.lockup__from {
  display: flex; align-items: center; gap: 0.9rem; width: 100%;
  margin-top: 0.55em; font-family: var(--display); font-weight: 600;
  font-size: clamp(1rem, 1.7vw, 1.45rem); letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--on-dark);
}
.lockup__from::before, .lockup__from::after { content: ""; height: 2px; background: var(--red); flex: 1; max-width: 4.5rem; }
.lockup__from::after { max-width: none; }
.lockup__judge {
  display: block; font-family: var(--display); font-weight: 500;
  font-size: clamp(2.05rem, 4.35vw, 3.95rem); line-height: 1.05; letter-spacing: 0.055em;
  text-transform: uppercase; color: #f4f4f2;
}
.lockup__rule { display: flex; align-items: center; gap: 0.6rem; width: 100%; margin: 0.65rem 0 0.35rem; color: var(--red); }
.lockup__rule::before, .lockup__rule::after { content: ""; height: 2px; flex: 1; background: var(--red); }
.lockup__rule span { font-size: 0.7rem; line-height: 1; color: var(--on-dark-soft); }
.lockup__script {
  position: relative; display: inline-block; font-family: var(--script);
  font-size: clamp(1.55rem, 2.9vw, 2.45rem); line-height: 1.3; color: var(--on-dark);
  padding-bottom: 0.45em;
}
.lockup__underline { position: absolute; left: -2%; bottom: 0; width: 104%; height: 0.55em; overflow: visible; }
.lockup__underline path { fill: none; stroke: var(--red); stroke-width: 3.2; stroke-linecap: round; }

.hero__pitch { max-width: 33rem; margin: 1.8rem 0 0; font-size: clamp(1.12rem, 1.5vw, 1.3rem); line-height: 1.55; color: #dcdddb; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.6rem; margin-top: 2.1rem; }
.hero__actions .text-link { color: var(--on-dark); font-size: 1.05rem; }
.ship-notice {
  max-width: 36rem; margin: 1.1rem 0 0; padding: 0.75rem 1rem;
  border-left: 3px solid var(--red); border-radius: 0 4px 4px 0;
  background: rgba(179, 49, 45, .07); font-size: 0.98rem; line-height: 1.5;
}
.ship-notice strong { font-weight: 650; }
.on-dark .ship-notice { background: rgba(255, 255, 255, .07); color: var(--on-dark); }
.buybox .ship-notice, .catalog-item__buy .ship-notice { margin: 0.9rem 0 0; font-size: 0.93rem; }
.catalog-item__buy .ship-notice { margin: 0.2rem 0 0.4rem; }
.hero__note { margin: 1rem 0 0; color: var(--on-dark-soft); font-size: 0.98rem; }

/* ---------- 3D book ---------- */

.book3d { --w: min(400px, 74vw); --t: 34px; perspective: 1900px; display: grid; place-items: center; padding-block: 1rem 2.5rem; }
.book3d__body {
  position: relative; width: var(--w); aspect-ratio: 974 / 1391;
  transform-style: preserve-3d; transform: rotateY(-26deg) rotateX(5deg) rotateZ(-1deg);
}
.book3d__face, .book3d__pages, .book3d__back { position: absolute; }
.book3d__face {
  inset: 0; transform: translateZ(calc(var(--t) / 2)); border-radius: 2px 5px 5px 2px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
}
.book3d__face img { width: 100%; height: 100%; object-fit: cover; }
.book3d__face::after {           /* hinge crease and sheen */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,.28) 0, rgba(255,255,255,.18) 1.6%, rgba(0,0,0,.12) 3.2%, transparent 6%),
    linear-gradient(115deg, rgba(255,255,255,.14), transparent 40%, rgba(0,0,0,.08));
}
.book3d__pages {
  top: 4px; bottom: 4px; left: calc(var(--w) - var(--t) / 2 - 2px); width: var(--t);
  transform: rotateY(90deg);
  background: repeating-linear-gradient(90deg, #f4f3ee 0 1px, #d9d8d2 1px 2px);
  box-shadow: inset 0 0 6px rgba(0,0,0,.25);
}
.book3d__back { inset: 0; transform: translateZ(calc(var(--t) / -2)); background: #3a3c3f; border-radius: 2px 5px 5px 2px; }
.book3d::after {
  content: ""; width: calc(var(--w) * 0.95); height: 26px; margin-top: -10px;
  border-radius: 50%; background: radial-gradient(closest-side, rgba(0,0,0,.55), transparent);
  filter: blur(4px);
}

/* Publisher's 3D render of the book */
.hero-book { display: grid; place-items: center; padding-block: 0.5rem 1.5rem; }
.hero-book img {
  width: min(440px, 78vw); height: auto;
  filter: drop-shadow(0 34px 34px rgba(0, 0, 0, .45)) drop-shadow(0 6px 10px rgba(0, 0, 0, .3));
}
@media (max-width: 900px) { .hero-book img { width: min(330px, 72vw); } }

@media (prefers-reduced-motion: no-preference) {
  .js .hero .hero-book img { animation: rise 1.1s cubic-bezier(.2,.7,.2,1) both; }
  .js .hero .lockup__underline path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s 0.5s cubic-bezier(.6,.05,.3,1) forwards; }
  .js .hero .book3d__body { animation: settle 1.2s cubic-bezier(.2,.7,.2,1) both; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes settle { from { opacity: 0; transform: rotateY(-40deg) rotateX(5deg) rotateZ(-1deg) translateX(30px); } }

@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__media { order: 2; }
  .book3d { --w: min(300px, 68vw); }
}

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

.section { padding-block: clamp(4rem, 9vw, 7.5rem); }
.section--tight { padding-block: clamp(3rem, 6vw, 5rem); }
.section--bright { background: var(--paper-bright); }
.section + .section--rule { border-top: 1px solid var(--sketch); }

.section-title {
  margin: 0 0 0.6rem; font-family: var(--display); font-weight: 600;
  font-size: clamp(2.3rem, 4.6vw, 3.6rem); line-height: 1.05; letter-spacing: 0.005em;
}
.section-lede { margin: 0 0 2.6rem; max-width: 40rem; color: var(--pencil); font-size: 1.15rem; }

.prose p { max-width: var(--measure); margin: 0 0 1.15em; }
.prose em, .prose cite { font-style: italic; }

/* ---------- Inside the book (rotating highlights) ---------- */

.inside { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.inside__figure {
  margin: 0; position: relative; aspect-ratio: 4 / 3.2;
  background: #fff; border: 1px solid var(--sketch); border-radius: 2px;
  box-shadow: 0 1px 0 #e5e5e2, 0 18px 40px -24px rgba(38,40,43,.45);
  padding: clamp(0.8rem, 2vw, 1.4rem);
}
.inside__figure img { width: 100%; height: 100%; object-fit: contain; }
.inside__slides { position: relative; min-height: 15rem; }
.inside__slide[hidden] { display: none; }
.inside__slide h3 { margin: 0 0 0.9rem; font-family: var(--display); font-weight: 600; font-size: clamp(1.8rem, 3vw, 2.45rem); line-height: 1.1; }
.inside__slide p { margin: 0; font-size: 1.15rem; max-width: 34rem; }

.inside__controls { display: flex; align-items: center; gap: 0.6rem; margin-top: 2rem; }
.round-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.9rem; height: 2.9rem; border-radius: 50%; cursor: pointer;
  background: transparent; border: 1px solid #9a9ea2; color: var(--ink);
}
.round-btn:hover { border-color: var(--ink); background: #fff; }
.round-btn svg { width: 18px; height: 18px; }
.inside__count { margin-left: 0.6rem; color: var(--pencil); font-size: 1rem; font-variant-numeric: tabular-nums; }
.inside__timer { height: 2px; margin-top: 1.4rem; max-width: 34rem; background: var(--sketch); overflow: hidden; }
.inside__timer span { display: block; height: 100%; width: 100%; background: var(--red); transform-origin: left; transform: scaleX(0); }
.inside__timer.is-running span { animation: timer var(--interval, 8s) linear forwards; }
@keyframes timer { to { transform: scaleX(1); } }

.fade-in { animation: fadeIn .45s ease both; }
@keyframes fadeIn { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .fade-in { animation: none; } }

@media (max-width: 860px) { .inside { grid-template-columns: 1fr; } }

/* ---------- About the book ---------- */

.about-book { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.facts { margin: 0; border-top: 2px solid var(--ink); }
.facts div { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--sketch); }
.facts dt { color: var(--pencil); font-size: 1rem; }
.facts dd { margin: 0; font-size: 1.02rem; }
@media (max-width: 860px) { .about-book { grid-template-columns: 1fr; } }

/* ---------- Contents ---------- */

.contents { list-style: none; margin: 0; padding: 0; columns: 3 17rem; column-gap: 3rem; counter-reset: ch; }
.contents li {
  counter-increment: ch; break-inside: avoid;
  display: grid; grid-template-columns: 2.2rem 1fr; gap: 0.4rem;
  padding: 0.45rem 0; border-bottom: 1px solid var(--sketch); font-size: 1.05rem; line-height: 1.4;
}
.contents li::before { content: counter(ch); color: var(--red); font-variant-numeric: tabular-nums; font-weight: 600; }
.contents li.is-extra { display: none; }
.contents.is-open li.is-extra { display: grid; }
.contents-toggle { margin-top: 1.8rem; }

/* ---------- Excerpt ---------- */

.excerpt {
  position: relative; max-width: 46rem; margin-inline: auto;
  background: #fff; border: 1px solid var(--sketch); border-radius: 2px;
  box-shadow: 0 30px 60px -40px rgba(38,40,43,.5);
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1.4rem, 6vw, 4.8rem);
}
.excerpt__title { margin: 0; text-align: center; font-family: var(--display); font-weight: 600; font-size: clamp(2rem, 4vw, 2.8rem); }
.excerpt__by { margin: 0.2rem 0 2.2rem; text-align: center; color: var(--pencil); font-style: italic; }
.excerpt__body p { margin: 0 0 1.1em; text-indent: 1.6em; font-size: 1.16rem; line-height: 1.78; hyphens: auto; }
.excerpt__body p:first-child { text-indent: 0; }
.excerpt__body.is-clamped { max-height: 30rem; overflow: hidden; -webkit-mask-image: linear-gradient(#000 65%, transparent); mask-image: linear-gradient(#000 65%, transparent); }
.excerpt__toggle { display: flex; justify-content: center; margin-top: 1.2rem; }

/* ---------- Author ---------- */

.author { display: grid; grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.author__photo { margin: 0; border-radius: 2px; overflow: hidden; background: var(--sketch); }
.author__photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; filter: grayscale(1) contrast(1.02); }
.author__photo figcaption { padding: 0.6rem 0.2rem 0; background: var(--paper); font-size: 0.92rem; color: var(--pencil); }
@media (max-width: 760px) { .author { grid-template-columns: 1fr; } .author__photo { max-width: 22rem; } }

/* ---------- Reviews ---------- */

.praise-lead, .praise-item { margin: 0; }
.praise-lead::before, .praise-item::before { content: ""; display: block; width: 2.6rem; height: 2px; background: var(--red); margin-bottom: 1.1rem; }
.praise-lead { max-width: 54rem; margin: 2rem 0 clamp(3rem, 6vw, 4.5rem); }
.praise-lead p { margin: 0 0 1.1rem; font-family: var(--display); font-weight: 500; font-size: clamp(1.55rem, 2.5vw, 2.15rem); line-height: 1.3; }
.praise-grid { columns: 2 24rem; column-gap: clamp(2rem, 5vw, 4rem); }
.praise-item { break-inside: avoid; padding-bottom: 2.6rem; }
.praise-item p { margin: 0 0 0.9rem; font-size: 1.08rem; line-height: 1.68; }
.praise-lead footer, .praise-item footer { display: grid; gap: 0.1rem; font-size: 0.98rem; line-height: 1.45; }
.praise-lead footer strong, .praise-item footer strong { font-weight: 650; }
.praise-lead footer span, .praise-item footer span { color: var(--pencil); }
.praise-lead cite, .praise-item cite { font-style: italic; }

/* ---------- Buy band ---------- */

.buy-band { padding-block: clamp(3.5rem, 7vw, 5.5rem); }
.buy-band__grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 4rem); align-items: center; }
.buy-band__cover { width: clamp(120px, 16vw, 190px); box-shadow: 0 24px 40px -18px rgba(0,0,0,.7); border-radius: 2px; }
.buy-band__cover--3d { width: clamp(140px, 18vw, 220px); box-shadow: none; border-radius: 0; filter: drop-shadow(0 18px 22px rgba(0,0,0,.5)); }
.buy-band h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.08; }
.buy-band__meta { margin: 0.6rem 0 1.6rem; color: var(--on-dark-soft); }
.buy-band__price { color: var(--on-dark); font-weight: 600; }
.buy-band cite { font-style: normal; }
.on-dark .btn--outline { color: var(--on-dark); }
.on-dark .btn--outline:hover { background: rgba(255,255,255,.08); }
@media (max-width: 600px) { .buy-band__grid { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */

.site-footer { background: var(--graphite-deep); color: var(--on-dark-soft); padding-block: 3rem; font-size: 0.98rem; }
.site-footer__grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem 3rem; }
.site-footer p { margin: 0 0 0.4rem; }
.site-footer a { color: var(--on-dark); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.6rem; }

/* ---------- Page header (inner pages) ---------- */

.page-head { padding-block: clamp(2.5rem, 6vw, 4rem); }
.page-head h1 { margin: 0; font-family: var(--display); font-weight: 600; font-size: clamp(2.4rem, 5vw, 3.8rem); line-height: 1.05; }
.page-head p { margin: 0.6rem 0 0; color: var(--on-dark-soft); max-width: 40rem; }

.breadcrumb { margin: 0; padding: 1.2rem 0 0; font-size: 0.98rem; color: var(--pencil); }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.breadcrumb li + li::before { content: "/"; margin-right: 0.5rem; color: #a3a6a9; }

/* ---------- Catalog (all books) ---------- */

.catalog { list-style: none; margin: 0; padding: 0; }
.catalog-item {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) 18.5rem; gap: clamp(1.25rem, 3vw, 2.5rem);
  padding-block: 2.2rem; border-bottom: 1px solid var(--sketch); align-items: start;
}
.catalog-item:first-child { padding-top: 0.5rem; }
.catalog-item__cover img { box-shadow: 0 14px 26px -16px rgba(0,0,0,.6); border-radius: 2px; }
.catalog-item h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: clamp(1.8rem, 3vw, 2.3rem); line-height: 1.1; }
.catalog-item h2 a { text-decoration: none; }
.catalog-item h2 a:hover { text-decoration: underline; text-decoration-color: var(--red); }
.catalog-item__sub { margin: 0.15rem 0 0.4rem; font-family: var(--script); font-size: 1.2rem; color: var(--pencil); }
.catalog-item__by { margin: 0 0 0.8rem; color: var(--pencil); }
.catalog-item__desc { margin: 0; max-width: 40rem; }
.catalog-item__buy { display: grid; gap: 0.6rem; }
.catalog-item__price { margin: 0; font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.catalog-item__status { margin: 0 0 0.4rem; font-size: 0.98rem; color: var(--pencil); }
.catalog-item__buy .qty-select { margin-bottom: 0; }
.catalog-next { margin: 2.5rem 0 0; color: var(--pencil); font-style: italic; }
@media (max-width: 860px) {
  .catalog-item { grid-template-columns: 110px minmax(0, 1fr); }
  .catalog-item__buy { grid-column: 1 / -1; max-width: 24rem; }
}

/* ---------- Product page ---------- */

.product { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr) minmax(16rem, 0.75fr); gap: clamp(1.5rem, 3.5vw, 3rem); align-items: start; padding-block: 1.8rem clamp(3rem, 6vw, 5rem); }
.gallery__main { margin: 0; background: #fff; border: 1px solid var(--sketch); border-radius: 2px; padding: 1rem; }
.gallery__main img { width: 100%; max-height: 640px; object-fit: contain; }
.gallery__thumbs { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.8rem; list-style: none; padding: 0; }
.gallery__thumbs button {
  width: 4.4rem; height: 4.4rem; padding: 0.25rem; cursor: pointer;
  background: #fff; border: 1px solid var(--sketch); border-radius: 2px;
}
.gallery__thumbs button[aria-pressed="true"] { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.gallery__thumbs img { width: 100%; height: 100%; object-fit: contain; }
.gallery__caption { margin: 0.5rem 0 0; font-size: 0.92rem; color: var(--pencil); }

.product__title { margin: 0; font-family: var(--display); font-weight: 600; font-size: clamp(2.3rem, 4vw, 3.2rem); line-height: 1.04; }
.product__subtitle { margin: 0.3rem 0 0.5rem; font-family: var(--script); font-size: 1.45rem; color: var(--pencil); }
.product__by { margin: 0 0 1.4rem; }
.product__by a { color: var(--red); font-weight: 600; }
.product .facts { margin-top: 2rem; }

.buybox {
  position: sticky; top: 1.2rem;
  background: var(--paper-bright); border: 1px solid var(--sketch); border-radius: 6px; padding: 1.5rem;
}
.buybox__price { margin: 0; font-size: 2.1rem; font-weight: 600; line-height: 1.1; }
.buybox__status { margin: 0.5rem 0 1.2rem; font-size: 1rem; }
.buybox__status strong { color: var(--red); }
.buybox__label { display: block; font-size: 0.95rem; color: var(--pencil); margin-bottom: 0.4rem; }
.format-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1.1rem; padding: 0; border: 0; }
.format-picker label {
  display: grid; padding: 0.55rem 0.9rem; min-width: 7.5rem; cursor: pointer;
  border: 1px solid #b9bbb8; border-radius: 4px; background: #fff; font-size: 0.98rem; line-height: 1.3;
}
.format-picker input { position: absolute; opacity: 0; pointer-events: none; }
.format-picker input:checked + span, .format-picker label:has(input:checked) { border-color: var(--red); }
.format-picker label:has(input:checked) { box-shadow: 0 0 0 1px var(--red); }
.format-picker label:has(input:focus-visible) { outline: 2px solid var(--red); outline-offset: 2px; }
.format-picker small { color: var(--pencil); font-size: 0.92rem; }
.qty-select {
  width: 100%; min-height: 3rem; margin-bottom: 1.1rem; padding: 0 0.8rem;
  font: inherit; font-size: 1.05rem; border: 1px solid #b9bbb8; border-radius: 4px; background: #fff;
}
.buybox__actions { display: grid; gap: 0.6rem; }
.buybox__fine { margin: 1.1rem 0 0; font-size: 0.93rem; color: var(--pencil); line-height: 1.5; }
.buybox__fine p { margin: 0 0 0.4rem; }

.product-more { border-top: 1px solid var(--sketch); }
.highlight-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 2.6rem 2.2rem; }
.highlight-list img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; border: 1px solid var(--sketch); padding: 0.6rem; margin-bottom: 0.9rem; }
.highlight-list h3 { margin: 0 0 0.4rem; font-family: var(--display); font-weight: 600; font-size: 1.55rem; line-height: 1.15; }
.highlight-list p { margin: 0; font-size: 1.05rem; }

@media (max-width: 1080px) {
  .product { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
  .buybox-col { grid-column: 2; }
  .buybox { position: static; }
}
@media (max-width: 760px) {
  .product { grid-template-columns: 1fr; }
  .buybox-col { grid-column: auto; }
  .gallery { max-width: 26rem; }
}

/* ---------- Cart (drawer + page) ---------- */

.drawer { position: fixed; inset: 0; z-index: 60; visibility: hidden; }
.drawer.is-open { visibility: visible; }
.drawer__backdrop { position: absolute; inset: 0; background: rgba(28,30,32,.55); opacity: 0; transition: opacity .2s ease; }
.drawer.is-open .drawer__backdrop { opacity: 1; }
.drawer__panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%);
  display: flex; flex-direction: column; background: var(--paper); color: var(--ink);
  box-shadow: -20px 0 50px -20px rgba(0,0,0,.4);
  transform: translateX(100%); transition: transform .25s cubic-bezier(.2,.7,.2,1);
}
.drawer.is-open .drawer__panel { transform: none; }
@media (prefers-reduced-motion: reduce) { .drawer__panel, .drawer__backdrop { transition: none; } }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 1.2rem 1.4rem; border-bottom: 1px solid var(--sketch); }
.drawer__head h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.9rem; }
.drawer__added { margin: 0; padding: 0.8rem 1.4rem; background: #fff; border-bottom: 1px solid var(--sketch); font-size: 1rem; }
.drawer__added[hidden] { display: none; }
.drawer__added strong { color: #2f6b3a; }
.drawer__body { flex: 1; overflow-y: auto; padding: 0 1.4rem; }
.drawer__foot { padding: 1.2rem 1.4rem 1.4rem; border-top: 1px solid var(--sketch); background: var(--paper-bright); }

.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 1rem; padding: 1.2rem 0; border-bottom: 1px solid var(--sketch); }
.cart-line img { border-radius: 2px; box-shadow: 0 6px 14px -8px rgba(0,0,0,.5); }
.cart-line__title { margin: 0; font-weight: 600; line-height: 1.3; }
.cart-line__title a { text-decoration: none; }
.cart-line__meta { margin: 0.15rem 0 0.6rem; font-size: 0.95rem; color: var(--pencil); }
.cart-line__price { font-weight: 600; white-space: nowrap; }
.stepper { display: inline-flex; align-items: center; border: 1px solid #b9bbb8; border-radius: 4px; background: #fff; }
.stepper button { width: 2.4rem; height: 2.4rem; border: 0; background: none; cursor: pointer; font-size: 1.2rem; }
.stepper button:hover { background: var(--paper); }
.stepper output { min-width: 2rem; text-align: center; font-variant-numeric: tabular-nums; }
.cart-line__remove { margin-left: 0.8rem; font-size: 0.95rem; font-weight: 400; }
.cart-empty { padding: 2.5rem 0; }
.cart-empty p { margin: 0 0 1.2rem; }

.cart-summary__row { display: flex; justify-content: space-between; gap: 1rem; font-size: 1.15rem; }
.cart-summary__row strong { font-size: 1.3rem; }
.cart-summary__note { margin: 0.4rem 0 1rem; font-size: 0.93rem; color: var(--pencil); }
.cart-summary .btn + .btn { margin-top: 0.6rem; }

.cart-page { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(16rem, 0.8fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; padding-block: 2.5rem clamp(3rem, 6vw, 5rem); }
.cart-page .cart-lines { border-top: 2px solid var(--ink); }
.cart-page .cart-line { grid-template-columns: 96px minmax(0, 1fr) auto; }
.cart-page .cart-summary { background: var(--paper-bright); border: 1px solid var(--sketch); border-radius: 6px; padding: 1.5rem; }
@media (max-width: 760px) { .cart-page { grid-template-columns: 1fr; } }

/* ---------- Notice dialog + toast ---------- */

.notice { max-width: 30rem; width: calc(100% - 2rem); border: 0; border-radius: 6px; padding: 0; background: var(--paper-bright); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
.notice::backdrop { background: rgba(28,30,32,.55); }
.notice__body { padding: 1.8rem 1.8rem 1.4rem; }
.notice h2 { margin: 0 0 0.6rem; font-family: var(--display); font-weight: 600; font-size: 1.9rem; line-height: 1.1; }
.notice p { margin: 0 0 0.8rem; }
.notice__actions { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 0 1.8rem 1.6rem; }

.leave { max-width: 34rem; }
.leave__choice { font-weight: 650; }
.leave .ship-notice { margin: 0.4rem 0 0; font-size: 0.95rem; }
.leave__actions { flex-wrap: wrap; justify-content: flex-start; }
@media (max-width: 480px) { .leave__actions .btn { width: 100%; } }

.loading { opacity: .6; pointer-events: none; }

/* ---------- 404 ---------- */
.notfound { min-height: 60vh; display: grid; place-items: center; text-align: center; }
.notfound h1 { font-family: var(--display); font-weight: 600; font-size: clamp(2.4rem, 6vw, 4rem); margin: 0 0 0.5rem; }
.notfound p { margin: 0 0 1.6rem; color: var(--on-dark-soft); }
