/* === Fonts === */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400&family=Source+Sans+3:wght@300;400;600&display=swap');

/* === Tokens === */
:root {
  --bg: #0f0f10;
  --bg-surface: #18181b;
  --bg-card: #1e1e23;
  --fg: #f0ece4;
  --fg-muted: #9a918a;
  --accent: #c9852a;
  --accent-glow: #e8a83a;
  --border: #2a2a30;
  --stat-fill: #c9852a;
  --book-spine: #8b5e3c;
}

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

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* === Typography === */
h1, h2, h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

/* === Nav === */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 3rem;
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.03em;
}

.nav-tagline {
  font-size: 0.8rem;
  color: var(--fg-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-cta {
  background: var(--accent);
  color: var(--bg);
  padding: 0.5rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 3px;
  transition: background 0.2s;
}

.nav-cta:hover {
  background: var(--accent-glow);
}

/* === Hero === */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 3rem;
  padding: 6rem 3rem 4rem;
  min-height: 70vh;
  background: radial-gradient(ellipse 70% 60% at 60% 40%, rgba(201,133,42,0.07) 0%, transparent 70%), var(--bg);
}

.hero-eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1.2rem;
  font-weight: 600;
}

.hero h1 {
  font-size: clamp(2.8rem, 6vw, 5.5rem);
  color: var(--fg);
  margin-bottom: 1.5rem;
  font-weight: 900;
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--fg-muted);
  max-width: 52ch;
  line-height: 1.75;
  font-weight: 300;
}

/* === Dice decoration === */
.dice-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.die {
  width: 64px;
  height: 64px;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.5;
}

/* === Stats section === */
.stats-section {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4rem 3rem;
}

.stats-inner {
  max-width: 700px;
  margin: 0 auto;
}

.stats-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.stat-row {
  display: grid;
  grid-template-columns: 90px 1fr 50px;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.stat-name {
  font-size: 0.85rem;
  color: var(--fg-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-bar {
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  background: var(--stat-fill);
  border-radius: 2px;
  transition: width 1s ease;
}

.stat-val {
  font-size: 0.85rem;
  color: var(--fg);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stats-footer {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--fg-muted);
  font-style: italic;
}

/* === Features === */
.features {
  padding: 6rem 3rem;
}

.features h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  color: var(--fg);
  margin-bottom: 3rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2px;
}

.feature-card {
  background: var(--bg-surface);
  padding: 2.5rem;
  border: 1px solid var(--border);
  position: relative;
}

.feature-num {
  font-family: 'Playfair Display', serif;
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--bg-card);
  -webkit-text-stroke: 1px var(--accent);
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  line-height: 1;
}

.feature-card h3 {
  font-size: 1.3rem;
  color: var(--fg);
  margin-bottom: 0.8rem;
  font-weight: 700;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.7;
  font-weight: 300;
}

/* === World Generation === */
.worldgen {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 6rem 3rem;
}

.worldgen-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.worldgen-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  display: block;
  margin-bottom: 1rem;
}

.worldgen-header h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: 3rem;
}

.worldgen-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

.worldgen-text p {
  color: var(--fg-muted);
  font-size: 0.95rem;
  line-height: 1.8;
  font-weight: 300;
  margin-bottom: 1.2rem;
}

.worldgen-roll {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.roll-display {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.5rem;
}

.roll-category {
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
}

.roll-result {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
}

.roll-result span {
  font-size: 0.9rem;
  color: var(--fg);
}

.roll-result strong {
  color: var(--accent-glow);
}

.roll-mono {
  font-size: 0.7rem;
  color: var(--fg-muted);
  opacity: 0.5;
  font-family: monospace;
}

/* === Marketplace === */
.marketplace {
  padding: 6rem 3rem;
}

.marketplace-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.marketplace-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  display: block;
  margin-bottom: 1rem;
}

.marketplace-header h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: 3rem;
}

.marketplace-body {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 4rem;
  align-items: start;
}

.marketplace-description p {
  color: var(--fg-muted);
  font-size: 0.95rem;
  line-height: 1.8;
  font-weight: 300;
  margin-bottom: 1rem;
}

.marketplace-cards {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.book-card {
  display: flex;
  gap: 0;
  width: 160px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.book-spine {
  width: 12px;
  background: var(--book-spine);
  flex-shrink: 0;
}

.book-content {
  padding: 1rem;
}

.book-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.3;
  margin-bottom: 0.4rem;
}

.book-author {
  font-size: 0.7rem;
  color: var(--fg-muted);
  margin-bottom: 0.5rem;
}

.book-meta {
  font-size: 0.65rem;
  color: var(--fg-muted);
  opacity: 0.6;
  margin-bottom: 0.6rem;
  line-height: 1.4;
}

.book-price {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

/* === Closing === */
.closing {
  padding: 7rem 3rem;
  text-align: center;
  background: radial-gradient(ellipse 60% 80% at 50% 100%, rgba(201,133,42,0.06) 0%, transparent 70%), var(--bg);
}

.closing-inner {
  max-width: 600px;
  margin: 0 auto;
}

.closing-quote {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-style: italic;
  color: var(--fg);
  line-height: 1.4;
  margin-bottom: 1.5rem;
}

.closing-sub {
  font-size: 0.95rem;
  color: var(--fg-muted);
  font-weight: 300;
  line-height: 1.7;
}

/* === Footer === */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--accent);
}

.footer-tagline {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* === Pricing Modal === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,0.88);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.open {
  display: flex;
}

.modal-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3rem;
  max-width: 680px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 40px rgba(201,133,42,0.08);
}

.modal-close {
  position: absolute;
  top: 1.2rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--fg); }

.modal-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.modal-eyebrow {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  font-weight: 600;
  display: block;
  margin-bottom: 0.8rem;
}

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  color: var(--fg);
  margin-bottom: 0.5rem;
  font-weight: 900;
}

.modal-sub {
  font-size: 0.9rem;
  color: var(--fg-muted);
  font-weight: 300;
}

.pricing-tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.tier {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1.5rem 1rem;
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  cursor: pointer;
  position: relative;
  text-align: center;
}

.tier:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(201,133,42,0.12);
  transform: translateY(-2px);
}

.tier-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--bg);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.7rem;
  border-radius: 99px;
  white-space: nowrap;
}

.tier-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 0.4rem;
}

.tier-price {
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.3rem;
}

.tier-desc {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-bottom: 1.2rem;
  font-weight: 300;
}

.tier-cta {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.4rem 1rem;
  border-radius: 3px;
  transition: background 0.2s, color 0.2s;
}

.tier:hover .tier-cta {
  background: var(--accent);
  color: var(--bg);
}

.tier-premium {
  border-color: rgba(201,133,42,0.4);
  background: var(--bg-surface);
}

.modal-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-weight: 300;
}

@media (max-width: 600px) {
  .pricing-tiers {
    grid-template-columns: 1fr;
  }
}

/* === Responsive === */
@media (max-width: 768px) {
  nav, .hero, .features, .worldgen, .marketplace, .closing {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .hero {
    grid-template-columns: 1fr;
    padding-top: 3rem;
  }

  .hero-decoration { display: none; }

  .worldgen-layout, .marketplace-body {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

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

  footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .stat-row {
    grid-template-columns: 70px 1fr 40px;
    gap: 0.6rem;
  }

  .marketplace-cards {
    flex-direction: column;
  }

  .book-card { width: 100%; }
}