/* Posse Comitatus — book site */

:root {
  --paper: #efe4cc;
  --paper-2: #e6d6b4;
  --paper-3: #d9c49b;
  --ink: #241911;
  --ink-soft: #4a3828;
  --muted: #6e5a44;
  --brass: #9a6b2f;
  --brass-dark: #7a5222;
  --rule: rgba(36, 25, 17, 0.28);
  --night: #1b140e;
  --night-2: #2a2016;
  --cream: #f4ead3;
  --badge-blue: #2b3d63;

  --display: "Playfair Display", Georgia, "Times New Roman", serif;
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --caps: "Cinzel", "Trajan Pro", Georgia, serif;

  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
}

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

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

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(255, 248, 230, 0.7), transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(150, 110, 60, 0.18), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .12 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(18px, 1.1vw + 12px, 20px);
  line-height: 1.6;
  overflow-x: hidden;
}

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

a { color: var(--brass-dark); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--cream);
  padding: 8px 14px;
  z-index: 100;
}
.skip:focus { left: 8px; top: 8px; }

/* ---------- Shared bits ---------- */

.eyebrow {
  font-family: var(--caps);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass-dark);
  margin: 0 0 14px;
}

h1, h2, h3 { font-family: var(--display); line-height: 1.08; margin: 0; font-weight: 800; }

h2 {
  font-size: clamp(2rem, 3.4vw + 0.6rem, 3.1rem);
  letter-spacing: -0.01em;
}

.ornament {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--brass);
  margin: 18px 0 26px;
}
.ornament::before,
.ornament::after {
  content: "";
  height: 1px;
  flex: 1;
  background: currentColor;
  opacity: 0.6;
}
.ornament svg { width: 18px; height: 18px; flex: none; }
.ornament.left::before { display: none; }
.ornament.left { max-width: 280px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--caps);
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 15px 26px;
  border-radius: 2px;
  border: 2px solid var(--ink);
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary {
  background: var(--ink);
  color: var(--cream);
  box-shadow: 4px 4px 0 var(--brass);
}
.btn-primary:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--brass); }
.btn-primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--brass); }
.btn-ghost { color: var(--ink); background: transparent; }
.btn-ghost:hover { background: rgba(36, 25, 17, 0.07); }
.btn:focus-visible { outline: 3px solid var(--brass); outline-offset: 3px; }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(239, 228, 204, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}
.brand {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.brand svg { width: 22px; height: 22px; color: var(--brass); }

.nav { display: flex; align-items: center; gap: 28px; }
.nav a {
  font-family: var(--caps);
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
}
.nav a:hover { color: var(--ink); }
.nav .btn { padding: 10px 16px; font-size: 0.72rem; box-shadow: 3px 3px 0 var(--brass); color: var(--cream); }

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rule);
  padding: 8px 10px;
  border-radius: 2px;
  color: var(--ink);
  cursor: pointer;
}
.menu-toggle svg { width: 22px; height: 22px; display: block; }

@media (max-width: 820px) {
  .menu-toggle { display: block; }
  .nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: 8px var(--gutter) 20px;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 14px 0; border-bottom: 1px solid var(--rule); font-size: 0.85rem; }
  .nav .btn { margin-top: 16px; justify-content: center; border-bottom: 2px solid var(--ink); }
}

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

.hero {
  position: relative;
  padding: clamp(48px, 8vw, 96px) 0 clamp(56px, 8vw, 104px);
  overflow: hidden;
}
.hero .wrap {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}
.hero-copy .eyebrow { display: flex; align-items: center; gap: 10px; }
.hero h1 {
  font-size: clamp(3.2rem, 7.4vw, 6.4rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  line-height: 0.92;
  text-shadow: 2px 2px 0 rgba(154, 107, 47, 0.25);
}
.hero .subtitle {
  font-family: var(--caps);
  font-weight: 700;
  font-size: clamp(1rem, 1.2vw + 0.6rem, 1.3rem);
  letter-spacing: 0.06em;
  line-height: 1.4;
  color: var(--ink-soft);
  margin: 22px 0 0;
  max-width: 30ch;
}
.hero .lede {
  font-size: 1.15em;
  font-style: italic;
  color: var(--ink-soft);
  margin: 24px 0 34px;
  max-width: 36ch;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.hero-meta {
  margin-top: 30px;
  font-family: var(--caps);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.hero-meta span + span::before { content: "✦"; margin-right: 18px; color: var(--brass); }

.book {
  position: relative;
  justify-self: center;
  width: min(100%, 380px);
  perspective: 1600px;
}
.book-inner {
  position: relative;
  transform: rotateY(-10deg) rotateX(2deg);
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(.2,.8,.2,1);
}
.book:hover .book-inner { transform: rotateY(-4deg) rotateX(0deg); }
.book img {
  width: 100%;
  border-radius: 2px 6px 6px 2px;
  box-shadow:
    inset 4px 0 10px rgba(0,0,0,.3),
    1px 1px 0 rgba(0,0,0,.2),
    18px 26px 40px rgba(36, 25, 17, 0.45),
    40px 50px 80px rgba(36, 25, 17, 0.25);
}
.book-inner::before {
  /* spine highlight */
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 14px;
  background: linear-gradient(90deg, rgba(255,255,255,.25), rgba(0,0,0,.25) 60%, transparent);
  border-radius: 2px 0 0 2px;
  z-index: 1;
  pointer-events: none;
}
.seal {
  position: absolute;
  left: -44px;
  bottom: 70px;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  display: grid;
  place-content: center;
  text-align: center;
  font-family: var(--caps);
  font-weight: 700;
  line-height: 1.1;
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--brass), 6px 10px 22px rgba(0,0,0,.3);
  transform: rotate(-10deg);
  z-index: 2;
}
.seal small { font-size: 0.58rem; letter-spacing: 0.22em; color: var(--paper-3); }
.seal strong { font-size: 1.7rem; font-family: var(--display); font-weight: 900; letter-spacing: 0.02em; }

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .book { order: -1; width: min(78%, 320px); }
  .seal { width: 84px; height: 84px; left: -26px; bottom: 50px; }
  .seal strong { font-size: 1.3rem; }
}

/* ---------- Pillars strip ---------- */

.pillars {
  background: var(--ink);
  color: var(--cream);
  border-top: 3px double var(--brass);
  border-bottom: 3px double var(--brass);
}
.pillars ul {
  list-style: none;
  margin: 0;
  padding: 22px 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  text-align: center;
}
.pillars li {
  font-family: var(--caps);
  font-weight: 700;
  font-size: clamp(0.8rem, 1vw + 0.4rem, 1.05rem);
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.pillars li + li { border-left: 1px solid rgba(244, 234, 211, 0.25); }
@media (max-width: 560px) {
  .pillars ul { grid-template-columns: repeat(2, 1fr); row-gap: 14px; }
  .pillars li:nth-child(3) { border-left: 0; }
}

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

section { scroll-margin-top: 72px; }
.section { padding: clamp(64px, 9vw, 120px) 0; }

/* About */
.about .wrap {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}
.about-head { position: sticky; top: 100px; }
.about-head .tagline {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.3rem, 1.4vw + 0.8rem, 1.7rem);
  line-height: 1.35;
  color: var(--ink-soft);
  margin-top: 26px;
}
.about-body p { margin: 0 0 1.15em; }
.about-body p:first-child::first-letter {
  font-family: var(--display);
  font-weight: 900;
  float: left;
  font-size: 4.4em;
  line-height: 0.82;
  padding: 6px 12px 0 0;
  color: var(--brass-dark);
}
.about-body .closing {
  font-size: 1.1em;
  border-top: 1px solid var(--rule);
  padding-top: 1.1em;
  margin-top: 1.6em;
}
@media (max-width: 860px) {
  .about .wrap { grid-template-columns: 1fr; }
  .about-head { position: static; }
}

/* Banner image */
.banner {
  position: relative;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--night);
}
.banner img {
  width: 100%;
  height: clamp(260px, 42vw, 520px);
  object-fit: cover;
  object-position: center 40%;
  filter: contrast(1.05);
  opacity: 0.92;
}
.banner figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 60px var(--gutter) 22px;
  background: linear-gradient(transparent, rgba(27, 20, 14, 0.85));
  color: var(--cream);
  text-align: center;
  font-family: var(--caps);
  font-size: clamp(0.78rem, 1vw + 0.4rem, 1rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

/* Timeline */
.journey { background: var(--paper-2); border-bottom: 1px solid var(--rule); }
.journey .intro { max-width: 640px; margin-bottom: 56px; }
.journey .intro p { color: var(--ink-soft); margin: 0; }

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 19px;
  left: 0;
  right: 0;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--brass) 0 10px, transparent 10px 16px);
}
.timeline li { position: relative; padding: 52px 18px 0 0; }
.timeline .dot {
  position: absolute;
  top: 6px;
  left: 0;
  width: 28px;
  height: 28px;
  color: var(--ink);
  background: var(--paper-2);
}
.timeline .when {
  font-family: var(--caps);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass-dark);
}
.timeline h3 { font-size: 1.3rem; margin: 6px 0 8px; }
.timeline p { margin: 0; font-size: 0.92em; color: var(--ink-soft); line-height: 1.5; }

@media (max-width: 900px) {
  .timeline { grid-template-columns: 1fr; gap: 30px; padding-left: 44px; }
  .timeline::before {
    top: 0; bottom: 0; left: 13px; right: auto; width: 2px; height: auto;
    background: repeating-linear-gradient(180deg, var(--brass) 0 10px, transparent 10px 16px);
  }
  .timeline li { padding: 0; }
  .timeline .dot { left: -44px; top: 0; }
}

/* Inside the book */
.inside .head { text-align: center; max-width: 720px; margin: 0 auto 52px; }
.inside .head .ornament { max-width: 360px; margin-left: auto; margin-right: auto; }
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--rule);
  background: rgba(255, 250, 238, 0.35);
}
.card {
  padding: 32px 28px 30px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.card:nth-child(3n) { border-right: 0; }
.card:nth-last-child(-n+3) { border-bottom: 0; }
.card svg { width: 34px; height: 34px; color: var(--brass-dark); margin-bottom: 18px; }
.card h3 { font-size: 1.32rem; margin-bottom: 8px; }
.card p { margin: 0; color: var(--ink-soft); font-size: 0.95em; line-height: 1.5; }

@media (max-width: 900px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .card, .card:nth-child(3n), .card:nth-last-child(-n+3) { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
  .card:nth-child(2n) { border-right: 0; }
  .card:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .card, .card:nth-child(n) { border-right: 0; border-bottom: 1px solid var(--rule); }
  .card:last-child { border-bottom: 0; }
}

/* Quote */
.quote {
  background: var(--night);
  color: var(--cream);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.quote::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("images/skyline.jpg") center 30% / cover no-repeat;
  opacity: 0.16;
  filter: sepia(1);
}
.quote .wrap { position: relative; }
.quote blockquote { margin: 0 auto; max-width: 900px; }
.quote .mark {
  font-family: var(--display);
  font-size: 7rem;
  line-height: 0.6;
  color: var(--brass);
  display: block;
  height: 46px;
}
.quote p {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.8rem, 3.6vw + 0.4rem, 3.2rem);
  line-height: 1.22;
  margin: 0;
}
.quote cite {
  display: block;
  margin-top: 30px;
  font-family: var(--caps);
  font-style: normal;
  font-size: 0.82rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--paper-3);
}

/* Author */
.author .wrap {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}
.portrait {
  position: relative;
  margin: 0;
  background: #fbf5e6;
  padding: 14px 14px 56px;
  box-shadow: 0 1px 0 rgba(0,0,0,.1), 10px 18px 36px rgba(36, 25, 17, 0.28);
  transform: rotate(-2deg);
  max-width: 420px;
  justify-self: center;
}
.portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 20%; filter: sepia(0.25); }
.portrait figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 16px;
  text-align: center;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-soft);
}
.author h2 { margin-bottom: 4px; }
.author .role {
  font-family: var(--caps);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 10px 0 0;
}
.author p { margin: 0 0 1em; }
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}
.stats li { padding: 18px 12px 16px 0; }
.stats li + li { border-left: 1px solid var(--rule); padding-left: 18px; }
.stats strong {
  display: block;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1.6rem, 2vw + 0.8rem, 2.3rem);
  line-height: 1;
  color: var(--ink);
}
.stats span {
  display: block;
  margin-top: 8px;
  font-family: var(--caps);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.4;
}
@media (max-width: 860px) {
  .author .wrap { grid-template-columns: 1fr; }
  .portrait { max-width: 320px; }
}

/* Covers */
.covers { background: var(--paper-2); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.covers .head { text-align: center; margin-bottom: 44px; }
.covers .head p { color: var(--ink-soft); margin: 14px auto 0; max-width: 520px; }
.cover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(20px, 4vw, 48px);
  max-width: 820px;
  margin: 0 auto;
}
.cover-grid button {
  all: unset;
  cursor: zoom-in;
  display: block;
  position: relative;
}
.cover-grid img {
  width: 100%;
  box-shadow: 10px 16px 32px rgba(36, 25, 17, 0.32);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.cover-grid button:hover img,
.cover-grid button:focus-visible img { transform: translateY(-6px); box-shadow: 14px 24px 44px rgba(36, 25, 17, 0.4); }
.cover-grid button:focus-visible { outline: 3px solid var(--brass); outline-offset: 6px; }
.cover-grid .label {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-family: var(--caps);
  font-size: 0.76rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Lightbox */
.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 94vw;
  max-height: 94vh;
}
.lightbox::backdrop { background: rgba(20, 14, 9, 0.88); }
.lightbox img { max-height: 90vh; width: auto; margin: 0 auto; }
.lightbox button {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(244, 234, 211, 0.4);
  background: rgba(27, 20, 14, 0.7);
  color: var(--cream);
  font-size: 1.4rem;
  cursor: pointer;
}

/* Buy CTA */
.buy { text-align: center; position: relative; }
.buy .then-now {
  font-family: var(--caps);
  font-weight: 700;
  font-size: clamp(0.9rem, 1vw + 0.5rem, 1.15rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--brass-dark);
  margin: 0 0 18px;
}
.buy h2 { font-size: clamp(2.4rem, 5vw + 0.5rem, 4.4rem); text-transform: uppercase; font-weight: 900; }
.buy .sub { color: var(--ink-soft); max-width: 560px; margin: 22px auto 34px; font-size: 1.08em; }
.buy .details {
  margin: 34px auto 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  font-family: var(--caps);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Footer */
.site-footer {
  background: var(--night);
  color: var(--paper-3);
  padding: 44px 0;
  font-size: 0.9rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.site-footer .brand { color: var(--cream); font-size: 1rem; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--paper-3); }

/* Reveal on scroll */
/* Only hidden when JavaScript is running, so content always shows without it */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s ease; }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .book-inner, .book:hover .book-inner { transform: none; transition: none; }
}
