/* =====================================================================
   Anybookshop design system
   One stylesheet for every page. Mobile-first; no framework.
   Sections: 1 tokens · 2 base · 3 layout · 4 components · 5 header/footer
             6 pages (home, book, listings, cart, checkout, prose)
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* Colour: brand coral #FF6F61, refined. Text on coral is dark ink (6.4:1);
     coral-ink is the accessible coral for text on white (5.7:1). */
  --brand: #ff6f61;
  --brand-hover: #ff5b4c;
  --brand-ink: #b93a2e;
  --brand-soft: #fff0ee;
  --brand-line: #ffd2cc;

  --ink: #1f1a17;          /* body text, 16.9:1 on white */
  --ink-2: #4f4843;        /* secondary text, 9.0:1 */
  --ink-3: #6b645e;        /* muted text, 5.8:1 */
  --line: #e8e2dc;
  --line-strong: #cfc6be;
  --surface: #ffffff;
  --bg: #fbf8f5;           /* warm paper */
  --bg-2: #f4efe9;

  --success: #1d7348;
  --success-soft: #e7f5ec;
  --warning-soft: #fff6dc;
  --warning-line: #e8b400;
  --danger: #b42318;
  --danger-soft: #fdecea;

  /* Type: Montserrat for headings, Lato for text; system fallbacks */
  --font-head: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text-xs: 0.8125rem;    /* 13 */
  --text-sm: 0.875rem;     /* 14 */
  --text-md: 1rem;         /* 16 */
  --text-lg: 1.125rem;     /* 18 */
  --text-xl: 1.375rem;     /* 22 */
  --text-2xl: 1.75rem;     /* 28 */
  --text-3xl: clamp(1.875rem, 1.4rem + 2vw, 2.75rem); /* 30-44 */

  /* Spacing (4px grid) */
  --s-1: 0.25rem; --s-2: 0.5rem; --s-3: 0.75rem; --s-4: 1rem;
  --s-5: 1.5rem;  --s-6: 2rem;   --s-7: 3rem;    --s-8: 4rem;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(31, 26, 23, .06), 0 1px 3px rgba(31, 26, 23, .08);
  --shadow: 0 4px 16px rgba(31, 26, 23, .08);
  --focus: 0 0 0 3px #fff, 0 0 0 5px var(--brand-ink);

  --container: 1200px;
  --header-h: 64px;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 var(--s-3);
  color: var(--ink);
  letter-spacing: -0.01em;
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
.h3 { font-size: var(--text-xl); }
p { margin: 0 0 var(--s-4); }
a { color: var(--brand-ink); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
img { max-width: 100%; height: auto; display: block; }
/* Inline icons default to the text size; components size them explicitly where needed */
svg[aria-hidden="true"] { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
ul, ol { padding-left: 1.25rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-6) 0; }
small, .text-sm { font-size: var(--text-sm); }
.muted { color: var(--ink-3); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: 100;
  background: var(--ink); color: #fff; padding: var(--s-2) var(--s-4); border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--s-2); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- 3. Layout ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--s-4); }
@media (min-width: 768px) { .container { padding: 0 var(--s-5); } }
.narrow { max-width: 760px; }
main { display: block; min-height: 50vh; }
.section { padding: var(--s-7) 0; }
.section-tight { padding: var(--s-5) 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-5); flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.page-head { padding: var(--s-6) 0 var(--s-4); }
.page-head p { color: var(--ink-2); max-width: 65ch; margin: 0; }
.stack > * + * { margin-top: var(--s-4); }

/* ---------- 4. Components ---------- */

/* Buttons: one primary per view; secondary and ghost share its size and shape */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-5);
  font: 700 var(--text-md)/1 var(--font-body);
  border: 2px solid transparent; border-radius: var(--radius);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn svg { width: 1.1em; height: 1.1em; flex: none; }
.btn-primary { background: var(--brand); color: var(--ink); }
.btn-primary:hover { background: var(--brand-hover); color: var(--ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--ink); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--brand-ink); padding: 0 var(--s-3); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand-ink); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #f0b8b2; }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-lg { min-height: 52px; font-size: var(--text-lg); padding: 0 var(--s-6); }
.btn-sm { min-height: 36px; font-size: var(--text-sm); padding: 0 var(--s-3); border-radius: var(--radius-sm); }
.btn-block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* Form fields: label above field */
.field { display: flex; flex-direction: column; gap: var(--s-1); margin-bottom: var(--s-4); }
.field label, .label { font-weight: 700; font-size: var(--text-sm); color: var(--ink); }
.field .hint { font-size: var(--text-xs); color: var(--ink-3); }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: var(--s-2) var(--s-3);
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
.field textarea { min-height: 120px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand-ink); box-shadow: 0 0 0 3px var(--brand-line);
}
.field input:read-only, .field select:disabled { background: var(--bg-2); color: var(--ink-2); }
.form-grid { display: grid; gap: 0 var(--s-4); }
@media (min-width: 640px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .span-2 { grid-column: 1 / -1; }
}
.check { display: flex; align-items: center; gap: var(--s-2); font-weight: 700; cursor: pointer; margin: var(--s-2) 0 var(--s-4); }
.check input { width: 20px; height: 20px; accent-color: var(--brand-ink); margin: 0; }
fieldset { border: 0; padding: 0; margin: 0 0 var(--s-5); min-width: 0; }
legend { font: 700 var(--text-lg)/1.3 var(--font-head); margin-bottom: var(--s-3); padding: 0; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s-5); }
.card-lg { padding: var(--s-6); }
@media (max-width: 479px) { .card, .card-lg { padding: var(--s-4); } }

/* Badges and notices */
.badge {
  display: inline-block; padding: 2px var(--s-2); border-radius: 999px;
  font-size: var(--text-xs); font-weight: 700; line-height: 1.6;
  background: var(--bg-2); color: var(--ink-2);
}
.badge-new { background: var(--success-soft); color: var(--success); }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
.notice { padding: var(--s-3) var(--s-4); border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); margin-bottom: var(--s-4); }
.notice-warning { background: var(--warning-soft); border-color: var(--warning-line); }
.notice-error { background: var(--danger-soft); border-color: #f0b8b2; color: var(--danger); }
.notice-success { background: var(--success-soft); border-color: #a9d8bc; color: var(--success); }

/* Book card + grid (subject pages, search results, featured row) */
.book-grid { display: grid; gap: var(--s-5) var(--s-4); grid-template-columns: repeat(2, minmax(0, 1fr)); list-style: none; margin: 0; padding: 0; }
@media (min-width: 600px) { .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .book-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .book-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.book-card { position: relative; display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.book-card .cover {
  aspect-ratio: 2 / 3; width: 100%; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--bg-2); box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s;
}
.book-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.book-card:hover .cover { box-shadow: var(--shadow); transform: translateY(-2px); }
.book-card h3 { font: 700 var(--text-md)/1.35 var(--font-body); margin: 0; letter-spacing: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-card h3 a { color: var(--ink); text-decoration: none; }
.book-card h3 a::after { content: ""; position: absolute; inset: 0; } /* whole card is the link */
.book-card h3 a:focus-visible { box-shadow: none; }
.book-card:focus-within .cover { box-shadow: var(--focus); }
.book-card .author { font-size: var(--text-sm); color: var(--ink-3); margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-card .price { font-weight: 700; margin: 0; }

/* Cover placeholder when Open Library has no image */
.cover-fallback { display: flex; align-items: center; justify-content: center; text-align: center; padding: var(--s-3);
  font: 700 var(--text-sm)/1.3 var(--font-head); color: var(--ink-2); background: linear-gradient(160deg, var(--bg-2), var(--brand-soft)); }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: center; align-items: center; margin-top: var(--s-6); list-style: none; padding: 0; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 var(--s-3);
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 700;
}
.pagination a:hover { border-color: var(--ink); }
.pagination [aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Tables (order summaries) */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: var(--s-3) 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: var(--text-sm); color: var(--ink-3); font-weight: 700; }
.table .num { text-align: right; white-space: nowrap; }
.table tfoot td { border-bottom: 0; }
.table .total td { font-weight: 700; font-size: var(--text-lg); border-top: 2px solid var(--ink); }

/* Key/value details list */
.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-2) var(--s-5); margin: 0; }
.meta-list dt { color: var(--ink-3); font-size: var(--text-sm); padding-top: 1px; }
.meta-list dd { margin: 0; overflow-wrap: anywhere; }

/* Breadcrumbs */
.breadcrumbs { font-size: var(--text-sm); color: var(--ink-3); padding: var(--s-4) 0 0; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s-1); margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: "/"; margin-right: var(--s-1); color: var(--line-strong); }
.breadcrumbs a { color: var(--ink-2); }

/* ---------- 5. Header and footer ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.header-bar { display: grid; grid-template-columns: auto 1fr auto auto; grid-template-areas: "brand . cart menu" "search search search search";
  align-items: center; gap: var(--s-3); padding-top: var(--s-3); padding-bottom: var(--s-3); }
.brand { grid-area: brand; display: inline-flex; align-items: center; gap: var(--s-2); text-decoration: none; color: var(--ink); }
.brand img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.brand span { font: 700 1.25rem/1 var(--font-head); letter-spacing: -0.02em; }
.brand:hover { color: var(--ink); }

.search-form { grid-area: search; display: flex; position: relative; }
.search-form input {
  flex: 1; min-width: 0; min-height: 44px; padding: 0 var(--s-3) 0 2.5rem; font: inherit; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--radius) 0 0 var(--radius);
}
.search-form input:focus { outline: none; background: var(--surface); border-color: var(--brand-ink); box-shadow: 0 0 0 3px var(--brand-line); }
.search-form > svg { position: absolute; left: var(--s-3); top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.search-form .btn { border-radius: 0 var(--radius) var(--radius) 0; padding: 0 var(--s-4); }

.header-cart { grid-area: cart; position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.header-cart:hover { background: var(--bg-2); color: var(--ink); }
.header-cart svg { width: 24px; height: 24px; }
.cart-count { position: absolute; top: 2px; right: 0; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--brand); color: var(--ink); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; }
.cart-count[data-count="0"] { display: none; }

.nav-toggle { grid-area: menu; display: inline-flex; align-items: center; gap: var(--s-1); min-height: 44px; padding: 0 var(--s-3);
  background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius); font: 700 var(--text-sm)/1 var(--font-body); color: var(--ink); cursor: pointer; }
.nav-toggle svg { width: 20px; height: 20px; }

.site-nav { border-top: 1px solid var(--line); background: var(--surface); }
.js .site-nav:not(.is-open) { display: none; }
.nav-list { list-style: none; margin: 0; padding: var(--s-2) var(--s-4) var(--s-4); }
.nav-list > li > a, .nav-group > summary {
  display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 var(--s-2);
  font-weight: 700; color: var(--ink); text-decoration: none; cursor: pointer; list-style: none; border-radius: var(--radius-sm);
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: ""; width: 8px; height: 8px; border: solid var(--ink-3); border-width: 0 2px 2px 0; transform: rotate(45deg); margin: 0 var(--s-1) 4px var(--s-2); transition: transform .15s; }
.nav-group[open] > summary::after { transform: rotate(-135deg); margin-bottom: -2px; }
.nav-list > li > a:hover, .nav-group > summary:hover { background: var(--bg-2); color: var(--ink); }
.nav-menu { list-style: none; margin: 0; padding: var(--s-1) 0 var(--s-3) var(--s-3); columns: 2 10rem; column-gap: var(--s-4); }
.nav-menu a { display: block; padding: var(--s-2); color: var(--ink-2); text-decoration: none; border-radius: var(--radius-sm); break-inside: avoid; }
.nav-menu a:hover { background: var(--brand-soft); color: var(--ink); }

@media (min-width: 960px) {
  .header-bar { grid-template-columns: auto minmax(0, 560px) 1fr auto; grid-template-areas: "brand search . cart"; gap: var(--s-5); }
  .nav-toggle { display: none; }
  .js .site-nav:not(.is-open), .site-nav { display: block; }
  .nav-list { display: flex; gap: var(--s-1); padding: 0 var(--s-5); }
  .nav-list > li { position: relative; }
  .nav-list > li > a, .nav-group > summary { min-height: 48px; padding: 0 var(--s-3); font-size: var(--text-sm); }
  .nav-group[open] > summary { color: var(--brand-ink); }
  .nav-menu {
    position: absolute; top: 100%; left: 0; z-index: 60; width: max-content; max-width: min(640px, 90vw);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: var(--s-3); columns: 3 11rem;
  }
  .nav-list > li:nth-last-child(-n+2) .nav-menu { left: auto; right: 0; }
}

.site-footer { background: var(--ink); color: #e9e4df; margin-top: var(--s-8); }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { color: var(--brand); text-decoration: underline; }
.footer-grid { display: grid; gap: var(--s-6); padding-top: var(--s-7); padding-bottom: var(--s-6); grid-template-columns: 1fr 1fr; }
.footer-grid .footer-about { grid-column: 1 / -1; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } .footer-grid .footer-about { grid-column: auto; } }
.footer-grid h2 { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: .08em; color: #bfb7b0; margin-bottom: var(--s-3); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li + li { margin-top: var(--s-2); }
.footer-about .brand { color: #fff; margin-bottom: var(--s-3); }
.footer-about p { color: #cfc8c2; max-width: 34ch; }
.footer-delivery { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 700; color: #fff; }
.footer-delivery svg { width: 20px; height: 20px; color: var(--brand); }
.footer-base { border-top: 1px solid #3a332e; padding: var(--s-4) 0; font-size: var(--text-sm); color: #bfb7b0; }

/* ---------- 6. Pages ---------- */

/* Home */
.hero { background: radial-gradient(1200px 400px at 85% -10%, var(--brand-soft), transparent 70%), var(--surface); border-bottom: 1px solid var(--line); }
.hero-inner { padding-top: var(--s-7); padding-bottom: var(--s-7); display: grid; gap: var(--s-6); align-items: center; }
@media (min-width: 900px) { .hero-inner { grid-template-columns: 1.1fr .9fr; padding-top: var(--s-8); padding-bottom: var(--s-8); } }
.hero h1 { max-width: 16ch; margin-bottom: var(--s-4); }
.hero .lead { font-size: var(--text-lg); color: var(--ink-2); max-width: 46ch; margin-bottom: var(--s-5); }
.hero .search-form { max-width: 560px; }
.hero .search-form input { min-height: 56px; font-size: var(--text-lg); background: var(--surface); }
.hero .search-form .btn { min-height: 56px; padding: 0 var(--s-5); }
.trust-list { list-style: none; padding: 0; margin: var(--s-5) 0 0; display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); color: var(--ink-2); font-size: var(--text-sm); }
.trust-list li { display: inline-flex; align-items: center; gap: var(--s-2); }
.trust-list svg { width: 18px; height: 18px; color: var(--success); flex: none; }
.hero-covers { display: none; }
@media (min-width: 900px) {
  .hero-covers { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); transform: rotate(-4deg); }
  .hero-covers .cover { aspect-ratio: 2/3; border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow); background: var(--bg-2); }
  .hero-covers .cover:nth-child(3n+2) { transform: translateY(var(--s-6)); }
  .hero-covers img { width: 100%; height: 100%; object-fit: cover; }
}

.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* A single scrollable row of book cards */
.book-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(140px, 1fr); gap: var(--s-4);
  overflow-x: auto; scroll-snap-type: x mandatory; list-style: none; margin: 0 calc(-1 * var(--s-4)); padding: var(--s-1) var(--s-4) var(--s-4);
  scrollbar-width: thin; }
.book-row > li { scroll-snap-align: start; }
@media (min-width: 768px) { .book-row { grid-auto-columns: calc((100% - 5 * var(--s-4)) / 6); margin: 0; padding: var(--s-1) 0 var(--s-4); } }

.tile-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(2, minmax(0, 1fr)); list-style: none; padding: 0; margin: 0; }
@media (min-width: 700px) { .tile-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-4); min-height: 112px; padding: var(--s-4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink);
  transition: border-color .15s, box-shadow .15s; }
.tile:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); color: var(--ink); }
.tile strong { font: 700 var(--text-md)/1.25 var(--font-head); }
.tile span { font-size: var(--text-sm); color: var(--brand-ink); font-weight: 700; }
.tile .tile-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; }
.tile .tile-icon svg { width: 20px; height: 20px; }

.article-grid { display: grid; gap: var(--s-4); grid-template-columns: 1fr; list-style: none; margin: 0; padding: 0; }
@media (min-width: 768px) { .article-grid { grid-template-columns: repeat(3, 1fr); } }
.article-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; }
.article-card .thumb { aspect-ratio: 16/9; background: var(--bg-2); display: grid; place-items: center; overflow: hidden; }
.article-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.article-card .thumb-type { font: 700 var(--text-2xl)/1.1 var(--font-head); color: var(--brand-ink); text-align: center; padding: var(--s-4); background: var(--brand-soft); width: 100%; height: 100%; display: grid; place-items: center; }
.article-card .body { padding: var(--s-4) var(--s-5) var(--s-5); }
.article-card h3 { font-size: var(--text-lg); margin-bottom: var(--s-2); }
.article-card h3 a { color: var(--ink); text-decoration: none; }
.article-card h3 a::after { content: ""; position: absolute; inset: 0; }
.article-card p { color: var(--ink-2); margin: 0; font-size: var(--text-sm); }
.article-card:hover { box-shadow: var(--shadow); }

.value-strip { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 768px) { .value-strip { grid-template-columns: repeat(3, 1fr); } }
.value-strip > div { display: flex; gap: var(--s-3); align-items: flex-start; }
.value-strip svg { width: 28px; height: 28px; color: var(--brand-ink); flex: none; }
.value-strip h3 { font-size: var(--text-md); margin-bottom: var(--s-1); }
.value-strip p { margin: 0; color: var(--ink-2); font-size: var(--text-sm); }

/* Book page */
.book-page { display: grid; gap: var(--s-6); padding: var(--s-5) 0 var(--s-7); }
@media (min-width: 800px) { .book-page { grid-template-columns: minmax(240px, 360px) 1fr; gap: var(--s-7); align-items: start; } }
.book-cover { position: relative; }
@media (min-width: 800px) { .book-cover { position: sticky; top: calc(var(--header-h) + var(--s-7)); } }
.book-cover .cover { aspect-ratio: 2/3; border-radius: var(--radius); overflow: hidden; background: var(--bg-2); box-shadow: var(--shadow); max-width: 240px; margin: 0 auto; }
@media (min-width: 800px) { .book-cover .cover { max-width: 360px; } }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-info h1 { font-size: clamp(1.625rem, 1.3rem + 1.4vw, 2.25rem); margin-bottom: var(--s-2); }
.book-info .byline { font-size: var(--text-lg); color: var(--ink-2); margin-bottom: var(--s-4); }
.buy-box { margin: var(--s-5) 0; display: grid; gap: var(--s-3); }
.buy-box .price { font: 700 2rem/1 var(--font-head); margin: 0; }
.buy-box .delivery { display: flex; align-items: center; gap: var(--s-2); color: var(--ink-2); margin: 0; }
.buy-box .delivery svg { width: 20px; height: 20px; color: var(--success); flex: none; }
.buy-box .add-to-cart-btn { margin-top: var(--s-2); }
@media (min-width: 480px) { .buy-box .add-to-cart-btn { max-width: 320px; } }
.buy-box .secure { font-size: var(--text-sm); color: var(--ink-3); margin: 0; }
.book-section { margin-top: var(--s-6); }
.book-section h2 { font-size: var(--text-xl); }
.description { white-space: pre-line; color: var(--ink-2); max-width: 70ch; }
.tag-list { display: flex; flex-wrap: wrap; gap: var(--s-2); list-style: none; padding: 0; margin: 0; }

/* Cart and checkout */
.checkout-layout { display: grid; gap: var(--s-5); padding-bottom: var(--s-7); }
@media (min-width: 960px) { .checkout-layout { grid-template-columns: 1fr 380px; align-items: start; } .checkout-layout .summary { position: sticky; top: calc(var(--header-h) + var(--s-7)); } }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line { display: grid; grid-template-columns: 64px 1fr auto; gap: var(--s-3); padding: var(--s-4) 0; border-bottom: 1px solid var(--line); align-items: start; }
.cart-line img { width: 64px; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px; background: var(--bg-2); }
.cart-line .title { font-weight: 700; margin: 0; }
.cart-line .meta { font-size: var(--text-sm); color: var(--ink-3); margin: 0; }
.cart-line .line-price { font-weight: 700; text-align: right; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.actions-split { justify-content: space-between; }
.summary-row { display: flex; justify-content: space-between; gap: var(--s-4); padding: var(--s-2) 0; }
.summary-row.total { border-top: 2px solid var(--ink); margin-top: var(--s-2); padding-top: var(--s-3); font-weight: 700; font-size: var(--text-lg); }

/* Long-form text: about, FAQ, terms, privacy, articles */
.prose { max-width: 72ch; }
.prose h2 { margin-top: var(--s-6); }
.prose h3 { margin-top: var(--s-5); }
.prose li + li { margin-top: var(--s-2); }
.faq details { border-bottom: 1px solid var(--line); padding: var(--s-3) 0; }
.faq summary { font-weight: 700; cursor: pointer; min-height: 44px; display: flex; align-items: center; }

/* Result pages (payment success / cancelled) */
.result-card { margin-top: var(--s-6); text-align: center; }
.result-card .notice { text-align: left; }
.notice > p:last-child, .card > p:last-child { margin-bottom: 0; }

/* Articles: entries (book list items, shortlist) as quiet panels */
.article h1 { margin-bottom: var(--s-5); }
.article > div:not([class]):has(> h2), .article div:not([class]):has(> h3) {
  border-left: 3px solid var(--brand-line); padding: var(--s-1) 0 var(--s-1) var(--s-4); margin: var(--s-5) 0;
}
.article > div:not([class]):has(> h2) h2 { margin-top: 0; font-size: var(--text-xl); }
.article div:not([class]):has(> h3) h3 { margin: 0 0 var(--s-1); }
.article div:not([class]):has(> h3) p { margin-bottom: var(--s-2); }

/* Grouped settings and stacked cards */
fieldset.card { margin-bottom: var(--s-5); }
fieldset.card legend { float: left; width: 100%; margin-bottom: var(--s-4); }
fieldset.card legend + * { clear: both; }
.field select { max-width: 100%; }
.checkout-layout .form-grid p { margin: 0 0 var(--s-3); }
.card.prose { max-width: none; }
.prose > :first-child, .prose > :first-child > :first-child { margin-top: 0; }

/* Small utilities */
.mt-0 { margin-top: 0; } .mt-4 { margin-top: var(--s-4); } .mt-5 { margin-top: var(--s-5); } .m-0 { margin: 0; }
.text-center { text-align: center; }
.check-plain { font-weight: 400; }
.section-head-tight { margin-bottom: var(--s-3); }
.search-form-inline { max-width: 560px; }
