/* ==========================================================================
   WebWorkshop — Concept 3: The Curio Cabinet & Vintage Library Archive
   Theme: Dark Academia, Antique Leather, Aged Parchment & Brass Accents
   ========================================================================== */

:root {
  /* Rich Dark Academia Palette */
  --archive-bg: #0f0c09;
  --archive-wood: #18120d;
  --archive-wood-elevated: #241a13;
  --archive-wood-hover: #31231a;
  --archive-border: #3d2c20;
  --archive-border-gold: #c5a059;
  
  --archive-gold: #d4af37;
  --archive-gold-faint: rgba(212, 175, 55, 0.12);
  --archive-gold-glow: rgba(212, 175, 55, 0.25);
  
  --archive-crimson: #841b1b;
  --archive-crimson-faint: rgba(132, 27, 27, 0.18);
  --archive-wax: #a32222;
  
  --archive-parchment: #f0e6d2;
  --archive-parchment-dim: #c7b8a1;
  --archive-parchment-card: #e8dcbe;
  --archive-ink: #2b2018;
  --archive-ink-dim: #5c4738;
  
  --archive-font-display: "Cinzel", "Playfair Display", "Times New Roman", serif;
  --archive-font-serif: "EB Garamond", "Source Serif 4", Georgia, serif;
  --archive-font-mono: "Courier New", Courier, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100vh;
  background-color: var(--archive-bg);
  color: var(--archive-parchment);
  font-family: var(--archive-font-serif);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Warm Library Lamp Ambient Vignette */
.archive-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(ellipse 55rem 40rem at 50% 10%, rgba(212, 175, 55, 0.08), transparent 70%),
    radial-gradient(circle at 50% 50%, transparent 50%, rgba(5, 3, 2, 0.85) 100%);
}

/* Wood Grain & Subtle Parchment Background */
.archive-texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: radial-gradient(#d4af37 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Main Container */
.archive-shell {
  position: relative;
  z-index: 10;
  max-width: 1160px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

/* ---------- 1. Ex Libris Header ---------- */
.archive-head {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--archive-border);
  position: relative;
}

.archive-head::after {
  content: "✦";
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--archive-bg);
  padding: 0 14px;
  color: var(--archive-gold);
  font-size: 13px;
}

.archive-crest {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  box-shadow: 0 0 24px var(--archive-gold-faint);
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.archive-crest:hover {
  transform: scale(1.05);
  box-shadow: 0 0 32px var(--archive-gold-glow);
}

.archive-crest-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.archive-title-label {
  font-family: var(--archive-font-display);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--archive-gold);
}

.archive-main-title {
  font-family: var(--archive-font-display);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--archive-parchment);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  line-height: 1.15;
}

.archive-tagline {
  max-width: 58ch;
  font-style: italic;
  font-size: 1.12rem;
  color: var(--archive-parchment-dim);
}

.archive-latin-motto {
  font-family: var(--archive-font-display);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--archive-gold);
  opacity: 0.75;
}

/* ---------- 2. Featured Tome: Sven Hassel Archive ---------- */
.archive-masterpiece-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.archive-section-label {
  font-family: var(--archive-font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--archive-gold);
  display: flex;
  align-items: center;
  gap: 12px;
}

.archive-section-label::before,
.archive-section-label::after {
  content: "";
  height: 1px;
  background: var(--archive-border);
  flex: 1;
}

/* Heavy Leather Tome Bookstand */
.archive-tome-desk {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 40px;
  background: linear-gradient(145deg, var(--archive-wood-elevated) 0%, var(--archive-wood) 100%);
  border: 1px solid var(--archive-border);
  border-radius: 14px;
  padding: 36px 36px 36px 32px;
  box-shadow: 
    0 16px 40px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(212, 175, 55, 0.2);
  position: relative;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.archive-tome-desk:hover {
  border-color: var(--archive-border-gold);
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.75),
    0 0 25px var(--archive-gold-faint);
}

/* Antique Book Display & 3D Fanned Folio Deck */
.archive-book-display {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  perspective: 1000px;
}

.archive-deck-stack {
  position: relative;
  width: 100%;
  max-width: 200px;
  aspect-ratio: 5 / 8;
  margin: 8px auto 0;
}

/* Layered Companion Volumes Peeking in 3D */
.archive-deck-layer {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(212, 175, 55, 0.25);
  box-shadow: -8px 10px 20px rgba(0, 0, 0, 0.7);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
  pointer-events: none;
}

.archive-deck-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.65;
  filter: sepia(0.2) brightness(0.8);
  display: block;
}

.archive-deck-layer.layer-3 {
  transform: rotate(-5deg) translate(-14px, 8px);
  z-index: 1;
  opacity: 0.75;
}

.archive-deck-layer.layer-2 {
  transform: rotate(4deg) translate(12px, 5px);
  z-index: 2;
  opacity: 0.85;
}

.archive-deck-stack:hover .archive-deck-layer.layer-3 {
  transform: rotate(-7deg) translate(-18px, 10px);
}

.archive-deck-stack:hover .archive-deck-layer.layer-2 {
  transform: rotate(6deg) translate(16px, 7px);
}

/* Foreground Active Book Tome */
.archive-deck-front {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  overflow: hidden;
  background: #0b0806;
  border: 1px solid rgba(212, 175, 55, 0.45);
  box-shadow: 
    4px 2px 0 #d4af37,
    6px 3px 0 #18120d,
    8px 4px 0 rgba(212, 175, 55, 0.6),
    -12px 16px 30px rgba(0, 0, 0, 0.85);
  cursor: pointer;
  display: block;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.archive-deck-front:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 
    5px 3px 0 #d4af37,
    8px 4px 0 #18120d,
    10px 5px 0 rgba(212, 175, 55, 0.7),
    -16px 22px 36px rgba(0, 0, 0, 0.95);
}

.archive-deck-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.22s ease;
}

/* Spine Shadow Overlay */
.archive-deck-front::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.65) 0%,
    rgba(255, 255, 255, 0.12) 3.5%,
    rgba(0, 0, 0, 0.3) 8%,
    transparent 16%
  );
  z-index: 5;
}

/* Antique Wooden Lectern Ledge */
.archive-lectern-ledge {
  position: absolute;
  bottom: -10px;
  left: -12px;
  right: -12px;
  height: 14px;
  background: linear-gradient(to bottom, #3b281b 0%, #1e130c 100%);
  border-top: 2px solid var(--archive-gold);
  border-bottom: 1px solid #000;
  border-radius: 3px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.8);
  z-index: 6;
  pointer-events: none;
}

.archive-lectern-ledge::after {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 6px;
  background: var(--archive-gold);
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Hanging Red Archival Bookmark Ribbon */
.archive-ribbon-marker {
  position: absolute;
  top: -12px;
  right: 24px;
  width: 18px;
  height: 68px;
  background: var(--archive-crimson);
  box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.5);
  z-index: 10;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  border-top: 2px solid var(--archive-gold);
}

/* Wax Seal on Lectern */
.archive-wax-seal {
  position: absolute;
  bottom: -8px;
  right: -16px;
  width: 44px;
  height: 44px;
  background: radial-gradient(circle at 40% 35%, #b92b2b 0%, #7e1717 65%, #4a0c0c 100%);
  border-radius: 50%;
  box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.75), inset 0 1px 2px rgba(255, 255, 255, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border: 1px solid #5a1010;
  font-family: var(--archive-font-display);
  font-size: 13px;
  font-weight: 700;
  color: #f7d2d2;
  text-shadow: 0 -1px 1px #330000;
  pointer-events: none;
}

.archive-wax-seal small {
  font-size: 7.5px;
  letter-spacing: 0.1em;
  color: #e5a4a4;
  margin-top: -3px;
}

/* Interactive Gallery Navigation Controls */
.archive-gallery-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 220px;
  gap: 8px;
  padding-top: 4px;
}

.archive-gallery-arrow {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--archive-border-gold);
  background: var(--archive-wood);
  color: var(--archive-gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  font-family: var(--archive-font-display);
  transition: all 0.15s ease;
  user-select: none;
}

.archive-gallery-arrow:hover {
  background: var(--archive-wood-hover);
  color: #fff;
  border-color: var(--archive-gold);
  box-shadow: 0 0 10px var(--archive-gold-glow);
  transform: scale(1.08);
}

.archive-gallery-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.archive-active-vol-label {
  font-family: var(--archive-font-display);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--archive-parchment);
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  max-width: 140px;
}

.archive-active-counter {
  font-family: var(--archive-font-mono);
  font-size: 10.5px;
  color: var(--archive-gold);
}

/* Brass Corner Embellishments */
.archive-tome-desk::before,
.archive-tome-desk::after {
  content: "⚜";
  position: absolute;
  color: var(--archive-gold);
  font-size: 16px;
  opacity: 0.6;
}
.archive-tome-desk::before {
  top: 10px;
  left: 12px;
}
.archive-tome-desk::after {
  bottom: 10px;
  right: 12px;
}

/* Tome Description & Metadata */
.archive-tome-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.archive-meta-stamp-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.archive-stamp-pill {
  font-family: var(--archive-font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border: 1px solid var(--archive-border-gold);
  color: var(--archive-gold);
  border-radius: 3px;
  background: var(--archive-gold-faint);
  text-transform: uppercase;
}

.archive-stamp-pill.seal {
  background: var(--archive-crimson-faint);
  border-color: var(--archive-crimson);
  color: #ff9999;
}

.archive-tome-title {
  font-family: var(--archive-font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.3rem);
  font-weight: 700;
  color: var(--archive-parchment);
  line-height: 1.2;
}

.archive-tome-desc {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--archive-parchment-dim);
}

/* Active Reading Bookmark Slip (Detected from LocalStorage) */
.archive-bookmark-slip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--archive-parchment-card);
  color: var(--archive-ink);
  padding: 12px 18px;
  border-left: 4px solid var(--archive-crimson);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  font-size: 13.5px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.archive-bookmark-slip:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
}

.archive-bookmark-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.archive-bookmark-label {
  font-family: var(--archive-font-display);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--archive-crimson);
  font-weight: 700;
}

.archive-bookmark-btn {
  font-family: var(--archive-font-display);
  font-size: 12px;
  color: var(--archive-parchment);
  background: var(--archive-crimson);
  padding: 6px 14px;
  border-radius: 3px;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.archive-bookmark-btn:hover {
  background: #a32222;
}

/* Masterpiece CTAs */
.archive-actions-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--archive-border);
}

.archive-primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--archive-gold) 0%, #aa842d 100%);
  color: #120e0b;
  font-family: var(--archive-font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.archive-primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.archive-secondary-link {
  font-family: var(--archive-font-display);
  font-size: 12.5px;
  color: var(--archive-gold);
  text-decoration: none;
  letter-spacing: 0.06em;
  transition: color 0.15s ease;
}

.archive-secondary-link:hover {
  color: #fff;
  text-decoration: underline;
}

/* Mini Catalog Drawer (Volumes in this folio) */
.archive-index-drawer {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.archive-drawer-label {
  font-family: var(--archive-font-display);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--archive-parchment-dim);
}

.archive-tome-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.archive-tome-pill {
  font-family: var(--archive-font-serif);
  font-size: 13px;
  color: var(--archive-parchment);
  background: var(--archive-wood);
  border: 1px solid var(--archive-border);
  padding: 4px 10px;
  border-radius: 3px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.archive-tome-pill:hover {
  border-color: var(--archive-gold);
  color: var(--archive-gold);
  background: var(--archive-wood-hover);
}

/* ---------- 3. The Curio Cabinet Folio Boxes (3 Grid) ---------- */
.archive-cabinet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

/* Antiquarian Card Index / Curio Box */
.archive-folio-card {
  background: linear-gradient(160deg, var(--archive-wood-elevated) 0%, var(--archive-wood) 100%);
  border: 1px solid var(--archive-border);
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  color: var(--archive-parchment);
  position: relative;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.archive-folio-card:hover {
  transform: translateY(-4px);
  border-color: var(--archive-gold);
  box-shadow: 
    0 16px 36px rgba(0, 0, 0, 0.6),
    0 0 18px var(--archive-gold-faint);
}

/* Brass Card Pull / Label Plate Top */
.archive-card-plate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--archive-border);
  padding-bottom: 10px;
}

.archive-card-catalog-no {
  font-family: var(--archive-font-mono);
  font-size: 11px;
  color: var(--archive-gold);
  letter-spacing: 0.1em;
}

.archive-card-badge {
  font-family: var(--archive-font-display);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 2px;
  border: 1px solid var(--archive-border);
}

.archive-card-badge.manuscript {
  color: #a3c293;
  border-color: #3b5430;
  background: rgba(59, 84, 48, 0.2);
}

.archive-card-badge.treatise {
  color: #deb887;
  border-color: #8c6d43;
  background: rgba(140, 109, 67, 0.2);
}

.archive-card-badge.archive {
  color: #9cb3c9;
  border-color: #384c5e;
  background: rgba(56, 76, 94, 0.2);
}

.archive-card-title {
  font-family: var(--archive-font-display);
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--archive-parchment);
  line-height: 1.25;
  transition: color 0.15s ease;
}

.archive-folio-card:hover .archive-card-title {
  color: var(--archive-gold);
}

.archive-card-desc {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--archive-parchment-dim);
  flex: 1;
}

.archive-card-footer {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--archive-font-display);
  font-size: 11.5px;
  color: var(--archive-gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.archive-card-footer span {
  transition: transform 0.15s ease;
}

.archive-folio-card:hover .archive-card-footer span {
  transform: translateX(4px);
}

/* ---------- 4. Archival Footer ---------- */
.archive-foot {
  text-align: center;
  padding-top: 32px;
  border-top: 1px solid var(--archive-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--archive-parchment-dim);
  font-size: 13.5px;
}

.archive-foot-latin {
  font-family: var(--archive-font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--archive-gold);
  opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .archive-tome-desk {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 20px;
  }
  .archive-book-display {
    width: 100%;
    max-width: 240px;
    margin: 0 auto;
  }
  .archive-deck-stack {
    max-width: 180px;
  }
  .archive-gallery-controls {
    width: 100%;
    max-width: 240px;
  }
  .archive-cabinet-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .archive-bookmark-slip {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .archive-bookmark-btn {
    align-self: flex-start;
  }
}

