/* ============================================
   SLY ROUNDABOUT STORIES — "Noir Codex" Theme
   ============================================ */

:root {
  /* Palette */
  --bg-deep: #08080c;
  --bg-primary: #0a0a10;
  --bg-elevated: #111118;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;

  --gold: #d4a853;
  --gold-dim: #b8923f;
  --gold-bright: #e8be5a;
  --gold-glow: rgba(212, 168, 83, 0.15);
  --amber: #c45e2c;

  --text-primary: #e8e0d4;
  --text-secondary: #9a94a8;
  --text-muted: #5e5a68;

  --border: rgba(212, 168, 83, 0.1);
  --border-hover: rgba(212, 168, 83, 0.25);

  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Outfit', system-ui, sans-serif;

  /* Spacing */
  --section-pad: clamp(80px, 12vw, 140px);
  --container-max: 1180px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.65;
  overflow-x: hidden;
}

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

/* ---- Grain Overlay ---- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  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");
  background-repeat: repeat;
  background-size: 200px;
}

/* ---- Container ---- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  border-radius: 6px;
  padding: 14px 28px;
  transition: all 0.35s var(--ease-out);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gold);
  color: #0a0a10;
  box-shadow: 0 0 0 0 var(--gold-glow), 0 2px 8px rgba(0, 0, 0, 0.3);
}
.btn-primary:hover {
  background: var(--gold-bright);
  box-shadow: 0 0 30px var(--gold-glow), 0 4px 16px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

.btn-ghost {
  border: 1px solid var(--border-hover);
  color: var(--text-primary);
  background: transparent;
}
.btn-ghost:hover {
  border-color: var(--gold-dim);
  color: var(--gold);
  background: rgba(212, 168, 83, 0.05);
}

.btn-nav {
  padding: 10px 22px;
  font-size: 0.82rem;
  background: var(--gold);
  color: #0a0a10;
}
.btn-nav:hover {
  background: var(--gold-bright);
}

.btn-lg {
  padding: 18px 36px;
  font-size: 1rem;
}

/* ---- Navigation ---- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: rgba(8, 8, 12, 0.7);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border);
  transition: padding 0.3s var(--ease-out), background 0.3s;
}

.nav.scrolled {
  padding: 12px 32px;
  background: rgba(8, 8, 12, 0.92);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  color: var(--gold);
  font-size: 0.8rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a:not(.btn) {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  transition: color 0.25s;
  position: relative;
}

.nav-links a:not(.btn)::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: width 0.35s var(--ease-out);
}

.nav-links a:not(.btn):hover {
  color: var(--text-primary);
}
.nav-links a:not(.btn):hover::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 28px;
  padding: 4px 0;
}
.nav-toggle span {
  display: block;
  height: 1.5px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s var(--ease-out);
  transform-origin: center;
}
.nav-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99;
  background: rgba(8, 8, 12, 0.97);
  backdrop-filter: blur(20px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-out);
}
.mobile-menu.open {
  opacity: 1;
  pointer-events: auto;
}
.mobile-menu a {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.25s;
}
.mobile-menu a:hover { color: var(--gold); }

/* ---- Hero ---- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 0 80px;
  overflow: hidden;
}

.hero-bg-pattern {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 50%, rgba(212, 168, 83, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 40% 60% at 80% 30%, rgba(196, 94, 44, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 80% 40% at 50% 100%, rgba(212, 168, 83, 0.03) 0%, transparent 50%);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 0.85fr;
  gap: 60px;
  align-items: center;
}

.hero-eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
  margin-bottom: 20px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 5.5vw, 4.5rem);
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.hero-title-accent {
  display: block;
  color: var(--gold);
  font-style: italic;
  font-weight: 500;
}

.hero-desc {
  font-size: 1.08rem;
  line-height: 1.75;
  color: var(--text-secondary);
  max-width: 520px;
  margin-bottom: 36px;
}

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

.hero-trust {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.trust-item svg {
  color: var(--gold-dim);
  flex-shrink: 0;
}

/* ---- Book Showcase ---- */
.book-showcase {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.book-glow {
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(40px);
  animation: pulse-glow 4s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

.book-placeholder {
  position: relative;
  width: 280px;
  height: 400px;
  perspective: 800px;
}

.book-spine {
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 24px;
  background: linear-gradient(90deg, #1a1510, #2a2018 40%, #1a1510);
  border-radius: 3px 0 0 3px;
  transform: translateZ(-2px);
  box-shadow: -3px 0 12px rgba(0, 0, 0, 0.5);
}

.book-front {
  position: absolute;
  left: 12px;
  top: 0;
  width: 268px;
  height: 100%;
  background: linear-gradient(135deg, var(--bg-card) 0%, #1a1a24 100%);
  border: 1px solid var(--border-hover);
  border-radius: 2px 8px 8px 2px;
  box-shadow:
    4px 4px 20px rgba(0, 0, 0, 0.4),
    0 0 60px rgba(212, 168, 83, 0.05);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
}

.book-placeholder:hover .book-front {
  transform: rotateY(-6deg) translateX(4px);
  box-shadow:
    8px 4px 30px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(212, 168, 83, 0.08);
}

.book-front-inner {
  text-align: center;
  padding: 30px;
}

.book-label {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--gold-dim);
  margin-bottom: 8px;
}

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

/* Book with actual image */
.book-front.has-image {
  padding: 0;
  border: none;
}
.book-front.has-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- Demo Section ---- */
.demo-section {
  padding: 0 0 var(--section-pad);
  position: relative;
}

.demo-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: clamp(32px, 5vw, 56px);
  position: relative;
  overflow: hidden;
}

.demo-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  opacity: 0.4;
}

.demo-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
  margin-bottom: 20px;
}

.demo-paragraph {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  font-weight: 400;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 720px;
}

.highlight-word {
  position: relative;
  color: var(--text-primary);
  font-weight: 600;
  transition: color 0.3s;
}

.highlight-word::before {
  content: '';
  position: absolute;
  left: -3px;
  right: -3px;
  top: -1px;
  bottom: -1px;
  background: rgba(212, 168, 83, 0.15);
  border-radius: 3px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease-out);
}

.highlight-word.active::before {
  transform: scaleX(1);
}

.highlight-word.active {
  color: var(--gold);
}

.highlight-word::after {
  content: attr(data-highlight);
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--gold);
  opacity: 0;
  transition: opacity 0.3s 0.2s, transform 0.3s 0.2s var(--ease-spring);
}

.highlight-word.active::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Section Common ---- */
.section {
  padding: var(--section-pad) 0;
  position: relative;
}

.section-dark {
  background: var(--bg-elevated);
}

.section-dark::before,
.section-dark::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, var(--border) 50%, transparent 95%);
}
.section-dark::before { top: 0; }
.section-dark::after { bottom: 0; }

.section-header {
  text-align: center;
  margin-bottom: clamp(48px, 6vw, 72px);
}

.section-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--gold);
  margin-bottom: 14px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto;
}

/* ---- Steps ---- */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.step-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px 24px;
  transition: all 0.4s var(--ease-out);
}

.step-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.step-number {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--gold);
  opacity: 0.2;
  line-height: 1;
  margin-bottom: 20px;
}

.step-icon {
  color: var(--gold-dim);
  margin-bottom: 18px;
}

.step-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.step-desc {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* ---- Features ---- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px 28px;
  transition: all 0.4s var(--ease-out);
}

.feature-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.feature-icon {
  color: var(--gold);
  margin-bottom: 18px;
  opacity: 0.8;
}

.feature-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.feature-card p {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* ---- Chapters Table ---- */
.chapters-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}

.chapters-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.chapters-table thead {
  background: rgba(212, 168, 83, 0.05);
}

.chapters-table th {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold-dim);
  text-align: left;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.chapters-table td {
  padding: 14px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.2s;
}

.chapters-table tr:last-child td {
  border-bottom: none;
}

.chapters-table tbody tr:hover td {
  background: rgba(212, 168, 83, 0.03);
}

.ch-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--gold);
  opacity: 0.5;
  width: 60px;
}

.ch-range {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-family: var(--font-body);
  letter-spacing: 0.02em;
}

.ch-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  font-style: italic;
  color: var(--text-primary);
}

/* ---- FAQ ---- */
.faq-list {
  max-width: 720px;
  margin: 0 auto;
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 22px 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  transition: color 0.25s;
}

.faq-question::-webkit-details-marker { display: none; }

.faq-question:hover {
  color: var(--gold);
}

.faq-chevron {
  color: var(--text-muted);
  transition: transform 0.35s var(--ease-out), color 0.25s;
  flex-shrink: 0;
  margin-left: 16px;
}

.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
  color: var(--gold);
}

.faq-answer {
  padding: 0 0 22px;
}

.faq-answer p {
  font-size: 0.92rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

/* ---- CTA Section ---- */
.cta-section {
  padding: var(--section-pad) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 50% at 50% 60%, rgba(212, 168, 83, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.cta-content {
  position: relative;
}

.cta-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.cta-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 36px;
}

/* ---- Footer ---- */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-deep);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-links {
  display: flex;
  gap: 28px;
}

.footer-links a {
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: color 0.25s;
}
.footer-links a:hover {
  color: var(--gold);
}

.footer-copy {
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 12px;
}

/* ---- Reveal Animations ---- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 48px;
  }
  .hero-desc {
    margin-left: auto;
    margin-right: auto;
  }
  .hero-actions {
    justify-content: center;
  }
  .hero-trust {
    justify-content: center;
  }
  .steps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .mobile-menu { display: flex; }

  .nav { padding: 14px 20px; }

  .hero {
    min-height: auto;
    padding: 100px 0 60px;
  }

  .steps-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .features-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .book-placeholder {
    width: 220px;
    height: 310px;
  }
  .book-front {
    width: 208px;
  }

  .chapters-table th,
  .chapters-table td {
    padding: 12px 16px;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
  .footer-links {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-actions .btn {
    justify-content: center;
  }

  .demo-card {
    padding: 24px 20px;
  }

  .btn-lg {
    padding: 16px 28px;
    font-size: 0.92rem;
  }
}
