/* Bookshop — light, fast, mobile first */
:root {
  --bg: #f6efe3;
  --paper: #fffbf4;
  --ink: #2b1d14;
  --ink-2: #5b4636;
  --muted: #8a7461;
  --line: #e6d8c3;
  --gold: #a87a2a;
  --gold-2: #c99a3f;
  --ok: #2f7a4b;
  --bad: #a3362a;
  --wa: #1f8f4e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 29, 20, .06), 0 6px 18px rgba(43, 29, 20, .08);
  --serif: Georgia, "Times New Roman", "Noto Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); }
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
a { color: var(--gold); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: clamp(1.5rem, 5vw, 2.1rem); }
h2 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: 40px; min-height: 60vh; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.lead { font-size: 1.1rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; color: var(--gold); font-weight: 700; margin-bottom: .4em; }

/* header / footer */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--ink); color: #f6efe3; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; color: #f6efe3; text-decoration: none; font-family: var(--serif); font-size: 1.1rem; font-weight: 700; min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 430px) { .brand { font-size: .95rem; gap: 8px; } .top { padding: 10px 12px; } .top nav a { padding: 5px 9px; font-size: .85rem; } }
.top nav { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.top nav a { color: #f6efe3; text-decoration: none; font-size: .9rem; padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(246, 239, 227, .25); }
.top nav a.on, .top nav a:hover { background: rgba(246, 239, 227, .12); }
.foot { border-top: 1px solid var(--line); padding: 24px 0 32px; font-size: .9rem; color: var(--ink-2); text-align: center; }
.foot a { color: var(--ink-2); }
.pay-logos { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pay-logos span { font-weight: 700; font-size: .8rem; letter-spacing: .02em; padding: 4px 10px; border-radius: 6px; background: var(--paper); border: 1px solid var(--line); color: var(--ink-2); }
.demo-bar { background: var(--gold-2); color: var(--ink); text-align: center; font-size: .85rem; padding: 6px 12px; font-weight: 600; }

/* cards & buttons */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 18px; box-shadow: var(--shadow); margin: 0 0 20px; }
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.btn { display: inline-block; background: var(--ink); color: #fffbf4; text-decoration: none; border: 0; border-radius: 12px; padding: 12px 20px; font: 600 1rem var(--sans); cursor: pointer; text-align: center; }
.btn:hover { background: #3d2a1d; }
.btn.big { display: block; width: 100%; padding: 16px 20px; font-size: 1.1rem; }
.btn.wa { background: var(--wa); }
.btn.wa:hover { background: #18773f; }
.btn.light { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--bad); }
.btn.small { padding: 8px 12px; font-size: .9rem; }
.btn[disabled] { opacity: .6; cursor: wait; }
.error { background: #fbe9e6; color: var(--bad); border: 1px solid #f0c8c1; border-radius: 10px; padding: 10px 12px; }
.notice { background: #fff4dc; border: 1px solid #ecd6a4; border-radius: 10px; padding: 10px 12px; margin-bottom: 16px; font-size: .95rem; }
.flash { background: #e6f3ea; border: 1px solid #bcdcc6; color: var(--ok); border-radius: 10px; padding: 10px 12px; margin-bottom: 16px; }
.tip { background: #f3ead9; border-radius: 10px; padding: 12px 14px; font-size: .95rem; margin: 0 0 1em; }

/* home */
.hero { text-align: center; padding: 18px 0 8px; }
.hero h1 { max-width: 640px; margin: 0 auto .7em; }
.steps { list-style: none; padding: 0; margin: 0 auto 24px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 640px; }
.steps li { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px 6px 6px; font-size: .9rem; display: flex; align-items: center; gap: 8px; }
.steps b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: #fff; font-size: .8rem; }
.shelf { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; margin-bottom: 28px; }
@media (min-width: 640px) { .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; } }
.book { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 3px; }
.book img { aspect-ratio: 2 / 3; object-fit: cover; width: 100%; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,.15), 0 10px 22px rgba(43,29,20,.18); margin-bottom: 8px; transition: transform .15s; background: #e9dcc7; }
.book:hover img { transform: translateY(-3px); }
.book .t { font-family: var(--serif); font-weight: 700; line-height: 1.25; }
.book .s { font-size: .8rem; color: var(--muted); }
.book .p { font-weight: 700; color: var(--gold); }
.about p { color: var(--ink-2); }

/* book page */
.detail { display: grid; gap: 20px; margin-bottom: 20px; }
@media (min-width: 720px) { .detail { grid-template-columns: 280px 1fr; gap: 32px; align-items: start; } }
.cover-wrap { max-width: 240px; margin: 0 auto; }
@media (min-width: 720px) { .cover-wrap { max-width: none; } }
.cover { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,.18), 0 16px 32px rgba(43,29,20,.22); }
.by { color: var(--ink-2); margin-top: -.3em; }
.blurb { font-family: var(--serif); font-size: 1.15rem; font-style: italic; color: var(--ink-2); }
.desc summary { cursor: pointer; font-weight: 600; margin-bottom: .5em; }
.desc div { color: var(--ink-2); }
.buy { max-width: 560px; margin-left: auto; margin-right: auto; }
form label { display: block; font-weight: 600; margin: 0 0 14px; font-size: .95rem; }
input, textarea, select { display: block; width: 100%; margin-top: 6px; padding: 12px 12px; border: 1px solid #d9c7ad; border-radius: 10px; font: 16px var(--sans); background: #fff; color: var(--ink); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--gold-2); outline-offset: 1px; border-color: var(--gold-2); }
input[type=checkbox], input[type=radio] { display: inline-block; width: auto; margin: 0; }
.hint { display: block; font-weight: 400; color: var(--muted); margin-top: 4px; }
.hint.ok { color: var(--ok); font-weight: 600; }
.hint.bad { color: var(--bad); }
.formats { border: 0; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.fmt { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0; cursor: pointer; background: #fff; }
.fmt:has(input:checked) { border-color: var(--gold); background: #fff8ea; }
.fmt span { flex: 1; display: flex; flex-direction: column; }
.fmt small { font-weight: 400; color: var(--muted); }
.fmt em { font-style: normal; font-weight: 700; font-size: 1.1rem; }

/* pay / order */
.howto { padding-left: 1.2em; }
.howto li { margin-bottom: .6em; }
.copy { cursor: pointer; border-bottom: 1px dashed var(--gold); }
.big-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; margin: 0 auto 12px; background: #f6dcd6; color: var(--bad); }
.big-icon.ok { background: #dcefe2; color: var(--ok); }
.phone-anim { width: 64px; height: 104px; border: 4px solid var(--ink); border-radius: 14px; margin: 6px auto 18px; position: relative; }
.phone-anim span { position: absolute; inset: 30% 18%; border-radius: 6px; background: var(--gold-2); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .phone-anim span { animation: none; opacity: .7; } }
.status-line { font-weight: 600; color: var(--ink-2); }
.order-book { display: flex; gap: 14px; align-items: center; background: #f6efe3; border-radius: 12px; padding: 12px; margin: 0 0 18px; }
.order-book img { width: 60px; border-radius: 4px; box-shadow: var(--shadow); }
.timeline { list-style: none; padding: 0; margin: 10px 0 16px; }
.timeline li { padding: 6px 0 6px 28px; position: relative; color: var(--muted); }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 11px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); background: #fff; }
.timeline li.done { color: var(--ink); }
.timeline li.done::before { background: var(--ok); border-color: var(--ok); }
.timeline li.now { color: var(--ink); font-weight: 700; }
.timeline li.now::before { border-color: var(--gold); }

/* admin */
body.admin .top { background: #1d140e; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 1.4rem; font-family: var(--serif); }
.stat span { font-size: .8rem; color: var(--muted); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a { text-decoration: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); background: var(--paper); font-size: .9rem; }
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.rows { list-style: none; padding: 0; margin: 0; }
.rows li { border-bottom: 1px solid var(--line); }
.rows a.row { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 12px 4px; text-decoration: none; color: var(--ink); }
.rows .main { min-width: 0; }
.rows .main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .main small { color: var(--muted); }
.rows .side { text-align: right; flex-shrink: 0; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eee3d2; color: var(--ink-2); }
.badge.paid, .badge.delivered { background: #dcefe2; color: var(--ok); }
.badge.dispatched { background: #dbe7f5; color: #2b5d92; }
.badge.pending, .badge.awaiting { background: #fff1cf; color: #8a5a00; }
.badge.failed, .badge.cancelled { background: #f6dcd6; color: var(--bad); }
.badge.live { background: #dcefe2; color: var(--ok); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0 0 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.actions form { margin: 0; }
.grid2 { display: grid; gap: 0 16px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.search input { margin: 0; }
.thumb { width: 44px; aspect-ratio: 2/3; object-fit: cover; border-radius: 3px; flex-shrink: 0; background: #e9dcc7; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; }
fieldset.box { border: 1px solid var(--line); border-radius: 12px; padding: 14px 14px 4px; margin: 0 0 18px; }
fieldset.box legend { font-weight: 700; padding: 0 6px; font-family: var(--serif); }
code { background: #efe4d2; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.lead b, .howto b { white-space: nowrap; }

/* personalised books */
.promo { display: grid; gap: 16px; background: linear-gradient(135deg, #2b1d14, #4a3121); color: #f6efe3; border: 0; }
.promo h2, .promo .eyebrow { color: #f3d89c; }
.promo p { color: #eadfcd; }
.promo .muted { color: #cdbca3; }
.promo .btn { background: var(--gold-2); color: var(--ink); }
.promo .btn.light { background: transparent; color: #f6efe3; border: 1px solid rgba(246,239,227,.45); }
.promo-buttons { display: grid; gap: 10px; }
@media (min-width: 720px) { .promo { grid-template-columns: 1.4fr 1fr; align-items: center; padding: 28px; } }
.shelf-title { text-align: center; margin-top: 8px; }
.custom-hero { padding-bottom: 0; }
.custom-hero .lead { max-width: 620px; margin-left: auto; margin-right: auto; }
.custom-form { max-width: 680px; margin-left: auto; margin-right: auto; }
.custom-form h2 { font-size: 1.15rem; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.custom-form > h2:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
fieldset.section { border: 0; padding: 0; margin: 0; min-width: 0; }
.person { background: #f8f1e5; border-radius: 12px; padding: 12px 12px 2px; margin-bottom: 12px; }
.photo input[type=file] { padding: 10px; background: #fff; }
.preview { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; margin-top: 8px; box-shadow: var(--shadow); }
.total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.1rem; margin: 18px 0 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.total b { font-size: 1.4rem; font-family: var(--serif); }
.badge.making { background: #efe2ff; color: #5b3a8c; }
.photos { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 16px; }
.photos figure { margin: 0; width: 120px; }
.photos img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; box-shadow: var(--shadow); }
.photos figcaption { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.brief { white-space: pre-wrap; background: #f8f1e5; border-radius: 10px; padding: 12px; font-size: .9rem; }

.payway legend { font-weight: 700; margin-bottom: 8px; }
.shelf-block { margin-bottom: 12px; }
.chips { justify-content: center; margin-bottom: 18px; }
.book .tag { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--gold); }

/* Authors report */
.stat.owed b { color: var(--bad); }
.tablewrap { overflow-x: auto; margin: 0 -4px; }
table.report { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.report th, table.report td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.report td:not(:first-child), table.report thead th:not(:first-child) { text-align: right; white-space: nowrap; }
table.report thead th { font-size: .78rem; color: var(--muted); font-weight: 600; }
table.report tr.month th { background: #f8f1e5; font-family: var(--serif); }
.rows li.row-plain { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 10px 4px; }
.rows li.row-plain .main small { display: block; }

/* Terms page */
.terms h2 { margin-top: 1.6em; scroll-margin-top: 80px; }
.terms ul { padding-left: 1.2em; }
.terms li { margin-bottom: .45em; }
.toc { background: #f8f1e5; border-radius: 10px; padding: 10px 12px; line-height: 1.9; }
table.refunds { width: 100%; border-collapse: collapse; margin: 8px 0 12px; }
table.refunds th, table.refunds td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--line); }
table.refunds th { width: 32%; font-family: var(--serif); }
@media (max-width: 520px) {
  table.refunds, table.refunds tbody, table.refunds tr, table.refunds th, table.refunds td { display: block; width: auto; }
  table.refunds th { border-bottom: 0; padding-bottom: 0; }
}
