/* ==========================================================================
   Polite Confessions — politeconfessions.com
   Grounded in the book's archival collector's palette:
     Ink Slate:       #1E242B / #151A20
     Archival Cream:  #F7F3EA / #EFE9DC
     Vermilion Red:   #C4452B
     Blueprint Slate: #2D4A68
     Drafting Brass:  #C88B2E
     Quiet Sage:      #4A6B5D
   ========================================================================== */

:root {
  --paper: #F7F3EA;
  --paper-warm: #EFE9DC;
  --paper-card: #FCF9F2;
  --ink-deep: #151A20;
  --ink: #1E242B;
  --ink-mid: #28303A;
  --ink-body: #2C3138;
  --ink-muted: #646B73;
  --red: #C4452B;
  --red-soft: rgba(196, 69, 43, 0.10);
  --slate: #2D4A68;
  --slate-soft: #E6EDF3;
  --brass: #C88B2E;
  --brass-bright: #DCA245;
  --sage: #4A6B5D;
  --border: rgba(30, 36, 43, 0.12);
  --border-dark: rgba(247, 243, 234, 0.14);

  --font-display: 'Literata', Georgia, 'Times New Roman', serif;
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-soft: 0 8px 26px rgba(20, 24, 29, 0.07);
  --shadow-book: 0 26px 58px rgba(8, 10, 14, 0.52), 0 8px 18px rgba(8, 10, 14, 0.30);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 62px;
  -webkit-text-size-adjust: 100%;
}

section[id] { scroll-margin-top: 62px; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.62;
  color: var(--ink-body);
  background: var(--paper);
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button, input { font: inherit; }

:focus-visible {
  outline: 2.5px solid var(--brass);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: -999px; top: 8px; z-index: 100;
  background: var(--brass); color: var(--ink);
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { left: 16px; }

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Sticky Header ===== */
.site-header {
  position: sticky;
  top: 0; z-index: 40;
  background: rgba(21, 26, 32, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-dark);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--paper);
}
.brand-name {
  font-family: var(--font-mono);
  font-size: 0.80rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  white-space: nowrap;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}
.site-nav a {
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(247, 243, 234, 0.82);
  transition: color 0.16s ease;
}
.site-nav a:hover { color: var(--paper); }
.site-nav .nav-cta {
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--red);
  color: var(--paper);
  font-weight: 600;
  font-size: 0.84rem;
}
.site-nav .nav-cta:hover { background: #D45237; }

/* ===== Hero ===== */
.hero {
  position: relative;
  background: radial-gradient(circle at 75% 42%, rgba(200, 139, 46, 0.11), transparent 52%),
              linear-gradient(180deg, var(--ink-deep) 0%, var(--ink) 100%);
  color: var(--paper);
  padding: 64px 0 72px;
  border-bottom: 2px solid var(--brass);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 52px;
  align-items: center;
}
.eyebrow {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass-bright);
}
.eyebrow-ink { color: var(--slate); }

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 3.85rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: var(--paper);
}
.hero-subtitle {
  margin: 12px 0 18px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: #DDD5C7;
}
.hero-subtitle em { color: var(--brass-bright); }

.hero-quote {
  margin: 0 0 22px;
  padding: 13px 16px;
  background: rgba(247, 243, 234, 0.05);
  border-left: 3px solid var(--red);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.hero-quote-said {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: #E89A89;
}
.hero-quote-real {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.02rem;
  color: var(--paper);
}
.hero-lead {
  margin: 0 0 26px;
  font-size: 1.01rem;
  line-height: 1.66;
  color: rgba(247, 243, 234, 0.84);
  max-width: 56ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.94rem;
  text-decoration: none;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.16s ease, border-color 0.16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--red);
  color: var(--paper);
}
.btn-primary:hover { background: #D45237; }
.btn-secondary {
  background: rgba(247, 243, 234, 0.08);
  color: var(--paper);
  border-color: rgba(247, 243, 234, 0.22);
}
.btn-secondary:hover {
  background: rgba(247, 243, 234, 0.14);
  border-color: var(--brass);
}
.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: rgba(30, 36, 43, 0.25);
}
.btn-outline:hover {
  border-color: var(--ink);
  background: rgba(30, 36, 43, 0.04);
}
.btn-full { width: 100%; }

.hero-meta {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: rgba(247, 243, 234, 0.56);
}

/* 3D Hardcover Book Object */
.hero-book-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.book-object {
  position: relative;
  display: block;
  padding: 0;
  border: none;
  background: transparent;
  width: min(100%, 400px);
  aspect-ratio: 1 / 1;
  border-radius: 4px 10px 10px 4px;
  overflow: hidden;
  box-shadow: var(--shadow-book);
  cursor: pointer;
  transition: transform 0.24s ease, box-shadow 0.24s ease;
}
.book-object:hover {
  transform: translateY(-4px) rotate(-0.6deg);
  box-shadow: 0 32px 68px rgba(8, 10, 14, 0.62);
}
.book-object img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.book-spine {
  position: absolute;
  left: 0; top: 0; bottom: 0; width: 16px;
  background: linear-gradient(90deg, rgba(255,255,255,0.16) 0%, rgba(0,0,0,0.34) 45%, rgba(255,255,255,0.08) 72%, transparent 100%);
  pointer-events: none;
}
.book-hint {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  color: rgba(247, 243, 234, 0.60);
}

/* ===== Interactive Reader (Content-First, Full-Width Spread Focus) ===== */
.reader-section {
  background: var(--ink-deep);
  padding: 12px 0 18px;
  border-bottom: 1px solid var(--border-dark);
}
.reader-container {
  width: 100%;
  max-width: min(1520px, 98vw);
  margin: 0 auto;
  padding: 0 12px;
}
.reader-shell {
  background: transparent;
  color: var(--paper);
}
.reader-shell.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  max-width: none;
  background: var(--ink-deep);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 18px 12px;
}
.reader-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 4px 10px;
}
.reader-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  color: rgba(247, 243, 234, 0.90);
}
.reader-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.mode-switch {
  display: inline-flex;
  background: rgba(247, 243, 234, 0.07);
  padding: 2px;
  border-radius: var(--radius-sm);
}
.mode-btn {
  border: none;
  background: transparent;
  color: rgba(247, 243, 234, 0.70);
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}
.mode-btn.is-active {
  background: var(--paper);
  color: var(--ink);
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(247, 243, 234, 0.16);
  background: rgba(247, 243, 234, 0.05);
  color: rgba(247, 243, 234, 0.88);
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.tool-btn:hover { background: rgba(247, 243, 234, 0.13); color: var(--paper); }
.tool-btn-accent {
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
}
.tool-btn-accent:hover { background: #D45237; }
.icon-compress { display: none; }
.reader-shell.is-fullscreen .icon-expand { display: none; }
.reader-shell.is-fullscreen .icon-compress { display: inline; }

.reader-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  outline: none;
  flex: 1;
}
.stage-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(247, 243, 234, 0.24);
  background: rgba(21, 26, 32, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.78;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.stage-prev { left: 10px; }
.stage-next { right: 10px; }
.stage-nav:hover:not(:disabled) { opacity: 1; background: rgba(21, 26, 32, 0.92); }
.stage-nav:disabled { opacity: 0.16; cursor: default; }

.book-frame {
  position: relative;
  margin: 0;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.55);
  background: var(--paper);
  transition: opacity 0.15s ease;
}
.book-frame.is-square {
  height: min(calc(100vh - 148px), 780px);
  max-width: 100%;
  aspect-ratio: 1 / 1;
}
.book-frame.is-spread {
  width: min(100%, calc((100vh - 148px) * 2), 1480px);
  aspect-ratio: 2 / 1;
}
.reader-shell.is-fullscreen .book-frame.is-square {
  height: min(calc(100vh - 108px), 920px);
  width: auto;
  aspect-ratio: 1 / 1;
}
.reader-shell.is-fullscreen .book-frame.is-spread {
  width: min(98vw, calc((100vh - 108px) * 2), 1840px);
  height: auto;
  aspect-ratio: 2 / 1;
}
.book-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.book-frame.is-loading { opacity: 0.82; }

.click-zone {
  position: absolute;
  top: 0; bottom: 0; width: 28%;
  cursor: pointer;
  z-index: 4;
}
.click-zone-prev { left: 0; }
.click-zone-next { right: 0; }

.reader-bottombar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 10px 4px 0;
}
.bottom-nav-mobile {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bar-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(247, 243, 234, 0.16);
  background: rgba(247, 243, 234, 0.06);
  color: rgba(247, 243, 234, 0.88);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}
.bar-btn:disabled { opacity: 0.25; cursor: default; }
.reader-counter {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--brass-bright);
  min-width: 54px;
  text-align: center;
}
.scrubber-wrap { flex: 1; min-width: 140px; }
#readerScrubber {
  width: 100%;
  accent-color: var(--red);
  cursor: pointer;
}
.reader-hint {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(247, 243, 234, 0.48);
}
.reader-hint kbd {
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid rgba(247, 243, 234, 0.22);
  background: rgba(247, 243, 234, 0.07);
  color: rgba(247, 243, 234, 0.85);
  font-family: var(--font-mono);
  font-size: 0.70rem;
}

.thumb-drawer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-dark);
}
.thumb-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.thumb-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  background: rgba(247, 243, 234, 0.05);
  color: rgba(247, 243, 234, 0.76);
  cursor: pointer;
}
.thumb-item img {
  height: 56px; width: auto;
  border-radius: 2px;
}
.thumb-item span {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  white-space: nowrap;
}
.thumb-item.is-active {
  border-color: var(--brass);
  background: rgba(200, 139, 46, 0.16);
  color: var(--paper);
}

/* ===== Sections ===== */
.section { padding: 68px 0; }
.section-alt {
  background: var(--paper-warm);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section-header { max-width: 680px; margin-bottom: 36px; }
.section-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
}
.section-sub {
  margin: 0;
  font-size: 1.02rem;
  color: var(--ink-muted);
}

.spec-jump {
  padding: 0;
  border: none;
  background: none;
  font-family: var(--font-mono);
  font-size: 0.80rem;
  font-weight: 600;
  color: var(--red);
  cursor: pointer;
}
.spec-jump:hover { text-decoration: underline; }

/* ===== Origin / Hook Museum Callout ===== */
.origin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 36px;
  align-items: start;
}
.origin-prose p {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 1.04rem;
  line-height: 1.72;
}
.crown-card {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-md);
  padding: 24px 26px;
  border-top: 3px solid var(--brass);
  box-shadow: var(--shadow-soft);
}
.crown-kicker {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--brass-bright);
}
.crown-file {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--paper);
}
.crown-quote {
  margin: 0 0 16px;
  padding-left: 14px;
  border-left: 2.5px solid var(--red);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.98rem;
  line-height: 1.56;
  color: #EFE9DC;
}
.crown-foot {
  margin: 0;
  font-size: 0.84rem;
  color: rgba(247, 243, 234, 0.70);
}

/* ===== Downloads ===== */
.downloads-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.download-card {
  background: var(--paper-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--shadow-soft);
}
.download-card-featured {
  border-color: var(--red);
  border-width: 1.5px;
}
.download-badge {
  display: inline-block;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--red-soft);
  color: var(--red);
}
.download-badge-subtle {
  background: var(--slate-soft);
  color: var(--slate);
}
.download-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--ink);
}
.download-desc {
  margin: 0;
  font-size: 0.91rem;
  color: var(--ink-body);
}
.download-desc code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--paper-warm);
  padding: 1px 4px;
  border-radius: 3px;
}
.download-specs {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-muted);
}

/* ===== Footer ===== */
.site-footer {
  background: var(--ink-deep);
  color: rgba(247, 243, 234, 0.74);
  padding: 40px 0;
  border-top: 2px solid var(--brass);
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}
.footer-mark {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--paper);
}
.footer-credit {
  margin: 0;
  font-size: 0.88rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}
.footer-links a {
  color: var(--brass-bright);
  text-decoration: none;
}
.footer-links a:hover { text-decoration: underline; }

/* ===== Responsive ===== */
@media (max-width: 920px) {
  .hero-grid, .origin-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero-book-wrap { order: -1; }
  .book-object { width: min(100%, 340px); }
  .downloads-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .site-nav a:not(.nav-cta) { display: none; }
  .stage-nav { display: none; }
  .reader-hint { display: none; }
  .reader-container { padding: 0 8px; }
  .book-frame.is-square { width: 100%; height: auto; }
}
