/* BookSagar — site.css
   Direction: a cosy bookshop café. Green awning, chalkboard menu, chai on the counter,
   cover-less books printed with little patterns. Shrikhand (retro café signage) for headlines,
   Bricolage Grotesque for reading, Caveat for pencil and chalk notes. */

@font-face { font-family: "Shrikhand"; src: url("fonts/shrikhand-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("fonts/caveat-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --cream:    #F8EFE0;
  --paper:    #FFFBF3;
  --espresso: #2B1B14;
  --chai:     #7A4A2B;
  --wood:     #A9703F;
  --green:    #1F5143;
  --green-dk: #143A30;
  --board:    #183E33;
  --pistachio:#E7EFD4;
  --blush:    #F6DDD2;
  --marigold: #F4B63F;
  --red:      #C2412D;
  --pencil:   #6E5B4B;
  --rule:     #E3D3BA;

  --display: "Shrikhand", "Georgia", serif;
  --font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hand: "Caveat", "Bradley Hand", cursive;

  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1180px;
  --r-pill: 999px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--espresso); background: var(--cream); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; border-radius: 4px; }
.board :focus-visible, .site-footer :focus-visible { outline-color: var(--marigold); }

.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--marigold); color: var(--espresso); padding: 10px 16px; border-radius: 4px; font-weight: 700; }
.skip:focus { top: 12px; }
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* ── Header ─────────────────────────────── */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--paper); border-bottom: 2px solid var(--espresso); }
.site-header .bar { display: grid; align-items: center; gap: 12px 24px; grid-template-columns: auto 1fr auto; padding-block: 10px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; justify-self: start; }
.wordmark .mark { width: 38px; height: 38px; flex: none; }
.wordmark span { font-family: var(--display); font-size: 26px; line-height: 1; letter-spacing: .005em; }
.search { position: relative; max-width: 460px; width: 100%; justify-self: center; }
.search input { width: 100%; height: 44px; padding: 0 16px 0 44px; border: 2px solid var(--espresso); border-radius: var(--r-pill); background: var(--cream); }
.search input::placeholder { color: var(--pencil); }
.search input:focus { outline: none; background: var(--paper); box-shadow: 0 0 0 3px var(--marigold); }
.search svg { position: absolute; left: 15px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--pencil); pointer-events: none; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { text-decoration: none; font-weight: 700; font-size: 15px; padding: 10px 14px; border-radius: var(--r-pill); }
.nav a:hover, .nav a.is-active { background: var(--blush); }
.nav .btn-login { background: var(--green); color: var(--paper); }
.nav .btn-login:hover { background: var(--green-dk); }
@media (max-width: 760px) {
  .site-header .bar { grid-template-columns: 1fr auto; }
  .search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .nav a.hide-sm { display: none; }
  .wordmark span { font-size: 23px; }
}

/* ── Buttons ────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 26px; cursor: pointer;
  border: 2px solid var(--espresso); border-radius: var(--r-pill); font-weight: 800; font-size: 16px; text-decoration: none;
  box-shadow: 0 4px 0 var(--espresso); transition: translate .12s ease, box-shadow .12s ease; }
.btn:hover { translate: 0 2px; box-shadow: 0 2px 0 var(--espresso); }
.btn:active { translate: 0 4px; box-shadow: 0 0 0 var(--espresso); }
.btn-marigold { background: var(--marigold); color: var(--espresso); }
.btn-green { background: var(--green); color: var(--paper); }
.btn-wide { width: 100%; }

/* ── Awning ─────────────────────────────── */
.awning { position: relative; height: 68px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='68'%3E%3Cpath fill='%231F5143' d='M0 0H44V44A22 22 0 0 1 0 44Z'/%3E%3Cpath fill='%23FFFBF3' d='M44 0H88V44A22 22 0 0 1 44 44Z'/%3E%3Cpath fill='none' stroke='%232B1B14' stroke-width='2.5' d='M44 44A22 22 0 0 1 0 44M88 44A22 22 0 0 1 44 44'/%3E%3C/svg%3E") repeat-x 0 0 / 88px 68px;
  filter: drop-shadow(0 7px 0 rgba(43,27,20,.14)); }
.awning::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 10px; background: var(--green-dk); }

/* ── Hero ───────────────────────────────── */
.hero { position: relative; overflow: hidden; background: var(--cream); }
.hero .grid { display: grid; gap: 24px 40px; align-items: center; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); padding-block: clamp(24px, 4vw, 48px) clamp(32px, 5vw, 64px); }
.hero .copy { position: relative; z-index: 1; }
.hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(44px, 6.6vw, 88px); line-height: 1.02; letter-spacing: .005em; text-shadow: 3px 4px 0 var(--marigold); max-width: 11ch; }
.hero .lede { margin-top: 22px; font-size: clamp(18px, 1.7vw, 21px); max-width: 38ch; color: var(--chai); font-weight: 500; }
.hero .actions { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; }
.text-link { font-weight: 700; text-underline-offset: 5px; text-decoration-thickness: 2px; text-decoration-color: var(--red); }
.hero .art { position: relative; }
.hero .art::before { content: ""; position: absolute; inset: 6% -6% 2% 6%; border-radius: 50%; background: var(--pistachio); z-index: 0; }
.hero .scene { position: relative; z-index: 1; width: 100%; max-width: 600px; margin-inline: auto; overflow: visible; }
.steam path { animation: steam 3.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center bottom; }
@keyframes steam { 0%, 100% { opacity: .15; translate: 0 4px; } 50% { opacity: .9; translate: 0 -4px; } }
@media (max-width: 900px) {
  .hero .grid { grid-template-columns: 1fr; }
  .hero .scene { max-width: 400px; }
}

/* ── Sections ───────────────────────────── */
.section { padding-block: clamp(48px, 7vw, 88px); }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 24px; margin-bottom: 30px; }
.section-head h2, .about h2, .swap h2 { font-family: var(--display); font-weight: 400; letter-spacing: .005em; }
.section-head h2 { font-size: clamp(32px, 4.2vw, 50px); line-height: 1.05; }
.section-head a { font-weight: 700; text-underline-offset: 5px; text-decoration-thickness: 2px; text-decoration-color: var(--red); }

/* ── Chalkboard menu ────────────────────── */
.menu-sec { padding-block: clamp(20px, 3vw, 40px) clamp(40px, 5vw, 64px); }
.board { position: relative; color: #F6F2E8; padding: clamp(24px, 4vw, 48px) clamp(22px, 5vw, 56px) clamp(28px, 4vw, 52px);
  background: radial-gradient(120% 90% at 20% 0%, #21493D 0%, var(--board) 60%);
  border: 14px solid var(--wood); border-radius: 10px;
  box-shadow: inset 0 0 0 3px rgba(0,0,0,.25), inset 0 10px 40px rgba(0,0,0,.35), 0 10px 0 var(--chai), 0 22px 30px -10px rgba(43,27,20,.35); }
.board h2 { font-family: var(--hand); font-weight: 600; font-size: clamp(42px, 6vw, 68px); line-height: 1; color: #FFFDF6; }
.board h2::after { content: ""; display: block; width: min(260px, 60%); height: 8px; margin-top: 8px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='8'%3E%3Cpath d='M0 4q7.5-5 15 0t15 0t15 0t15 0' fill='none' stroke='%23F4B63F' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x 0 0 / 60px 8px; }
.chalk-sub { font-family: var(--hand); font-size: 26px; color: #D9E6D6; margin-top: 10px; }
.chalk-cup { position: absolute; right: clamp(16px, 4vw, 48px); top: clamp(16px, 3vw, 36px); width: clamp(54px, 8vw, 92px); color: #F6F2E8; opacity: .9; rotate: 6deg; }
.menu { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px clamp(28px, 5vw, 64px); }
@media (max-width: 900px) { .menu { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .menu { grid-template-columns: 1fr; } .chalk-cup { display: none; } }
.menu a { display: flex; align-items: baseline; gap: 8px; padding: 9px 4px; text-decoration: none; font-family: var(--hand); font-size: 28px; line-height: 1.1; border-radius: 6px; }
.menu .dots { flex: 1; border-bottom: 2.5px dotted rgba(246,242,232,.45); translate: 0 -5px; min-width: 16px; }
.menu .n { color: var(--marigold); min-width: 1.2ch; text-align: right; }
.menu a:hover, .menu a:focus-visible { background: rgba(244,182,63,.16); }
.menu a:hover .name { text-decoration: underline; text-decoration-color: var(--marigold); text-decoration-thickness: 2.5px; text-underline-offset: 4px; }

/* ── Book cards ─────────────────────────── */
.fresh { background: var(--pistachio); border-block: 2px solid var(--espresso); }
.books { display: grid; gap: 40px 22px; grid-template-columns: repeat(4, minmax(0, 1fr)); list-style: none; margin: 0; padding: 0; }
@media (max-width: 960px) { .books { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .books { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 14px; } }

.card { position: relative; display: flex; flex-direction: column; gap: 12px; text-decoration: none; height: 100%; }
.cover { position: relative; z-index: 1; aspect-ratio: 2 / 3; width: 100%; background: var(--paper); border-radius: 3px 7px 7px 3px; overflow: hidden;
  box-shadow: inset 4px 0 0 rgba(0,0,0,.16), 0 2px 0 rgba(0,0,0,.2); transition: translate .18s ease; }
.card:hover .cover { translate: 0 -6px; }
.cover > img { width: 100%; height: 100%; object-fit: cover; }
.ledge { display: block; height: 11px; margin: -13px -7px 2px; border-radius: 2px; background: linear-gradient(#C98A55, #8A5A3B); box-shadow: 0 6px 6px -3px rgba(43,27,20,.35); }

.cover.gen { background: var(--bg); color: var(--fg); display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; padding: 0 16px 16px 22px; }
.cover.gen::after { content: ""; position: absolute; inset: 56% 0 0 0; background: var(--bg); z-index: 0; }
.cover.gen .motif { position: absolute; inset: 0 0 auto 0; width: 100%; height: 58%; opacity: .95; }
.cover.gen .t { position: relative; z-index: 1; font-family: var(--display); font-size: clamp(17px, 2vw, 24px); line-height: 1.06; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.cover.gen .a { position: relative; z-index: 1; font-size: 12.5px; font-weight: 700; opacity: .9; }
.cover.gen::before { content: ""; z-index: 2; position: absolute; inset: 10px 10px 10px 16px; border: 1.5px solid currentColor; opacity: .35; border-radius: 2px; pointer-events: none; }

.stamp { position: absolute; right: 8px; top: 8px; z-index: 3; font-size: 12px; font-weight: 800; line-height: 1; padding: 6px 8px; border-radius: 3px; background: var(--paper); border: 2px solid currentColor; rotate: 4deg; }
.stamp.used { color: var(--red); }
.stamp.new  { color: var(--green); }
.burst { position: absolute; left: 8px; top: 8px; z-index: 3; width: 54px; height: 54px; border-radius: 50%; background: var(--marigold); color: var(--espresso); rotate: -10deg;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; line-height: 1; border: 2px solid var(--espresso); }
.burst b { font-family: var(--display); font-weight: 400; font-size: 16px; letter-spacing: -.01em; }

.card .meta { display: flex; flex-direction: column; gap: 2px; }
.card .title { font-weight: 800; font-size: 17px; line-height: 1.2; letter-spacing: -0.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .author { font-size: 14px; color: var(--pencil); }
.price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; margin-top: auto; }
.price .now { font-family: var(--display); font-size: 24px; line-height: 1.1; }
.price .was { font-family: var(--hand); font-weight: 600; font-size: 23px; color: var(--pencil); text-decoration: line-through; text-decoration-thickness: 2px; line-height: 1; }

/* ── Swap ───────────────────────────────── */
.swap { background: var(--blush); }
.swap .grid { display: grid; gap: 40px 56px; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; }
.swap .scene { width: 100%; max-width: 560px; margin-inline: auto; }
@media (max-width: 900px) { .swap .grid { grid-template-columns: 1fr; } .swap .art { order: -1; } .swap .scene { max-width: 400px; margin-inline: auto; } }
.soon { font-family: var(--hand); font-size: 28px; color: var(--red); rotate: -2deg; display: inline-block; line-height: 1; margin-bottom: 6px; }
.swap h2 { font-size: clamp(32px, 4.4vw, 54px); line-height: 1.04; max-width: 15ch; }
.swap .lede { margin-top: 16px; font-size: 18px; color: var(--chai); font-weight: 500; max-width: 44ch; }
.steps { list-style: none; margin: 26px 0 30px; padding: 0; display: grid; gap: 14px; max-width: 460px; }
.steps li { display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: center; background: var(--paper); border: 2px solid var(--espresso); border-radius: 10px; padding: 12px 16px; box-shadow: 0 4px 0 var(--espresso); }
.steps li:nth-child(even) { rotate: .6deg; } .steps li:nth-child(odd) { rotate: -.5deg; }
.steps .n { font-family: var(--hand); font-size: 40px; line-height: 1; color: var(--red); text-align: center; }
.steps p { font-weight: 800; font-size: 17px; line-height: 1.25; }
.steps small { display: block; font-weight: 500; font-size: 14.5px; color: var(--pencil); margin-top: 2px; }

/* ── About / order slip ─────────────────── */
.about .grid { display: grid; gap: 36px 64px; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); align-items: center; }
@media (max-width: 900px) { .about .grid { grid-template-columns: 1fr; } }
.about h2 { font-size: clamp(30px, 3.6vw, 42px); line-height: 1.08; }
.about p { margin-top: 14px; max-width: 58ch; font-size: 17px; }
.slip { position: relative; background: var(--paper); padding: 26px 26px 34px; border: 2px solid var(--espresso); border-bottom: 0; rotate: 1deg; margin-bottom: 14px; }
.slip::after { content: ""; position: absolute; left: -2px; right: -2px; top: 100%; height: 14px;
  background: linear-gradient(-45deg, transparent 8px, var(--paper) 0) left top / 16px 14px, linear-gradient(45deg, transparent 8px, var(--paper) 0) left top / 16px 14px; }
.slip h3 { font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.15; }
.slip p { margin-top: 8px; font-size: 16px; color: var(--pencil); }
.slip a.mail { display: inline-block; margin-top: 14px; font-weight: 800; font-size: 18px; text-underline-offset: 5px; text-decoration-color: var(--red); text-decoration-thickness: 2px; }

/* ── Footer ─────────────────────────────── */
.site-footer { background: var(--espresso); color: #E7D6BE; padding-bottom: 40px; }
.site-footer .floor { height: 28px; margin-bottom: 36px; background: conic-gradient(var(--red) 25%, var(--cream) 0 50%, var(--red) 0 75%, var(--cream) 0) 0 0 / 28px 28px; }
.site-footer .row { display: flex; flex-wrap: wrap; gap: 20px 40px; justify-content: space-between; align-items: center; }
.site-footer .wordmark span { color: var(--paper); }
.site-footer .tagline { font-family: var(--hand); font-size: 24px; margin-top: 6px; color: var(--marigold); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 24px; font-weight: 600; }
.site-footer nav a { text-underline-offset: 4px; }
.site-footer small { display: block; margin-top: 28px; font-size: 14px; color: #B79F86; }

/* ── Catalog page ───────────────────────── */
.page { padding-block: clamp(28px, 4vw, 48px) clamp(56px, 7vw, 96px); }
.crumbs { font-size: 14px; color: var(--pencil); margin-bottom: 10px; }
.crumbs a { text-underline-offset: 3px; }
.page-title { font-family: var(--display); font-weight: 400; font-size: clamp(36px, 5vw, 60px); line-height: 1.05; text-shadow: 2px 3px 0 var(--marigold); }
.catalog { display: grid; gap: 28px 44px; grid-template-columns: 230px minmax(0, 1fr); margin-top: 32px; align-items: start; }
@media (max-width: 900px) { .catalog { grid-template-columns: 1fr; } }

.shelves { position: sticky; top: 96px; background: var(--board); color: #F6F2E8; border: 8px solid var(--wood); border-radius: 8px; padding: 14px 10px 16px; box-shadow: inset 0 6px 24px rgba(0,0,0,.35), 0 6px 0 var(--chai); }
.shelves h2 { font-family: var(--hand); font-size: 32px; font-weight: 600; line-height: 1; padding: 0 8px 8px; }
.shelves ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.shelves a { display: block; padding: 5px 8px; border-radius: 6px; text-decoration: none; font-family: var(--hand); font-size: 24px; line-height: 1.15; }
.shelves a:hover { background: rgba(244,182,63,.16); }
.shelves a[aria-current="page"] { background: var(--marigold); color: var(--espresso); }
@media (max-width: 900px) {
  .shelves { position: static; background: none; border: 0; box-shadow: none; padding: 0; color: inherit; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); overflow-x: auto; }
  .shelves h2 { display: none; }
  .shelves ul { flex-direction: row; gap: 8px; width: max-content; padding-bottom: 8px; }
  .shelves a { background: var(--paper); border: 2px solid var(--espresso); border-radius: var(--r-pill); white-space: nowrap; padding: 6px 16px; font-family: var(--font); font-weight: 700; font-size: 15px; }
  .shelves a[aria-current="page"] { background: var(--green); color: var(--paper); }
}

.toolbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { text-decoration: none; font-weight: 700; font-size: 15px; padding: 8px 16px; border-radius: var(--r-pill); background: var(--paper); border: 2px solid var(--espresso); }
.chip:hover { background: var(--blush); }
.chip[aria-current="true"] { background: var(--green); color: var(--paper); }
.sort { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--pencil); }
.sort select { height: 40px; border: 2px solid var(--espresso); border-radius: var(--r-pill); padding: 0 14px; background: var(--paper); font-weight: 700; }
.count { font-size: 15px; color: var(--pencil); margin-bottom: 20px; }

.empty { background: var(--paper); border: 2px dashed var(--chai); border-radius: 10px; padding: 48px 24px; text-align: center; }
.empty h2 { font-family: var(--display); font-weight: 400; font-size: 28px; }
.empty p { margin: 8px auto 20px; color: var(--pencil); max-width: 40ch; }

/* ── Book page ──────────────────────────── */
.book { display: grid; gap: 40px clamp(32px, 6vw, 80px); grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); margin-top: 28px; align-items: start; }
@media (max-width: 800px) { .book { grid-template-columns: 1fr; } }
.book .display { max-width: 380px; width: 100%; margin-inline: auto; }
.book h1 { font-family: var(--display); font-weight: 400; font-size: clamp(34px, 4.4vw, 52px); line-height: 1.05; }
.book .by { margin-top: 10px; font-size: 18px; color: var(--pencil); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tag { font-size: 14px; font-weight: 700; padding: 6px 12px; border-radius: var(--r-pill); background: var(--paper); border: 2px solid var(--espresso); text-decoration: none; }
.tag.used { color: var(--red); border-color: currentColor; }
.tag.new { color: var(--green); border-color: currentColor; }
.buybox { position: relative; margin-top: 28px; padding: 26px 26px 34px; background: var(--paper); border: 2px solid var(--espresso); border-bottom: 0; margin-bottom: 14px; }
.buybox::after { content: ""; position: absolute; left: -2px; right: -2px; top: 100%; height: 14px;
  background: linear-gradient(-45deg, transparent 8px, var(--paper) 0) left top / 16px 14px, linear-gradient(45deg, transparent 8px, var(--paper) 0) left top / 16px 14px; }
.buybox .price .now { font-size: 42px; }
.buybox .price .was { font-size: 30px; }
.buybox .save { margin-top: 4px; font-weight: 700; color: var(--green); font-size: 15px; }
.buybox .btn { margin-top: 20px; }
.buybox ul { list-style: none; margin: 20px 0 0; padding: 16px 0 0; border-top: 2px dashed var(--rule); display: grid; gap: 8px; font-size: 15px; color: var(--pencil); }
.about-book { margin-top: 30px; max-width: 60ch; font-size: 17px; }
.about-book h2 { font-family: var(--hand); font-weight: 600; font-size: 32px; line-height: 1; margin-bottom: 8px; color: var(--red); }
.related { margin-top: clamp(56px, 7vw, 88px); }

@media (max-width: 640px) { .ledge { margin-inline: -3px; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .steam path { animation: none; opacity: .7; }
  .cover, .btn { transition: none; }
}
