/* ==========================================================================
   Spalding Publishing — mmCMS v3 theme 1.0.0
   Brand: black header, SP mark, Spalding red. Editorial serif headings (Playfair Display) over
   Inter body. Core views (Shop, Blog, Pages, ContactForm) are styled here, never forked.
   ========================================================================== */

:root {
  --sp-red: #cf2e2e;
  --sp-red-dark: #a82222;
  --sp-ink: #141414;
  --sp-text: #262626;
  --sp-muted: #5d5d5d;
  --sp-paper: #faf8f5;
  --sp-line: #e8e3dc;
  --sp-radius: 14px;
  --sp-shadow: 0 1px 2px rgba(20, 20, 20, .06), 0 8px 24px rgba(20, 20, 20, .06);
  --sp-shadow-lift: 0 2px 4px rgba(20, 20, 20, .08), 0 18px 40px rgba(20, 20, 20, .12);
  --sp-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sp-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --sp-max: 1180px;

  /* tokens the core views read */
  --color-primary: var(--sp-red);
  --color-accent: var(--sp-red-dark);
  --color-dark: var(--sp-ink);
  --color-text: var(--sp-text);
}

/* ---------- base ---------- */
html { scroll-behavior: smooth; }
body {
  font-family: var(--sp-sans);
  color: var(--sp-text);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { color: var(--sp-ink); letter-spacing: -0.01em; }
a { color: var(--sp-red); }
a:hover { color: var(--sp-red-dark); }
:focus-visible { outline: 3px solid rgba(207, 46, 46, .45); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; height: auto; }

/* The core layout's <main> has no container: every direct child is centred at the site width,
   except blocks that are deliberately full-bleed (.sp-bleed). */
#main-content { padding: clamp(28px, 5vw, 56px) 20px clamp(48px, 7vw, 88px); min-height: 55vh; }
#main-content > :not(.sp-bleed) { max-width: var(--sp-max) !important; margin-left: auto !important; margin-right: auto !important; }
#main-content:has(> .sp-bleed) { padding: 0; }

/* ---------- buttons ---------- */
.sp-btn, .btn-primary, .sp-prose a.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .8em 1.5em; border-radius: 999px; border: 2px solid var(--sp-red);
  background: var(--sp-red); color: #fff !important; font-weight: 600; font-size: .95rem;
  text-decoration: none !important; line-height: 1.2; cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s, box-shadow .2s;
}
.sp-btn:hover, .btn-primary:hover { background: var(--sp-red-dark); border-color: var(--sp-red-dark); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(207, 46, 46, .25); }
.sp-btn--ghost { background: transparent; color: var(--sp-ink) !important; border-color: var(--sp-ink); }
.sp-btn--ghost:hover { background: var(--sp-ink); border-color: var(--sp-ink); color: #fff !important; box-shadow: none; }
.btn-full { width: 100%; }

/* ---------- header ---------- */
.sp-header.header {
  position: fixed; top: var(--header-top-offset, 0); left: 0; right: 0; z-index: 1000;
  background: rgba(10, 10, 10, .96); backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .06); box-shadow: none; padding: 0;
  transition: box-shadow .25s, background .25s;
}
.sp-header.header.scrolled { background: rgba(10, 10, 10, .92); box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
.sp-header__inner {
  max-width: var(--sp-max); margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 28px;
}
.sp-brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: #fff; min-width: 0; }
.sp-brand__mark { width: 52px; height: 52px; border-radius: 50%; flex: none; transition: width .25s, height .25s; }
.sp-header.scrolled .sp-brand__mark { width: 42px; height: 42px; }
.sp-brand__text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sp-brand__name { font-family: var(--sp-serif); font-weight: 700; font-size: 1.3rem; color: #fff; letter-spacing: .01em; }
.sp-brand__tagline { font-size: .78rem; color: rgba(255, 255, 255, .62); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-brand:hover .sp-brand__name { color: #fff; }

.sp-nav.nav { margin-left: auto; }
.sp-nav__list { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.sp-nav__link {
  display: block; padding: 10px 14px; border-radius: 999px; color: rgba(255, 255, 255, .86);
  font-size: .93rem; font-weight: 500; text-decoration: none; transition: color .2s, background .2s;
}
.sp-nav__link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.sp-nav__link.is-current { color: #fff; background: var(--sp-red); }

.sp-cart {
  position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  color: #fff; background: rgba(255, 255, 255, .08); transition: background .2s; flex: none;
}
.sp-cart:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.sp-cart__count {
  position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--sp-red); color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center;
  border: 2px solid #0a0a0a;
}

.sp-menu-toggle.mobile-toggle { display: none; }

@media (max-width: 860px) {
  .sp-header__inner { gap: 12px; padding: 10px 16px; }
  .sp-brand__mark { width: 44px; height: 44px; }
  .sp-brand__name { font-size: 1.1rem; }
  .sp-brand__tagline { display: none; }
  .sp-menu-toggle.mobile-toggle {
    display: flex; flex-direction: column; justify-content: center; gap: 5px; order: 3;
    width: 44px; height: 44px; margin-left: 0; padding: 0 11px; border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .08); cursor: pointer;
  }
  .sp-menu-toggle span { display: block; height: 2px; background: #fff; border-radius: 2px; transition: transform .25s, opacity .25s; }
  .sp-menu-toggle.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .sp-menu-toggle.is-active span:nth-child(2) { opacity: 0; }
  .sp-menu-toggle.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .sp-cart { margin-left: auto; order: 2; }
  .sp-nav.nav {
    position: fixed; left: 0; right: 0; top: 64px; margin: 0; padding: 12px 16px 24px;
    background: #0a0a0a; border-top: 1px solid rgba(255, 255, 255, .08);
    transform: translateY(-8px); opacity: 0; visibility: hidden; transition: opacity .2s, transform .2s, visibility .2s;
    overflow-y: auto;
  }
  .sp-nav.nav.is-open { transform: none; opacity: 1; visibility: visible; }
  .sp-nav__list { flex-direction: column; align-items: stretch; gap: 4px; }
  .sp-nav__link { padding: 14px 16px; border-radius: 12px; font-size: 1.05rem; }
}

/* ---------- home ---------- */
.sp-eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 700; color: var(--sp-red); margin: 0 0 12px; }
.sp-intro { background: linear-gradient(180deg, var(--sp-paper), #fff); border-bottom: 1px solid var(--sp-line); }
.sp-intro__inner {
  max-width: var(--sp-max); margin: 0 auto; padding: clamp(36px, 6vw, 80px) 20px;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: center;
}
.sp-intro__media img {
  display: block; width: 100%; aspect-ratio: 16 / 11; object-fit: cover; object-position: 30% 20%;
  border-radius: calc(var(--sp-radius) * 1.4); box-shadow: var(--sp-shadow-lift); background: #fff;
}
.sp-intro__title { font-family: var(--sp-serif); font-size: clamp(2rem, 4.2vw, 3.1rem); line-height: 1.08; margin: 0 0 18px; }
.sp-intro__text .sp-prose { font-size: 1.02rem; color: #3a3a3a; }
.sp-intro__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
@media (max-width: 860px) { .sp-intro__inner { grid-template-columns: 1fr; } }

.sp-section-heading { max-width: var(--sp-max); margin: 0 auto; padding: clamp(48px, 7vw, 84px) 20px 8px; text-align: center; }
.sp-section-heading h2 { font-family: var(--sp-serif); font-size: clamp(1.8rem, 3.4vw, 2.5rem); margin: 0; }
.sp-section-heading h2::after { content: ''; display: block; width: 64px; height: 3px; border-radius: 3px; background: var(--sp-red); margin: 18px auto 0; }
.sp-section-heading p { color: var(--sp-muted); margin-top: 14px; }

.sp-books-section { max-width: var(--sp-max); margin: 0 auto; padding: 32px 20px clamp(56px, 8vw, 96px); }
.sp-books-section__more { text-align: center; margin-top: 40px; }
.sp-books { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: clamp(20px, 3vw, 34px); }
.sp-book { display: flex; flex-direction: column; }
.sp-book__cover {
  position: relative; display: block; aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden;
  background: #f1eee9; box-shadow: var(--sp-shadow); transition: transform .3s, box-shadow .3s;
}
.sp-book__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-book:hover .sp-book__cover { transform: translateY(-4px); box-shadow: var(--sp-shadow-lift); }
.sp-book__badge {
  position: absolute; top: 10px; left: 10px; background: var(--sp-ink); color: #fff; font-size: .72rem;
  font-weight: 700; letter-spacing: .04em; padding: 5px 10px; border-radius: 999px;
}
.sp-book__body { padding: 14px 2px 0; }
.sp-book__title { font-family: var(--sp-serif); font-size: 1.08rem; line-height: 1.3; margin: 0 0 6px; }
.sp-book__title a { color: var(--sp-ink); text-decoration: none; }
.sp-book__title a:hover { color: var(--sp-red); }
.sp-book__formats { font-size: .8rem; color: var(--sp-muted); margin: 0 0 6px; }
.sp-book__price { font-weight: 600; color: var(--sp-ink); margin: 0; }
.sp-book__price span { color: var(--sp-muted); font-weight: 500; }

/* ---------- pages & prose ---------- */
.sp-page { max-width: 820px !important; }
.sp-page__header h1 { font-family: var(--sp-serif); font-size: clamp(2rem, 4vw, 2.8rem); margin: 0 0 28px; line-height: 1.12; }
.sp-prose { line-height: 1.75; font-size: 1.02rem; }
.sp-prose > * + * { margin-top: 1em; }
.sp-prose h2, .sp-prose h3 { font-family: var(--sp-serif); margin-top: 1.6em; line-height: 1.25; }
.sp-prose h2 { font-size: 1.6rem; } .sp-prose h3 { font-size: 1.3rem; }
.sp-prose ul, .sp-prose ol { padding-left: 1.3em; }
.sp-prose blockquote {
  margin: 1.4em 0 .4em; padding: 18px 22px; border-left: 4px solid var(--sp-red); background: var(--sp-paper);
  border-radius: 0 var(--sp-radius) var(--sp-radius) 0; font-style: italic; color: #333;
}
.sp-prose blockquote p { margin: 0; }
.sp-notice { padding: 14px 18px; border-radius: 12px; margin-bottom: 22px; font-weight: 500; }
.sp-notice--ok { background: #ecf8ef; color: #1d6b33; border: 1px solid #cbeed5; }
.sp-notice--error { background: #fdeeee; color: #9b1c1c; border: 1px solid #f6caca; }

/* forms (contact form component + page forms) */
.sp-prose form, .sp-form { display: grid; gap: 16px; margin-top: 8px; }
.sp-prose label, .sp-form label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: var(--sp-ink); }
.sp-prose input[type=text], .sp-prose input[type=email], .sp-prose input[type=tel], .sp-prose textarea, .sp-prose select,
.sp-form input, .sp-form textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--sp-line); border-radius: 12px; background: #fff;
  font: inherit; font-size: 1rem; color: var(--sp-text); transition: border-color .2s, box-shadow .2s;
}
.sp-prose input:focus, .sp-prose textarea:focus, .sp-form input:focus, .sp-form textarea:focus { outline: none; border-color: var(--sp-red); box-shadow: 0 0 0 4px rgba(207, 46, 46, .12); }
.sp-prose button[type=submit], .sp-form button[type=submit] {
  justify-self: start; padding: .85em 1.8em; border: 0; border-radius: 999px; background: var(--sp-red); color: #fff;
  font-weight: 600; font-size: 1rem; cursor: pointer; transition: background .2s;
}
.sp-prose button[type=submit]:hover, .sp-form button[type=submit]:hover { background: var(--sp-red-dark); }

/* ---------- shop (core Shop views) ---------- */
#main-content > h1 { font-family: var(--sp-serif); font-size: clamp(2rem, 4vw, 2.7rem) !important; font-weight: 700 !important; }
/* catalog cards */
#main-content > div[style*="auto-fill"] { gap: clamp(20px, 3vw, 30px) !important; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)) !important; }
#main-content > div[style*="auto-fill"] > div {
  border-radius: var(--sp-radius) !important; box-shadow: var(--sp-shadow) !important; border: 1px solid var(--sp-line);
  transition: transform .3s, box-shadow .3s; display: flex; flex-direction: column;
}
#main-content > div[style*="auto-fill"] > div:hover { transform: translateY(-4px); box-shadow: var(--sp-shadow-lift) !important; }
#main-content > div[style*="auto-fill"] > div img { height: 300px !important; object-fit: contain !important; background: var(--sp-paper) !important; padding: 16px; }
#main-content > div[style*="auto-fill"] h3 { font-family: var(--sp-serif); font-size: 1.12rem !important; line-height: 1.3; }
#main-content > div[style*="auto-fill"] > div > div { display: flex; flex-direction: column; flex: 1; }
#main-content > div[style*="auto-fill"] .btn-primary { margin-top: auto !important; }

/* product page */
.product-detail-grid { gap: clamp(28px, 5vw, 64px) !important; }
.product-detail-image img { border-radius: var(--sp-radius) !important; box-shadow: var(--sp-shadow-lift); background: var(--sp-paper) !important; }
.product-detail-grid h1 { font-family: var(--sp-serif); font-size: clamp(1.9rem, 3.6vw, 2.6rem) !important; line-height: 1.12; }
.variant-btn, .option-btn { border-radius: 999px !important; padding: 9px 18px !important; font-weight: 600; transition: all .2s; }
.product-detail-grid form button[type=submit], .product-detail-grid .btn-primary { border-radius: 999px !important; padding: 14px 28px !important; font-size: 1rem !important; }
.product-detail-grid [style*="border-top:1px solid #e0e0e0"] { border-top-color: var(--sp-line) !important; }
.product-detail-grid [style*="border-top:1px solid #e0e0e0"] h3 { font-family: var(--sp-serif); font-size: 1.35rem !important; }
.product-detail-grid [style*="border-top:1px solid #e0e0e0"] > div { line-height: 1.75; }
.product-detail-grid blockquote {
  margin: 1.2em 0 .4em; padding: 16px 20px; border-left: 4px solid var(--sp-red); background: var(--sp-paper);
  border-radius: 0 12px 12px 0; font-style: italic;
}
.product-detail-grid blockquote p { margin: 0; }
.product-detail-grid [style*="border-top:1px solid #e0e0e0"] p + p,
.product-detail-grid [style*="border-top:1px solid #e0e0e0"] h3 + p { margin-top: .9em; }
.product-detail-grid [style*="border-top:1px solid #e0e0e0"] h3:not(:first-child) { margin-top: 1.4em; }

/* ---------- footer ---------- */
.sp-footer { background: #0a0a0a; color: rgba(255, 255, 255, .72); margin-top: 0; }
.sp-footer__inner {
  max-width: var(--sp-max); margin: 0 auto; padding: 64px 20px 44px;
  display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 40px;
}
.sp-brand--footer .sp-brand__mark { width: 44px; height: 44px; }
.sp-brand--footer .sp-brand__name { font-size: 1.2rem; }
.sp-footer__tagline { margin: 14px 0 6px; color: rgba(255, 255, 255, .82); }
.sp-footer__note { font-size: .88rem; margin: 0; }
.sp-footer__heading { font-family: var(--sp-sans); font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; color: #fff; margin: 4px 0 16px; }
.sp-footer__nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sp-footer a { color: rgba(255, 255, 255, .78); text-decoration: none; }
.sp-footer a:hover { color: #fff; }
.sp-footer__contact p { margin: 0 0 16px; font-size: .95rem; }
.sp-footer .sp-btn--ghost { color: #fff !important; border-color: rgba(255, 255, 255, .5); }
.sp-footer .sp-btn--ghost:hover { background: #fff; color: var(--sp-ink) !important; border-color: #fff; }
.sp-footer__bottom { border-top: 1px solid rgba(255, 255, 255, .08); }
.sp-footer__bottom p { max-width: var(--sp-max); margin: 0 auto; padding: 18px 20px; font-size: .82rem; color: rgba(255, 255, 255, .5); }
@media (max-width: 860px) { .sp-footer__inner { grid-template-columns: 1fr; gap: 32px; padding-top: 48px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* cart: the way in to check-by-mail / purchase orders (theme.js) */
.sp-offline-link { text-align: center; margin: 12px 0 0; font-size: .9rem; }
.sp-offline-link a { color: var(--sp-muted); text-decoration: underline; text-underline-offset: 3px; }
.sp-offline-link a:hover { color: var(--sp-red); }

/* ---------- featured book (home) ---------- */
.sp-feature { background: radial-gradient(120% 90% at 85% 0%, #3a0d0d 0%, #140707 45%, #0a0a0a 100%); color: rgba(255, 255, 255, .86); }
.sp-feature__inner {
  max-width: var(--sp-max); margin: 0 auto; padding: clamp(40px, 7vw, 96px) 20px;
  display: grid; grid-template-columns: minmax(220px, 400px) 1fr; gap: clamp(32px, 6vw, 80px); align-items: center;
}
.sp-feature__cover { display: block; border-radius: 10px; overflow: hidden; box-shadow: 0 30px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06); transform: rotate(-1.5deg); transition: transform .4s; }
.sp-feature__cover:hover { transform: rotate(0) translateY(-4px); }
.sp-feature__cover img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.sp-eyebrow--light { color: #ff7a7a; }
.sp-feature__title { font-family: var(--sp-serif); color: #fff; font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.04; margin: 0 0 16px; }
.sp-feature__pitch { font-size: 1.08rem; line-height: 1.7; max-width: 58ch; margin: 0 0 22px; }
.sp-feature__formats { list-style: none; margin: 0 0 26px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sp-feature__formats li { display: inline-flex; gap: 8px; align-items: baseline; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); font-size: .9rem; }
.sp-feature__formats strong { color: #fff; }
.sp-feature__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.sp-btn--light { background: transparent; color: #fff !important; border-color: rgba(255, 255, 255, .55); }
.sp-btn--light:hover { background: #fff; color: var(--sp-ink) !important; border-color: #fff; box-shadow: none; }
.sp-feature__listen { margin-top: 34px; padding-top: 26px; border-top: 1px solid rgba(255, 255, 255, .12); }
.sp-feature__listen-title { font-family: var(--sp-serif); color: #fff; font-size: 1.25rem; margin: 0 0 14px; }
.sp-feature__samples { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.sp-sample { padding: 14px 16px; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); }
.sp-sample__meta { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; font-size: .88rem; }
.sp-sample__meta strong { color: #fff; font-size: .95rem; }
.sp-sample audio { width: 100%; height: 40px; }
.sp-feature__more { display: inline-block; margin-top: 14px; color: #ff9d9d; font-weight: 600; text-decoration: none; }
.sp-feature__more:hover { color: #fff; }
@media (max-width: 860px) {
  .sp-feature__inner { grid-template-columns: 1fr; }
  .sp-feature__cover { max-width: 300px; margin: 0 auto; }
}

/* language switch on multi-language books (Publishing) */
.pub-editions { border-color: var(--sp-line) !important; background: var(--sp-paper) !important; }
