/* ============================================
   Callum Voss — callumvoss.com
   Brutalist psychological horror aesthetic
   Palette: Concrete, Void, Fluorescent, Teal, Copper
   Font: Cormorant Garamond, EB Garamond
   ============================================ */

:root {
  --concrete: #3D3A38;
  --void: #0C0B0A;
  --void-cold: #080A0C;
  --fluorescent: #D4E4E8;
  --teal: #2A4A4F;
  --copper: #C17B45;
  --text: #D4D0CC;
  --text-muted: rgba(212, 208, 204, 0.5);
  --font: 'Cormorant Garamond', 'Georgia', serif;
  --font-book: 'EB Garamond', 'Georgia', serif;
  --grain-opacity: 0.03;
  --depth: 0; /* 0 at top, 1 at bottom — set by JS scroll listener */
}

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

html {
  scroll-behavior: smooth;
  font-size: 18px;
}

/* ---- Temperature Shift: warm void at top, cold void at bottom ---- */

body {
  font-family: var(--font);
  background: linear-gradient(180deg,
    var(--void) 0%,
    var(--void) 30%,
    #0B0A0B 50%,
    #090A0B 70%,
    var(--void-cold) 100%
  );
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

::selection {
  background: var(--copper);
  color: var(--void);
}

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

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.hero-content {
  text-align: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.tagline {
  font-size: clamp(0.9rem, 2vw, 1.15rem);
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  max-width: 32ch;
  margin: 0 auto;
  letter-spacing: 0.03em;
}

.scroll-indicator {
  position: absolute;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.scroll-indicator span {
  display: block;
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--copper), transparent);
  animation: heartbeat 6s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { opacity: 0.15; }
  8% { opacity: 0.6; }
  16% { opacity: 0.15; }
  24% { opacity: 0.45; }
  32% { opacity: 0.15; }
}

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

section {
  padding: 6rem 2rem;
}

.section-heading {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 3rem;
  color: var(--copper);
}

/* ---- Book (Corridor Effect: widest section — 1000px) ---- */

.book {
  background: transparent;
}

.book-container {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 4rem;
  align-items: center;
}

.book-cover img {
  width: 100%;
  max-width: 360px;
  height: auto;
  display: block;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(212, 208, 204, 0.05);
}

.book-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--copper);
  margin-bottom: 0.5rem;
}

.book-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.book-hook {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  color: var(--fluorescent);
}

.book-description {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  max-width: 50ch;
}

.book-actions {
  display: flex;
  gap: 1rem;
  margin: 2rem 0 1.5rem;
  flex-wrap: wrap;
}

.book-note {
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

.btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: var(--copper);
  color: var(--void);
}

.btn-primary:hover {
  background: #D4914F;
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(212, 208, 204, 0.3);
}

.btn-secondary:hover {
  border-color: var(--copper);
  color: var(--copper);
}

/* ---- The Threshold Line ---- */

.threshold-line {
  width: 100%;
  max-width: 600px;
  height: 1px;
  margin: 0 auto;
  background: var(--copper);
  opacity: 0.3;
}

/* ---- Chapter Toggle Button ---- */

.chapter-toggle {
  display: block;
  margin: 0 auto 2rem;
  padding: 0.75rem 2.5rem;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--copper);
  background: transparent;
  border: 1px solid var(--copper);
  cursor: pointer;
  transition: all 0.4s ease;
}

.chapter-toggle:hover {
  background: rgba(193, 123, 69, 0.1);
}

.toggle-icon {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 1px solid var(--copper);
  border-bottom: 1px solid var(--copper);
  transform: rotate(45deg);
  margin-left: 0.75rem;
  transition: transform 0.3s;
  vertical-align: middle;
}

.chapter-toggle[aria-expanded="true"] .toggle-icon {
  transform: rotate(-135deg);
}

/* ---- Chapter Content (collapsible) ---- */

.chapter-text {
  overflow: hidden;
  transition: max-height 0.8s ease, opacity 0.6s ease;
}

.chapter-text[hidden] {
  display: block !important;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}

/* ---- Read Chapter 1 ---- */

.chapter-excerpt {
  padding: 5rem 2rem 6rem;
  background: transparent;
}

.chapter-container {
  max-width: 900px;
  margin: 0 auto;
}

.chapter-label {
  text-align: center;
  font-family: var(--font);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-muted);
  margin-top: -1.5rem;
  margin-bottom: 3rem;
  letter-spacing: 0.05em;
}

.chapter-text {
  max-width: 58ch;
  margin: 0 auto;
  font-family: var(--font-book);
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text);
  position: relative;
}

.chapter-text p {
  margin-bottom: 1.2em;
  text-indent: 1.5em;
}

.chapter-text p:first-child {
  text-indent: 0;
}

.chapter-text p:first-child::first-line {
  font-variant: small-caps;
  letter-spacing: 0.04em;
}

.chapter-text em {
  font-style: italic;
}

.chapter-continue {
  text-align: center;
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: none;
}

.chapter-continue-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1rem;
  font-style: italic;
}

/* ---- Series (Corridor Effect: narrows to 800px) ---- */

.series {
  background: transparent;
}

.series-container {
  max-width: 800px;
  margin: 0 auto;
}

.series-tagline {
  text-align: center;
  font-style: italic;
  color: var(--text-muted);
  margin-top: -2rem;
  margin-bottom: 3rem;
}

.series-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.series-book {
  padding: 2rem;
  border: 1px solid rgba(212, 208, 204, 0.08);
  transition: border-color 0.3s ease;
}

.series-book:hover {
  border-color: rgba(193, 123, 69, 0.3);
}

.series-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--copper);
  margin-bottom: 1rem;
  opacity: 0.6;
}

.series-book h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.series-protagonist {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--teal);
  margin-bottom: 1rem;
}

.series-line {
  font-style: italic;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.series-status {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0.3rem 0.8rem;
}

.series-status.available {
  color: var(--copper);
  border: 1px solid var(--copper);
}

.series-status.coming {
  color: var(--text-muted);
  border: 1px solid rgba(212, 208, 204, 0.15);
}

.series-note {
  text-align: center;
  font-style: italic;
  color: var(--text-muted);
  margin-top: 3rem;
  font-size: 0.9rem;
}

/* ---- About (Corridor Effect: narrows to 600px) ---- */

.about {
  background: transparent;
}

.about-container {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.about-container p {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  font-size: 1rem;
}

/* ---- Newsletter (Corridor Effect: narrowest — 500px, inside the building) ---- */

.newsletter {
  background: transparent;
  padding: 5rem 2rem 4rem;
}

.newsletter-container {
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
  padding: 3rem 2rem;
}

.newsletter-container > p {
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 2rem;
}

.newsletter-form {
  display: flex;
  gap: 0;
  max-width: 400px;
  margin: 0 auto;
}

.newsletter-form input[type="email"] {
  flex: 1;
  padding: 0.75rem 1rem;
  font-family: var(--font);
  font-size: 0.9rem;
  background: rgba(212, 208, 204, 0.05);
  border: 1px solid rgba(212, 208, 204, 0.15);
  border-right: none;
  color: var(--text);
  outline: none;
  transition: border-color 0.3s;
}

.newsletter-form input[type="email"]:focus {
  border-color: var(--copper);
}

.newsletter-form input[type="email"]::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.newsletter-form .btn {
  border: 1px solid var(--copper);
}

.newsletter-response {
  margin-top: 1.5rem;
}

.success-msg {
  color: var(--copper);
  font-style: italic;
  font-size: 1.1rem;
}

.error-msg {
  color: #a04040;
  font-style: italic;
  font-size: 0.9rem;
}

.newsletter-note {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 1rem;
  opacity: 0.5;
}

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

.footer {
  padding: 4rem 2rem;
  text-align: center;
  border-top: none;
}

.footer-container {
  max-width: 600px;
  margin: 0 auto;
}

.footer-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.footer-links {
  margin-bottom: 1rem;
}

.footer-links a {
  font-size: 0.8rem;
  color: var(--copper);
  text-decoration: none;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: opacity 0.3s;
}

.footer-links a:hover {
  opacity: 0.7;
}

.footer-sep {
  margin: 0 0.75rem;
  color: var(--text-muted);
  opacity: 0.3;
}

.footer-line {
  font-style: italic;
  font-size: 0.85rem;
  color: var(--text-muted);
  opacity: 0.5;
  margin-bottom: 1.5rem;
}

.footer-copy {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.3;
}

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

@media (max-width: 768px) {
  html { font-size: 16px; }

  section { padding: 4rem 1.5rem; }

  .book-container {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    text-align: center;
  }

  .book-cover {
    display: flex;
    justify-content: center;
  }

  .book-cover img {
    max-width: 280px;
  }

  .book-description {
    max-width: none;
  }

  .book-actions {
    justify-content: center;
  }

  .series-grid {
    grid-template-columns: 1fr;
  }

  .series-container {
    max-width: 100%;
  }

  .chapter-text {
    max-width: 100%;
    font-size: 1rem;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .newsletter-form input[type="email"] {
    border-right: 1px solid rgba(212, 208, 204, 0.15);
    border-bottom: none;
  }

  .newsletter-container {
    padding: 2rem 1.5rem;
  }
}

/* ---- The Building: unified corridor effect driven by --depth ---- */
/* One continuous narrowing from hero (open) to newsletter (compressed) */
/* JS sets --depth (0→1) on <html> based on scroll position */

.corridor-wall {
  position: fixed;
  top: 0;
  bottom: 0;
  width: calc(var(--depth) * 15vw);
  pointer-events: none;
  z-index: 10;
  transition: none; /* instant — driven by scroll, not animation */
}

.corridor-wall--left {
  left: 0;
  background: linear-gradient(to right,
    rgba(8, 10, 12, calc(0.4 + var(--depth) * 0.5)),
    transparent
  );
}

.corridor-wall--right {
  right: 0;
  background: linear-gradient(to left,
    rgba(8, 10, 12, calc(0.4 + var(--depth) * 0.5)),
    transparent
  );
}

/* ---- Ambient animation (concrete grain) ---- */
/* Scroll-Triggered Grain: base 3%, increases in lower sections via stacking */

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: calc(0.02 + var(--depth) * 0.04);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  z-index: 9999;
}

/* Grain intensification removed — was conflicting with corridor
   ::before pseudos and creating TV-static effect. The base 3%
   grain + corridor side-walls provide sufficient texture. */
