/* ==========================================================================
   Atlas Book — Brew Cartographer
   Vintage parchment atlas with continent pages and page-turn animation
   ========================================================================== */

/* Tab switcher */
.atlas-tabs {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}

.atlas-tab {
  background: none;
  border: none;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8B7355;
  cursor: pointer;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.atlas-tab:hover { color: #C9A84C; }
.atlas-tab.active {
  color: #C9A84C;
  border-bottom-color: #C9A84C;
}

/* Book container */
.book-wrapper {
  perspective: 2000px;
  width: 100%;
  max-width: 1100px;
}

.book {
  position: relative;
  width: 100%;
  max-width: 800px;
  aspect-ratio: 4 / 5;
  max-height: 750px;
  margin: 0 auto;
  border-radius: 4px;
  overflow: hidden;
  box-shadow:
    0 8px 40px rgba(0,0,0,0.6),
    0 2px 10px rgba(0,0,0,0.4);
}

/* Parchment background */
.book-spread {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E"),
    linear-gradient(135deg, #E8D5B0 0%, #D4BC8E 25%, #C9B07A 50%, #D8C494 75%, #E2D1A8 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.book-spread.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

.book-spread.turning-out {
  animation: pageTurnOut 0.7s ease-in-out forwards;
  z-index: 3;
}

.book-spread.turning-in {
  animation: pageTurnIn 0.7s ease-in-out forwards;
  z-index: 2;
}

@keyframes pageTurnOut {
  0% { transform: rotateY(0deg); transform-origin: left center; opacity: 1; }
  100% { transform: rotateY(-90deg); transform-origin: left center; opacity: 0; }
}

@keyframes pageTurnIn {
  0% { transform: rotateY(90deg); transform-origin: right center; opacity: 0; }
  100% { transform: rotateY(0deg); transform-origin: right center; opacity: 1; }
}

/* Page */
.book-page {
  position: relative;
  padding: 30px;
  overflow: hidden;
}

/* Decorative border frame */
.page-frame {
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(139, 115, 85, 0.3);
  pointer-events: none;
}

.page-frame::before,
.page-frame::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: rgba(139, 115, 85, 0.4);
  border-style: solid;
}

.page-frame::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}

.page-frame::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
}

/* Map SVG */
.book-map-container {
  position: absolute;
  inset: 28px;
  z-index: 3;
}

.book-map-container svg {
  width: 100%;
  height: 100%;
}

/* Land — vintage sepia */
.land {
  fill: #C4A96B;
  fill-opacity: 0.35;
  stroke: #5A4630;
  stroke-width: 0.5px;
  stroke-opacity: 0.6;
}

.land-highlight {
  fill: #B89855;
  fill-opacity: 0.5;
  stroke: #5A4630;
  stroke-width: 0.8px;
  stroke-opacity: 0.8;
}

.borders {
  fill: none;
  stroke: #8B7355;
  stroke-width: 0.3px;
  stroke-opacity: 0.3;
  stroke-dasharray: 2,1;
}

.graticule {
  fill: none;
  stroke: #8B7355;
  stroke-width: 0.4px;
  stroke-opacity: 0.2;
}

.graticule-label {
  font-family: 'Crimson Pro', serif;
  font-size: 8px;
  fill: #8B7355;
  fill-opacity: 0.5;
}

/* Pins */
.pin-marker {
  cursor: pointer;
}

.pin-dot {
  fill: #8B5E14;
  stroke: #3A2A10;
  stroke-width: 1.5px;
}

.pin-glow {
  fill: #8B5E14;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.pin-marker:hover .pin-glow {
  opacity: 0.4;
}

/* Continent title */
.continent-title {
  position: absolute;
  top: 28px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 14px;
  font-style: italic;
  font-weight: 400;
  color: #5A4630;
  letter-spacing: 0.08em;
  z-index: 5;
  pointer-events: none;
}

/* Watermarks */
.book-watermark {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Great Vibes', cursive;
  font-size: 28px;
  color: #5A4630;
  opacity: 0.12;
  pointer-events: none;
  z-index: 8;
  white-space: nowrap;
}

.compass-watermark {
  position: absolute;
  bottom: 35px;
  right: 35px;
  width: 64px;
  height: 64px;
  opacity: 0.15;
  pointer-events: none;
  z-index: 8;
}

/* Continent index tabs */
.book-index {
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 15;
}

.index-tab {
  background: #D4BC8E;
  border: 1px solid rgba(139, 115, 85, 0.4);
  border-right: none;
  padding: 6px 8px;
  font-family: 'Crimson Pro', serif;
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5A4630;
  cursor: pointer;
  border-radius: 3px 0 0 3px;
  transition: all 0.2s ease;
  width: 36px;
  text-align: center;
}

.index-tab:hover {
  background: #C9B07A;
  color: #3A2A18;
}

.index-tab.active {
  background: #C9A84C;
  color: #1A1008;
  font-weight: 600;
  width: 40px;
}

/* Nav arrows */
.book-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #8B7355;
  font-size: 28px;
  cursor: pointer;
  padding: 20px 8px;
  z-index: 15;
  opacity: 0.4;
  transition: opacity 0.2s, color 0.2s;
  font-family: serif;
}

.book-nav-arrow:hover {
  opacity: 0.8;
  color: #C9A84C;
}

.book-nav-prev { left: 6px; }
.book-nav-next { right: 44px; }

/* Tooltip */
.book-tooltip {
  position: absolute;
  background: #150D06;
  border: 1px solid #3D2B1A;
  padding: 10px 14px;
  z-index: 100;
  pointer-events: none;
  display: none;
  max-width: 220px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.book-tooltip strong {
  display: block;
  font-family: 'Libre Baskerville', serif;
  font-size: 13px;
  font-weight: 400;
  color: #F0E8D8;
  margin-bottom: 4px;
}

.book-tooltip span {
  display: block;
  font-family: 'Crimson Pro', serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #A89070;
}

/* Page number */
.page-number {
  position: absolute;
  bottom: 22px;
  font-family: 'Crimson Pro', serif;
  font-size: 10px;
  color: #8B7355;
  opacity: 0.5;
  z-index: 5;
  pointer-events: none;
}

.page-number-right { right: 30px; }
