/* Urban Reads Bookstore storefront styles.
   Palette from Tia's retro logo: cream, red, green, gold, teal. Brown is a sparing accent only.
   Text colors are the darker variants so they pass contrast on cream. */

:root {
  --cream: #f6eade;
  --cream-2: #efe0cf;
  --paper: #fbf5ed;
  --red: #ea4236;      /* fills and accents only */
  --red-d: #bf2c22;    /* text and buttons (4.9:1 on cream, 5.8:1 with white text) */
  --green: #5aae7e;    /* fills only, always with dark ink text */
  --gold: #f6d24e;     /* fills only, always with dark ink text */
  --teal: #067e7e;     /* fills with white text (4.9:1) */
  --teal-d: #04625f;   /* text and links (6.1:1 on cream) */
  --brown: #724e12;    /* outline accent, used very sparingly */
  --ink: #251d16;      /* body text (14:1 on cream) */
  --muted: #5e4e3e;    /* secondary text (6.7:1 on cream) */
  --line: rgba(37, 29, 22, 0.22);
  --font-display: 'Shrikhand', 'Rockwell', Georgia, serif;
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --shadow: 3px 3px 0 var(--ink);
  --radius: 14px;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--cream);
  /* subtle halftone paper, CSS only */
  background-image: radial-gradient(rgba(37, 29, 22, 0.05) 1px, transparent 1.5px);
  background-size: 14px 14px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  overflow-x: hidden;
}

main { flex: 1 0 auto; outline: none; }

img { max-width: 100%; height: auto; }

[hidden] { display: none !important; }

a { color: var(--teal-d); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--red-d); }

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; overflow-wrap: anywhere; }
h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.5rem, 4.5vw, 2.1rem); }
p { margin: 0 0 1em; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.icon { display: inline-flex; line-height: 0; }

:focus-visible {
  outline: 3px solid var(--teal-d);
  outline-offset: 3px;
  border-radius: 4px;
}
.site-footer :focus-visible { outline-color: var(--gold); }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--cream);
  padding: 10px 16px; border-radius: 8px; font-weight: 700;
}
.skip-link:focus { top: 8px; color: var(--cream); }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 680px; }

/* retro layered stripe, echoes the logo's drop shadow */
.stripe {
  height: 12px;
  background: linear-gradient(var(--red) 0 25%, var(--gold) 25% 50%, var(--green) 50% 75%, var(--teal) 75% 100%);
}

/* ---------- header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--cream);
  min-height: 118px;
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 8px 16px 10px;
  display: grid;
  grid-template-columns: max-content 1fr;
  grid-template-areas: "brand actions" "search search";
  align-items: center;
  gap: 8px 12px;
}
.brand { grid-area: brand; display: inline-flex; flex: none; line-height: 0; border-radius: 8px; }
/* explicit width (logo is 360x233): a flexible or auto width let the nav squeeze the logo to a sliver */
.brand img { height: 52px; width: 80px; max-width: none; flex: none; display: block; object-fit: contain; }
.header-actions { grid-area: actions; justify-self: end; display: flex; align-items: center; gap: 6px; }

.cart-link, .menu-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px;
  font: inherit; font-weight: 700; line-height: 1.1;
  color: var(--ink); text-decoration: none;
  background: none; border: 0; border-radius: 999px; cursor: pointer;
}
.cart-link:hover { background: var(--cream-2); color: var(--ink); }
.cart-link[aria-current] { background: var(--ink); color: var(--cream); }
.cart-link[aria-current] .cart-count { background: var(--gold); color: var(--ink); }
.cart-count {
  min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red-d); color: #fff;
  font-size: 0.8rem; font-weight: 700; border-radius: 999px;
}
.cart-count[hidden] { display: none; }
.cart-label { display: none; }

/* hamburger */
.menu-toggle { background: var(--paper); border: 2px solid var(--ink); padding: 0 14px 0 12px; }
.menu-toggle:hover { background: var(--gold); }
.menu-bars { position: relative; display: inline-block; width: 20px; height: 16px; }
.menu-bars span {
  position: absolute; left: 0; right: 0; height: 3px; border-radius: 2px; background: currentColor;
  transition: transform 0.18s ease, opacity 0.18s ease, top 0.18s ease;
}
.menu-bars span:nth-child(1) { top: 0; }
.menu-bars span:nth-child(2) { top: 6.5px; }
.menu-bars span:nth-child(3) { top: 13px; }
.menu-toggle[aria-expanded="true"] .menu-bars span:nth-child(1) { top: 6.5px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-bars span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-bars span:nth-child(3) { top: 6.5px; transform: rotate(-45deg); }

.header-search {
  grid-area: search;
  display: flex; align-items: stretch;
  border: 2px solid var(--ink); border-radius: 999px;
  background: var(--paper); overflow: hidden;
}
.search-label { display: none; }
.header-search input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 1rem; padding: 10px 14px; min-height: 44px;
}
.header-search input:focus-visible { outline: none; }
.header-search:focus-within { outline: 3px solid var(--teal-d); outline-offset: 2px; }
.search-btn {
  border: 0; background: var(--teal); color: #fff; cursor: pointer;
  width: 52px; display: inline-flex; align-items: center; justify-content: center;
}
.search-btn:hover { background: var(--teal-d); }

/* main navigation: a dropdown panel under the header on phones and tablets */
.site-nav {
  display: none;
  position: absolute; left: 0; right: 0; top: 100%;
  padding: 4px 16px 16px;
  background: var(--cream);
  border-bottom: 3px solid var(--ink);
  box-shadow: 0 10px 0 rgba(37, 29, 22, 0.12);
  max-height: calc(100vh - 130px);
  max-height: calc(100dvh - 130px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.menu-open .site-nav { display: block; }
.nav-list { list-style: none; margin: 0 auto; padding: 0; max-width: 560px; }
.nav-link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-height: 54px; padding: 0 10px;
  font: inherit; font-size: 1.1rem; font-weight: 700; text-align: left;
  color: var(--ink); text-decoration: none;
  background: none; border: 0; border-bottom: 2px dashed var(--line); border-radius: 0; cursor: pointer;
}
.nav-link:hover { background: var(--cream-2); color: var(--ink); }
.nav-link[aria-current] { background: var(--cream-2); box-shadow: inset 6px 0 0 var(--teal); padding-left: 20px; }
.chev {
  flex: none; width: 10px; height: 10px; margin-right: 4px;
  border-right: 3px solid currentColor; border-bottom: 3px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.18s ease;
}
.nav-col-btn[aria-expanded="true"] .chev { transform: rotate(-135deg) translate(-2px, -2px); }

.collections-panel {
  margin: 8px 0 10px; padding: 8px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 14px;
  max-height: 46vh; overflow-y: auto;
}
.collections-all {
  display: flex; align-items: center; min-height: 44px; padding: 0 10px; margin-bottom: 4px;
  font-weight: 700; color: var(--red-d); border-radius: 8px;
}
.collections-all:hover { background: var(--cream-2); }
.collections-list { list-style: none; margin: 0; padding: 0; }
.collections-list a {
  display: flex; align-items: center; min-height: 42px; padding: 4px 10px;
  color: var(--ink); text-decoration: none; font-weight: 500; border-radius: 8px;
}
.collections-list a:hover { background: var(--cream-2); color: var(--ink); }
.collections-msg { padding: 10px; color: var(--muted); }

@media (min-width: 720px) {
  .site-header { min-height: 142px; }
  .header-inner {
    gap: 10px 20px; padding: 10px 20px 14px;
  }
  .brand img { height: 70px; width: 108px; }
  /* the search gets its own row under the menu bar, centred and wide */
  .header-search {
    justify-self: center; width: 100%; max-width: 780px;
    box-shadow: 3px 3px 0 var(--ink);
  }
  .header-search input { font-size: 1.05rem; padding: 10px 20px; min-height: 48px; }
  .search-btn { width: auto; padding: 0 24px; gap: 8px; font: inherit; font-weight: 700; }
  .search-label { display: inline; }
  .cart-label { display: inline; }
  .site-nav { padding: 4px 20px 18px; max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); }
}
@media (min-width: 800px) {
  .wrap { padding: 0 20px; }
}

/* full inline navigation on wide screens */
@media (min-width: 1040px) {
  .header-inner {
    position: relative;
    grid-template-columns: max-content 1fr auto;
    grid-template-areas: "brand nav actions" "search search search";
  }
  .menu-toggle { display: none; }
  .site-nav {
    display: block; position: static; grid-area: nav; justify-self: center;
    padding: 0; background: none; border: 0; box-shadow: none; max-height: none; overflow: visible;
  }
  .nav-list { display: flex; align-items: center; gap: 2px; margin: 0; max-width: none; }
  .nav-item { flex: none; }
  .nav-link {
    width: auto; min-height: 44px; padding: 0 12px; font-size: 1rem;
    border: 0; border-radius: 999px; white-space: nowrap;
  }
  .nav-link[aria-current] { background: var(--ink); color: var(--cream); box-shadow: none; padding-left: 12px; }
  .nav-link[aria-current]:hover { background: var(--ink); color: var(--cream); }
  .nav-collections { position: static; }
  .collections-panel {
    position: absolute; top: calc(100% + 16px); right: 20px; z-index: 60;
    width: min(700px, calc(100vw - 40px)); max-height: min(70vh, 470px);
    margin: 0; padding: 14px 16px 16px;
    border-width: 2.5px; border-radius: 16px; box-shadow: 5px 5px 0 var(--ink);
  }
  .collections-list { columns: 3; column-gap: 18px; }
  .collections-list li { break-inside: avoid; }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px;
  font: inherit; font-weight: 700; font-size: 1rem; line-height: 1.1; text-align: center;
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 999px;
  box-shadow: var(--shadow);
  text-decoration: none; cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); color: var(--ink); background: #fff; }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn-primary { background: var(--red-d); color: #fff; }
.btn-primary:hover { background: #a82219; color: #fff; }
.btn-teal { background: var(--teal); color: #fff; }
.btn-teal:hover { background: var(--teal-d); color: #fff; }
.btn-ghost { background: transparent; }
.btn-small { min-height: 38px; padding: 0 16px; font-size: 0.95rem; }
.btn-wide { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] {
  background: var(--cream-2); color: var(--muted);
  border-color: var(--muted); box-shadow: none; cursor: not-allowed; transform: none;
}
.link-btn {
  background: none; border: 0; padding: 8px 4px; min-height: 44px;
  font: inherit; font-weight: 700; color: var(--red-d);
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer;
}
.link-btn:hover { color: #7d1c15; }

/* ---------- hero ---------- */

.hero { position: relative; padding: 24px 0 32px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; right: -60px; top: -40px; width: 380px; height: 380px;
  background-image: radial-gradient(var(--red) 3px, transparent 3.5px);
  background-size: 18px 18px; opacity: 0.22;
  -webkit-mask-image: radial-gradient(circle at 70% 30%, #000 0 30%, transparent 70%);
  mask-image: radial-gradient(circle at 70% 30%, #000 0 30%, transparent 70%);
  pointer-events: none;
}
.hero-inner { position: relative; display: flex; flex-direction: column; gap: 16px; align-items: center; text-align: center; }
.hero-art { order: -1; width: min(300px, 80%); }
.hero-art img { display: block; width: 100%; filter: drop-shadow(0 6px 0 rgba(37, 29, 22, 0.12)); }
.hero-copy { width: 100%; max-width: 640px; container-type: inline-size; } /* width: containment gives 0 intrinsic width, so the centred stacked column collapsed on phones */
.eyebrow {
  display: inline-block; margin: 0 0 12px; padding: 4px 12px;
  background: var(--gold); color: var(--ink);
  font-weight: 700; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase;
  border: 2px solid var(--ink); border-radius: 999px;
}
.result-card h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.5rem, 11vw, 4.4rem); line-height: 1.05; margin-bottom: 0.35em;
  color: var(--ink);
  text-shadow: 2px 2px 0 var(--red), 4px 4px 0 var(--gold), 6px 6px 0 var(--green), 8px 8px 0 var(--teal);
}
/* Sized off the hero-copy column's own width (container query units), not the viewport, so
   "The city that reads." always fits on one line whether hero-copy is full width (mobile, stacked
   layout) or the narrower side-by-side column (desktop) - a plain vw-based size cannot tell those
   two cases apart. */
.hero h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.3rem, 7cqw, 4.4rem); line-height: 1.05; margin-bottom: 0.35em;
  color: var(--ink); white-space: nowrap;
  text-shadow: 2px 2px 0 var(--red), 4px 4px 0 var(--gold), 6px 6px 0 var(--green), 8px 8px 0 var(--teal);
}
.hashtag { font-weight: 700; color: var(--red); margin: 0 0 0.6em; font-size: 0.95rem; letter-spacing: 0.02em; }
.lede { font-size: 1.125rem; max-width: 46ch; margin-left: auto; margin-right: auto; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 8px; }

@media (min-width: 800px) {
  .hero { padding: 48px 0 56px; }
  .hero-inner { flex-direction: row; text-align: left; justify-content: space-between; gap: 40px; }
  .hero-art { order: 2; width: 46%; max-width: 520px; flex: none; }
  .hero-copy { flex: 1; }
  .lede { margin-left: 0; }
  .hero-actions { justify-content: flex-start; }
}

/* ---------- sections ---------- */

.section { padding: 28px 0 36px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { margin: 0; }
.more-link-group { display: flex; gap: 16px; flex-wrap: wrap; }
.more-link { font-weight: 700; }

.tiles { list-style: none; margin: 0; padding: 6px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tile-skel { aspect-ratio: 4 / 3; border-radius: 18px; background: var(--cream-2); }
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  aspect-ratio: 4 / 3; padding: 14px;
  border: 2.5px solid var(--brown); border-radius: 18px;
  text-decoration: none; overflow: hidden;
  box-shadow: 4px 4px 0 rgba(37, 29, 22, 0.85);
  transition: transform 0.15s ease;
}
.tile::before {
  content: ""; position: absolute; right: -20px; bottom: -20px; width: 120px; height: 120px;
  background-image: radial-gradient(currentColor 2px, transparent 2.5px); background-size: 11px 11px; opacity: 0.22;
  -webkit-mask-image: radial-gradient(circle, #000 0 40%, transparent 72%); mask-image: radial-gradient(circle, #000 0 40%, transparent 72%);
}
.tile-name { position: relative; font-family: var(--font-display); font-size: clamp(1.15rem, 4.8vw, 1.5rem); line-height: 1.1; overflow-wrap: anywhere; }
.tile-count {
  position: relative; align-self: flex-start;
  padding: 3px 12px 3px 10px; font-size: 0.8rem; font-weight: 700;
  background: var(--cream); color: var(--ink);
  border: 2px solid var(--ink);
  clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 50%, 100% 100%, 0 100%);
}
.tile-teal { background: var(--teal); color: #fff; }
.tile-gold { background: var(--gold); color: var(--ink); }
.tile-red { background: var(--red-d); color: #fff; }
.tile-green { background: var(--green); color: var(--ink); }
.tile:hover { color: inherit; transform: rotate(0deg) translateY(-3px) !important; }
.tilt-a { transform: rotate(-1.2deg); }
.tilt-b { transform: rotate(1.2deg); }
.tile:hover .tile-name { text-decoration: underline; text-decoration-thickness: 2px; }
.tile:focus-visible { outline-offset: 4px; border-radius: 18px; }

@media (min-width: 800px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
  .tile { padding: 18px; }
}

/* shelf of books */
.section-shelf { background: linear-gradient(transparent, rgba(6, 126, 126, 0.07) 40%, transparent); }
.shelf { position: relative; }
.shelf-row {
  list-style: none; margin: 0; padding: 8px 6px 22px;
  display: flex; gap: 18px; overflow-x: auto;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.shelf-row > li { flex: 0 0 150px; scroll-snap-align: start; min-width: 0; }
.shelf-row > .shelf-end { display: flex; align-items: center; justify-content: center; flex-basis: 170px; }
.plank {
  height: 14px; margin: -4px 0 0; border-radius: 4px;
  background: linear-gradient(var(--ink) 0 3px, var(--teal) 3px 100%);
  box-shadow: 0 6px 0 rgba(37, 29, 22, 0.12);
}
@media (min-width: 800px) { .shelf-row > li { flex-basis: 180px; } }

/* foundation strip */
.foundation {
  display: flex; flex-direction: column; gap: 16px; align-items: flex-start;
  padding: 24px; border: 2.5px solid var(--ink); border-radius: 18px;
  background: var(--gold); box-shadow: 5px 5px 0 var(--ink);
}
.foundation h2 { margin-bottom: 0.25em; }
.foundation p { margin: 0; max-width: 52ch; }
@media (min-width: 700px) {
  .foundation { flex-direction: row; align-items: center; justify-content: space-between; padding: 28px 32px; }
}

/* ---------- page heads ---------- */

.page-head { padding: 28px 0 16px; }
.page-head h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2rem, 7vw, 3.1rem); margin-bottom: 0.25em;
}
.page-head h1::after {
  content: ""; display: block; width: 110px; height: 12px; margin-top: 10px; border-radius: 3px;
  background: linear-gradient(90deg, var(--red) 0 25%, var(--gold) 25% 50%, var(--green) 50% 75%, var(--teal) 75%);
}
.page-head .sub { color: var(--muted); margin: 6px 0 0; }
.sub:empty { display: none; }

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

.shop-layout { display: grid; gap: 12px; padding-bottom: 48px; }
.filters { min-width: 0; }
.filter-select label { display: block; font-weight: 700; margin-bottom: 4px; }
.filter-select select {
  width: 100%; min-height: 46px; padding: 0 12px;
  font: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 12px;
}
.filter-list { display: none; }
.filter-list h2 { font-size: 1.1rem; font-family: var(--font-body); font-weight: 700; margin-bottom: 8px; }
.filter-list ul { list-style: none; margin: 0; padding: 0; }
.filter-list a {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  padding: 7px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 0.95rem;
}
.filter-list a:hover { background: var(--cream-2); }
.filter-list a[aria-current="page"] { background: var(--ink); color: var(--cream); font-weight: 700; }
.side-count { color: var(--muted); font-size: 0.85rem; flex: none; }
.filter-list a[aria-current="page"] .side-count { color: var(--cream); }
.result-count { color: var(--muted); font-weight: 500; margin: 8px 0 14px; min-height: 1.5em; }

.grid { list-style: none; margin: 0; padding: 4px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 16px; }
.more { display: flex; justify-content: center; padding: 28px 0 0; }

@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 20px; } }
@media (min-width: 900px) {
  .shop-layout { grid-template-columns: 250px minmax(0, 1fr); gap: 32px; }
  .filter-select { display: none; }
  .filter-list { display: block; position: sticky; top: 108px; max-height: calc(100vh - 128px); overflow-y: auto; padding-right: 6px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

/* ---------- book cards ---------- */

.card { position: relative; min-width: 0; display: flex; flex-direction: column; }
.cover {
  position: relative; width: 100%; aspect-ratio: 2 / 3;
  background: var(--paper);
  border: 1px solid var(--line); border-radius: 6px 10px 10px 6px;
  box-shadow: 4px 4px 0 rgba(37, 29, 22, 0.2);
  overflow: hidden;
}
.cover img { width: 100%; height: 100%; object-fit: contain; display: block; position: relative; }
.cover img.cover-bg {
  position: absolute; inset: 0; object-fit: cover; display: block;
  filter: blur(16px) brightness(0.92); transform: scale(1.18);
}
.cover.is-missing img.cover-bg { display: none; }
.cover-ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 10px 26px; text-align: center; color: var(--ink);
  background:
    linear-gradient(var(--red) 0 25%, var(--gold) 25% 50%, var(--green) 50% 75%, var(--teal) 75%) bottom / 100% 20px no-repeat,
    radial-gradient(rgba(37, 29, 22, 0.08) 1.5px, transparent 2px) 0 0 / 12px 12px,
    var(--cream-2);
}
.cover-ph-mark { color: var(--teal-d); }
.cover-ph-title {
  font-family: var(--font-display); font-size: 0.95rem; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.card-title { font-size: 1rem; font-weight: 700; font-family: var(--font-body); margin: 12px 0 2px; line-height: 1.3; }
.card-title a {
  color: var(--ink); text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-title a::after { content: ""; position: absolute; inset: 0; } /* whole card is the link */
.card:hover .card-title a { text-decoration: underline; text-decoration-thickness: 2px; color: var(--red-d); }
.card:hover .cover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 rgba(37, 29, 22, 0.28); }
.cover { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.card-title a:focus-visible { outline: none; }
.card:focus-within .cover { outline: 3px solid var(--teal-d); outline-offset: 3px; }
.card-author { color: var(--muted); font-size: 0.9rem; margin: 0 0 2px; }
.card-price { font-weight: 700; margin: 2px 0 6px; font-size: 1.05rem; }
.badges { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  padding: 2px 9px; font-size: 0.75rem; font-weight: 700; line-height: 1.5;
  background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 999px;
}
.badge-out { background: var(--ink); color: var(--cream); }
.badge-pre { background: var(--gold); }
.card.is-out .cover { filter: grayscale(0.85); opacity: 0.7; }
.card.is-out .card-price { color: var(--muted); }

.card-skel .cover { box-shadow: none; }
.skel-line { height: 12px; border-radius: 6px; background: var(--cream-2); margin-top: 12px; }
.skel-line.short { width: 55%; }
.card-skel .cover, .skel-line, .tile-skel { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }

.empty { grid-column: 1 / -1; padding: 24px 0; }

/* ---------- notices ---------- */

.notice {
  padding: 16px 18px; margin: 0 0 16px;
  background: var(--paper); border: 2px solid var(--ink); border-left-width: 8px; border-left-color: var(--teal);
  border-radius: 10px;
}
.notice p:last-child { margin-bottom: 0; }
.notice h1 { font-family: var(--font-display); font-weight: 400; font-size: 1.8rem; }
.notice-error { border-left-color: var(--red-d); }
.notice-info { border-left-color: var(--gold); background: #fff8dc; }
.notice-error .btn { margin-top: 10px; }
.loading { padding: 40px 0; color: var(--muted); }
.placeholder {
  display: inline; font-style: italic; color: var(--ink);
  background: rgba(246, 210, 78, 0.5); padding: 0 4px; border-radius: 3px;
}
.site-footer .placeholder { background: transparent; color: var(--gold); }

/* ---------- book page ---------- */

.crumbs { padding: 18px 0 8px; font-size: 0.95rem; }
.crumbs a { font-weight: 700; }
.book { display: grid; gap: 24px; padding-bottom: 56px; }
.book-media { width: min(280px, 72%); margin: 8px auto 0; }
.book-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.8rem, 6.5vw, 2.8rem); margin-bottom: 0.2em; }
.book-author { color: var(--muted); font-size: 1.1rem; margin-bottom: 16px; }
.cover-book { box-shadow: 6px 6px 0 rgba(37, 29, 22, 0.25); }

.buy-box {
  padding: 18px; margin: 12px 0 28px;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 18px; box-shadow: 5px 5px 0 var(--ink);
}
.format-picker { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
.format-picker legend { font-weight: 700; padding: 0; margin-bottom: 8px; }
.format-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.format-opt { position: relative; }
.format-opt input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.format-opt label {
  display: flex; flex-direction: column; gap: 2px; height: 100%;
  padding: 10px 12px; background: var(--cream); border: 2px solid var(--ink); border-radius: 12px;
}
.format-opt input:checked + label { background: var(--gold); box-shadow: 3px 3px 0 var(--ink); }
.format-opt input:focus-visible + label { outline: 3px solid var(--teal-d); outline-offset: 3px; }
.format-opt input:disabled { cursor: not-allowed; }
.format-opt.is-out label { border-style: dashed; color: var(--muted); background: var(--cream-2); }
.format-name { font-weight: 700; }
.format-extra { font-size: 0.85rem; color: var(--muted); }
.format-price { font-size: 1.15rem; font-weight: 700; }
.format-note { font-size: 0.8rem; font-weight: 700; }
.price-row { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.book-price { margin: 0; font-size: 2rem; font-weight: 700; line-height: 1.1; }
.book-stock { margin: 0; font-weight: 700; font-size: 0.9rem; }
.book-stock.is-in { color: var(--teal-d); }
.book-stock.is-pre { color: var(--ink); }
.book-stock.is-out { color: var(--red-d); }
.buy-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.buy-row .btn { flex: 1 1 200px; width: auto; }
.add-status { margin-top: 12px; font-weight: 500; min-height: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.add-status:empty { display: none; }
.add-status .icon { color: var(--teal-d); }

.qty { display: inline-flex; align-items: center; gap: 0; }
.qty-label { font-weight: 700; margin-right: 10px; }
.qty-btn, .qty-input {
  height: 44px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  font: inherit; font-weight: 700; text-align: center;
}
.qty-btn { width: 44px; cursor: pointer; font-size: 1.3rem; line-height: 1; padding: 0; }
.qty-btn:first-of-type, .qty > .qty-btn:first-child { border-radius: 999px 0 0 999px; }
.qty-btn:last-child { border-radius: 0 999px 999px 0; }
.qty-btn:hover { background: var(--gold); }
.qty-input { width: 56px; border-left: 0; border-right: 0; border-radius: 0; -moz-appearance: textfield; appearance: textfield; padding: 0; }
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.book-desc h2, .book-cols h2 { font-size: 1.4rem; }
.book-desc p { max-width: 68ch; overflow-wrap: anywhere; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px;
  background: var(--paper); color: var(--ink); font-weight: 700; text-decoration: none;
  border: 2px solid var(--ink); border-radius: 999px;
}
.chip:hover { background: var(--teal); color: #fff; }
.book-cols { margin-top: 28px; }

@media (min-width: 800px) {
  .book { grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 56px; align-items: start; }
  .book-media { width: 100%; margin: 8px 0 0; position: sticky; top: 112px; }
  .buy-box { max-width: 560px; }
}

/* ---------- cart ---------- */

.cart-layout { display: grid; gap: 28px; padding-bottom: 56px; }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line {
  display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 14px; align-items: start;
  padding: 18px 0; border-bottom: 2px dashed var(--line);
}
.cart-line:first-child { border-top: 2px dashed var(--line); }
.cover-cart { box-shadow: 3px 3px 0 rgba(37, 29, 22, 0.2); }
.cart-line-title { font-family: var(--font-body); font-weight: 700; font-size: 1.05rem; margin: 0 0 2px; }
.cart-line-title a { color: var(--ink); }
.cart-line-format { margin: 0; font-size: 0.9rem; color: var(--muted); font-weight: 500; }
.cart-line-unit { margin: 0 0 8px; font-size: 0.9rem; color: var(--muted); }
.cart-line-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.cart-line-total { margin: 0; font-weight: 700; font-size: 1.1rem; text-align: right; }
#cart-title:focus { outline: none; }
.cart-summary {
  padding: 20px; align-self: start;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 18px; box-shadow: 5px 5px 0 var(--ink);
}
.cart-summary h2 { font-size: 1.4rem; }
.summary-rows { margin: 0 0 16px; }
.summary-rows > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.summary-rows dt { font-weight: 500; }
.summary-rows dd { margin: 0; font-weight: 700; text-align: right; }
.summary-rows dd.later { font-weight: 500; color: var(--muted); }
.placeholder-box { font-size: 0.9rem; padding: 10px 12px; background: var(--cream); border: 2px dashed var(--muted); border-radius: 10px; }
.checkout-error { margin-top: 12px; }
.checkout-error .notice { margin: 0; }
.continue { display: block; text-align: center; margin-top: 14px; font-weight: 700; }
.cart-empty { max-width: 520px; }

@media (min-width: 900px) {
  .cart-layout { grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; }
  .cart-summary { position: sticky; top: 112px; }
  .cart-line { grid-template-columns: 96px minmax(0, 1fr) auto; }
}

/* ---------- result pages ---------- */

.result-card {
  margin: 36px 0 64px; padding: 28px 24px;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 20px; box-shadow: 6px 6px 0 var(--ink);
  text-align: center;
}
.result-card .lede { margin-left: auto; margin-right: auto; }
.result-card .hero-actions { justify-content: center; }
.result-card h1 { font-size: clamp(2.2rem, 9vw, 3.4rem); }

/* ---------- footer ---------- */

.site-footer { margin-top: 24px; background: var(--teal-d); color: var(--cream); }
.site-footer a { color: var(--cream); }
.site-footer a:hover { color: var(--gold); }
.footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 32px 16px 12px;
  display: grid; grid-template-columns: 1fr; gap: 28px;
}
.footer-col { min-width: 0; }
.footer-col h2 {
  font-family: var(--font-body); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 10px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { padding: 1px 0; overflow-wrap: anywhere; }
.footer-col li a, .footer-col address a { display: inline-block; padding: 5px 0; }
.footer-col p { margin: 8px 0 0; }
.footer-col address { font-style: normal; margin: 0 0 4px; }
.footer-brand img { display: block; width: 130px; height: auto; }
.footer-tag { font-family: var(--font-display); font-size: 1.25rem; line-height: 1.2; color: var(--cream); }
.footer-social { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; }
.footer-legal { max-width: 1200px; margin: 0 auto; padding: 16px 16px 28px; font-size: 0.85rem; color: var(--cream); opacity: 0.9; }
/* newsletter signup (footer, and reusable elsewhere through mountNewsletter) */
.footer-news { grid-column: 1 / -1; padding-bottom: 24px; border-bottom: 2px dashed rgba(246, 234, 222, 0.4); }
.newsletter > * { max-width: 600px; }
.news-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.4rem, 5.5vw, 1.9rem); line-height: 1.15; margin: 0 0 10px;
}
.site-footer .news-title { color: var(--gold); }
.news-label { display: block; font-weight: 700; margin-bottom: 6px; }
.news-row { display: flex; flex-direction: column; gap: 10px; }
.news-input {
  width: 100%; min-height: 48px; padding: 0 16px;
  font: inherit; font-size: 1rem; color: var(--ink); background: #fff;
  border: 2px solid var(--ink); border-radius: 999px;
}
.news-input[aria-invalid="true"] { border-color: var(--red-d); background: #fff4f2; }
.news-btn { background: var(--gold); color: var(--ink); width: 100%; }
.news-btn:hover { background: #ffe27a; color: var(--ink); }
.site-footer .news-btn { box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.45); }
.news-trap { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.news-consent { margin: 10px 0 0; font-size: 0.85rem; line-height: 1.45; }
.news-msg { margin: 0; }
.news-msg:empty { display: none; }
.news-msg.is-ok, .news-msg.is-err {
  margin-top: 12px; padding: 10px 14px; font-weight: 500;
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-left-width: 8px; border-radius: 10px;
}
.news-msg.is-ok { border-left-color: var(--green); }
.news-msg.is-err { border-left-color: var(--red-d); }
@media (min-width: 480px) {
  .news-row { flex-direction: row; align-items: stretch; }
  .news-btn { width: auto; flex: none; min-width: 130px; }
}

/* ---------- subscribe popup ---------- */
.subscribe-dialog {
  width: min(460px, calc(100vw - 32px)); max-width: 460px; padding: 0; margin: auto;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 20px;
  box-shadow: 8px 8px 0 rgba(37, 29, 22, 0.3);
}
.subscribe-dialog::backdrop { background: rgba(37, 29, 22, 0.55); }
.subscribe-dialog-body { padding: 32px 28px 28px; }
.subscribe-dialog-kick {
  display: inline-block; margin: 0 0 10px; padding: 4px 14px; font-weight: 700; font-size: 0.78rem;
  letter-spacing: 0.08em; text-transform: uppercase; color: #fff; background: var(--teal);
  border: 2px solid var(--ink); border-radius: 999px;
}
.subscribe-dialog .news-title { color: var(--ink); }
.subscribe-dialog-close {
  position: absolute; top: 10px; right: 10px; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; line-height: 1; color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 50%; cursor: pointer;
}
.subscribe-dialog-close:hover { background: var(--cream-2); }

@media (min-width: 560px) {
  .footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
}
@media (min-width: 700px) {
  .footer-inner { padding: 40px 20px 12px; }
  .footer-legal { padding: 16px 20px 28px; }
}
@media (min-width: 1000px) {
  .footer-inner { grid-template-columns: 1.1fr 1fr 1.35fr 1fr 1fr; gap: 32px; }
  .footer-brand { grid-column: auto; }
}

/* ---------- information pages (about, contact, policies, FAQ) ---------- */

.page-head .lede-line { font-size: 1.15rem; max-width: 60ch; margin: 10px 0 0; color: var(--ink); }

.prose { max-width: 68ch; padding-bottom: 40px; font-size: 1.0625rem; line-height: 1.7; }
.prose > :last-child { margin-bottom: 0; }
.prose h2 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.4rem, 4.2vw, 1.8rem); line-height: 1.2;
  margin: 2em 0 0.5em;
}
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-family: var(--font-body); font-weight: 700; font-size: 1.15rem; line-height: 1.3; margin: 1.6em 0 0.35em; }
.prose p { margin: 0 0 1.1em; overflow-wrap: anywhere; }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.prose li { margin: 0 0 0.5em; padding-left: 0.2em; overflow-wrap: anywhere; }
.prose li::marker { color: var(--red-d); font-weight: 700; }
.prose .lead { font-size: 1.25rem; line-height: 1.55; }
.prose .notice { font-size: 1rem; line-height: 1.6; }
.prose .notice strong { font-weight: 700; }
.prose hr { border: 0; border-top: 2px dashed var(--line); margin: 2em 0; }
.prose :target, .prose h2[id], .prose h3[id] { scroll-margin-top: 140px; }

.toc {
  max-width: 68ch; margin: 0 0 28px; padding: 14px 18px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 12px;
}
.toc h2 {
  font-family: var(--font-body); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--teal-d); margin: 0 0 6px;
}
.toc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0 24px; }
.toc a { display: inline-block; padding: 5px 0; font-weight: 500; }
@media (min-width: 640px) { .toc ul { grid-template-columns: 1fr 1fr; } }

/* about */
.about-layout { display: grid; gap: 28px; align-items: start; }
.about-art {
  margin: 0; padding: 14px; text-align: center;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 18px; box-shadow: 5px 5px 0 var(--ink);
}
.about-art img { display: block; width: min(300px, 100%); margin: 0 auto; }
.about-art figcaption { margin-top: 8px; font-size: 0.9rem; color: var(--muted); }
@media (min-width: 900px) {
  .about-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 56px; }
  .about-art { position: sticky; top: 130px; }
}
.link-list { list-style: none; padding: 0 !important; }
.link-list li { padding-left: 0; }
.link-list a { font-weight: 700; }

/* contact */
.contact-grid { list-style: none; margin: 0 0 32px; padding: 0; display: grid; gap: 18px; grid-template-columns: 1fr; max-width: 820px; }
.contact-card {
  padding: 16px 18px 18px; background: var(--paper);
  border: 2.5px solid var(--ink); border-top-width: 12px; border-radius: 18px; box-shadow: 4px 4px 0 var(--ink);
}
.contact-card:nth-child(1) { border-top-color: var(--red); }
.contact-card:nth-child(2) { border-top-color: var(--gold); }
.contact-card:nth-child(3) { border-top-color: var(--green); }
.contact-card:nth-child(4) { border-top-color: var(--teal); }
.contact-card h2 {
  font-family: var(--font-body); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--teal-d); margin: 0 0 6px;
}
.contact-card p { margin: 0 0 4px; font-size: 1.2rem; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.contact-card p.small { font-size: 0.95rem; font-weight: 500; color: var(--muted); }
.contact-card a { text-underline-offset: 3px; }
@media (min-width: 640px) { .contact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* FAQ accordion */
.faq { max-width: 760px; margin: 20px 0 28px; }
.faq details {
  margin: 0 0 14px; background: var(--paper);
  border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: 3px 3px 0 var(--ink);
}
.faq summary {
  position: relative; display: block; cursor: pointer; list-style: none;
  min-height: 56px; padding: 14px 54px 14px 16px;
  font-weight: 700; font-size: 1.05rem; line-height: 1.35; border-radius: 11px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::marker { content: ""; }
.faq summary::after {
  content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  font-size: 1.7rem; font-weight: 700; line-height: 1; color: var(--red-d);
}
.faq details[open] > summary::after { content: "\2212"; }
.faq summary:hover { background: var(--cream-2); }
.faq details[open] > summary { background: var(--gold); border-radius: 11px 11px 0 0; border-bottom: 2px solid var(--ink); }
.faq summary:focus-visible { outline-offset: 2px; border-radius: 11px; }
.faq-answer { padding: 14px 16px 6px; line-height: 1.65; }
.faq-answer p, .faq-answer ul, .faq-answer ol { margin: 0 0 1em; }
.faq-answer ul, .faq-answer ol { padding-left: 1.3em; }
.faq-answer li { margin-bottom: 0.4em; }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .tile:hover { transform: none !important; }
}

/* series strip on the book page */
.book-series { margin-top: 28px; }
.book-series h2 { font-size: 1.1rem; margin: 0 0 12px; }
.series-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 14px; }
.series-list li { width: 112px; }
.series-item { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; font-size: 0.85rem; line-height: 1.25; }
.series-item .cover { width: 100%; aspect-ratio: 2 / 3; }
.series-list .is-here .series-item { border: 2px solid #ea4236; border-radius: 8px; padding: 8px; background: #fff7ee; }
.series-note { font-size: 0.75rem; color: #724e12; }
a.series-item:hover .series-title, a.series-item:focus-visible .series-title { text-decoration: underline; }

/* product details on the book page */
.book-details { margin-top: 24px; }
.book-details h2 { font-size: 1.1rem; margin: 0 0 10px; }
.details-list { margin: 0; border-top: 1px solid rgba(114, 78, 18, 0.25); }
.details-row { display: flex; gap: 16px; padding: 8px 0; border-bottom: 1px solid rgba(114, 78, 18, 0.25); font-size: 0.95rem; }
.details-row dt { flex: 0 0 9.5em; font-weight: 700; }
.details-row dd { margin: 0; overflow-wrap: anywhere; }

/* subcategories in the shop menu */
.filter-list li.side-sub { padding-left: 16px; }
.filter-list li.side-sub a { font-size: 0.92em; }

/* Gift card box in the cart summary */
.gift-box { margin: 0 0 14px; }
.gift-label { display: block; font-weight: 700; margin-bottom: 6px; }
.gift-row { display: flex; gap: 8px; }
.gift-input { flex: 1 1 auto; min-width: 0; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 10px; font: inherit; background: #fff; text-transform: uppercase; }
.gift-msg:empty { display: none; }
.gift-msg .notice { margin: 8px 0 0; }
