/* Shared type, controls and page frame */
:root {
    --paper:#f8f7f2; --ink:#192f35; --muted:#58696d; --line:#d8dbd4;
    --accent:#b5462d; --serif:Georgia,"Times New Roman",serif;
    font:16px/1.55 system-ui,-apple-system,"Segoe UI",sans-serif; color:var(--ink);
    background:var(--paper); color-scheme:light;
}
* { box-sizing:border-box }
body { margin:0; min-height:100vh; display:flex; flex-direction:column }
main { flex:1; min-width:0 }
button,input,select,textarea { font:inherit; color:inherit }
button,a { -webkit-tap-highlight-color:transparent }
button { cursor:pointer; background:none; border:0; padding:0 }
button:disabled { opacity:.52; cursor:not-allowed }
a { color:inherit; text-underline-offset:3px }
h1,h2,h3,p,dl,dd,fieldset { margin:0 }
h1,h2,h3 { overflow-wrap:anywhere; text-wrap:balance; font-weight:500 }
h1,h2 { font-family:var(--serif); letter-spacing:-.035em; line-height:1.12 }
h1 { font-size:clamp(2.55rem,5vw,4.6rem) }
h2 { font-size:clamp(1.5rem,2.2vw,2.15rem) }
h3 { font-size:1.1rem; font-weight:620 }
p,dt,dd,td { overflow-wrap:anywhere }
:focus-visible { outline:3px solid #2975a0; outline-offset:3px }
h1[tabindex="-1"]:focus { outline:none }
input:not([type=checkbox]),select,textarea {
    width:100%; min-width:0; background:white; padding:10px 12px;
    border:1px solid #b8c1bc; border-radius:6px; line-height:1.45;
}
input[type=color] { padding:3px; height:46px; cursor:pointer }
input[type=checkbox] { accent-color:var(--ink); width:1.1rem; height:1.1rem }
select { cursor:pointer; min-height:44px; text-overflow:ellipsis }
fieldset { min-width:0; padding:0; border:0 }
textarea { resize:vertical }
.wrap { width:min(calc(100% - clamp(2.25rem,10vw,10rem)),1320px); margin-inline:auto }
.icon { width:19px; height:19px; flex:none; vertical-align:middle }
.sr-only,.skip-link:not(:focus) { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap }
.muted,.result-count { color:var(--muted); font-size:.895rem }
.masthead { border-bottom:1px solid var(--line) }
.mast { display:flex; align-items:center; padding-block:20px; gap:24px }
.brand { display:flex; gap:10px; align-items:center; font-weight:700; font-size:1.42rem; letter-spacing:-.05em }
.admin-link { margin-left:auto; font-weight:560; font-size:.9rem }
.admin-link .icon { width:15px; margin-left:4px }
.mast a,.site-foot a,.crumb a,.button { text-decoration:none }
.admin-link:hover,.site-foot a:hover,.text-button:hover,.crumb a:hover { text-decoration:underline }
.site-foot { border-top:1px solid var(--line); display:flex; justify-content:space-between; color:var(--muted); padding:24px 0; margin-top:72px; font-size:.875rem }
.site-foot>span { font-weight:690 }
.toolbar,.crumb,.section-rule,.result-count { display:flex; align-items:center; gap:10px; flex-wrap:wrap }
.button,.circle { display:inline-flex; justify-content:center; align-items:center; gap:9px; background:white; border:1px solid #c8cfca; font-weight:570; color:var(--ink) }
.button { min-height:44px; padding:9px 16px; font-size:.91rem; line-height:1.3; border-radius:6px }
.primary,.included { color:white; background:var(--ink); border-color:var(--ink) }
.circle { width:40px; height:40px; border-radius:100%; flex:none }
.button:hover:not(:disabled),.circle:hover:not(:disabled),.directory-card:hover .circle { border-color:var(--ink); background:var(--ink); color:white }
.primary:hover:not(:disabled) { background:#345760 }
.text-button { display:inline-flex; align-items:center; gap:5px; font-size:.88rem; color:var(--ink); font-weight:580 }
.search-box { display:flex; align-items:center; padding-left:16px; border-radius:7px; background:white; border:1px solid #bdc5bf; min-width:0 }
.search-box input[type=search] { background:transparent; border:0; padding-block:13px; outline:0 }
.search-box:focus-within { outline:2px solid #2975a0; outline-offset:2px }
.search-submit { width:46px; flex:none; min-height:44px }
.eyebrow,.section-rule { font-size:.72rem; font-weight:680; text-transform:uppercase; letter-spacing:.115em }
.empty { text-align:center; padding:clamp(35px,7vw,95px) 20px }
.empty>*+* { margin-top:15px }
.panel { background:white; border-radius:10px; border:1px solid var(--line); padding:clamp(18px,3vw,36px) }

/* Directory: each spine and cover uses the published client accent. */
.directory-head,.catalog-head { display:flex; justify-content:space-between; align-items:end; gap:26px; flex-wrap:wrap }
.directory-head { padding:clamp(40px,5.5vw,84px) 0 clamp(34px,4vw,56px) }
.directory-head p,.client-heading p { color:var(--muted); margin-top:12px; font-size:1.05rem }
.directory-head .search-box { width:min(100%,350px) }
.section-rule { justify-content:space-between; border-bottom:1px solid var(--line); padding-bottom:13px }
.section-rule span+span { color:var(--muted); letter-spacing:.07em }
.directory-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:38px 24px; margin-top:26px }
.directory-card { display:block; text-decoration:none; min-width:0 }
.cover-stage {
    display:grid; place-items:center; aspect-ratio:1.12; overflow:hidden;
    border-radius:8px; background:linear-gradient(135deg,color-mix(in srgb,var(--accent) 8%,#faf8ec),color-mix(in srgb,var(--accent) 20%,#edeada));
    container-type:inline-size;
}
.book-cover {
    position:relative; display:flex; flex-direction:column; justify-content:space-between;
    background:color-mix(in srgb,var(--accent) 56%,#081319); color:white; padding:5cqw 3cqw 4cqw 5cqw;
    width:48cqw; height:65cqw; gap:3cqw; border-radius:3px 2px 2px 3px;
    transform:perspective(1100px) rotateY(-14deg) rotate(-6deg);
    box-shadow:1px 1px #fff,2px 2px #c3bfaf,3px 3px #fff,4px 4px #cdcabe,5px 5px #4c504d,
        8px 12px 10px -5px #192f354b,20px 28px 33px -12px #192f3554;
    transition:transform .35s ease;
}
.book-cover:before { content:""; position:absolute; inset:0 auto 0 0; width:8%; border-radius:inherit; background:linear-gradient(90deg,#0005,#fff2 45%,#0002 71%,#fff1 85%,transparent) }
.directory-card:hover .book-cover { transform:perspective(1100px) rotateY(-5deg) rotate(-2deg) translateY(-2%) }
.cover-name,.cover-foot { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; overflow-wrap:anywhere }
.cover-name { font:500 6.1cqw/1.08 var(--serif); letter-spacing:-.025em }
.cover-foot { border-top:1px solid #ffffff6e; padding-top:2.1cqw; font-size:2.5cqw; line-height:1.3 }
.cover-picture,.cover-pattern { width:100%; flex:1; min-height:0 }
.cover-picture { object-fit:contain; background:white; padding:2.1cqw }
.cover-pattern { background:repeating-radial-gradient(circle at bottom left,transparent,transparent 2.2cqw,#ffffff66 2.25cqw,#ffffff66 2.48cqw) }
.card-caption { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-top:18px }
.card-caption h2 { font-size:1.65rem }
.card-caption p { margin-top:3px; font-size:.88rem; color:var(--muted) }
.card-caption .circle { background:transparent; width:37px; height:37px }

/* Published catalog */
.crumb { padding:28px 0 20px; color:var(--muted); font-size:.9rem }
.crumb .icon { margin-right:5px }
.catalog-head { padding-bottom:30px; margin-bottom:30px; border-bottom:1px solid var(--line) }
.client-heading { border-left:4px solid var(--accent); padding-left:18px }
.client-heading h1 { font-size:clamp(2.3rem,3.5vw,3.6rem) }
.client-heading p { margin-top:6px }
.catalog-body { display:grid; grid-template-columns:minmax(180px,20%) minmax(0,1fr); gap:clamp(24px,4vw,60px) }
.filters label { display:block; margin:0 0 10px }
.filters label:nth-of-type(2) { margin-top:30px }
#category { display:none }
.category-list { max-height:68vh; overflow-y:auto; scrollbar-width:thin }
.category-list button { text-align:left; display:block; font-size:.88rem; color:var(--muted); padding:10px 12px; width:100%; overflow-wrap:anywhere; border-left:3px solid transparent }
.category-list button:hover,.category-list .current { background:color-mix(in srgb,var(--accent) 8%,white); color:var(--ink) }
.category-list .current { border-color:var(--accent); font-weight:620 }
.results { scroll-margin-top:20px }
.search-tools,.view-toggle { display:flex; align-items:center }
.search-tools { gap:12px }
.search-tools .search-box { flex:1; padding-left:0 }
.search-tools select { width:185px; margin-left:auto }
.view-toggle { border:1px solid var(--line); background:#eeefe9; padding:3px; border-radius:6px }
.view-toggle button { min-width:38px; min-height:38px; border-radius:4px }
.view-toggle [aria-pressed=true] { background:white; box-shadow:0 1px 4px #192f3525 }
.result-count { justify-content:space-between; margin:19px 0 }
.products { display:grid; gap:16px }
.products.grid { grid-template-columns:repeat(var(--columns,3),minmax(0,1fr)) }
.product { position:relative; display:flex; flex-direction:column; min-width:0; background:white; border:1px solid var(--line); border-radius:8px; padding:20px; gap:16px; overflow-wrap:anywhere }
.product:hover,.product:focus-within { border-color:color-mix(in srgb,var(--accent),var(--line)) }
.product-visual,.detail-visual { display:grid; place-items:center; width:100%; height:clamp(135px,15vw,220px) }
.product-img { width:100%; height:100%; min-height:0; object-fit:contain }
.missing-photo { display:flex; flex-direction:column; align-items:center; gap:6px; color:#78827f; font-size:.8rem }
.missing-photo .icon { width:28px; height:28px }
.sku { font-size:.78rem; letter-spacing:.045em; font-variant-numeric:tabular-nums; color:var(--muted) }
.product-copy { min-width:0; flex:1 }
.product h2 { font:610 1rem/1.42 system-ui,sans-serif; letter-spacing:0; margin:6px 0; text-wrap:wrap }
.product-title { text-align:left; overflow-wrap:anywhere }
.product-title:after { content:""; position:absolute; inset:0 }
.product-footer { display:flex; gap:12px; justify-content:space-between; align-items:center; flex-wrap:wrap }
.product-footer:empty { display:none }
.price,.detail-price { font-weight:670; font-variant-numeric:tabular-nums }
.add { position:relative; margin-left:auto }
.products.list { gap:10px }
.list .product { flex-direction:row; align-items:center; padding:15px }
.list .product-visual { width:85px; height:85px; flex:none }
.pager { display:flex; align-items:center; justify-content:center; gap:18px; margin-top:32px }
.pager input[type=number] { width:80px; text-align:center; padding-inline:4px }

/* Product detail, basket and private editor */
body:has(dialog[open]) { overflow:hidden }
.sheet { color:var(--ink); border:0; border-radius:12px; padding:clamp(24px,4vw,54px); max-height:90dvh; width:min(870px,94%); overflow:auto; box-shadow:0 28px 100px #132a3740 }
.sheet::backdrop { background:#14262cb3 }
.sheet h2 { padding-right:26px; margin:10px 0 18px }
.sheet .close { position:absolute; top:16px; right:16px }
.detail-body { display:flex; gap:32px; align-items:center }
.detail-visual { width:38%; flex:none; height:270px }
.detail-copy { flex:1; overflow-wrap:anywhere; min-width:0 }
.detail-copy .eyebrow { padding-right:40px }
.detail-copy dl { display:grid; grid-template-columns:auto 1fr; gap:8px 16px; margin:22px 0; font-size:.9rem }
.detail-copy dt,.description p { color:var(--muted) }
.detail-copy dd { text-align:right }
.description { border-top:1px solid var(--line); margin-top:30px; padding-top:20px }
.description p { white-space:pre-line; margin-top:8px }
.basket-sheet h2 small { color:var(--muted) }
.basket-lines { margin:24px 0; border-top:1px solid var(--line) }
.basket-row { display:grid; grid-template-columns:minmax(0,1fr) 126px auto; align-items:center; gap:12px; padding:16px 0; border-bottom:1px solid var(--line); overflow-wrap:anywhere }
.quantity span,.basket-row p { font-size:.82rem; color:var(--muted) }
.basket-row .error { grid-column:1/-1 }
.basket-sheet>p+.button { margin-top:16px }
.print-only, #blazor-error-ui { display:none }
#blazor-error-ui { position:fixed; inset:auto 0 0; padding:18px; z-index:2000; background:#fff0da }
.admin { padding-top:44px }
.admin h1 { font-size:clamp(2.1rem,4vw,3.6rem) }
.admin-head,.admin-body { display:grid; gap:22px }
.admin-head { grid-template-columns:1fr auto; align-items:center; margin-bottom:28px }
.admin-body { grid-template-columns:minmax(0,2fr) minmax(290px,1fr); align-items:start }
.stack { display:grid; gap:18px; min-width:0 }
.fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px }
.wide { grid-column:1/-1 }
.field { display:grid; gap:6px; font-weight:550; font-size:.92rem }
.field input,.field select,.field textarea { font-size:1rem; font-weight:400 }
.check { display:flex; align-items:center; gap:8px }
.announcement,.notice,.error,.success { padding:12px 15px; border-radius:6px; font-size:.92rem; overflow-wrap:anywhere }
.error { background:#fdebe6; color:#802a19 }
.notice { background:#faf0d8; color:#594020 }
.success,.announcement { background:#e8f2ea; color:#244e39 }
.history { margin:0; padding:0; list-style:none }
.history li { border-top:1px solid var(--line); padding:12px 0; overflow-wrap:anywhere }
.history small { display:block; color:var(--muted) }
.panel summary { cursor:pointer; font-weight:610 }
.panel[open] summary { margin-bottom:18px }
@media (max-width:1050px) {
    .directory-grid { grid-template-columns:repeat(3,minmax(0,1fr)) }
    .products.grid { grid-template-columns:repeat(min(var(--columns,3),2),minmax(0,1fr)) }
}
@media (max-width:800px) {
    .directory-grid { grid-template-columns:repeat(2,minmax(0,1fr)) }
    .directory-head .search-box { width:100% }
    .catalog-body,.admin-body,.admin-head { grid-template-columns:minmax(0,1fr) }
    .filters { display:grid; grid-template-columns:1fr 1fr; gap:8px 12px }
    .filters label,.filters label:nth-of-type(2) { margin:0; grid-row:1 }
    .filters #category { display:block }
    .category-list { display:none }
    .catalog-head { gap:18px; padding-bottom:22px; margin-bottom:20px }
    .admin-head { justify-items:start }
}
@media (max-width:600px) {
    .mast { padding-block:13px; gap:14px; flex-wrap:wrap }
    .brand { font-size:1.26rem }
    .admin-link { font-size:.83rem }
    .directory-grid { gap:26px 14px }
    .cover-stage { aspect-ratio:.94 }
    .book-cover { width:58cqw; height:79cqw }
    .cover-name { font-size:7.7cqw }
    .card-caption { padding-top:12px }
    .card-caption h2 { font-size:1.3rem }
    .card-caption p { font-size:.8rem }
    .card-caption .circle { display:none }
    .catalog-head .toolbar { display:grid; grid-template-columns:1fr 1fr; width:100% }
    .catalog-head .button { padding-inline:6px; font-size:.85rem }
    .search-tools { flex-wrap:wrap }
    .search-tools .search-box { flex:1 1 100% }
    .search-tools select { flex:1 }
    .products.grid,.fields { grid-template-columns:minmax(0,1fr) }
    .list .product { display:grid; grid-template-columns:auto 1fr }
    .list .product-footer { grid-column:1/-1 }
    .product-visual { height:170px }
    .detail-body { flex-direction:column; gap:20px; align-items:stretch }
    .detail-visual { width:100%; height:195px }
    .basket-row { grid-template-columns:1fr auto }
    .basket-row>div:first-child { grid-column:1/-1 }
    .quantity { max-width:160px }
    .pager { gap:8px }
    .pager .button { padding-inline:10px }
    .pager input[type=number] { width:58px }
}
@media (prefers-reduced-motion:reduce) { .book-cover { transition:none } }
@media print {
    body:has(.basket-sheet[open]) { display:block; overflow:visible; background:white }
    body:has(.basket-sheet[open]) :is(.masthead,.site-foot,.catalog>:not(.basket-sheet),.no-print,.close) { display:none }
    .basket-sheet[open] { position:static; border:0; padding:0; margin:0; width:100%; max-height:none; overflow:visible; box-shadow:none }
    .basket-sheet::backdrop { display:none }
    .basket-row { break-inside:avoid; display:flex; justify-content:space-between }
    .print-only { display:block }
}
