/* =====================================================
   WRITE ON BOOK COVERS — SHARED DESIGN SYSTEM
   ===================================================== */

:root {
  --bg-dark:    #1a0a0f;
  --bg-mid:     #2d0f1a;
  --bg-deep:    #0f0608;
  --gold:       #c9963e;
  --gold-soft:  #b87c3c;
  --gold-faint: rgba(201, 150, 62, 0.18);
  --gold-line:  rgba(201, 150, 62, 0.22);
  --cream:      #f5e6d3;
  --cream-dim:  rgba(245, 230, 211, 0.72);
  --cream-mute: rgba(245, 230, 211, 0.48);

  --serif: 'Cormorant Garamond', 'EB Garamond', Georgia, serif;
  --sans:  'Lato', system-ui, sans-serif;

  --eyebrow-tracking: 0.28em;
  --eyebrow-size: 0.7rem;

  --frame-pad: clamp(1.25rem, 3vw, 3rem);

  --shadow-deep:   0 24px 60px rgba(0,0,0,0.55), 0 4px 12px rgba(0,0,0,0.4);
  --shadow-cover:  6px 8px 30px rgba(0,0,0,0.55), -2px 0 10px rgba(0,0,0,0.35);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { background: var(--bg-dark); }

body {
  color: var(--cream);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ───── Type ───── */
.serif { font-family: var(--serif); }
.italic { font-style: italic; }
.eyebrow {
  font-family: var(--sans);
  font-size: var(--eyebrow-size);
  letter-spacing: var(--eyebrow-tracking);
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 400;
}
.cream-dim { color: var(--cream-dim); }

/* ───── Nav ───── */
.site-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.05rem clamp(1.5rem, 4vw, 3rem);
  background: rgba(15, 6, 8, 0.78);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--gold-line);
}
.site-nav .nav-logo {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: var(--cream);
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.site-nav .nav-logo .mark { color: var(--gold); }
.site-nav .nav-logo svg { flex-shrink: 0; opacity: 0.85; }
.site-nav .nav-links {
  display: flex;
  gap: clamp(1.4rem, 2.5vw, 2.2rem);
  list-style: none;
  align-items: center;
}
.site-nav .nav-links a {
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream-dim);
  transition: color 0.25s ease;
  position: relative;
  padding: 0.4rem 0;
}
.site-nav .nav-links a:hover { color: var(--gold); }
.site-nav .nav-links a.active { color: var(--gold); }
.site-nav .nav-links a.active::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -2px;
  transform: translateX(-50%);
  width: 16px; height: 1px;
  background: var(--gold);
}
.site-nav .nav-cta {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 0.55rem 1.1rem;
  transition: background 0.3s, color 0.3s;
}
.site-nav .nav-cta:hover { background: var(--gold); color: var(--bg-dark); }

/* ───── Hamburger button ───── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  z-index: 102;
}
.nav-hamburger span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: var(--gold);
  transition: transform 0.3s, opacity 0.3s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 880px) {
  .nav-hamburger { display: flex; }
  .site-nav .nav-links { display: none; }
  .site-nav .nav-cta { display: none; }
}

/* ───── Mobile drawer (lives on <body>, outside nav stacking context) ───── */
.nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0,0,0,0.65);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}
.nav-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.nav-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(300px, 82vw);
  z-index: 9999;
  background: #0f0608;
  border-left: 1px solid var(--gold-line);
  box-shadow: -10px 0 50px rgba(0,0,0,0.85);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}
.nav-drawer.open {
  transform: translateX(0);
}
.nav-drawer-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 5rem 0 2rem;
}
.nav-drawer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.nav-drawer-links li {
  border-bottom: 1px solid rgba(201,150,62,0.1);
}
.nav-drawer-links li:first-child {
  border-top: 1px solid rgba(201,150,62,0.1);
}
.nav-drawer-links a {
  display: block;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--cream-dim);
  padding: 1.1rem 2rem;
  transition: color 0.25s, background 0.25s, padding-left 0.25s;
  text-decoration: none;
}
.nav-drawer-links a:hover,
.nav-drawer-links a.active {
  color: var(--gold);
  padding-left: 2.5rem;
  background: rgba(201,150,62,0.05);
}
.nav-drawer-etsy {
  margin-top: auto;
  border-top: 1px solid rgba(201,150,62,0.18) !important;
  border-bottom: none !important;
}
.nav-drawer-etsy a {
  color: var(--gold) !important;
  text-align: center;
}

/* ───── Footer ───── */
.site-footer {
  border-top: 1px solid var(--gold-line);
  padding: 3.5rem clamp(1.5rem, 4vw, 3rem) 2.5rem;
  background: var(--bg-deep);
}
.site-footer .footer-grid {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 3rem;
}
.site-footer h5 {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.1rem;
  font-weight: 400;
}
.site-footer p, .site-footer li {
  font-size: 0.88rem;
  color: var(--cream-dim);
  margin-bottom: 0.55rem;
}
.site-footer li { list-style: none; }
.site-footer a:hover { color: var(--gold); }
.site-footer .footer-brand {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--cream);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.site-footer .footer-tag {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.02rem;
  color: var(--cream-dim);
  max-width: 280px;
  margin-bottom: 1.5rem;
}
.site-footer .footer-bottom {
  max-width: 1180px;
  margin: 3rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid rgba(245, 230, 211, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.site-footer .footer-bottom small {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream-mute);
}
@media (max-width: 800px) {
  .site-footer .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
}
@media (max-width: 500px) {
  .site-footer .footer-grid { grid-template-columns: 1fr; }
}

/* ───── Buttons ───── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 0.95rem 2.2rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
  cursor: pointer;
  border: 1px solid var(--gold);
  color: var(--gold);
  background: transparent;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--gold); color: var(--bg-dark); }
.btn.solid { background: var(--gold); color: var(--bg-dark); }
.btn.solid:hover { background: var(--cream); border-color: var(--cream); color: var(--bg-dark); }
.btn.ghost { border-color: rgba(245, 230, 211, 0.3); color: var(--cream); }
.btn.ghost:hover { border-color: var(--cream); background: var(--cream); color: var(--bg-dark); }
.btn .arrow { font-size: 0.9rem; transform: translateY(-1px); }

/* ───── Rule ornaments ───── */
.gold-rule {
  width: 80px; height: 1px;
  background: var(--gold);
  opacity: 0.45;
}
.gold-rule.center { margin: 1.6rem auto; }
.gold-rule.wide { width: 140px; }

.ornament-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--gold);
  opacity: 0.55;
}
.ornament-row::before, .ornament-row::after {
  content: '';
  width: 60px; height: 1px;
  background: var(--gold);
  opacity: 0.5;
}
.ornament-row .glyph {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 0.4em;
}

/* ───── Section headings ───── */
.section-eyebrow {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: var(--eyebrow-tracking);
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.85;
  margin-bottom: 0.75rem;
}
.section-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(2rem, 4vw, 3.2rem);
  color: var(--cream);
  line-height: 1.15;
  letter-spacing: -0.005em;
  margin-bottom: 1rem;
  text-wrap: balance;
}
.section-title em { color: var(--gold); font-style: italic; }
.section-lead {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--cream-dim);
  max-width: 560px;
  margin-bottom: 2rem;
  text-wrap: pretty;
}

/* ───── Butterfly mark (singular brand glyph) ───── */
.butterfly-mark {
  display: inline-block;
  vertical-align: middle;
}

/* ───── Page intro (sub-pages) ───── */
.page-intro {
  padding: 9rem clamp(1.5rem, 4vw, 3rem) 4rem;
  text-align: center;
  position: relative;
  background:
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(201,150,62,0.08), transparent 70%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-dark) 100%);
  border-bottom: 1px solid var(--gold-line);
}
.page-intro .eyebrow { margin-bottom: 1rem; display: block; }
.page-intro h1 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(2.6rem, 5.5vw, 4.4rem);
  color: var(--cream);
  line-height: 1.1;
  margin-bottom: 1.25rem;
  text-wrap: balance;
}
.page-intro h1 em { color: var(--gold); }
.page-intro .lead {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  color: var(--cream-dim);
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.6;
  text-wrap: pretty;
}

/* ───── Generic content frame ───── */
.frame {
  max-width: 1280px;
  margin: 0 auto;
  padding: 5rem clamp(1.5rem, 4vw, 3rem);
}
.frame-narrow { max-width: 880px; }
.frame-wide { max-width: 1400px; }

/* ───── Placeholder book cover ───── */
.cover {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 2px 6px 6px 2px;
  overflow: hidden;
  box-shadow: var(--shadow-cover);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.06), transparent 50%),
    linear-gradient(160deg, #2d1b3d 0%, #4a2060 55%, #1a0e26 100%);
}
.cover::before {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 6px; height: 100%;
  background: linear-gradient(90deg, rgba(0,0,0,0.45), transparent);
  z-index: 2;
}
.cover::after {
  /* subtle paper grain */
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(245,230,211,0.04) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
  pointer-events: none;
}
.cover .cover-inner {
  position: absolute;
  inset: 10px 8px 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 1;
}
.cover .cover-frame {
  border: 0.5px solid rgba(201,150,62,0.22);
  position: absolute;
  inset: 14px 12px 18px 20px;
  pointer-events: none;
}
.cover .cover-top {
  font-family: var(--sans);
  font-size: 0.5rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(245,230,211,0.55);
  text-align: center;
  padding-top: 0.7rem;
}
.cover .cover-figure {
  position: relative;
  flex: 1;
  margin: 0.4rem 0;
  border-radius: 1px;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(201,150,62,0.18), transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.55) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cover .cover-figure-mark {
  width: 36%;
  height: 50%;
  opacity: 0.6;
}
.cover .cover-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.78rem;
  line-height: 1.15;
  color: rgba(245,230,211,0.92);
  text-align: center;
  margin-top: 0.3rem;
  text-wrap: balance;
}
.cover .cover-rule {
  width: 40%;
  height: 0.5px;
  background: rgba(201,150,62,0.55);
  margin: 0.45rem auto;
}
.cover .cover-author {
  font-family: var(--sans);
  font-size: 0.46rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(201,150,62,0.78);
  text-align: center;
  padding-bottom: 0.4rem;
}

/* Cover variants */
.cover.regency  { background: linear-gradient(160deg, #2d1b3d 0%, #4a2060 55%, #1a0e26 100%); }
.cover.highland { background: linear-gradient(160deg, #0e2620 0%, #1f4a3a 55%, #0a1a16 100%); }
.cover.viking   { background: linear-gradient(160deg, #1a1a2d 0%, #25406a 55%, #0e1226 100%); }
.cover.duke     { background: linear-gradient(160deg, #2d1010 0%, #5a1818 55%, #1a0606 100%); }
.cover.outlaw   { background: linear-gradient(160deg, #2d2010 0%, #6a4810 55%, #1f1606 100%); }
.cover.imperial { background: linear-gradient(160deg, #2d100a 0%, #7a1f1a 55%, #2a0a06 100%); }
.cover.pirate   { background: linear-gradient(160deg, #1a1a1f 0%, #3a3a4a 55%, #0a0a14 100%); }
.cover.fae      { background: linear-gradient(160deg, #1f0a2d 0%, #4a1f5a 55%, #0f0518 100%); }

/* Diagonal stripe placeholder fallback */
.placeholder-stripe {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(245,230,211,0.04),
    rgba(245,230,211,0.04) 8px,
    rgba(245,230,211,0.02) 8px,
    rgba(245,230,211,0.02) 16px
  );
}

/* ───── Fade-in observer base ───── */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* ───── Focus ───── */
:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 3px;
}

/* ───── Selection ───── */
::selection { background: var(--gold); color: var(--bg-dark); }

/* ───── Custom scrollbar ───── */
html { scrollbar-color: var(--gold-soft) var(--bg-deep); }
