@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

/* ─── Design Tokens ─────────────────────────────────────────────── */
:root {
  --color-bg:      #ffffff;
  --color-accent:  #0000FF;
  --color-nav:     #0000FF;

  --space:         10px;
  --columns:       4;
  --col-gap:       10px;
  --edge-margin:   10px;
}

/* ─── Reset / Base ──────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Space Mono', sans-serif;
  background-color: var(--color-bg);
  color: var(--color-accent);
  line-height: 1.1;
  letter-spacing: -0.03em;
  word-spacing: -0.1em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}


/* ─── Grid ──────────────────────────────────────────────────────── */
/*
  4-column grid, 10px margins left/right, 10px gaps.
  Used as a utility on any full-width container that needs the grid.
*/
.grid {
  display: grid;
  grid-template-columns: repeat(var(--columns), 1fr);
  gap: var(--col-gap);
  padding-left: var(--edge-margin);
  padding-right: var(--edge-margin);
}

/* ─── SECTION 1 — Hero Video ────────────────────────────────────── */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* iOS/iPadOS Safari: use svh so hero matches the actual visible viewport
   with browser chrome present — prevents hero from peeking after scroll */
@supports (height: 100svh) {
  @media (max-width: 1024px) {
    .hero {
      height: 100svh;
    }
  }
}

.hero__click-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
}

.hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
}

.hero__logo {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.hero__logo-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: block;
  pointer-events: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 40%;
}

.hero__logo img {
  display: block;
  width: 100%;
  height: auto;
  animation: spin 10s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ─── SECTION 2 — Sticky Header ─────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-bg);
}

.site-header__inner {
  display: flex;
  flex-direction: column;
  padding: 20px 20px var(--space);
  gap: var(--space);
}

.site-header__logo {
  display: block;
  width: 100%;
  position: relative;
  overflow: visible;
}

.site-header__logo a {
  display: block;
  width: 100%;
}

.site-header__logo img {
  display: block;
  height: auto;
  width: 100%;
  max-width: 100%;
}


.site-header__bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.site-header__nav-left {
  display: flex;
  flex-direction: row;
  gap: 9px;
}

.site-header__nav-right {
  display: flex;
  flex-direction: row;
  gap: var(--space);
}

.back-btn {
  display: block;
  width: 100%;
  text-align: right;
  padding: var(--space) 20px var(--space);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Space Mono', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-accent);
  letter-spacing: -0.03em;
  word-spacing: -0.1em;
}

.back-btn:hover {
  font-weight: 700;
}

.site-header__rule {
  display: block;
  border: none;
  height: 2px;
  background-color: var(--color-accent);
  margin: 0 20px;
}

.header-back-btn {
  position: absolute;
  top: 100%;
  margin-top: var(--space);
  right: 20px;
  z-index: 150;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: 'Space Mono', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-accent);
  letter-spacing: -0.03em;
  word-spacing: -0.1em;
  padding: 0;
  line-height: 1;
}

.header-back-btn:hover {
  font-weight: 700;
}

.nav-link {
  display: block;
  font-family: 'Space Mono', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-nav);
  text-decoration: none;
  letter-spacing: -0.03em;
  line-height: 1;
  transition: font-weight 0.1s ease;
}

.nav-link--active,
.nav-link:hover,
.nav-link:focus-visible {
  font-weight: 700;
}

/* ─── Sticky footer layout (terms2) ─────────────────────────────── */
.sticky-footer-layout {
  height: 100vh;
  overflow: hidden;
  display: block;
  position: relative;
}

.sticky-footer-layout .site-header {
  position: sticky;
  top: 0;
  z-index: 200;
}

.sticky-footer-layout .page-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
}

.sticky-footer-layout .site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--color-bg);
  z-index: 150;
  display: flex;
  flex-direction: column;
  margin-top: 0;
}

.sticky-footer-layout .site-footer__pre {
  display: none;
}

.contact-page .page-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.contact-page .about-section {
  flex: 1;
  min-height: 0;
  padding-bottom: 0;
}

.about-page .page-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.about-page .about-section {
  flex: 1;
  min-height: 0;
  padding-bottom: 0;
}

.about-page .about-image {
  object-fit: cover;
  object-position: center;
}

.contact-page .about-body {
  justify-content: space-between;
  gap: 0;
}

.contact-page .contact-form {
  display: contents;
}

.contact-page .contact-submit {
  margin-bottom: 0;
  margin-top: 0;
}

/* ─── Page Content ──────────────────────────────────────────────── */
.page-content {
  position: relative;
  z-index: 1;
  flex: 1;
  margin-bottom: 10px;
}

/* ─── Books Grid ─────────────────────────────────────────────────── */
.books-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 20px 20px var(--space);
}

.book-item {
  display: flex;
  flex-direction: column;
  padding: 0 8px;
}

.book-item__cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  display: block;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.book-item a:hover .book-item__cover,
.book-item a:hover img {
  transform: scale(1.01);
}

.book-item__cover.is-sold-out {
  filter: grayscale(80%) brightness(0.93);
  opacity: 0.8;
  transition: filter 0.3s ease, opacity 0.3s ease;
}

.book-item a:hover .book-item__cover.is-sold-out {
  filter: none;
  opacity: 1;
}

.book-item a {
  display: block;
  overflow: hidden;
}


.book-item__cover--placeholder {
  background-color: #d9d9d9;
}

.book-item__caption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--space);
}

.book-item__title {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
}

a.book-item__title {
  text-decoration: none;
}

a.book-item__title:hover {
  text-decoration: underline;
}

.book-item__publisher {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-accent);
}

.book-item__price {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
}

/* ─── Product Page ───────────────────────────────────────────────── */
.product-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--col-gap);
  padding: 20px 20px var(--space);
  align-items: start;
}

.product-cover {
  grid-column: 1 / 2;
}

.product-cover img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.product-cover--natural img {
  aspect-ratio: unset;
  object-fit: unset;
}

.product-info {
  grid-column: 2 / 3;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: var(--col-gap);
}

.product-info__header {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.product-info__body {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 10px;
}

.product-info__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
}

.product-info__publisher {
  font-size: 14px;
  font-weight: 400;
  color: var(--color-accent);
}

.product-info__year {
  font-size: 14px;
  font-weight: 400;
  color: var(--color-accent);
}

.product-info__price {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 10px;
}

.product-info__description {
  font-size: 14px;
  font-weight: 400;
  color: var(--color-accent);
  line-height: 1.2;
  margin-top: 10px;
}

.product-info__specs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 10px;
}

.product-info__specs p {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
}

.product-actions {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space);
  width: fit-content;
  align-self: stretch;
}

.product-actions .quantity-selector {
  flex: 1;
}

.product-actions .add-to-cart-btn {
  flex: 1;
}

.quantity-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--color-accent);
  width: 100%;
  box-sizing: border-box;
}

.qty-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Space Mono', sans-serif;
  font-size: 18px;
  font-weight: 400;
  color: var(--color-accent);
  padding: 8px 12px;
  line-height: 1;
}

.qty-btn:hover {
  background-color: var(--color-accent);
  color: #ffffff;
}

.qty-value {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-accent);
}

.add-to-cart-btn {
  width: 100%;
  background-color: var(--color-accent);
  color: #ffffff;
  border: none;
  cursor: pointer;
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.03em;
  padding: 10px 14px;
  white-space: nowrap;
}

.add-to-cart-btn:hover {
  opacity: 0.85;
}

/* ─── Spread Images ──────────────────────────────────────────────── */
.spreads-section {
  padding: var(--space) 20px 20px;
}

.spreads-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--col-gap);
}

.spread-placeholder {
  grid-column: span 2;
  height: 400px;
  background-color: #d9d9d9;
}

.spread-image {
  grid-column: span 2;
  width: 100%;
  height: auto;
  display: block;
  min-width: 0;
  max-width: 100%;
}

.spread-image--landscape {
  aspect-ratio: 4 / 3;
  object-fit: contain;
  object-position: left;
}

.spread-image--ls-back {
  aspect-ratio: 1385 / 983;
  object-fit: contain;
  object-position: left;
}

.spread-image--dm-back {
  aspect-ratio: 1341 / 918;
  object-fit: contain;
  object-position: left;
}

/* ─── Archive Grid ───────────────────────────────────────────────── */
.archive-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 20px 20px;
}

.archive-item {
  position: relative;
}

.archive-item img {
  display: block;
  width: 100%;
  height: auto;
}



.contact-image {
  grid-column: 3 / 5;
  grid-row: 1;
  width: 100%;
  height: auto;
  display: block;
  align-self: start;
}

/* Contact Form ───────────────────────────────────────────────── */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.contact-field {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.contact-label {
  font-family: 'Space Mono', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-accent);
  letter-spacing: -0.03em;
}

.contact-input {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-accent);
  background: none;
  border: none;
  border-bottom: 2px solid var(--color-accent);
  border-radius: 0;
  outline: none;
  padding: 6px 0;
  width: 100%;
  letter-spacing: -0.03em;
  word-spacing: -0.1em;
  resize: none;
  appearance: none;
  -webkit-appearance: none;
}

.contact-input--error {
  border-bottom-color: #ff0000;
}

.contact-textarea {
  line-height: 1.4;
}

.contact-submit {
  width: 100%;
  background-color: var(--color-accent);
  color: #ffffff;
  border: none;
  cursor: pointer;
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.03em;
  padding: 12px;
  margin-top: 4px;
  margin-bottom: 24px;
}

.contact-submit:hover {
  opacity: 0.85;
}

.contact-success {
  font-family: 'Space Mono', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: -0.03em;
}

/* ─── Back to top ────────────────────────────────────────────────── */
.site-footer__pre {
  display: flex;
  justify-content: flex-end;
  padding: 20px 20px 10px;
}

.back-to-top {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Space Mono', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-accent);
  letter-spacing: -0.03em;
  word-spacing: -0.1em;
  padding: 0;
}

.back-to-top:hover {
  font-weight: 700;
}

/* ─── Footer ─────────────────────────────────────────────────────── */
.site-footer {
  background-color: var(--color-bg);
  margin-top: 40px;
}

.site-footer__rule {
  display: block;
  border: none;
  height: 2px;
  background-color: var(--color-accent);
  margin: 0 20px;
}

.site-footer__bottom {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-end;
  padding: var(--space) 20px 20px;
}

.site-footer__links {
  display: flex;
  flex-direction: row;
  gap: 5px;
}

.site-footer__copyright {
  font-family: 'Space Mono', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-accent);
}

.site-footer__copyright .copyright-symbol {
  font-size: 0.75em;
  vertical-align: baseline;
}

.footer-br {
  display: none;
}

.back-to-top--bottom {
  display: none;
}

/* ─── About / Legal Pages ────────────────────────────────────────── */
.about-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--col-gap);
  padding: 20px 20px;
}

.about-body {
  grid-column: 1 / 2;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.legal-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.about-image {
  grid-column: 2 / 5;
  grid-row: 1;
  width: 100%;
  height: auto;
  display: block;
  align-self: start;
}

.section-rule {
  display: block;
  border: none;
  height: 2px;
  background-color: var(--color-accent);
  margin: 0;
}

.about-intro {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.about-intro--row {
  flex-direction: row;
  align-items: baseline;
  gap: var(--space);
}

.about-section-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.about-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-accent);
}

.about-subtitle {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
}

.about-text {
  font-size: 14px;
  font-weight: 400;
  color: var(--color-accent);
  line-height: 1.4;
}

/* ─── Inventory / Stock ──────────────────────────────────────────── */

.book-item__stock-label {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.book-item__stock-label--sold-out {
  color: #999999;
}

.book-item__stock-label--low {
  color: var(--color-accent);
}

.product-instagram {
  display: block;
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
  text-decoration: none;
  margin-top: 14px;
}

.product-instagram:hover {
  text-decoration: underline;
}

.product-instagram + .product-instagram {
  margin-top: 2px;
}

.product-stock-warning {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
}

.add-to-cart-btn.is-sold-out {
  background-color: #999999;
  cursor: not-allowed;
  opacity: 1;
}

/* ─── Cart Drawer ────────────────────────────────────────────────── */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cart-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 100vw;
  background: var(--color-bg);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s ease;
}

.cart-drawer.is-open {
  transform: translateX(0);
}

.cart-drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px var(--space);
  border-bottom: 2px solid var(--color-accent);
}

.cart-drawer__title {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
}

.cart-drawer__close {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Space Mono', sans-serif;
  font-size: 20px;
  color: var(--color-accent);
  line-height: 1;
  padding: 0;
}

.cart-drawer__items {
  flex: 1;
  overflow-y: auto;
  padding: var(--space) 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cart-drawer__empty {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  color: var(--color-accent);
}

.cart-item {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: var(--space);
  align-items: start;
}

.cart-item__img {
  width: 70px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}

.cart-item__details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cart-item__title {
  display: block;
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
}

.cart-item__publisher {
  display: block;
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-accent);
}

.cart-item__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.cart-item__qty-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-item__qty-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Space Mono', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-accent);
  padding: 0;
  line-height: 1;
}

.cart-item__qty-btn:hover {
  font-weight: 700;
}

.cart-item__qty-val {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-accent);
  min-width: 16px;
  text-align: center;
}

.cart-item__price {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
}

.cart-drawer__footer {
  padding: var(--space) 20px 20px;
  border-top: 2px solid var(--color-accent);
  display: flex;
  flex-direction: column;
  gap: var(--space);
}

.cart-drawer__total {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
  display: flex;
  justify-content: space-between;
}

.cart-drawer__region {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-drawer__region-label {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-accent);
}

.cart-drawer__region-select {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  background: var(--color-bg);
  padding: 4px 8px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.cart-drawer__checkout-btn {
  width: 100%;
  background-color: var(--color-accent);
  color: #ffffff;
  border: none;
  cursor: pointer;
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.03em;
  padding: 12px;
  white-space: nowrap;
}

.cart-drawer__checkout-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Stripe Checkout Overlay ────────────────────────────────────── */
.stripe-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 300;
  display: none;
  flex-direction: column;
  overflow-y: auto;
}

.stripe-overlay.is-open {
  display: flex;
}

.stripe-overlay__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px var(--space);
  border-bottom: 2px solid var(--color-accent);
  flex-shrink: 0;
}

.stripe-overlay__label {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
}

.stripe-overlay__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

#checkout {
  flex: 1;
  padding: 20px;
}

/* ─── Return / Confirmation Page ─────────────────────────────────── */
.return-page {
  display: flex;
  align-items: flex-start;
  padding: 40px 20px;
}

.return-message {
  font-family: 'Space Mono', sans-serif;
  font-size: 14px;
  color: var(--color-accent);
  display: flex;
  flex-direction: column;
  gap: var(--space);
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Tablet (≤768px) ───────────────────────────────────────────── */
@media (max-width: 768px) {

  .books-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Spread images full width on tablet */
  .spreads-grid {
    grid-template-columns: 1fr;
  }
  .spread-image {
    grid-column: span 1 !important;
  }

  /* Archive: 2-column, override all inline spans to auto-place */
  .archive-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .archive-grid > * {
    grid-column: auto !important;
    grid-row: auto !important;
  }
  /* Full-width items remain full-width */
  .archive-grid > [style*="grid-column:1/5"],
  .archive-grid > [style*="grid-column:1/4"] {
    grid-column: 1 / -1 !important;
  }

  /* Cart: full width */
  .cart-drawer {
    width: 100%;
  }
}

/* ─── Mobile (≤480px) ───────────────────────────────────────────── */
@media (max-width: 480px) {

  html, body {
    overflow-x: clip;
  }

  /* ── Reader figure: remove desktop pixel nudges, keep proportional scale */
  .site-header__logo a[href="archive.html"] {
    transform: scale(0.92) !important;
  }

  /* ── Hero: dvh so hero tracks the live viewport as browser chrome hides */
  @supports (height: 100dvh) {
    .hero {
      height: 100dvh;
    }
  }

  /* ── Hero GIF ─────────────────────────────────────── */
  .hero__logo-btn {
    width: calc(150% - 60px);
    max-width: calc(150% - 60px);
  }

  /* ── Header ───────────────────────────────────────── */
  .site-header__inner {
    padding: 12px 20px;
  }

  /* ── Books grid: 2 columns ──────────────────────────── */
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding-bottom: 100px;
  }

  /* ── Product pages ────────────────────────────────── */
  .product-section {
    grid-template-columns: 1fr;
  }
  .product-cover {
    grid-column: 1;
    grid-row: 1;
  }
  .product-info {
    grid-column: 1 !important;
    grid-row: 2;
    grid-template-columns: 1fr;
  }
  .product-info__header {
    grid-column: 1;
    grid-row: 1;
  }
  .product-actions {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    align-self: auto;
  }
  .product-actions .add-to-cart-btn {
    width: 100%;
  }
  .quantity-selector {
    width: 100%;
  }
  .product-info__body {
    grid-column: 1 !important;
    grid-row: 3;
  }

  /* Spread images: full width, 1 column */
  .spreads-grid {
    grid-template-columns: 1fr;
  }
  .spread-image {
    grid-column: span 1 !important;
  }
  .spread-image--landscape,
  .spread-image--ls-back,
  .spread-image--dm-back {
    aspect-ratio: unset;
    object-fit: unset;
    object-position: unset;
  }

  /* ── Archive: 1 column ────────────────────────────── */
  .archive-grid {
    grid-template-columns: 1fr;
  }
  .archive-grid > * {
    grid-column: 1 !important;
    grid-row: auto !important;
  }
  /* Sub-grid wrapper: collapse to 1 column */
  .archive-grid > [style*="display:grid"] {
    grid-template-columns: 1fr !important;
  }

  /* ── About/Contact/Legal: single column ──────────── */
  .about-section {
    grid-template-columns: 1fr;
  }
  .about-body {
    gap: 20px;
  }

  /* About page: flex column, image fills remaining height */
  .about-page .about-section {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .about-page .about-body {
    flex-shrink: 0;
  }
  .about-page .about-image {
    display: block;
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    object-fit: cover;
    object-position: center;
  }

  /* Contact page: hide image, form full width */
  .contact-image-wrap {
    display: none !important;
  }
  .contact-page .about-body {
    grid-column: 1 / -1 !important;
  }

  /* Legal page: hide telephone booth image */
  .legal-page .about-section > img {
    display: none !important;
  }
  .legal-page .about-body {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
  }

  /* ── Footer: mobile layout ──────────────────────── */
  .site-footer__rule {
    display: none;
  }
  .site-footer__pre {
    display: none;
  }
  .back-to-top--bottom {
    display: block;
    flex-shrink: 0;
    padding-bottom: var(--space);
  }
  .site-footer__bottom {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
  }
  .site-footer__links {
    flex: 1;
    flex-direction: row;
    padding-bottom: var(--space);
    border-bottom: none;
    margin-bottom: 0;
  }
  .site-footer__copyright {
    width: 100%;
    border-top: 2px solid var(--color-accent);
    padding-top: var(--space);
  }
  #legal-back-to-top {
    display: none;
  }
  .footer-br {
    display: block;
  }
}

/* ─── iPad Pro (1024px–1366px) ──────────────────────────────────── */
@media (min-width: 1024px) and (max-width: 1366px) {
  .books-grid {
    min-height: 100vh;
  }
}

/* ─── Tablet (768px–1366px) ─────────────────────────────────────── */
@media (min-width: 768px) and (max-width: 1366px) {

  /* Hero GIF: 125% larger than desktop */
  .hero__logo-btn {
    max-width: 90%;
  }

  /* Books grid: 2 columns */
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Product pages: 2 column grid */
  .product-section {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-cover {
    grid-column: 1;
  }

  .product-info {
    grid-column: 2;
  }

  /* Spread images: interior spans full width, back cover left column only */
  .spreads-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .spread-image {
    grid-column: span 2;
  }

  .spread-image--landscape,
  .spread-image--ls-back,
  .spread-image--dm-back {
    grid-column: span 1;
  }
}
