:root {
  --paper: #f8efe0;
  --paper-deep: #ead9ba;
  --ink: #141414;
  --charcoal: #1d1b18;
  --muted: #71664f;
  --line: #d2b77f;
  --blue: #253744;
  --green: #455b4a;
  --coral: #8f4b3c;
  --gold: #d6ab59;
  --gold-deep: #a97c2e;
  --gold-dark: #8d6422;
  --heading-font: Garamond, "EB Garamond", "Cormorant Garamond", Georgia, serif;
  --white: #fffdf7;
  --shadow: 0 18px 55px rgba(20, 20, 20, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(213, 171, 89, 0.12), transparent 22rem),
    #171511;
  color: rgba(255, 253, 247, 0.9);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
}

svg {
  width: 1.05em;
  height: 1.05em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.16em;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  background: var(--ink);
  color: var(--white);
  padding: 0.7rem 1rem;
}

.skip-link:focus {
  top: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--charcoal);
  border-bottom: 1px solid rgba(213, 173, 98, 0.38);
  backdrop-filter: blur(18px);
}

.nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.8rem clamp(1rem, 3vw, 2rem);
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}

.brand-mark,
.author-portrait {
  display: grid;
  place-items: center;
  color: var(--gold);
  background: #111;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.brand-mark {
  width: 3.5rem !important;
  height: 3.5rem !important;
  border-radius: 8px;
  font-family: var(--heading-font);
  font-weight: 700;
  border: 1px solid rgba(213, 173, 98, 0.45);
  flex-shrink: 0;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain !important;
  border-radius: inherit;
}

.brand strong {
  display: block;
  color: var(--white);
  font-family: var(--heading-font);
  font-size: 1.15rem;
}

.brand small {
  display: block;
  color: #ffffff !important;
  font-family: var(--heading-font) !important;
  font-size: 1.15rem !important; /* Changed from 0.85rem to match 'Bound Text' */
  letter-spacing: 0.05em;
  text-transform: capitalize !important;
  font-weight: 700 !important;   /* Increased to 700 to match the bold weight */
}

.site-menu {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.site-menu a {
  border-radius: 6px;
  color: var(--white);
  font-family: var(--heading-font);
  font-size: 1.04rem;
  font-weight: 700;
  padding: 0.65rem 0.8rem;
  text-decoration: none;
}

.site-menu a:hover,
.site-menu a[aria-current="true"] {
  background: rgba(213, 173, 98, 0.16);
  color: var(--white);
}

.menu-button {
  display: none;
  width: 2.7rem;
  height: 2.7rem;
  border: 1px solid rgba(213, 173, 98, 0.45);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.08);
}

.menu-button span {
  display: block;
  width: 1.1rem;
  height: 2px;
  margin: 4px auto;
  background: var(--gold);
}

main {
  min-height: 70vh;
  background: #171511;
}

.hero {
  position: relative;
  display: grid;
  align-items: center;
  min-height: calc(100vh - 5rem);
  overflow: hidden;
  border-bottom: 1px solid rgba(213, 173, 98, 0.42);
}

.hero-media {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, 
      rgba(17, 15, 13, 0.96) 0%,    
      rgba(17, 15, 13, 0.88) 50%,   
      rgba(17, 15, 13, 0.4) 75%,    
      transparent 100%              
    ),
    url("assets/hero-publishing.webp") center right / cover no-repeat; /* Updated to .webp */
}

.hero-copy {
  position: relative;
  max-width: 680px;
  padding: clamp(4rem, 12vh, 8rem) clamp(1.2rem, 7vw, 6rem);
}

.hero-logo {
  display: block;
  width: clamp(4.6rem, 9vw, 6.8rem);
  aspect-ratio: 1;
  margin-bottom: 1.1rem;
  border: 1px solid rgba(213, 173, 98, 0.48);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.hero-copy h1,
.hero-copy > p:not(.eyebrow) {
  color: var(--white);
  text-shadow: 0px 2px 8px rgba(0, 0, 0, 0.5);
}

.eyebrow {
  margin: 0 0 0.85rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--heading-font);
  font-weight: 700;
  line-height: 1.05;
}

h1 {
  max-width: 12ch;
  font-size: clamp(2.2rem, 5.5vw, 5rem); 
}

h2 {
  font-size: clamp(1.7rem, 3vw, 3.1rem);
}

h3 {
  font-size: 1.45rem;
}

p {
  margin: 0;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 58ch;
  margin-top: 1.2rem;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.hero-actions,
.book-actions,
.split-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.6rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.85rem;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 800;
  padding: 0.72rem 1rem;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: linear-gradient(180deg, #e3bd6b, var(--gold));
  border-color: rgba(141, 100, 34, 0.72);
  color: #141414;
  box-shadow: 0 10px 24px rgba(141, 100, 34, 0.22);
}

.button.secondary {
  background: #141414;
  border-color: rgba(213, 173, 98, 0.58);
  color: var(--gold);
}

.button.primary:hover,
.button.secondary:hover {
  transform: translateY(-1px);
}

.button.muted {
  background: var(--paper-deep);
  color: var(--muted);
}

.section,
.page-hero,
.authors-list,
.tool-layout,
.private-gate {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 6rem) clamp(1rem, 3vw, 2rem);
  color: rgba(255, 253, 247, 0.9);
}

.section h2,
.page-hero h1,
.authors-list h2,
.tool-layout h2,
.private-gate h2 {
  color: var(--white);
}

.intro-band {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 0.8fr);
  gap: 2rem;
  border-bottom: 1px solid rgba(213, 173, 98, 0.24);
}

.intro-band > p {
  align-self: end;
  color: rgba(255, 253, 247, 0.68);
  font-size: 1.1rem;
}

.section-heading,
.books-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
}

.market-select,
.filters label,
.locked-filter,
.tool-panel label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.market-select small {
  max-width: 18rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.35;
  text-transform: none;
}

.text-button {
  width: fit-content;
  border: 0;
  background: transparent;
  color: var(--gold-deep);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0;
  text-decoration: underline;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid rgba(169, 124, 46, 0.42);
  border-radius: 7px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  letter-spacing: 0;
  padding: 0.75rem 0.85rem;
}

.locked-filter {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  padding: 0.62rem 0.85rem;
}

.locked-filter strong {
  color: var(--ink);
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
}

.locked-filter a {
  color: var(--blue);
  font-size: 0.8rem;
  letter-spacing: 0;
  text-transform: none;
}

textarea {
  resize: vertical;
}

.market-select select {
  min-width: 6rem;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.4rem;
}

.book-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.book-card {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 1rem;
  background: rgba(255, 253, 247, 0.82);
  border: 1px solid rgba(169, 124, 46, 0.32);
  border-radius: 8px;
  padding: 0.8rem;
  box-shadow: 0 12px 35px rgba(21, 32, 43, 0.06);
}

.book-grid.compact .book-card {
  grid-template-columns: 1fr;
}

.cover-art,
.cover-image {
  position: relative;
  aspect-ratio: 2 / 3;
  min-height: 16rem;
  overflow: hidden;
  border-radius: 6px;
}

.cover-art {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--white);
  padding: 1rem;
  background: linear-gradient(150deg, #173f5f, #46766f);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.cover-image {
  margin: 0;
  background: var(--paper-deep);
  box-shadow: 0 10px 28px rgba(20, 20, 20, 0.18);
}

.cover-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-art::before {
  content: "";
  position: absolute;
  inset: auto -20% -28% -20%;
  height: 55%;
  background: rgba(255, 255, 255, 0.13);
  transform: rotate(-8deg);
}

.cover-art strong,
.cover-art em,
.cover-art small,
.cover-art b,
.cover-kicker {
  position: relative;
}

.cover-art strong {
  font-family: var(--heading-font);
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.05;
}

.cover-art em {
  color: rgba(255, 255, 255, 0.84);
  font-family: var(--heading-font);
  font-size: 0.95rem;
}

.cover-art small,
.cover-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.cover-art b {
  align-self: end;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  font-family: var(--heading-font);
}

.cover-colin-bamforth {
  background: linear-gradient(150deg, #173f5f, #c59a43);
}

.cover-avery-solene {
  background: linear-gradient(150deg, #2c3440, #bd5d4b);
}

.cover-russell-bruce {
  background: linear-gradient(150deg, #18202b, #46766f);
}

.book-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.book-copy p {
  color: #43515c;
  margin-top: 0.7rem;
}

.book-meta {
  display: grid;
  align-content: start;
  gap: 0.45rem;
  min-height: 4.8rem;
  margin-bottom: 0.55rem;
}

.book-grid:not(.compact) .book-meta {
  grid-template-columns: repeat(2, max-content);
  min-height: 2rem;
}

.book-meta span,
.status-pill {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.23rem 0.55rem;
}

.subtitle {
  color: var(--coral) !important;
  font-family: var(--heading-font);
  font-style: italic;
}

.page-hero {
  display: grid;
  gap: 1rem;
  border-bottom: 1px solid rgba(213, 173, 98, 0.24);
}

.page-hero h1 {
  max-width: 16ch;
  font-size: clamp(2.5rem, 6vw, 5rem);
}

.page-hero > p,
.page-hero > div > p:not(.eyebrow) {
  max-width: 68ch;
  color: rgba(255, 253, 247, 0.68);
  font-size: 1.1rem;
}

.authors-list {
  display: grid;
  gap: 1.2rem;
}

.author-panel {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 1.4rem;
  align-items: center;
  border-bottom: 1px solid rgba(213, 173, 98, 0.24);
  padding-bottom: 1.4rem;
}

.author-portrait {
  width: 8rem;
  height: 8rem;
  border-radius: 8px;
  font-family: var(--heading-font);
  font-size: 2rem;
}

.quiet {
  color: rgba(255, 253, 247, 0.62);
  font-size: 0.95rem;
}

.tool-panel .quiet {
  color: var(--muted);
}

.format-help {
  border-top: 1px solid var(--line);
  margin-top: 0.6rem;
  padding-top: 0.8rem;
}

.format-help summary {
  color: var(--gold-dark);
  cursor: pointer;
  font-family: var(--heading-font);
  font-weight: 800;
}

.format-help dl {
  display: grid;
  gap: 0.55rem;
  margin: 0.8rem 0 0;
}

.format-help dt {
  color: var(--ink);
  font-weight: 800;
}

.format-help dd {
  color: var(--muted);
  margin: -0.45rem 0 0;
}

.text-link {
  display: inline-flex;
  gap: 0.35rem;
  margin-top: 1rem;
  color: var(--gold);
  font-weight: 800;
  text-decoration: none;
}

.filters {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(10rem, 1fr) auto;
  gap: 0.8rem;
  align-items: end;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.2rem clamp(1rem, 3vw, 2rem) 0;
}

.filter-count {
  align-self: center;
  color: var(--gold-deep);
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
}

.no-results {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem) 4rem;
  color: rgba(255, 253, 247, 0.68);
  font-weight: 800;
}

.all-books {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.2rem clamp(1rem, 3vw, 2rem) clamp(3rem, 7vw, 6rem);
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 0.7fr) minmax(0, 1.3fr);
  gap: 1rem;
  align-items: start;
}

.ad-slot {
  display: grid;
  place-items: center;
  max-width: 1180px;
  min-height: 6rem;
  margin: 1.4rem auto 0;
  border: 1px dashed rgba(213, 173, 98, 0.7);
  border-radius: 8px;
  background: rgba(20, 20, 20, 0.04);
  color: var(--muted);
  padding: 1rem;
  text-align: center;
}

.ad-slot span {
  color: var(--ink);
  font-weight: 800;
}

.ad-slot.premium {
  background: #141414;
  color: rgba(255, 253, 247, 0.68);
}

.ad-slot.premium span {
  color: var(--gold);
}

.tool-panel,
.barcode-preview,
.private-workspace,
.payment-options article {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 12px 35px rgba(21, 32, 43, 0.06);
}

.barcode-preview canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: var(--white);
}

/* Container rules to keep the high-res preview neat and responsive */
#barcode-canvas {
  max-width: 100%;
  max-height: 260px;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 6px;
}
.barcode-preview [hidden] {
  display: none !important;
}

.private-gate {
  max-width: 760px;
}

.pro-workspace {
  display: grid;
  grid-template-columns: minmax(16rem, 0.72fr) minmax(0, 1.28fr);
  gap: 1rem;
}

.pro-preview {
  display: grid;
  align-content: center;
  min-height: 22rem;
}

.qr-preview {
  display: grid;
  justify-items: center;
  gap: 1rem;
}

.qr-preview img {
  width: min(100%, 280px);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: 0.7rem;
}

.private-workspace {
  display: grid;
  gap: 1rem;
}

.payment-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  border-top: 1px solid var(--line);
  background: #141414;
  color: var(--white);
  padding: 2rem clamp(1rem, 3vw, 2rem);
}

.site-footer > * {
  max-width: 1180px;
}

.site-footer p,
.footer-links a {
  color: rgba(255, 253, 247, 0.72);
}

.footer-links {
  display: flex;
  gap: 1rem;
}

@media (max-width: 980px) {
  .book-grid,
  .book-grid.compact {
    grid-template-columns: 1fr;
  }

  .book-grid.compact .book-card {
    grid-template-columns: 10rem minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .menu-button {
    display: block;
  }

  .site-menu {
    position: absolute;
    left: 1rem;
    right: 1rem;
    top: calc(100% + 0.4rem);
    display: none;
    flex-direction: column;
    align-items: stretch;
    border: 1px solid rgba(213, 173, 98, 0.42);
    border-radius: 8px;
    background: #141414;
    padding: 0.4rem;
    box-shadow: var(--shadow);
  }

  .site-menu.open {
    display: flex;
  }

  .hero {
    min-height: 86vh;
  }

 .hero-media {
    background:
      linear-gradient(180deg, rgba(20, 20, 20, 0.96) 0%, rgba(20, 20, 20, 0.82) 48%, rgba(20, 20, 20, 0.42) 100%),
      url("assets/hero-publishing.webp") center bottom / cover no-repeat; /* Updated to .webp */
  }

  h1 {
    font-size: clamp(1.8rem, 10vw, 3.2rem);
  }

  .intro-band,
  .section-heading,
  .books-hero,
  .tool-layout,
  .pro-workspace,
  .author-panel,
  .filters,
  .payment-options {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .books-hero,
  .site-footer {
    align-items: start;
    flex-direction: column;
  }

  .book-card,
  .book-grid.compact .book-card {
    grid-template-columns: 1fr;
  }

  .cover-art {
    min-height: 19rem;
  }

  .footer-links {
    flex-wrap: wrap;
  }
}

/* ==========================================================================
   TABLET & MOBILE OPTIMIZATIONS (Pasted at the bottom)
   ========================================================================== */
@media (max-width: 1024px) {
  
  /* 1. Scales down the main "Bound Text" title for tablets & mobile */
  .hero-copy h1 {
    font-size: clamp(2rem, 7vw, 3.4rem);
    line-height: 1.1;
  }

  /* 2. Shrinks the "A small press for..." paragraph text */
  .hero-copy > p:not(.eyebrow) {
    font-size: clamp(0.95rem, 2vw, 1.05rem);
    margin-top: 0.8rem;
  }

  /* 3. Scales down the Browse Books & Meet Authors buttons */
  .hero-actions .button {
    font-size: 0.85rem;       
    padding: 0.55rem 0.85rem;  
    min-height: 2.5rem;       
  }
  
  /* Tightens up the button row spacing */
  .hero-actions {
    margin-top: 1.2rem;
    gap: 0.5rem;
  }
}

/* ==========================================================================
   SUBPAGE TEXT SIZING ADJUSTMENTS (Authors, Books, Barcode, Private)
   ========================================================================== */

/* 1. Tames the main titles at the top of subpages (e.g., "Authors", "Books") */
.page-hero h1 {
  font-size: clamp(1.8rem, 4vh, 2.8rem) !important; 
}

/* 2. Tames the secondary section titles (e.g., "Meet the Team", "Our Collection") */
h2, 
.section h2, 
.authors-list h2, 
.tool-layout h2, 
.private-gate h2 {
  font-size: clamp(1.4rem, 2.5vw, 2rem) !important; 
}

/* 3. Tames sub-section headers (e.g., individual book titles or tool panels) */
h3 {
  font-size: 1.2rem !important; 
}

/* 4. Safely shrinks subpage description text down to standard reading size */
.page-hero > p, 
.page-hero > div > p:not(.eyebrow),
.intro-band > p {
  font-size: 1rem !important; 
  line-height: 1.6;
}

/* Modern Author Bio Portraits */
.author-image {
  width: 140px;
  height: 140px;
  border-radius: 50%;          /* Forces the image into a perfect circle */
  object-fit: cover;           /* Centers and crops the photo automatically */
  object-position: center top; /* Keeps the focus on their faces */
  border: 3px solid #e2e8f0;   /* Adds a clean, subtle border outline */
  margin-bottom: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); /* Soft modern shadow */
}

/* Author portrait styling */
.author-portrait {
  width: 100px;
  height: 100px;
  min-width: 100px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 20px;
  flex-shrink: 0;
  background: #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
}

.author-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- 1. Main Page Title Adjustment --- */
.hero-copy h1 {
  font-size: 2.6rem; 
}

/* --- 2. Header Logo Text Alignment --- */
.logo-text small, 
header small, 
.site-logo small,
[class*="logo"] small,
[class*="branding"] small {
  font-family: var(--heading-font) !important;
  color: #ffffff !important;
  text-transform: capitalize !important;
  font-size: 0.85rem !important;
  opacity: 1 !important;
}

/* Ironclad responsive boundaries for the self-hosted canvas engine */
#barcode-canvas {
  display: block !important;
  width: 100% !important;
  max-width: 300px !important;
  height: auto !important;
  margin: 0 auto !important;
  object-fit: contain !important;
  border-radius: 6px !important;
}
/* ==========================================================================
   PERFORMANCE & CLS OPTIMIZATIONS
   ========================================================================== */

/* Explicit dimension guidelines to prevent Layout Shifts (CLS) */
.hero-media {
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.cover-image img {
  width: 100%;
  height: auto;
  aspect-ratio: 239 / 360;
  object-fit: cover;
  display: block;
}

.brand-mark img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}
#main {
  min-height: 80vh;
}
