/* Next Level Guides, 2026 theme: shared by every page (shop, upcoming, vote, contact, errata). */
:root { --paper: #F3EFE6; --card: #FFFFFF; --ink: #17181C; --muted: #45464C; --soft: #D6D3CB;
        --blue: #1F5FBF; --orange: #E8890C; --line: rgba(23,24,28,.28); }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 'IBM Plex Sans', system-ui, sans-serif; }
h1, h2, h3 { font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif; font-weight: 700; line-height: 1; margin: 0; }
a { color: var(--blue); } a:hover { color: #174a96; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Header and footer */
.site-top { background: #FFFFFF; color: var(--ink); border-bottom: 3px solid var(--ink); }
.site-top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 24px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; min-height: 44px; }
.brand img { display: block; height: 40px; width: auto; }
.brand-mark { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; background: var(--blue);
              font: 700 17px 'Barlow Condensed', sans-serif; color: #fff; }
.brand-name { font: 700 24px 'Barlow Condensed', sans-serif; letter-spacing: .3px; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0 4px; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; color: var(--ink); text-decoration: none; font-weight: 600; }
.site-nav a:hover { text-decoration: underline; color: var(--blue); }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 3px; text-underline-offset: 8px; }
.site-foot { background: var(--ink); color: var(--soft); font-size: 14px; margin-top: 56px; }
.site-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 28px; padding-top: 24px; padding-bottom: 28px; }
.site-foot a { color: var(--paper); }

/* Page heading */
.page-head { padding: 32px 0 8px; }
.page-head h1 { font-size: clamp(36px, 6vw, 60px); }
.page-head p { color: var(--muted); margin: 10px 0 0; max-width: 640px; font-size: 17px; }
.section-title { font-size: clamp(28px, 4vw, 38px); margin: 40px 0 16px; }

/* Trust strip */
.trust { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0; margin: 24px 0 8px; border: 2px solid var(--ink); background: var(--card); }
.trust div { padding: 14px 18px; border-right: 2px solid var(--ink); }
.trust div:last-child { border-right: 0; }

.trust b { display: block; font: 700 21px 'Barlow Condensed', sans-serif; }
.trust span { color: var(--muted); font-size: 15px; }

/* Buttons, chips, tags */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border: 2px solid var(--ink);
       background: var(--card); color: var(--ink); font: 600 16px 'IBM Plex Sans', sans-serif; text-decoration: none; cursor: pointer; }
.btn:hover { color: var(--ink); background: #fbfaf6; }
.btn-primary { background: var(--orange); border-color: var(--orange); }
.btn-primary:hover { background: #f09a24; }
.btn[aria-disabled="true"], .btn:disabled { background: #c9c4b8; border-color: #c9c4b8; color: #3a3b40; pointer-events: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.chip { flex: none; min-height: 44px; padding: 0 16px; border: 2px solid var(--ink); background: transparent; color: var(--ink); font: 600 14px 'IBM Plex Sans', sans-serif; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.tag { align-self: flex-start; background: var(--orange); color: var(--ink); font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; padding: 1px 7px; }

/* The shelf: books drawn in 3D with CSS */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 40px 28px; margin-top: 16px; }
@media (min-width: 900px) { .shelf { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); } }
.book { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 10px; perspective: 900px; }
.book:focus-visible { outline: 3px solid var(--blue); outline-offset: 6px; }
.book[hidden] { display: none; }
.book-3d { position: relative; width: 100%; aspect-ratio: 6 / 9; transform-style: preserve-3d; transform: rotateY(-22deg); transition: transform .35s ease; }
.book:hover .book-3d, .book:focus-visible .book-3d { transform: rotateY(-6deg) translateY(-4px); }
.book-3d img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 1px 3px 3px 1px; box-shadow: 10px 12px 18px rgba(23,24,28,.28); }
.book-3d::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 7%; background: rgba(0,0,0,.28); border-right: 1px solid rgba(255,255,255,.25); z-index: 1; }
.book-3d::after { content: ""; position: absolute; top: 1.5%; bottom: 1.5%; right: -10px; width: 10px;
                  background: repeating-linear-gradient(to right, #fbfaf6 0 1px, #e6e1d6 1px 2px); transform: rotateY(90deg); transform-origin: left; }
@media (prefers-reduced-motion: reduce) { .book-3d { transition: none; } }
.book-title { font-weight: 600; font-size: 15px; line-height: 1.3; }
.book-meta { font-size: 13px; color: var(--muted); margin-top: -6px; }

/* Cards and forms (vote, contact, errata) */
.panel { background: var(--card); border: 2px solid var(--ink); padding: 22px; max-width: 640px; }
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-row label { font-weight: 600; }
input[type=text], input[type=email], textarea { font: inherit; padding: 12px 14px; border: 2px solid var(--line); background: #fff; color: var(--ink); width: 100%; }
input[type=text]:focus, input[type=email]:focus, textarea:focus { border-color: var(--blue); outline: none; }
.honey { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.choices { display: flex; flex-direction: column; gap: 10px; border: 0; padding: 0; margin: 0 0 20px; }
.choices label { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px 16px; border: 2px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; }
.choices label:has(input:checked) { border: 3px solid var(--blue); }
.choices input { width: 20px; height: 20px; accent-color: var(--blue); }
.status { margin: 14px 0 0; font-weight: 600; }
.status.ok { color: #1d6b38; } .status.err { color: #b3261e; }
.errata-list { padding-left: 20px; } .errata-list li { margin-bottom: 10px; }

/* The look-inside viewer */
dialog.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--ink); color: var(--paper); }
dialog.viewer::backdrop { background: rgba(23,24,28,.8); }
.v-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; z-index: 20; }
.v-bar span { font-size: 14px; color: var(--soft); }
.icon-btn { width: 48px; height: 48px; border: 0; background: transparent; color: var(--paper); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:focus-visible { outline: 3px solid var(--orange); }
.track { height: 100%; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; height: 100%; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; padding: 64px 16px 72px; }
.slide img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.details { width: min(520px, 100%); background: var(--paper); color: var(--ink); padding: 22px; max-height: 100%; overflow-y: auto; }
.details-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.details-head img { width: 78px; aspect-ratio: 6 / 9; object-fit: cover; flex: none; box-shadow: 4px 4px 0 var(--ink); }
.details h2 { font-size: 30px; }
.details p { color: var(--muted); margin: 6px 0 0; }
.details .choices label { min-height: 52px; }
.details .choices b { flex: 1; }
.fine { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.v-nav { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 6px; z-index: 20; }
.dot { width: 32px; height: 32px; border: 0; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.dot::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #6b6c72; }
.dot[aria-current="true"]::after { background: var(--orange); width: 22px; border-radius: 5px; }
.arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 20; background: rgba(23,24,28,.6); }
.arrow.prev { left: 8px; } .arrow.next { right: 8px; }
@media (hover: none) { .arrow { display: none; } }
/* Page turn: pages stacked, the top one flips over its spine as you swipe (scroll-driven, no animation script).
   JS adds .stacked only where scroll-driven animations work and motion isn't reduced; elsewhere it's a plain swipe. */
.stacked .track { scroll-timeline: --flip inline; }
.stacked .slide { position: sticky; left: 0; z-index: calc(10 - var(--i)); perspective: 1600px; }
.stacked .slide + .slide { margin-left: -100%; }
.stacked .slide, .stacked .slide > img { pointer-events: none; }
.stacked .details { pointer-events: auto; }
.stacked .spacer { flex: 0 0 100%; scroll-snap-align: end; }
.stacked .slide.flip > * { transform-origin: left center; backface-visibility: hidden; animation: flip linear both; animation-timeline: --flip;
                           animation-range: calc(var(--i) * var(--step)) calc(var(--i) * var(--step) + var(--step)); }
.stacked .slide:not(:first-child) { animation: reveal linear both; animation-timeline: --flip;
                                     animation-range: calc(var(--i) * var(--step) - var(--step)) calc(var(--i) * var(--step) - var(--step) + 1%); }
@keyframes flip { from { transform: none; filter: none; } to { transform: rotateY(-105deg); filter: brightness(.35); } }
@keyframes reveal { from { opacity: 0; } to { opacity: 1; } }

/* "Look inside" cues: a label on every cover, and a one-time nudge (the first book's cover opens a little,
   with a tip bubble) on a visitor's first visit. */
.book { position: relative; }
.book-3d .under { position: absolute; inset: 1% 0 1% 2%; background: repeating-linear-gradient(#fbfaf6 0 6px, #ece7dc 6px 7px); }
.book-3d img { transform-origin: left center; }
.peek { position: absolute; right: 0; bottom: 7%; z-index: 2; display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px 4px 7px;
        background: var(--ink); color: var(--paper); font: 600 12px/1 'IBM Plex Sans', sans-serif; transform: translateZ(1px); }
.peek svg { flex: none; }
.book:hover .peek, .book:focus-visible .peek { background: var(--orange); color: var(--ink); }
.tip { position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-30%); z-index: 5; width: max-content; max-width: 220px;
       background: var(--ink); color: var(--paper); padding: 9px 12px; font-size: 14px; font-weight: 600; box-shadow: 4px 4px 0 var(--orange);
       animation: tip-in .3s ease both; pointer-events: none; }
.tip::after { content: ""; position: absolute; left: 30%; top: 100%; border: 8px solid transparent; border-top-color: var(--ink); }
.tip.out { animation: tip-out .4s ease both; }
@keyframes tip-in { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }
@keyframes tip-out { to { opacity: 0; translate: 0 6px; } }
@media (prefers-reduced-motion: no-preference) {
  .nudge .book-3d img { animation: cover-peek 1.8s ease-in-out .4s 2; }
}
@keyframes cover-peek { 0%, 100% { transform: none; } 45%, 60% { transform: rotateY(-48deg); } }
.v-hint { color: var(--soft); }

/* Latest / Coming soon switch beside the shelf heading; the shelves swap in place with a short fade. */
.shelf-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin: 40px 0 14px; }
.shelf-head .section-title { margin: 0; }
.switch { display: inline-flex; border: 2px solid var(--ink); }
.switch [role=tab] { min-height: 44px; padding: 0 16px; border: 0; background: transparent; color: var(--ink); font: 600 15px 'IBM Plex Sans', sans-serif; cursor: pointer; }
.switch [role=tab][aria-selected="true"] { background: var(--ink); color: var(--paper); }
.switch [role=tab]:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.chips[hidden], .shelf[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .fade-in { animation: shelf-in .22s ease both; }
}
@keyframes shelf-in { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }
#shelf-soon { min-height: 75vh; align-content: start; }  /* the switch stays put when the shorter shelf shows */

/* Phones: logo and menu stay on one line (after the header rules so these win). */
@media (max-width: 480px) {
  .brand img { height: 32px; }
  .site-top .wrap { flex-wrap: nowrap; gap: 8px; }
  .site-nav { flex-wrap: nowrap; gap: 0; }
  .site-nav a { padding: 0 5px; font-size: 14px; white-space: nowrap; }
}
@media (max-width: 370px) { .brand img { height: 28px; } .site-nav a { padding: 0 4px; font-size: 13px; } }

/* Phones: the three "why buy direct" boxes shrink to one compact line of ticked points, so the books sit higher. */
@media (max-width: 720px) {
  .trust { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; margin: 16px 0 0; padding: 10px 12px; border: 0; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); background: transparent; }
  .trust div { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; }
  .trust b { font: 600 clamp(12px, 3.3vw, 15px) 'IBM Plex Sans', sans-serif; white-space: nowrap; }
  .trust span { display: none; }
  .trust div::before { content: ""; width: 4px; height: 9px; margin: -3px 2px 0 1px; border: solid var(--blue); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); flex: none; }
  .page-head { padding-top: 22px; }
  .shelf-head { margin-top: 14px; }
  .shelf-head .section-title, .desk-only { display: none; }  /* the switch and the Look inside labels already say it */
}

/* edition prices: shop price, list price struck through, % off; one store at a time (US/UK/AU switch) */
.cur { display: flex; gap: 6px; margin: 0 0 4px; }
.cur button { font: inherit; font-size: 13px; font-weight: 600; padding: 4px 10px; border: 2px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.cur button[aria-pressed="true"] { border-color: var(--blue); background: var(--blue); color: #fff; }
.choices .price { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; text-align: right; line-height: 1.2; }
.choices .price .now { font-size: 18px; font-weight: 700; }
.choices .price .was { font-size: 12px; font-weight: 400; color: var(--muted); }
.choices .price .was i { font-style: normal; font-weight: 700; color: #b3261e; }
.choices .price > span { white-space: nowrap; }
@media (max-width: 420px) {
  .choices label { flex-wrap: wrap; row-gap: 2px; }
  .choices .price { flex-basis: 100%; flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 10px; margin-left: 34px; }
}
