/* ===========================================================================
   Millan Press — catalog MVP stylesheet
   Premium publishing feel: warm paper palette, Fraunces display serif,
   Inter for body, generous spacing.
   =========================================================================== */

:root {
  --bg:        #ffffff;
  --surface:   #ffffff;
  --ink:       #211e1a;
  --ink-soft:  #443e36;
  --muted:     #7a7164;
  --line:      #e4ddcd;
  --accent:    #9a6b3f;   /* warm leather/brass */
  --accent-2:  #c9a86a;   /* gold hairline */

  --shadow-sm: 0 2px 8px rgba(33, 30, 26, 0.06);
  --shadow-md: 0 14px 34px rgba(33, 30, 26, 0.16);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --wrap: 1180px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 28px;
}

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

.dot { margin: 0 0.5ch; color: var(--muted); }

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 14px 28px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.btn-primary { background: var(--ink); color: var(--surface); }
.btn-primary:hover { background: #36302a; transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--surface); }

.btn-buy { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-buy:hover { background: #7f5631; border-color: #7f5631; }

.btn-buy.is-disabled {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
  cursor: not-allowed;
}

/* --- Header --------------------------------------------------------------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;           /* never let the header squeeze the brand */
  min-width: 0;
}

.brand-logo {
  height: 42px;
  width: auto;
  max-width: none;          /* override global img{max-width:100%} which, with a
                              fixed height, was distorting the logo when tight */
  flex-shrink: 0;
  object-fit: contain;
  display: block;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--ink);
  color: var(--surface);
  font-family: var(--serif);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  border-radius: 2px;
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.32rem;
  letter-spacing: 0.02em;
}

.site-nav { display: flex; gap: 30px; }

.site-nav a {
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.18s ease;
}

.site-nav a:hover { border-color: var(--accent); }

/* Hamburger toggle — pure CSS (checkbox hack), hidden on desktop. */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-burger { display: none; }

/* --- Hero ----------------------------------------------------------------- */

.hero {
  background:
    radial-gradient(900px 380px at 78% -8%, rgba(154, 107, 63, 0.12), transparent),
    var(--bg);
  border-bottom: 1px solid var(--line);
}

.hero-inner {
  padding: 96px 28px 104px;
  max-width: 880px;
}

.hero-title {
  font-size: clamp(2.7rem, 6vw, 4.6rem);
  margin-bottom: 24px;
}

.hero-lede {
  font-size: 1.18rem;
  color: var(--ink-soft);
  max-width: 600px;
  margin: 0 0 36px;
}

.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

/* --- Sections ------------------------------------------------------------- */

.section { padding: 76px 0; }
.section + .section { padding-top: 0; }

.section-genres { padding-bottom: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 36px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.section-title { font-size: clamp(1.7rem, 3vw, 2.3rem); }

.section-link {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.section-link:hover { text-decoration: underline; }

/* --- Spotlight (featured book #1) ---------------------------------------- */

.spotlight {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 56px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 48px;
  margin-bottom: 44px;
}

.spotlight-cover img {
  border-radius: 3px;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease;
}

.spotlight-cover:hover img { transform: translateY(-4px); }

.spotlight-title {
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  margin-bottom: 8px;
}

.spotlight-subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--muted);
  margin: 0 0 6px;
}

.spotlight-author {
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  margin: 0 0 20px;
}

.spotlight-desc {
  color: var(--ink-soft);
  margin: 0 0 28px;
  max-width: 52ch;
}

/* --- Book grid + card ----------------------------------------------------- */

.book-grid {
  display: grid;
  /* Fixed-width columns so covers stay thumbnail-sized and don't balloon to
     fill the row when there are only a few books; centered in the wrap. */
  grid-template-columns: repeat(auto-fill, 230px);
  justify-content: center;
  gap: 44px 36px;
}

.book-card { min-width: 0; }

.book-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.cover-frame {
  position: relative;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-card-link:hover .cover-frame {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
}

.cover-frame .cover {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.ribbon {
  position: absolute;
  top: 14px;
  left: 0;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: var(--ink);
  padding: 6px 12px;
}

.ribbon-coming-soon { background: #8a5a14; }
.ribbon-pre-order   { background: #2f4d6b; }

.book-card-body { padding-top: 12px; text-align: center; }

.book-card-title {
  font-size: 1.08rem;
  line-height: 1.25;
  margin-bottom: 4px;
}

.book-card-byline {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 8px;
}

.book-card-byline .bar { color: var(--line); margin: 0 3px; }

.book-card-teaser {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--ink-soft);
  margin: 0 0 12px;
}

.book-card-subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 4px;
}

.book-card-author {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 0 0 6px;
}

.book-card-price {
  font-size: 0.86rem;
  color: var(--ink);
  margin: 0;
}

.book-card-price .price-fmt {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 2px;
}

.book-card-price .dot { margin: 0 8px; color: var(--line); }

.book-card-soon {
  color: var(--accent);
  font-weight: 600;
}

.book-card-meta {
  font-size: 0.84rem;
  color: var(--muted);
  margin: 0;
}

/* --- About the Book (spoiler-free FAQ) ----------------------------------- */

.about-book-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
}
.about-book-link:hover { text-decoration: underline; }

.ebay-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
}
.ebay-link:hover { color: var(--accent); text-decoration: underline; }

.about-book-head {
  display: flex;
  gap: 32px;
  align-items: center;
  margin: 8px 0 40px;
}
.about-book-cover img {
  width: 132px;
  height: auto;
  border-radius: 3px;
  box-shadow: var(--shadow-sm);
}
.about-book-note { color: var(--muted); margin: 10px 0 0; }

.faq { max-width: 70ch; }
.faq-item { padding: 0 0 28px; }
.faq-item + .faq-item {
  border-top: 1px solid var(--line);
  padding-top: 28px;
}
.faq-q {
  font-size: 1.3rem;
  margin: 0 0 12px;
}
.faq-item p {
  color: var(--ink-soft);
  margin: 0 0 12px;
}

@media (max-width: 620px) {
  .about-book-head { flex-direction: column; align-items: flex-start; gap: 18px; }
}

/* --- Genre tiles (homepage) ---------------------------------------------- */

.genre-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.genre-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 26px 16px;
  transition: border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.genre-tile:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* --- Page head (catalog, 404) -------------------------------------------- */

.page-head {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 64px 0;
}

.page-title { font-size: clamp(2.1rem, 4vw, 3.1rem); margin-bottom: 14px; }
.page-lede { color: var(--ink-soft); font-size: 1.1rem; margin: 0; max-width: 60ch; }

/* --- Catalog controls ----------------------------------------------------- */

.catalog-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.search-field { flex: 1 1 260px; max-width: 360px; }

.search-field input {
  width: 100%;
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--ink);
}

.search-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.genre-pills { display: flex; flex-wrap: wrap; gap: 8px; }

.genre-pill {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.genre-pill:hover { border-color: var(--accent); }

.genre-pill.is-active {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

.result-count {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 30px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.2rem;
  padding: 60px 0;
}

/* --- Book detail ---------------------------------------------------------- */

.book-detail { padding: 48px 0 24px; }

.breadcrumb {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 36px;
}

.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

.detail-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 60px;
  align-items: start;
}

.detail-cover {
  position: sticky;
  top: 108px;
}

.detail-cover img {
  width: 100%;
  border-radius: 4px;
  box-shadow: var(--shadow-md);
}

.detail-title {
  font-size: clamp(2.2rem, 4.2vw, 3.2rem);
  margin-bottom: 10px;
}

.detail-subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--muted);
  margin: 0 0 12px;
}

.detail-author {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  margin: 0 0 20px;
}

.detail-status { margin-bottom: 28px; }

.detail-desc {
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 60ch;
}

.detail-desc p { margin: 0 0 16px; }

.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 18px 28px;
  margin: 32px 0;
  padding: 26px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-meta dt {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.detail-meta dd {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.05rem;
}

.detail-actions { margin-top: 28px; }

.buy-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 12px 0 0;
}

.related { padding: 70px 0 30px; }

/* --- Status badge --------------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
}

.badge-available   { color: #2f5d3a; background: #e5efe6; }
.badge-coming-soon { color: #8a5a14; background: #f3e8cf; }
.badge-pre-order   { color: #2f4d6b; background: #e3ebf3; }

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  background: var(--ink);
  color: #d8d1c4;
  margin-top: 90px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 60px;
  align-items: center;
  justify-content: space-between;
  padding: 50px 28px;
}

.site-footer .brand-name { color: var(--surface); }
.site-footer .muted { color: #968d7e; }

.footer-nav { display: flex; gap: 26px; }

.footer-nav a {
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #d8d1c4;
}

.footer-nav a:hover { color: var(--accent-2); }

.notfound { padding: 30px 28px 10px; }
.notfound .btn { margin-top: 22px; }

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 860px) {
  .spotlight {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 32px;
    text-align: center;
  }
  .spotlight-cover { max-width: 240px; margin: 0 auto; }
  .spotlight-desc { margin-left: auto; margin-right: auto; }

  .detail-grid { grid-template-columns: 1fr; gap: 36px; }
  .detail-cover { position: static; max-width: 280px; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .hero-inner { padding: 64px 28px 72px; }
  .section { padding: 56px 0; }
  .header-inner { min-height: 64px; }
  .brand-name { font-size: 1.15rem; }
  .brand-logo { height: 34px; }
  .site-nav { gap: 20px; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 30px 20px; }
  .catalog-controls { flex-direction: column; align-items: stretch; }
  .search-field { max-width: none; flex: 0 0 auto; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* Collapse the top nav into a hamburger when the header gets tight. */
@media (max-width: 700px) {
  .header-inner { min-height: 64px; }
  .brand-logo { height: 34px; }

  .nav-burger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 40px;
    padding: 9px 8px;
    box-sizing: border-box;
    cursor: pointer;
    flex-shrink: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
  }
  .nav-burger span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--ink);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  /* Nav becomes a full-width dropdown under the header, shown when checked. */
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
  }
  .nav-toggle:checked ~ .site-nav { display: flex; }
  .site-nav a {
    padding: 14px 28px;
    border-bottom: 1px solid var(--line);
  }
  .site-nav a:last-child { border-bottom: 0; }

  /* Burger morphs into an X when open. */
  .nav-toggle:checked ~ .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked ~ .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}
