/* Design tokens: themes and each site's appearance settings (/site.css) override these. */
:root { color-scheme: light dark; --line: #8884; --accent: #2457d6; --bad: #c0392b; --ok: #1e8449;
  --font: system-ui, sans-serif; --font-head: var(--font);
  font-family: var(--font); line-height: 1.55; }
h1, h2, h3, .brand { font-family: var(--font-head); }
/* Light/dark: a visitor's choice (mode.js sets data-theme) wins over the system setting. Themes style
   dark mode under both @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) … } and
   :root[data-theme="dark"]. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
.mode-toggle { background: none; color: inherit; border: 1px solid var(--line); border-radius: 999px; width: 2rem; height: 2rem; padding: 0;
  display: inline-grid; place-items: center; font-size: 1rem; line-height: 1; cursor: pointer; }
.mode-toggle .mode-sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mode-toggle .mode-sun { display: inline; } :root:not([data-theme="light"]) .mode-toggle .mode-moon { display: none; } }
:root[data-theme="dark"] .mode-toggle .mode-sun { display: inline; }
:root[data-theme="dark"] .mode-toggle .mode-moon { display: none; }
body { margin: 0; }
a { color: var(--accent); }
.site-header { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; max-width: 64rem; margin: 0 auto; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.site-header nav { display: flex; gap: 1rem; flex: 1; }
.site-header nav a, .brand { text-decoration: none; color: inherit; }
.brand { font-weight: 700; font-size: 1.25rem; }
.header-right { display: flex; gap: 1rem; align-items: center; }
.pay-in { display: flex; align-items: center; gap: .6rem; margin: .75rem 0; }
.currency-menu { position: relative; }
.currency-menu summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; }
.currency-menu summary::-webkit-details-marker { display: none; }
.currency-menu summary::after { content: ""; width: .4em; height: .4em; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-.15em) rotate(45deg); opacity: .6; transition: transform .15s; }
.currency-menu[open] summary::after { transform: translateY(.1em) rotate(-135deg); }
.currency-menu ul { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 20; list-style: none; margin: 0; padding: .3rem; min-width: 6rem;
  background: Canvas; color: CanvasText; border: 1px solid var(--line); border-radius: .4rem; box-shadow: 0 6px 20px #0002; }
.currency-menu li a { display: block; padding: .35rem .7rem; border-radius: .3rem; text-decoration: none; color: inherit; }
.currency-menu li a:hover { background: #8882; }
.currency-menu li a.on { font-weight: 700; color: var(--accent); }
main, .site-footer { max-width: 64rem; margin: 0 auto; padding: 1rem; }
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; font-size: .9rem; opacity: .85; }
h1 { font-size: 1.75rem; margin: .5rem 0 1rem; }
.lead { font-size: 1.1rem; opacity: .85; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

.grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1.25rem; }
.card-item { border: 1px solid var(--line); border-radius: .5rem; padding: .75rem; }
.card-item a { text-decoration: none; color: inherit; }
.card-item h2 { font-size: 1.1rem; margin: .5rem 0 0; }
.card-item img, .noimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: .35rem; display: block; }
.noimg { display: grid; place-items: center; background: #8881; opacity: .7; }
.price { font-weight: 600; margin: .25rem 0; }
.price.big { font-size: 1.6rem; margin: 0; }

.product-layout { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 2rem; align-items: start; }
@media (max-width: 52rem) { .product-layout { grid-template-columns: 1fr; } .buybox { order: -1; } }
.buybox { border: 1px solid var(--line); border-radius: .5rem; padding: 1rem; position: sticky; top: 1rem; }
.gallery { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: .75rem; }
.gallery li:first-child { grid-column: 1 / -1; } /* the first image is the hero; the rest are thumbnails */
.gallery img, .gallery video { width: 100%; border-radius: .35rem; display: block; }
.prose img { max-width: 100%; }
.prose pre { background: #8882; padding: .75rem; overflow-x: auto; }
.prose blockquote { border-left: 3px solid var(--line); margin-left: 0; padding-left: 1rem; }

label { display: block; margin: .75rem 0; font-weight: 500; }
label.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; }
label.check input { width: auto; margin-top: .3rem; }
input:not([type=checkbox]) { display: block; width: 100%; box-sizing: border-box; padding: .5rem; margin-top: .25rem; font: inherit; border: 1px solid var(--line); border-radius: .3rem; background: transparent; color: inherit; }
button { font: inherit; padding: .6rem 1.1rem; border: 0; border-radius: .35rem; background: var(--accent); color: #fff; cursor: pointer; }
button.link { background: none; color: var(--accent); padding: 0; text-decoration: underline; }
.buy-button { width: 100%; font-weight: 600; }
.hint { opacity: .75; font-size: .85rem; font-weight: 400; }
.notice { padding: .6rem .8rem; border-radius: .3rem; border: 1px solid; }
.notice.ok { border-color: var(--ok); }
.notice.err { border-color: var(--bad); }
.card.narrow { max-width: 26rem; border: 1px solid var(--line); border-radius: .5rem; padding: 1rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: .25rem 1rem; max-width: 22rem; margin-left: auto; }
.totals dd { margin: 0; text-align: right; }

.consent { position: fixed; left: 0; right: 0; bottom: 0; background: Canvas; color: CanvasText; border-top: 1px solid var(--line); box-shadow: 0 -2px 12px #0003;
  padding: .75rem 1rem; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; z-index: 10; }
.consent[hidden] { display: none; }
.consent p { margin: 0; flex: 1 1 24rem; }
.consent-buttons { display: flex; gap: .75rem; }
.consent-buttons button { min-width: 6rem; }

.subnav { display: flex; flex-wrap: wrap; gap: 1rem; margin: .5rem 0 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.store-links { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .5rem; }
.btn { display: inline-block; padding: .55rem 1rem; border-radius: .35rem; background: var(--accent); color: #fff; text-decoration: none; text-align: center; }
.demos h2, .upgrade h2 { font-size: 1.05rem; margin: 1rem 0 .25rem; }
.release { margin: 1.5rem 0; }
.release.card { border: 1px solid var(--line); border-radius: .5rem; padding: 1rem; }
code.secret { font-size: .72rem; word-break: break-all; }

button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); margin-top: .5rem; }
.includes { margin: 2rem 0; }
.cart-total { text-align: right; font-size: 1.1rem; }
.errtext { color: var(--bad); }

/* Gallery lightbox (gallery.js) */
.lightbox { border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; background: transparent; color: #fff; }
.lightbox::backdrop { background: #000d; }
.lightbox figure { margin: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; padding: 3.5rem 4.5rem; box-sizing: border-box; }
.lightbox img { max-width: 100%; max-height: calc(100% - 2.5rem); object-fit: contain; border-radius: .25rem; box-shadow: 0 10px 40px #0008; }
.lightbox figcaption { font-size: .95rem; opacity: .85; text-align: center; }
.lightbox button { position: fixed; background: #fff2; color: #fff; border: 0; border-radius: 999px; width: 3rem; height: 3rem; padding: 0;
  font-size: 2rem; line-height: 1; display: grid; place-items: center; cursor: pointer; box-shadow: none; transition: background .15s; }
.lightbox button:hover { background: #fff4; filter: none; }
.lightbox button[hidden] { display: none; }
.lb-close { top: 1rem; right: 1rem; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 1rem; }
.lb-next { right: 1rem; }
.lb-count { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); margin: 0; font-size: .85rem; opacity: .8; }
@media (max-width: 40rem) { .lightbox figure { padding: 3.5rem .5rem 5rem; } .lb-prev, .lb-next { top: auto; bottom: 1rem; transform: none; } }
.gallery a { cursor: zoom-in; }

/* Reviews */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.stars { color: #e0a100; letter-spacing: .08em; white-space: nowrap; }
.reviews { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .75rem; }
.review { border: 1px solid var(--line); border-radius: .5rem; padding: .75rem 1rem; }
.review p { margin: .25rem 0; }
.review-body { white-space: pre-line; overflow-wrap: anywhere; }
.reviews-summary { margin-top: 2rem; }
.reviews-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.big-rating { font-size: 1.2rem; margin: 0 0 .5rem; }
.rating-bars { list-style: none; padding: 0; margin: 0; display: grid; gap: .2rem; }
.rating-bars li { display: grid; grid-template-columns: 5rem 10rem 2rem; align-items: center; gap: .5rem; }
.rating-bars a.on { font-weight: 700; }
.rating-bars .bar { display: block; height: .6rem; border: 1px solid var(--line); border-radius: .3rem; overflow: hidden; }
.rating-bars .fill { display: block; height: 100%; background: #e0a100; }
.review-filter { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin: 1rem 0; }
.review-form { max-width: 36rem; margin-top: 2rem; padding: 1rem; border: 1px solid var(--line); border-radius: .5rem; }
.review-form label { display: block; margin: .6rem 0; }
.review-form textarea { display: block; width: 100%; box-sizing: border-box; padding: .5rem; margin-top: .25rem; font: inherit; border: 1px solid var(--line); border-radius: .3rem; background: transparent; color: inherit; resize: vertical; }
.star-input { border: 0; padding: 0; margin: .6rem 0; }
.star-input legend { padding: 0; margin-bottom: .25rem; }
.stars-pick { position: relative; display: flex; flex-direction: row-reverse; justify-content: flex-end; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.review-form .star-input label { display: inline-block; margin: 0; font-size: 2rem; line-height: 1; padding: 0 .1rem; color: var(--line); cursor: pointer; }
.star-input input:checked ~ label, .star-input label:hover, .star-input label:hover ~ label { color: #e0a100; }
.star-input input:focus-visible + label { outline: 2px solid currentColor; outline-offset: 2px; border-radius: .2rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.pager { display: flex; justify-content: space-between; }
.rating-bars .fill.w0 { width: 0%; }
.rating-bars .fill.w1 { width: 1%; }
.rating-bars .fill.w2 { width: 2%; }
.rating-bars .fill.w3 { width: 3%; }
.rating-bars .fill.w4 { width: 4%; }
.rating-bars .fill.w5 { width: 5%; }
.rating-bars .fill.w6 { width: 6%; }
.rating-bars .fill.w7 { width: 7%; }
.rating-bars .fill.w8 { width: 8%; }
.rating-bars .fill.w9 { width: 9%; }
.rating-bars .fill.w10 { width: 10%; }
.rating-bars .fill.w11 { width: 11%; }
.rating-bars .fill.w12 { width: 12%; }
.rating-bars .fill.w13 { width: 13%; }
.rating-bars .fill.w14 { width: 14%; }
.rating-bars .fill.w15 { width: 15%; }
.rating-bars .fill.w16 { width: 16%; }
.rating-bars .fill.w17 { width: 17%; }
.rating-bars .fill.w18 { width: 18%; }
.rating-bars .fill.w19 { width: 19%; }
.rating-bars .fill.w20 { width: 20%; }
.rating-bars .fill.w21 { width: 21%; }
.rating-bars .fill.w22 { width: 22%; }
.rating-bars .fill.w23 { width: 23%; }
.rating-bars .fill.w24 { width: 24%; }
.rating-bars .fill.w25 { width: 25%; }
.rating-bars .fill.w26 { width: 26%; }
.rating-bars .fill.w27 { width: 27%; }
.rating-bars .fill.w28 { width: 28%; }
.rating-bars .fill.w29 { width: 29%; }
.rating-bars .fill.w30 { width: 30%; }
.rating-bars .fill.w31 { width: 31%; }
.rating-bars .fill.w32 { width: 32%; }
.rating-bars .fill.w33 { width: 33%; }
.rating-bars .fill.w34 { width: 34%; }
.rating-bars .fill.w35 { width: 35%; }
.rating-bars .fill.w36 { width: 36%; }
.rating-bars .fill.w37 { width: 37%; }
.rating-bars .fill.w38 { width: 38%; }
.rating-bars .fill.w39 { width: 39%; }
.rating-bars .fill.w40 { width: 40%; }
.rating-bars .fill.w41 { width: 41%; }
.rating-bars .fill.w42 { width: 42%; }
.rating-bars .fill.w43 { width: 43%; }
.rating-bars .fill.w44 { width: 44%; }
.rating-bars .fill.w45 { width: 45%; }
.rating-bars .fill.w46 { width: 46%; }
.rating-bars .fill.w47 { width: 47%; }
.rating-bars .fill.w48 { width: 48%; }
.rating-bars .fill.w49 { width: 49%; }
.rating-bars .fill.w50 { width: 50%; }
.rating-bars .fill.w51 { width: 51%; }
.rating-bars .fill.w52 { width: 52%; }
.rating-bars .fill.w53 { width: 53%; }
.rating-bars .fill.w54 { width: 54%; }
.rating-bars .fill.w55 { width: 55%; }
.rating-bars .fill.w56 { width: 56%; }
.rating-bars .fill.w57 { width: 57%; }
.rating-bars .fill.w58 { width: 58%; }
.rating-bars .fill.w59 { width: 59%; }
.rating-bars .fill.w60 { width: 60%; }
.rating-bars .fill.w61 { width: 61%; }
.rating-bars .fill.w62 { width: 62%; }
.rating-bars .fill.w63 { width: 63%; }
.rating-bars .fill.w64 { width: 64%; }
.rating-bars .fill.w65 { width: 65%; }
.rating-bars .fill.w66 { width: 66%; }
.rating-bars .fill.w67 { width: 67%; }
.rating-bars .fill.w68 { width: 68%; }
.rating-bars .fill.w69 { width: 69%; }
.rating-bars .fill.w70 { width: 70%; }
.rating-bars .fill.w71 { width: 71%; }
.rating-bars .fill.w72 { width: 72%; }
.rating-bars .fill.w73 { width: 73%; }
.rating-bars .fill.w74 { width: 74%; }
.rating-bars .fill.w75 { width: 75%; }
.rating-bars .fill.w76 { width: 76%; }
.rating-bars .fill.w77 { width: 77%; }
.rating-bars .fill.w78 { width: 78%; }
.rating-bars .fill.w79 { width: 79%; }
.rating-bars .fill.w80 { width: 80%; }
.rating-bars .fill.w81 { width: 81%; }
.rating-bars .fill.w82 { width: 82%; }
.rating-bars .fill.w83 { width: 83%; }
.rating-bars .fill.w84 { width: 84%; }
.rating-bars .fill.w85 { width: 85%; }
.rating-bars .fill.w86 { width: 86%; }
.rating-bars .fill.w87 { width: 87%; }
.rating-bars .fill.w88 { width: 88%; }
.rating-bars .fill.w89 { width: 89%; }
.rating-bars .fill.w90 { width: 90%; }
.rating-bars .fill.w91 { width: 91%; }
.rating-bars .fill.w92 { width: 92%; }
.rating-bars .fill.w93 { width: 93%; }
.rating-bars .fill.w94 { width: 94%; }
.rating-bars .fill.w95 { width: 95%; }
.rating-bars .fill.w96 { width: 96%; }
.rating-bars .fill.w97 { width: 97%; }
.rating-bars .fill.w98 { width: 98%; }
.rating-bars .fill.w99 { width: 99%; }
.rating-bars .fill.w100 { width: 100%; }

/* The story under the overview: features, small features, quotes (product page) */
.story { display: grid; gap: 3.5rem; margin: 3rem 0; }
.feature { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 2.5rem; align-items: center; }
.feature.flip { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
.feature.flip .feature-media { order: 2; }
.feature.no-media { grid-template-columns: minmax(0, 40rem); }
.feature-media img, .feature-media video { width: 100%; display: block; border-radius: .5rem; border: 1px solid var(--line); box-shadow: 0 8px 28px #0002; }
.feature-media a { cursor: zoom-in; display: block; }
.feature-text h2 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .6rem; }
.feature-text p { margin: 0; font-size: 1.05rem; opacity: .85; }
@media (max-width: 52rem) { .feature, .feature.flip { grid-template-columns: minmax(0, 1fr); gap: 1rem; } .feature.flip .feature-media { order: 0; } }
.minor-features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1.25rem 2rem; }
.minor-features h3 { font-size: 1.05rem; margin: 0 0 .25rem; }
.minor-features p { margin: 0; font-size: .95rem; opacity: .8; }
.pullquote { margin: 0 auto; max-width: 40rem; text-align: center; }
.pullquote blockquote { margin: 0; font-family: var(--font-head); font-size: 1.6rem; line-height: 1.35; font-style: italic; }
.pullquote blockquote::before { content: "\201C"; } .pullquote blockquote::after { content: "\201D"; }
.pullquote figcaption { margin-top: .75rem; opacity: .7; }
.pullquote figcaption::before { content: "\2014\00a0"; }

/* Books: the cover leads, tilted slightly like a book on a shelf */
.is-book .gallery li:first-child { text-align: center; }
.is-book .gallery li:first-child img { width: auto; max-width: 100%; max-height: 30rem; margin: 0 auto; border-radius: .2rem .5rem .5rem .2rem; box-shadow: -4px 6px 18px #0004; }
@media (min-width: 40rem) and (prefers-reduced-motion: no-preference) {
  .is-book .gallery li:first-child img { transform: perspective(900px) rotateY(-8deg); transition: transform .3s; }
  .is-book .gallery li:first-child img:hover { transform: perspective(900px) rotateY(0); }
}

/* Look inside: the excerpt's pages as images; reader.js turns the list into pages (single, or a two-page spread) */
.look-inside { margin: 3rem 0; }
.book-pages { list-style: none; padding: 0; margin: 0 auto; max-width: 36rem; display: grid; gap: 1rem; }
.book-pages img { width: 100%; height: auto; display: block; background: #fff; box-shadow: 0 4px 18px #0003; }
.book-reader:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.book-reader.paged .book-pages { display: flex; max-width: none; gap: 0; justify-content: center; align-items: flex-start; }
.book-reader.paged li[hidden] { display: none; }
.book-reader.paged .book-pages li { flex: 0 1 36rem; min-width: 0; }
.book-reader.spread .book-pages li { flex-basis: 50%; max-width: 30rem; }
.book-reader.spread .book-pages li:first-child img, .book-reader.spread .book-pages li:nth-child(odd) img { box-shadow: 6px 4px 18px #0003; }
.book-reader.spread[data-view="first"] .book-pages { justify-content: flex-end; }
.book-reader.spread[data-view="last"] .book-pages { justify-content: flex-start; }
.book-reader.spread .book-pages { position: relative; }
.book-reader.spread .book-pages::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: #0002; pointer-events: none; }
.book-reader.spread[data-view="first"] .book-pages::after, .book-reader.spread[data-view="last"] .book-pages::after { display: none; }
.book-nav { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; }
.book-nav[hidden], [data-layout][hidden] { display: none; }
.book-nav button { margin: 0; width: 2.5rem; height: 2.5rem; padding: 0; border-radius: 999px; font-size: 1.4rem; line-height: 1; }
.book-nav button:disabled { opacity: .35; }
.look-inside .row button { margin: 0; }
.reader-more { text-align: center; }

/* Series strip and author cards (book pages) */
.series-strip { margin: 3rem 0; }
.series-strip ol { list-style: none; padding: 0; margin: 0; display: flex; gap: 1.25rem; overflow-x: auto; padding-bottom: .5rem; }
.series-strip li { flex: 0 0 8rem; }
.series-strip a { text-decoration: none; color: inherit; display: block; }
.series-strip img, .series-strip .noimg { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: .2rem .4rem .4rem .2rem; box-shadow: -3px 4px 12px #0003; }
.series-strip .noimg { padding: .5rem; box-sizing: border-box; text-align: center; font-size: .85rem; }
.series-strip .series-title { display: block; margin-top: .5rem; font-size: .9rem; line-height: 1.3; }
.series-strip li.current img, .series-strip li.current .noimg { outline: 3px solid var(--accent); outline-offset: 2px; }
.author-cards { display: grid; gap: 1.5rem; margin: 3rem 0; }
.author-card { border: 1px solid var(--line); border-radius: .5rem; padding: 1rem 1.5rem; max-width: 40rem; }
.author-card h2 { font-size: 1.15rem; margin-top: 0; }
