/* ============================================================
   Dungeon Codex Edition — edition-dungeon-codex.css
   ============================================================ */

/* ── Google Font imports handled in <head> ── */

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

html { scroll-behavior: smooth; }

body {
  background: #0d0b08;
  color: #e8d5a3;
  font-family: 'Share Tech Mono', monospace;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Stone-block background texture ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 38px,
      rgba(255,255,255,0.025) 38px,
      rgba(255,255,255,0.025) 40px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 78px,
      rgba(255,255,255,0.02) 78px,
      rgba(255,255,255,0.02) 80px
    );
  pointer-events: none;
  z-index: 0;
}

/* ── Fade-in overlay ── */
.dc-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  pointer-events: none;
}

/* ── Fixed torches ── */
.torch {
  position: fixed;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, #e8a030 0%, #c8860a 30%, transparent 70%);
  z-index: 100;
  pointer-events: none;
  opacity: 0.7;
}
.torch-tl { top: 20px;  left: 20px;  }
.torch-tr { top: 20px;  right: 20px; }
.torch-bl { bottom: 20px; left: 20px; }
.torch-br { bottom: 20px; right: 20px; }

/* ── Gate Header ── */
.dc-gate {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 38px,
      rgba(255,255,255,0.03) 38px,
      rgba(255,255,255,0.03) 40px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 78px,
      rgba(255,255,255,0.02) 78px,
      rgba(255,255,255,0.02) 80px
    ),
    #0d0b08;
}

/* CSS Arch */
.gate-arch {
  position: relative;
  width: min(500px, 90vw);
  padding: 60px 40px 50px;
  text-align: center;
  border: 3px solid #6b4c12;
  border-radius: 50% 50% 0 0 / 40% 40% 0 0;
  background: linear-gradient(180deg, #1a1208 0%, #0d0b08 100%);
  box-shadow:
    inset 0 0 60px rgba(200, 134, 10, 0.1),
    0 0 40px rgba(200, 134, 10, 0.15),
    0 0 80px rgba(200, 134, 10, 0.05);
  clip-path: inset(0% 0%);
}

.gate-arch::before,
.gate-arch::after {
  content: '';
  position: absolute;
  bottom: -3px;
  width: 3px;
  height: 60px;
  background: #6b4c12;
}
.gate-arch::before { left: -3px; }
.gate-arch::after  { right: -3px; }

.gate-inner { position: relative; z-index: 1; }

.gate-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #c8860a;
  line-height: 1.3;
  text-shadow: 0 0 20px rgba(200, 134, 10, 0.5);
}

.gate-prompt {
  margin-top: 28px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.75rem;
  color: #c8860a;
  letter-spacing: 0.05em;
  opacity: 1;
}

/* ── Main content wrapper ── */
.dc-main {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Floor dividers ── */
.floor-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 60px 0 32px;
  padding: 20px 0;
  background: repeating-linear-gradient(
    90deg,
    #2a2520 0px, #1a1510 4px, #2a2520 8px
  );
}

.divider-label {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.7rem, 1.5vw, 0.95rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #c8860a;
  white-space: nowrap;
  padding: 0 16px;
  flex-shrink: 0;
}

.divider-line {
  height: 1px;
  background: #c8860a;
  flex: 1;
  transform-origin: center;
  transform: scaleX(0);
}

/* ── Card grid ── */
.floor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

/* ── Chamber card ── */
.chamber-card {
  position: relative;
  border: 3px ridge #6b4c12;
  background: #1a1510;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}

/* Corner nail accents */
.chamber-card::before,
.chamber-card::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: #6b4c12;
  z-index: 10;
}
.chamber-card::before { top: 4px;  left: 4px; }
.chamber-card::after  { top: 4px;  right: 4px; }

.card-nail-bl,
.card-nail-br {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #6b4c12;
  z-index: 10;
}
.card-nail-bl { bottom: 4px; left: 4px; }
.card-nail-br { bottom: 4px; right: 4px; }

/* Card image area */
.card-image-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #0d0b08;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: #6b4c12;
  letter-spacing: 0.15em;
}

.card-image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 40%, #1a1510 100%);
  pointer-events: none;
}

.card-tint {
  position: absolute;
  inset: 0;
  opacity: 0.25;
  pointer-events: none;
}

/* Card divider */
.card-rule {
  height: 1px;
  background: #c8860a;
  margin: 0;
  opacity: 0.5;
}

/* Card body */
.card-body {
  padding: 14px 16px 18px;
}

.card-name {
  font-family: 'Palatino Linotype', Georgia, serif;
  font-style: italic;
  font-weight: bold;
  font-size: 1.05rem;
  line-height: 1.3;
  margin-bottom: 4px;
}

.card-year {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.68rem;
  color: #c8860a;
  margin-bottom: 12px;
}

.card-pages {
  list-style: none;
  padding: 0;
  margin: 0;
}

.card-page-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  color: #e8d5a3;
  text-decoration: none;
}

.card-page-item:hover { text-decoration: none; }

.card-bullet {
  flex-shrink: 0;
  font-size: 0.6rem;
  line-height: 1;
  display: inline-block;
}

/* ── Featured Chamber ── */
.featured-chamber {
  margin: 40px 0 20px;
}

.featured-card {
  position: relative;
  border: 3px ridge #6b4c12;
  background: #1a1510;
  display: grid;
  grid-template-columns: 40% 60%;
  overflow: hidden;
  min-height: 300px;
}

.featured-card::before,
.featured-card::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: #6b4c12;
  z-index: 10;
}
.featured-card::before { top: 6px; left: 6px; }
.featured-card::after  { top: 6px; right: 6px; }

.featured-nail-bl,
.featured-nail-br {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #6b4c12;
  z-index: 10;
}
.featured-nail-bl { bottom: 6px; left: 6px; }
.featured-nail-br { bottom: 6px; right: 6px; }

.featured-image-wrap {
  position: relative;
  overflow: hidden;
  background: #0d0b08;
  min-height: 300px;
}

.featured-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.featured-image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 60%, #1a1510 100%);
  pointer-events: none;
}

.featured-tint {
  position: absolute;
  inset: 0;
  opacity: 0.3;
  pointer-events: none;
}

.featured-body {
  position: relative;
  padding: 40px 32px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E"),
    linear-gradient(135deg, #1e1a12 0%, #1a1510 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid #6b4c12;
}

.featured-label {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  color: #c8860a;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.featured-name {
  font-family: 'Palatino Linotype', Georgia, serif;
  font-style: italic;
  font-weight: bold;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.2;
  margin-bottom: 8px;
}

.featured-year {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  color: #c8860a;
  margin-bottom: 16px;
}

.featured-tagline {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.78rem;
  color: #b8a883;
  margin-bottom: 20px;
  line-height: 1.5;
  font-style: italic;
}

.featured-rule {
  height: 1px;
  background: linear-gradient(90deg, #c8860a, transparent);
  margin-bottom: 16px;
}

.featured-pages {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.featured-page-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  color: #e8d5a3;
  text-decoration: none;
}

/* ── Section headers (additional torch elements in section areas) ── */
.section-torch-wrap {
  display: none; /* torches are fixed-position in this edition */
}

/* ── Footer ── */
.dc-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: #080604;
  border-top: 1px solid #2a2016;
  margin-top: 60px;
}

.footer-brand {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  color: #6b5a3e;
  letter-spacing: 0.1em;
}

.footer-name { margin-left: 6px; }

.footer-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-link {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: #6b5a3e;
  text-decoration: none;
}

.footer-sep {
  font-size: 11px;
  color: #3a2e20;
}

/* ── Reduced motion ── */
.no-motion .dc-overlay { opacity: 0 !important; }
.no-motion .chamber-card { opacity: 1 !important; filter: none !important; transform: none !important; }
.no-motion .featured-card { opacity: 1 !important; filter: none !important; transform: none !important; }
.no-motion .divider-line { transform: scaleX(1) !important; }
.no-motion .gate-arch { clip-path: none !important; }
.no-motion .gate-title { opacity: 1 !important; transform: none !important; }
.no-motion .gate-prompt { opacity: 1 !important; }
.no-motion .torch { opacity: 0.6 !important; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .featured-card {
    grid-template-columns: 1fr;
    grid-template-rows: 220px auto;
  }

  .featured-image-overlay {
    background: linear-gradient(180deg, transparent 60%, #1a1510 100%);
  }

  .featured-body {
    border-left: none;
    border-top: 1px solid #6b4c12;
    padding: 24px 20px;
  }

  .floor-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .dc-main { padding: 0 12px; }

  .dc-footer {
    flex-direction: column;
    gap: 8px;
    text-align: center;
    padding: 12px 16px;
  }

  .torch-bl, .torch-br { display: none; }
}

@media (max-width: 480px) {
  .floor-grid {
    grid-template-columns: 1fr;
  }

  .torch-tl, .torch-tr { width: 50px; height: 50px; }
}
