/* Joe Eddie's Cubist Abstract Tarot - Dark theme */
/* Palette: deep charcoal, warm ochre accents, cream text - Picasso by night */

:root {
  --ochre: #d4936b;
  --burnt-sienna: #a85a2a;
  --deep-blue: #2a3a5a;
  --cream: #e8e4dc;
  --warm-white: #f0ebe2;
  --charcoal: #1a1a24;
  --surface: #22222e;
  --surface-elevated: #2a2a38;
  --accent-gold: #c9a227;
  --shadow-warm: rgba(0, 0, 0, 0.4);
  --geometric-angle: 3deg;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Syne', sans-serif;
  background: #0f0f14;
  color: var(--cream);
  min-height: 100vh;
}

/* Header */
.header {
  background:
    linear-gradient(180deg, rgba(10, 10, 18, 0.94) 0%, rgba(15, 15, 28, 0.9) 50%, rgba(20, 20, 35, 0.92) 100%),
    url('card-18.png') center center / cover no-repeat;
  background-color: #0a0a12;
  color: var(--warm-white);
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    linear-gradient(45deg, transparent 48%, rgba(212, 147, 107, 0.06) 50%, transparent 52%),
    linear-gradient(-45deg, transparent 48%, rgba(201, 162, 39, 0.05) 50%, transparent 52%);
  pointer-events: none;
}

.header .title,
.header .subtitle,
.header .deck-changer,
.header .nav-tabs {
  position: relative;
  z-index: 1;
}

.title {
  font-family: 'Fraunces', serif;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.02em;
}

.subtitle {
  font-size: 0.95rem;
  opacity: 0.9;
  margin: 0.5rem 0 0.75rem;
}

.deck-changer {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.deck-btn {
  font-family: 'Syne', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
  color: var(--warm-white);
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 2px;
}

.deck-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
}

.deck-btn.active {
  background: rgba(212, 147, 107, 0.3);
  border-color: var(--ochre);
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-tab {
  font-family: 'Syne', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.6rem 1.2rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: var(--warm-white);
  cursor: pointer;
  transition: all 0.25s ease;
  border-radius: 2px;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
}

.nav-tab.active {
  background: var(--ochre);
  border-color: var(--ochre);
  color: var(--warm-white);
}

/* Main content */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.view {
  display: none;
  animation: fadeIn 0.4s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cardReveal {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  justify-items: center;
}

@media (min-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
  }
}

@media (min-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
  }
}

.gallery-card {
  position: relative;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
  aspect-ratio: 2/3;
  max-width: 200px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.gallery-card:hover {
  transform: translateY(-6px) rotate(var(--geometric-angle));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(212, 147, 107, 0.2);
}

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

.gallery-card .card-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 0.6rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.gallery-card:hover .card-label {
  opacity: 1;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 18, 0.97);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lightbox.active {
  display: flex;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 2rem;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  max-width: 90vw;
}

.lightbox-content img {
  max-height: 70vh;
  max-width: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-content img.reversed {
  transform: rotate(180deg);
}

.lightbox-info {
  text-align: center;
  color: white;
}

.lightbox-info h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  margin: 0 0 0.25rem;
}

.lightbox-info p {
  margin: 0;
  opacity: 0.85;
  font-size: 0.95rem;
}

.lightbox-meaning {
  margin-top: 1rem !important;
  max-width: 400px;
  font-style: italic;
  opacity: 0.9;
  line-height: 1.5;
  white-space: pre-line;
}

/* Daily Draw */
.daily-container {
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
}

.daily-intro h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.75rem;
  color: var(--warm-white);
  margin: 0 0 0.5rem;
}

.daily-intro p {
  color: var(--cream);
  opacity: 0.9;
  margin: 0 0 2rem;
}

.daily-card-area {
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.daily-card-slot {
  width: 100%;
}

.draw-btn {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 1rem 2.5rem;
  background: var(--ochre);
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px var(--shadow-warm);
}

.draw-btn:hover {
  background: var(--burnt-sienna);
  transform: scale(1.02);
}

.drawn-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.drawn-card.hidden {
  display: none !important;
}

.drawn-card img.clickable {
  cursor: pointer;
}

.drawn-card img {
  max-width: 220px;
  width: 100%;
  border-radius: 4px;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: transform 0.5s ease;
}

.drawn-card img.reversed {
  transform: rotate(180deg);
}

.drawn-card img.reversed:hover {
  transform: rotate(182deg) scale(1.02);
}

.drawn-card img:hover {
  transform: rotate(2deg) scale(1.02);
}

.drawn-card-info h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.4rem;
  margin: 0 0 0.25rem;
  color: var(--warm-white);
}

.drawn-card-info p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--cream);
  opacity: 0.85;
}

.daily-card-meaning {
  margin-top: 0.75rem !important;
  font-style: italic;
  max-width: 360px;
  line-height: 1.45;
  white-space: pre-line;
}

.daily-date {
  font-style: italic;
  margin-top: 0.5rem !important;
}

.draw-again-btn {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  padding: 0.5rem 1.2rem;
  background: transparent;
  border: 2px solid var(--ochre);
  color: var(--ochre);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.25s ease;
}

.draw-again-btn:hover {
  background: var(--ochre);
  color: white;
}

.draw-again-btn.hidden {
  display: none !important;
}

.daily-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1rem;
}

.daily-actions.hidden {
  display: none !important;
}

/* Spreads */
.spreads-container {
  max-width: 1000px;
  margin: 0 auto;
}

.spreads-container:has(.celtic-spread) {
  max-width: 1100px;
}

.spread-selector h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  color: var(--warm-white);
  margin: 0 0 1rem;
}

.spread-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.spread-option {
  flex: 1 1 200px;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  transition: all 0.25s ease;
  font-family: 'Syne', sans-serif;
}

.spread-option:hover {
  border-color: rgba(212, 147, 107, 0.5);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.spread-option.active {
  border-color: var(--ochre);
  background: linear-gradient(135deg, rgba(212, 147, 107, 0.15), rgba(201, 162, 39, 0.08));
}

.spread-name {
  display: block;
  font-weight: 600;
  color: var(--warm-white);
  margin-bottom: 0.25rem;
}

.spread-desc {
  display: block;
  font-size: 0.8rem;
  color: var(--cream);
  opacity: 0.8;
}

.spread-layout {
  background: var(--surface);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.spread-layout.celtic-spread {
  padding: 2.5rem;
  background: linear-gradient(160deg, #1a1a24 0%, #1e1e2a 50%, #16161e 100%);
}

.spread-instructions {
  margin-bottom: 1.5rem;
  color: var(--cream);
  opacity: 0.9;
}

.spread-positions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  min-height: 200px;
}

/* Spread layout variants */
.spread-positions.layout-row {
  flex-direction: row;
}

/* Celtic Cross layout with cross background */
/* Traditional: Cross (1-6) + Staff (7-10) on right */
.spread-positions.layout-celtic {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
  grid-template-rows: auto auto auto auto;
  gap: 1rem;
  max-width: 950px;
  margin-left: auto;
  margin-right: auto;
  padding: 2rem;
  min-height: 560px;
}

/* Cross design background - vertical and horizontal arms in ochre */
.spread-positions.layout-celtic::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, transparent 0%, transparent calc(50% - 4px), rgba(212, 147, 107, 0.1) calc(50% - 4px), rgba(212, 147, 107, 0.18) 50%, rgba(212, 147, 107, 0.1) calc(50% + 4px), transparent calc(50% + 4px), transparent 100%),
    linear-gradient(to bottom, transparent 0%, transparent calc(50% - 4px), rgba(212, 147, 107, 0.1) calc(50% - 4px), rgba(212, 147, 107, 0.18) 50%, rgba(212, 147, 107, 0.1) calc(50% + 4px), transparent calc(50% + 4px), transparent 100%);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  z-index: 0;
}

/* Inner frame - subtle cross-shaped boundary */
.spread-positions.layout-celtic::after {
  content: '';
  position: absolute;
  inset: 1.25rem;
  pointer-events: none;
  border: 1px solid rgba(212, 147, 107, 0.15);
  border-radius: 3px;
  z-index: 0;
}

.spread-positions.layout-celtic .position-slot {
  position: relative;
  z-index: 1;
}

/* Traditional ancient Celtic Cross layout */
.spread-positions.layout-celtic .position-slot:nth-child(1) { grid-column: 2; grid-row: 2; }  /* Center - Present */
.spread-positions.layout-celtic .position-slot:nth-child(2) { grid-column: 3; grid-row: 2; }  /* Crossing - Challenge */
.spread-positions.layout-celtic .position-slot:nth-child(3) { grid-column: 2; grid-row: 1; }  /* Above - Goal */
.spread-positions.layout-celtic .position-slot:nth-child(4) { grid-column: 2; grid-row: 3; }  /* Below - Distant Past */
.spread-positions.layout-celtic .position-slot:nth-child(5) { grid-column: 4; grid-row: 2; }  /* Right - Recent Past */
.spread-positions.layout-celtic .position-slot:nth-child(6) { grid-column: 1; grid-row: 2; }  /* Left - Future */
.spread-positions.layout-celtic .position-slot:nth-child(7) { grid-column: 5; grid-row: 4; }  /* Staff bottom - Self */
.spread-positions.layout-celtic .position-slot:nth-child(8) { grid-column: 5; grid-row: 3; }  /* Staff */
.spread-positions.layout-celtic .position-slot:nth-child(9) { grid-column: 5; grid-row: 2; }  /* Staff */
.spread-positions.layout-celtic .position-slot:nth-child(10) { grid-column: 5; grid-row: 1; } /* Staff top - Outcome */

/* Emphasize center cards (Present & Challenge) in the cross */
.spread-positions.layout-celtic .position-slot:nth-child(1),
.spread-positions.layout-celtic .position-slot:nth-child(2) {
  box-shadow: 0 0 0 1px rgba(212, 147, 107, 0.25), 0 8px 24px rgba(0, 0, 0, 0.4);
}

.spread-positions.layout-celtic .position-slot:nth-child(1).filled,
.spread-positions.layout-celtic .position-slot:nth-child(2).filled {
  border-color: var(--ochre);
  box-shadow: 0 0 0 1px rgba(212, 147, 107, 0.35), 0 8px 28px rgba(0, 0, 0, 0.5);
}

/* Slightly larger slots for Celtic Cross */
.spread-positions.layout-celtic .position-slot {
  width: 100%;
  min-width: 0;
  min-height: 200px;
}

.spread-positions.layout-celtic .position-slot.filled {
  min-height: 260px;
}

@media (max-width: 750px) {
  .spread-positions.layout-celtic {
    padding: 1rem;
    gap: 0.6rem;
    min-height: 420px;
  }

  .spread-positions.layout-celtic .position-slot {
    min-height: 140px;
  }

  .spread-positions.layout-celtic .position-slot.filled {
    min-height: 200px;
  }
}

.spread-positions.layout-single {
  justify-content: center;
}

.spread-positions.layout-single .position-slot {
  width: 160px;
  min-height: 240px;
}

.spread-positions.layout-single .position-slot.filled img {
  max-width: 150px;
}

.position-slot {
  width: 120px;
  min-height: 180px;
  background: linear-gradient(145deg, #1e1e2a, #252532);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  transition: all 0.3s ease;
}

.position-slot.filled {
  border-style: solid;
  border-color: var(--ochre);
  background: var(--surface-elevated);
  min-height: 240px;
}

.position-slot .slot-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--warm-white);
  text-align: center;
  margin-bottom: 0.25rem;
}

.position-slot .slot-desc {
  font-size: 0.65rem;
  color: var(--cream);
  opacity: 0.7;
  text-align: center;
  margin-bottom: 0.5rem;
}

.position-slot img {
  width: 100%;
  max-width: 110px;
  border-radius: 4px;
  flex: 1;
  object-fit: cover;
}

.position-slot img.clickable {
  cursor: pointer;
}

.position-slot img.reversed {
  transform: rotate(180deg);
}

.position-slot .card-name {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--cream);
  margin-top: 0.5rem;
  text-align: center;
}

.position-slot .card-meaning {
  font-size: 0.6rem;
  color: var(--cream);
  opacity: 0.8;
  margin-top: 0.35rem;
  text-align: center;
  line-height: 1.3;
  white-space: pre-line;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.draw-spread-btn {
  display: block;
  margin: 0 auto;
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.9rem 2rem;
  background: var(--ochre);
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.draw-spread-btn:hover {
  background: var(--burnt-sienna);
  transform: scale(1.02);
}

.draw-spread-btn.hidden {
  display: none !important;
}

.spread-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin: 1rem 0 1.5rem;
}

.spread-actions.hidden {
  display: none !important;
}

/* Print & Share buttons */
.action-btn {
  font-family: 'Syne', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: var(--cream);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.25s ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.action-btn.print-btn:hover {
  border-color: var(--ochre);
  background: rgba(212, 147, 107, 0.2);
}

.action-btn.share-btn:hover {
  border-color: var(--accent-gold);
  background: rgba(201, 162, 39, 0.15);
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 0.75rem 1.5rem;
  background: var(--surface-elevated);
  border: 1px solid rgba(212, 147, 107, 0.4);
  color: var(--cream);
  font-size: 0.9rem;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Print styles */
@media print {
  .no-print,
  .header,
  .nav-tabs,
  .deck-changer,
  .footer,
  .draw-btn,
  .draw-again-btn,
  .draw-spread-btn,
  .spread-selector,
  .spread-options,
  .lightbox,
  .lightbox-close {
    display: none !important;
  }

  body {
    background: white;
    color: #333;
  }

  .view {
    display: none !important;
  }

  body.print-daily #daily {
    display: block !important;
  }

  body.print-spread #spreads {
    display: block !important;
  }

  .daily-container,
  .spreads-container {
    max-width: 100%;
  }

  .drawn-card img {
    max-width: 200px;
  }

  .position-slot {
    break-inside: avoid;
  }
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.85rem;
  color: var(--cream);
  opacity: 0.6;
}
