/* Product detail page: media and buy box, the record, more books, questions and the sticky buy bar.
   Tokens, chrome, breadcrumb, buttons, .record-line and .questions live in style.css; product cards in storefront.css.
   Breakpoints: phone below 768, tablet 768 to 1023 (single column, buy bar), desktop from 1024 (two columns). */

/* Product main. Below 1024 the media and info wrappers dissolve into one grid: the cover well and the identity
   share the first row, the cover caption runs full width under them, and the decision follows at full width. */
.product-main {
 display: grid;
 grid-template-columns: 136px minmax(0, 1fr);
 column-gap: var(--space-4);
 align-items: start;
 padding: var(--space-2) var(--gutter) var(--space-8);
}
.product-media,
.product-info {
 display: contents;
}
/* The cover figure spans both columns through a subgrid, so its caption can run under the identity as well. */
.product-cover {
 display: grid;
 grid-column: 1 / -1;
 grid-row: 1 / span 2;
 grid-template-columns: subgrid;
 grid-template-rows: subgrid;
 margin: 0;
}
.cover-well {
 grid-column: 1;
 grid-row: 1;
 aspect-ratio: 4 / 5;
 overflow: hidden;
 background: var(--paper-deep);
}
/* The transparent square crops only its empty margin in the 4:5 well (every visible pixel lies within x 21 to 79%). */
.cover-well img {
 width: 100%;
 height: 100%;
 object-fit: cover;
}
.product-cover figcaption,
.product-photo figcaption {
 font-size: var(--text-xs);
 line-height: 1.45;
 color: var(--muted);
}
.product-cover figcaption {
 grid-column: 1 / -1;
 grid-row: 2;
 margin-top: 6px;
}
.product-photo {
 display: none;
 margin: 0;
}
.product-identity {
 grid-column: 2;
 grid-row: 1;
 align-self: center;
 min-width: 0;
}
.product-info > :not(.product-identity) {
 grid-column: 1 / -1;
}

/* Identity: the record line is the eyebrow, then the title and byline. */
.product-identity .record-line {
 align-items: flex-start;
 margin: 0 0 var(--space-2);
 font-size: 12px;
}
.product-identity .record-line::before {
 margin-top: calc(.675em - 2px);
}
.product-identity h1 {
 margin: 0 0 var(--space-2);
 font-size: clamp(28px, 7.7vw, 32px);
 line-height: 1.04;
 letter-spacing: -.02em;
 overflow-wrap: break-word;
}
.book-byline {
 margin: 0;
 line-height: 1.35;
}
.book-author {
 font-size: var(--text-m);
 color: var(--ink);
}
.book-published {
 display: block;
 font-size: var(--text-s);
 color: var(--muted);
}
.byline-dot {
 display: none;
}

/* Edition picker: two radio tiles side by side; the selected tile is scarlet, unselected tiles use the control grey. */
.format-picker {
 min-width: 0;
 margin: var(--space-4) 0 0;
 padding: 0;
 border: 0;
}
.format-picker legend {
 padding: 0;
 margin-bottom: 6px;
 font-size: var(--text-m);
 font-weight: 600;
 line-height: 22px;
}
.format-options {
 display: grid;
 grid-template-columns: repeat(2, minmax(0, 1fr));
 gap: var(--space-2);
}
.format-choice {
 display: flex;
 flex-direction: column;
 gap: 4px;
 min-width: 0;
 padding: 12px 12px 11px;
 border: 1px solid var(--control);
 background: var(--paper);
 cursor: pointer;
 transition: border-color .2s, background-color .2s;
}
@media (hover: hover) {
 .format-choice:hover {
  border-color: var(--ink);
 }
}
.format-choice:has(:checked) {
 border-color: var(--scarlet);
 background: var(--scarlet-wash);
 box-shadow: inset 0 0 0 1px var(--scarlet);
}
.format-choice:has(:focus-visible) {
 outline: 2px solid var(--ink);
 outline-offset: 3px;
}
.format-head {
 display: flex;
 align-items: center;
 gap: 10px;
 min-width: 0;
}
.format-choice input {
 appearance: none;
 display: grid;
 place-content: center;
 flex: none;
 width: 18px;
 height: 18px;
 min-height: 0;
 margin: 0;
 padding: 0;
 border: 1px solid var(--control);
 border-radius: 50%;
 background: var(--paper-bright);
 cursor: pointer;
}
.format-choice input::before {
 content: "";
 width: 8px;
 height: 8px;
 border-radius: 50%;
 background: var(--scarlet);
 transform: scale(0);
 transition: transform .25s var(--ease-out);
}
.format-choice input:checked {
 border-color: var(--scarlet);
}
.format-choice input:checked::before {
 transform: scale(1);
}
.format-choice input:focus-visible {
 outline: none;
}
.format-name {
 font-size: var(--text-m);
 font-weight: 600;
 line-height: 22px;
}
.format-line {
 display: flex;
 flex-wrap: wrap;
 align-items: baseline;
 gap: 0 var(--space-2);
}
.format-price {
 font: 400 24px/26px var(--serif);
 letter-spacing: -.01em;
 font-variant-numeric: lining-nums;
 color: var(--ink);
}
.format-detail {
 font-size: var(--text-s);
 line-height: 1.3;
 color: var(--muted);
 white-space: nowrap;
}
.format-soon {
 margin: var(--space-2) 0 0;
 font-size: var(--text-s);
 line-height: 1.45;
 color: var(--muted);
}
/* A link asking for a format that is not ready (?format=audio or bundle) lands on Hardcover with this line marked. */
.format-soon.is-highlighted {
 font-weight: 600;
 color: var(--ink);
}

/* Total before the click: one line, the figure in Newsreader, the breakdown muted at the end. */
.order-total {
 display: flex;
 flex-wrap: wrap;
 align-items: baseline;
 gap: 0 var(--space-3);
 margin: var(--space-2) 0 0;
 padding-top: 6px;
 border-top: 1px solid var(--rule);
}
.order-total-label {
 font-size: var(--text-m);
 font-weight: 600;
}
.order-total-figure {
 font: 400 28px/32px var(--serif);
 letter-spacing: -.015em;
 font-variant-numeric: lining-nums;
 color: var(--ink);
}
.order-breakdown {
 margin-left: auto;
 font-size: var(--text-s);
 color: var(--muted);
}
.product-buy {
 width: 100%;
 margin-top: var(--space-2);
}
.product-info .checkout-status {
 max-width: 56ch;
 margin: var(--space-2) 0 0;
}
/* Second action under the order button: keep browsing with this edition in the cart. */
.product-add {
 width: 100%;
 margin-top: var(--space-2);
}
.product-add[hidden] {
 display: none;
}
.product-add:disabled {
 cursor: default;
 opacity: 1;
 color: var(--muted);
 border-color: var(--rule-strong);
 background: transparent;
}
.order-launch-note {
 margin: var(--space-1) 0 0;
 font-size: var(--text-s);
 color: var(--ink-soft);
}
.order-launch-note[hidden] {
 display: none;
}

/* A coming-soon edition is a quiet, disabled statement, never a faded scarlet button. */
.product-buy[aria-disabled="true"],
.buy-bar-button[aria-disabled="true"],
.product-buy[aria-disabled="true"]:hover,
.buy-bar-button[aria-disabled="true"]:hover {
 background: var(--paper-deep);
 border: 1px dashed var(--control);
 color: var(--muted);
 cursor: not-allowed;
 transform: none;
}
.product-buy[aria-disabled="true"] svg {
 display: none;
}

/* Edition notes: small square bullets, one list per edition. */
.product-assurances {
 display: grid;
 gap: 6px;
 margin: var(--space-5) 0 0;
 padding: 0;
 list-style: none;
 font-size: var(--text-s);
 line-height: 1.45;
 color: var(--ink-soft);
}
.product-assurances li {
 display: grid;
 grid-template-columns: 5px minmax(0, 1fr);
 gap: var(--space-3);
}
.product-assurances li::before {
 content: "";
 width: 5px;
 height: 5px;
 margin-top: calc(.725em - 2.5px);
 background: var(--ink-soft);
}

/* Upsell: the matching set, ruled and quiet; no scarlet fill. */
.bundle-upsell {
 margin-top: var(--space-5);
 padding: var(--space-4) var(--space-4) var(--space-2);
 border: 1px solid var(--rule);
 background: var(--paper);
}
.bundle-upsell h2 {
 margin: 0 0 var(--space-1);
 font-size: var(--text-l);
 line-height: 1.3;
 letter-spacing: -.01em;
}
.bundle-upsell-offer {
 margin: 0;
 font-size: 15px;
 line-height: 1.5;
}
.bundle-upsell-math {
 margin: 2px 0 0;
 font-size: var(--text-s);
 line-height: 1.5;
 color: var(--muted);
}
.bundle-upsell .text-link {
 display: inline-flex;
 align-items: center;
 min-height: 44px;
 padding-block: 0;
}

/* Details: vertical accordions with the shared plus and minus mark. */
.product-details {
 margin-top: var(--space-6);
 border-top: 1px solid var(--ink);
}
.product-details details {
 border-bottom: 1px solid var(--rule);
}
.product-details summary {
 list-style: none;
 display: flex;
 align-items: center;
 justify-content: space-between;
 gap: var(--space-4);
 min-height: 52px;
 padding-block: var(--space-2);
 font: 600 var(--text-m)/1.35 var(--sans);
 cursor: pointer;
 transition: color .2s;
}
.product-details summary::-webkit-details-marker {
 display: none;
}
.product-details summary::after {
 content: "";
 flex: none;
 width: 14px;
 height: 14px;
 background:
  linear-gradient(currentColor, currentColor) center / 14px 1.5px no-repeat,
  linear-gradient(currentColor, currentColor) center / 1.5px 14px no-repeat;
 transition: transform .35s var(--ease-out);
}
.product-details details[open] summary::after {
 transform: rotate(45deg);
}
/* Hover only where a pointer hovers: a tapped row on a phone must not stay scarlet. */
@media (hover: hover) {
 .product-details summary:hover {
  color: var(--scarlet);
 }
}
.product-details-body {
 padding-bottom: var(--space-5);
}
.product-details-body p {
 max-width: 62ch;
 margin: 0 0 var(--space-3);
 font-size: 15px;
 line-height: 1.6;
 color: var(--ink-soft);
}
.product-details-body p:last-child {
 margin-bottom: 0;
}
.product-details-body .text-link {
 display: inline-flex;
 align-items: center;
 min-height: 44px;
 padding-block: 0;
}
.product-details .book-synopsis {
 font: 400 17px/1.6 var(--serif);
 color: var(--ink-soft);
}
.print-specs {
 display: grid;
 grid-template-columns: repeat(2, minmax(0, 1fr));
 gap: var(--space-4) var(--space-5);
 margin: 0;
}
.print-specs div {
 min-width: 0;
 padding-top: var(--space-2);
 border-top: 1px solid var(--rule);
}
.print-specs dt {
 margin-bottom: 2px;
 font: 400 12px/1.35 var(--label);
 letter-spacing: .1em;
 text-transform: uppercase;
 color: var(--muted);
}
.print-specs dd {
 margin: 0;
 font: 400 var(--text-m)/1.35 var(--serif);
 color: var(--ink);
}

/* The record: an archive stamp (label, year, record line) beside the history and a place to start. */
.book-record {
 display: grid;
 gap: var(--space-6);
 padding: var(--section) var(--gutter);
 border-top: 1px solid var(--rule);
}
.record-stamp {
 display: grid;
 grid-template-columns: auto minmax(0, 1fr);
 grid-template-areas: "title title" "year label";
 align-items: end;
 gap: var(--space-2) var(--space-4);
 width: fit-content;
 min-width: 220px;
 padding: var(--space-4) var(--space-5) var(--space-5);
 border: 1px solid var(--ink);
}
.record-stamp p {
 margin: 0;
}
.record-stamp-title {
 grid-area: title;
 padding-bottom: var(--space-2);
 border-bottom: 1px solid var(--rule);
 font-size: 12px;
 color: var(--muted);
}
.record-stamp-year {
 grid-area: year;
 font: 500 48px/.9 var(--label);
 letter-spacing: -.01em;
 font-variant-numeric: lining-nums;
 color: var(--ink);
}
.record-stamp-label {
 grid-area: label;
 padding-bottom: 3px;
}
/* One measure for the whole body, so the history, the rule and "A place to start" share a right edge. */
.record-body {
 min-width: 0;
 max-width: 40rem;
}
/* Section headings sit one step below the product title at every width. */
.record-body h2,
.more-books-head h2,
.product-page .questions h2 {
 font-size: var(--display-3);
}
.record-body h2 {
 max-width: 18ch;
 margin-bottom: var(--space-4);
}
.record-history {
 margin: 0 0 var(--space-2);
 font: 400 var(--text-l)/1.6 var(--serif);
 color: var(--ink-soft);
}
.record-body > .text-link {
 display: inline-flex;
 align-items: center;
 min-height: 44px;
 padding-block: 0;
}
.record-start {
 margin-top: var(--space-6);
 padding-top: var(--space-5);
 border-top: 1px solid var(--rule);
}
.record-start h3 {
 margin: 0 0 var(--space-2);
}
.record-start p {
 margin: 0 0 var(--space-1);
 font: 400 17px/1.6 var(--serif);
 color: var(--ink-soft);
}
.record-start .sample-link {
 display: inline-flex;
 align-items: center;
 min-height: 44px;
 padding-block: 0;
}

/* More books: the other four titles as product cards. */
.more-books {
 padding: var(--section) var(--gutter) var(--space-7);
 border-top: 1px solid var(--rule);
}
.more-books-head {
 display: flex;
 flex-wrap: wrap;
 align-items: center;
 justify-content: space-between;
 gap: 0 var(--space-4);
 margin-bottom: var(--space-5);
}
.more-books-head h2 {
 margin: 0;
}
.more-books-head .text-link {
 display: inline-flex;
 align-items: center;
 min-height: 44px;
 padding-block: 0;
}

/* Questions use the shared .questions section; keep the top rule when the closed-store entry hides. */
.questions details[data-when-closed][hidden] + details {
 border-top: 1px solid var(--rule);
}
.questions-more {
 display: inline-flex;
 align-items: center;
 min-height: 44px;
 margin-top: var(--space-4);
}

/* Buy bar below 1024 (and on short landscape screens): mirrors #buy once it has scrolled away.
   product.js writes the bar's measured height to --buy-bar-height, so content and focused items stay clear of it. */
.buy-bar {
 position: fixed;
 left: 0;
 right: 0;
 bottom: 0;
 z-index: 25;
 display: flex;
 align-items: center;
 justify-content: space-between;
 gap: var(--space-4);
 padding: var(--space-3) var(--gutter) max(var(--space-3), env(safe-area-inset-bottom));
 background: var(--paper);
 border-top: 1px solid var(--ink);
 box-shadow: 0 -12px 24px -20px rgba(29, 34, 33, .45);
}
/* Format and total share the first line (the name truncates first); the closed-store note takes the second. */
.buy-bar-summary {
 display: flex;
 flex-wrap: wrap;
 align-items: baseline;
 column-gap: var(--space-2);
 min-width: 0;
 margin: 0;
 line-height: 1.25;
}
.buy-bar-format {
 min-width: 0;
 font-size: var(--text-s);
 font-weight: 600;
 white-space: nowrap;
 overflow: hidden;
 text-overflow: ellipsis;
}
.buy-bar-total {
 flex: none;
 font-size: var(--text-s);
 white-space: nowrap;
 color: var(--muted);
}
.buy-bar-total span {
 font: 400 22px/1.1 var(--serif);
 font-variant-numeric: lining-nums;
 color: var(--ink);
}
.buy-bar-note {
 flex-basis: 100%;
 font-size: var(--text-s);
 color: var(--muted);
}
.buy-bar-button {
 flex: none;
 min-height: 48px;
 padding: 0 16px;
 font-size: var(--text-s);
}
body.has-buy-bar {
 padding-bottom: var(--buy-bar-height, 74px);
}
html:has(body.has-buy-bar) {
 scroll-padding-bottom: calc(var(--buy-bar-height, 74px) + var(--space-4));
}
@media (prefers-reduced-motion: no-preference) {
 .buy-bar {
  transition: transform .35s var(--ease-out);
 }
 @starting-style {
  .buy-bar {
   transform: translateY(100%);
  }
 }
}
@media (min-width: 1024px) and (min-height: 501px) {
 .buy-bar {
  display: none !important;
 }
}

/* Narrowest phones: the tiles stack. */
@media (max-width: 359px) {
 .format-options {
  grid-template-columns: minmax(0, 1fr);
 }
}

/* Tablet: the identity row grows to a 220px cover; the decision stays full width. */
@media (min-width: 768px) {
 .product-main {
  grid-template-columns: 220px minmax(0, 1fr);
  column-gap: var(--space-5);
 }
 .product-identity .record-line {
  margin-bottom: var(--space-3);
  font-size: 13px;
 }
 .product-identity h1 {
  font-size: 40px;
  line-height: 1.05;
  margin-bottom: var(--space-3);
 }
 .book-published {
  display: inline;
 }
 .byline-dot {
  display: inline;
 }
 .format-picker {
  margin-top: var(--space-4);
 }
 .format-choice {
  padding-inline: var(--space-4);
 }
 .bundle-upsell {
  padding-inline: var(--space-5);
 }
 .print-specs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
 }
 .record-history {
  font-size: var(--text-xl);
 }
}

/* Tablet only: the identity column has room, so the cover caption sits beside the cover's foot instead of under it. */
@media (min-width: 768px) and (max-width: 1023px) {
 .product-cover figcaption {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  margin-top: 0;
 }
}

/* Desktop: media column (cover well, then the staged photo) beside the info column, 6/6 and 7/5 from 1440.
   The record and the questions reuse the same two columns, so the buy box, the history and the answers share one left edge. */
@media (min-width: 1024px) {
 .product-page {
  --pdp-columns: repeat(2, minmax(0, 1fr));
  --pdp-gap: clamp(40px, 4.5vw, 72px);
 }
 .product-main,
 .book-record,
 .product-page .questions {
  grid-template-columns: var(--pdp-columns);
  column-gap: var(--pdp-gap);
 }
 .product-main {
  padding-top: var(--space-1);
  padding-bottom: var(--space-9);
 }
 /* The shorter column stays in view beside the taller one (Shopify Dawn's sticky product column), so neither
    side runs on alone beside an empty column. Keyboard focus inside the info column releases it to the normal
    flow, so a focused control is never pinned out of view. */
 .product-media,
 .product-info {
  position: sticky;
  top: calc(var(--header) + var(--space-5));
  align-self: start;
  min-width: 0;
 }
 .product-info:has(:focus-visible) {
  position: static;
 }
 .product-media {
  display: grid;
  gap: var(--space-6);
 }
 .product-info {
  display: block;
 }
 .product-cover {
  display: block;
  grid-column: auto;
  grid-row: auto;
 }
 /* Square, but never taller than the first screen allows, so the illustrative-cover caption stays above the fold. */
 .cover-well {
  width: 100%;
  max-height: max(360px, calc(100svh - 236px));
  aspect-ratio: 1;
 }
 .cover-well img {
  object-fit: contain;
 }
 .product-cover figcaption,
 .product-photo figcaption {
  margin-top: var(--space-2);
 }
 .product-photo {
  display: block;
 }
 .product-photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  background: var(--paper-deep);
 }
 .product-identity .record-line {
  margin-bottom: var(--space-3);
 }
 .product-identity h1 {
  font-size: 52px;
  line-height: 1.02;
  letter-spacing: -.025em;
 }
 .book-author {
  font-size: var(--text-m);
 }
 .format-picker {
  margin-top: var(--space-5);
 }
 .print-specs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
 }

 /* The stamp travels beside the history, like the Questions heading, instead of leaving the left column empty;
    the tagline takes the body's full measure rather than breaking at 18ch. */
 .record-stamp {
  position: sticky;
  top: calc(var(--header) + var(--space-6));
  grid-column: 1;
  justify-self: start;
  align-self: start;
 }
 .record-body {
  grid-column: 2;
 }
 .record-body h2 {
  max-width: none;
 }
}
@media (min-width: 1440px) {
 .product-page {
  --pdp-columns: minmax(0, 7fr) minmax(0, 5fr);
 }
}

/* Forced colours drop backgrounds and box shadows: draw the selected edition, the bullets and the accordion
   marks in system colours so the state stays visible. */
@media (forced-colors: active) {
 .format-choice input::before,
 .product-assurances li::before {
  forced-color-adjust: none;
  background: CanvasText;
 }
 .format-choice:has(:checked) {
  border-color: Highlight;
  outline: 2px solid Highlight;
  outline-offset: -3px;
 }
 .format-choice:has(:focus-visible) {
  outline: 2px solid CanvasText;
  outline-offset: 3px;
 }
 .product-details summary::after {
  forced-color-adjust: none;
  color: CanvasText;
 }
}
