/* ==========================================================================
   Design System & Global Variables
   ========================================================================== */
:root {
  /* Soft Mystic Color Palette */
  --bg-main: #fbf9f6;          /* Alabaster cream */
  --bg-card: #ffffff;          /* Soft card white */
  --color-lavender: #f2edf8;   /* Pale spiritual lavender */
  --color-rose: #faf0f2;       /* Soft dusty rose */
  --color-gold: #f4edd9;       /* Light antique gold tint */
  --accent-purple: #967bb6;    /* Medium muted amethyst */
  
  /* Text and Borders */
  --text-main: #3c3442;        /* Dark plum charcoal */
  --text-muted: #75687d;       /* Mauve gray */
  --border-pale: #ebe2f0;      /* Soft lavender gray borders */
  
  /* Glow Effects and Shadows */
  --shadow-subtle: 0 4px 20px rgba(117, 104, 125, 0.06);
  --shadow-hover: 0 10px 30px rgba(150, 123, 182, 0.12);
  --glow-active: 0 0 25px rgba(150, 123, 182, 0.4);
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Base Reset & Styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  position: relative;
  isolation: isolate;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  padding-top: 110px; /* Accommodate the fixed double header */
  scroll-behavior: smooth;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 20%, rgba(255, 172, 213, 0.2), transparent 48%),
    radial-gradient(ellipse at 82% 72%, rgba(177, 143, 255, 0.13), transparent 52%);
  animation: cosmic-pulse 9s ease-in-out infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  inset: 7px;
  z-index: 2000;
  pointer-events: none;
  border-radius: 13px;
  padding: 2px;
  background: conic-gradient(from 35deg, #ae6dff, #ff83c8, #8de8ff, #c39aff, #ae6dff);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  box-shadow: inset 0 0 20px rgba(177, 104, 255, 0.16), 0 0 18px rgba(233, 117, 255, 0.16);
}

body > * {
  position: relative;
  z-index: 1;
}

@keyframes cosmic-pulse {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

/* ==========================================================================
   Header and Fixed Navigation
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: rgba(251, 249, 246, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-pale);
  box-shadow: 0 2px 15px rgba(117, 104, 125, 0.04);
}

.navbar {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  flex-wrap: wrap;
  gap: 15px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-link {
  display: inline-flex;
  padding: 2px;
  border-radius: 12px;
  background: conic-gradient(from 35deg, #ae6dff, #ff83c8, #8de8ff, #c39aff, #ae6dff);
  transition: var(--transition-smooth);
}

.brand-logo-link img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
  background: var(--bg-card);
}

.brand-logo-link:hover,
.brand-logo-link:focus-visible {
  box-shadow: 0 0 12px rgba(219, 112, 255, 0.7), 0 0 24px rgba(255, 132, 200, 0.48);
  transform: translateY(-1px);
}

.site-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.site-links a {
  padding: 7px 12px;
  border: 1px solid var(--border-pale);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(242, 237, 248, 0.9), rgba(250, 240, 242, 0.9));
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: var(--transition-smooth);
}

.site-links a:hover,
.site-links a:focus-visible {
  border-color: #bd8bdb;
  box-shadow: 0 0 14px rgba(206, 112, 255, 0.34);
  color: #684c89;
}

#glow-box {
  font-family: "Georgia", serif;
  font-size: 1.5rem;
  font-weight: bold;
  letter-spacing: 1px;
  color: var(--text-main);
  text-shadow: 0 0 10px rgba(150, 123, 182, 0.25);
}

.search-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#searchInput {
  background-color: var(--bg-card);
  border: 1px solid var(--border-pale);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.9rem;
  color: var(--text-main);
  outline: none;
  min-width: 220px;
  transition: var(--transition-smooth);
}

#searchInput:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 8px rgba(150, 123, 182, 0.2);
}

/* Button Refinements */
button {
  background-color: var(--color-lavender);
  color: var(--text-main);
  border: 1px solid var(--border-pale);
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition-smooth);
}

button:hover {
  background-color: var(--color-rose);
  border-color: var(--accent-purple);
  transform: translateY(-1px);
}

#searchButton {
  background-color: var(--accent-purple);
  color: #ffffff;
  border: none;
}

#searchButton:hover {
  background-color: #8266a1;
  color: #ffffff;
}

#random-scroll-button {
  background-color: var(--color-rose);
}

#random-scroll-button:hover {
  background-color: #f7dee3;
}

/* Filter Navigation Bar */
.filter-bar {
  display: flex;
  justify-content: center;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-pale);
  padding: 8px 10px;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
}

.filter-bar::-webkit-scrollbar {
  display: none; /* Hide horizontal scrollbar for clean aesthetics */
}

.filter-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 15px;
  padding: 5px 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.filter-btn.active {
  background-color: var(--color-lavender);
  border-color: var(--border-pale);
  color: var(--text-main);
  font-weight: 600;
}

/* ==========================================================================
   Hero & Layout Elements
   ========================================================================== */
.jumbotron {
  max-width: 900px;
  margin: 40px auto 20px auto;
  padding: 40px 30px;
  background: linear-gradient(135deg, var(--color-rose) 0%, var(--color-lavender) 100%);
  border-radius: 16px;
  text-align: center;
  box-shadow: var(--shadow-subtle);
  border: 1px solid var(--border-pale);
}

.jumbotron h1 {
  font-family: "Georgia", serif;
  font-size: 2.2rem;
  color: var(--text-main);
  margin-bottom: 10px;
}

.jumbotron h2 {
  font-size: 1rem;
  font-weight: normal;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.jumbotron p {
  font-size: 0.95rem;
  color: var(--text-main);
  max-width: 700px;
  margin: 0 auto;
}

/* ==========================================================================
   Card System
   ========================================================================== */
.cards-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

.section-divider {
  font-family: "Georgia", serif;
  font-size: 1.8rem;
  color: var(--text-main);
  text-align: center;
  margin: 60px 0 30px 0;
  position: relative;
}

.section-divider::after {
  content: "";
  display: block;
  width: 60px;
  height: 2px;
  background-color: var(--accent-purple);
  margin: 10px auto 0 auto;
  opacity: 0.5;
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}

/* Individual Card Styling (Mimics physical cards) */
.tarot-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-pale);
  border-radius: 12px;
  padding: 30px;
  box-shadow: var(--shadow-subtle);
  transition: var(--transition-smooth);
  position: relative;
}

.tarot-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: #ded1e6;
}

/* Categorized Left Borders */
.tarot-card[data-category="major"] { border-left: 4px solid var(--accent-purple); }
.tarot-card[data-category="scrolls"] { border-left: 4px solid #b3c5d7; }
.tarot-card[data-category="roses"] { border-left: 4px solid #e2b2b8; }
.tarot-card[data-category="forces"] { border-left: 4px solid #adcbb1; }
.tarot-card[data-category="keys"] { border-left: 4px solid #ded39e; }

/* Glowing highlight state for searched/focused cards */
.tarot-card.selected-div {
  animation: glowPulse 2s infinite alternate;
  border-color: var(--accent-purple);
}

@keyframes glowPulse {
  0% { box-shadow: 0 0 10px rgba(150, 123, 182, 0.2); }
  100% { box-shadow: 0 0 25px rgba(150, 123, 182, 0.6); }
}

/* Inner Card Typography */
.card-header {
  margin-bottom: 18px;
}

.card-meta {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.card-title {
  font-family: "Georgia", serif;
  font-size: 1.4rem;
  color: var(--text-main);
}

.card-body p {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 15px;
}

.card-body p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Footers
   ========================================================================== */
.site-footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-pale);
  padding: 40px 20px;
  text-align: center;
  margin-top: 80px;
}

.site-footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 15px;
}

#glow-box-home {
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--text-main);
  background-color: var(--color-lavender);
  padding: 8px 18px;
  border-radius: 15px;
  border: 1px solid var(--border-pale);
  transition: var(--transition-smooth);
}

#glow-box-home:hover {
  background-color: var(--color-rose);
}

/* ==========================================================================
   Responsive Mechanics (Mobile & Tablet)
   ========================================================================== */
@media only screen and (max-width: 1100px) {
  body {
    padding-top: 165px;
  }

  .navbar {
    justify-content: center;
  }
}

@media only screen and (max-width: 768px) {
  body {
    padding-top: 0;
  }

  .site-header {
    position: sticky;
  }

  .navbar {
    justify-content: center;
    padding: 10px;
  }

  .logo-area {
    justify-content: center;
    width: 100%;
  }

  .site-links {
    width: 100%;
    flex-wrap: wrap;
  }

  .search-controls {
    justify-content: center;
    width: 100%;
  }

  #searchInput {
    flex-grow: 1;
  }

  .jumbotron {
    margin: 20px 15px;
    padding: 25px 15px;
  }

  .jumbotron h1 {
    font-size: 1.7rem;
  }

  .tarot-card {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}