:root {
  --ink: #1d2433; --soft: #5b6475; --line: #d9dde5; --tint: #f3f5f8; --paper: #fff;
  --wine: #7a1f3d; --wine-dark: #5d142c; --green: #1d6b45; --red: #a3231f; --red-tint: #fdf0ef;
  --title: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 1rem/1.55 system-ui, "Segoe UI", sans-serif; }
a { color: var(--wine); }
h1, h2 { font-family: var(--title); line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.9rem; margin: 0 0 1.25rem; }
h2 { font-size: 1.25rem; margin: 2rem 0 .75rem; }
small { color: var(--soft); font-size: .85rem; font-weight: normal; }
:focus-visible { outline: 3px solid #6f9cde; outline-offset: 2px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: .5rem; }

.top { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; padding: 1rem max(1rem, calc((100% - 70rem) / 2)); border-bottom: 1px solid var(--line); }
.logo { font: 700 1.6rem/1 var(--title); text-decoration: none; }
.search { flex: 1 1 16rem; display: flex; }
.search input { flex: 1; min-width: 0; border-radius: .3rem 0 0 .3rem; border-right: 0; }
.search button { border-radius: 0 .3rem .3rem 0; }
.basket { font-weight: 600; text-decoration: none; }
.basket span { background: var(--wine); color: #fff; border-radius: 1rem; padding: .1rem .5rem; font-size: .85rem; }
main { max-width: 72rem; margin: 0 auto; padding: 2rem 1rem 4rem; }
footer { border-top: 1px solid var(--line); background: var(--tint); padding: 1.5rem max(1rem, calc((100% - 70rem) / 2)); display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; font-size: .95rem; }
footer nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
footer p { margin: 0; }

input, select, textarea { font: inherit; color: inherit; background: var(--paper); border: 1px solid #8d96a6; border-radius: .3rem; padding: .5rem .6rem; max-width: 100%; }
input[type=radio], input[type=checkbox] { accent-color: var(--wine); width: 1.1rem; height: 1.1rem; }
input[type=number] { width: 5.5rem; }
button, .button { display: inline-block; font: 600 1rem/1.3 system-ui, "Segoe UI", sans-serif; color: #fff; background: var(--wine); border: 1px solid var(--wine); border-radius: .3rem; padding: .55rem 1rem; text-decoration: none; cursor: pointer; }
button:hover, .button:hover { background: var(--wine-dark); }
button:disabled { opacity: .45; cursor: default; }
.quiet { color: var(--wine); background: var(--paper); }
.quiet:hover { color: #fff; }
.link { color: var(--wine); background: none; border: 0; padding: .3rem 0; font-weight: normal; text-decoration: underline; }
.link:hover { background: none; color: var(--wine-dark); }
.problem { color: var(--red); background: var(--red-tint); border-radius: .3rem; padding: .5rem .8rem; }
.problem p, .done { margin: .2rem 0; }
.done { color: var(--green); background: #eef7f2; border-radius: .3rem; padding: .5rem .8rem; margin-bottom: 1rem; overflow-wrap: anywhere; }

.shelves { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.shelves a { background: var(--tint); border-radius: .3rem; padding: .35rem .8rem; text-decoration: none; }
.shelves a:hover { background: var(--line); }
.path { margin: 0 0 .25rem; color: var(--soft); }
nav.path { margin-bottom: 1.25rem; }
.books { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 2rem 1.5rem; }
.books li { display: flex; flex-direction: column; }
.books a { color: inherit; text-decoration: none; }
.books a:hover strong { text-decoration: underline; }
.books strong { display: block; font-family: var(--title); line-height: 1.25; margin-top: .6rem; }
.books .cover { display: flex; align-items: flex-end; height: 14rem; }
.cover img { max-width: 100%; max-height: 100%; box-shadow: 0 1px 5px rgb(29 36 51 / .3); }
.blank { display: grid; place-items: center; width: 9.2rem; height: 100%; max-height: 14rem; padding: 1rem; background: var(--tint); border: 1px solid var(--line); color: var(--soft); font-family: var(--title); text-align: center; overflow: hidden; }
.authors { color: var(--soft); font-size: .92rem; }
.books .authors { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.price { font-weight: 700; }
.stock { font-size: .92rem; color: var(--soft); }
.stock.here { color: var(--green); }
.stock.none { color: var(--red); }
.pages { display: flex; gap: 1.5rem; margin-top: 2.5rem; }

.book { display: grid; grid-template-columns: minmax(10rem, 19rem) 1fr; gap: 2.5rem; align-items: start; }
.book h1 { margin-bottom: .25rem; }
.book .price { font-size: 1.6rem; margin: 1rem 0 0; }
.book .stock { font-size: 1rem; margin: 0 0 1rem; }
.book .blank { height: 14rem; }
.text { max-width: 42rem; }
.text blockquote { margin: 0; padding: .5rem 1.25rem; background: var(--tint); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1.25rem; }
dt { color: var(--soft); }
dd { margin: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; vertical-align: top; padding: .6rem .75rem .6rem 0; border-bottom: 1px solid var(--line); }
th { font-size: .88rem; color: var(--soft); font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num + :not(.num) { padding-left: 1.25rem; }
form { margin: 0; }
fieldset { border: 0; padding: 0; margin: 0 0 2rem; min-width: 0; }
legend { font: 700 1.25rem var(--title); padding: 0; margin-bottom: .5rem; }
label { display: block; margin-bottom: .8rem; }
label > input:not([type=radio], [type=checkbox], [type=number]), label > textarea, label > select { display: block; width: 100%; margin-top: .2rem; }
.inline { display: inline-block; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: end; }
.pair input[type=number] { display: block; margin-top: .2rem; }
.fields { max-width: 34rem; }
.fields .inline { display: block; }
.narrow { max-width: 20rem; }
.checkout { display: grid; grid-template-columns: 1fr 21rem; gap: 3rem; align-items: start; }
.checkout aside { background: var(--tint); border-radius: .3rem; padding: 1.25rem; position: sticky; top: 1rem; }
.checkout aside h2 { margin-top: 0; }
.checkout aside ul { list-style: none; padding: 0; }
.checkout aside li { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.checkout aside b, .choice b { white-space: nowrap; }
.checkout aside button { width: 100%; }
.total { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: .75rem; font-size: 1.2rem; font-weight: 700; }
.choice { display: flex; align-items: center; gap: .75rem; border: 1px solid var(--line); border-radius: .3rem; padding: .7rem .9rem; margin-bottom: .5rem; cursor: pointer; }
.choice:has(:checked) { border-color: var(--wine); box-shadow: inset 0 0 0 1px var(--wine); }
.choice:has(:disabled) { opacity: .5; }
.choice span { flex: 1; }
.choice small { display: block; }
.point { margin: 0 0 .75rem 2.7rem; }
.state { font-size: 1.1rem; }
.pay { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; background: var(--tint); border-radius: .3rem; padding: 1.25rem; margin-bottom: 1.5rem; }
.pay h2 { margin-top: 0; }

.admin { font-size: .95rem; }
.admin .top nav { flex: 1; display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; }
.admin button, .admin .button { font-size: .95rem; padding: .4rem .8rem; }
.admin .link { padding: .3rem 0; }
.admin input[type=number] { width: 5rem; }
.filter { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.filter input { flex: 0 1 22rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1rem 3rem; align-items: start; }
.fields:has(.columns) { max-width: none; }
.steps { display: flex; flex-direction: column; gap: .75rem; background: var(--tint); border-radius: .3rem; padding: 1rem; }
.steps p { margin: 0; }
.steps:not(:has(*)) { display: none; }
.history { padding-left: 1.1rem; }
.thumb { max-width: 8rem; display: block; margin-bottom: .75rem; }
details { margin: 1rem 0; }
summary { cursor: pointer; color: var(--wine); margin-bottom: .75rem; }

@media (max-width: 48rem) {
  .checkout, .book { grid-template-columns: 1fr; gap: 1.5rem; }
  .checkout aside { position: static; }
  .books { grid-template-columns: repeat(2, 1fr); gap: 1.5rem 1rem; }
  .blank { width: 100%; }
  .search { order: 1; flex-basis: 100%; }
  .basket { margin-left: auto; }
  .admin .top nav { order: 1; flex-basis: 100%; }
  .admin .top form { margin-left: auto; }
  .admin table { display: block; overflow-x: auto; }
}
@media (max-width: 30rem) { .pair { grid-template-columns: 1fr; gap: 0; } }
