/* ===== Base Styles ===== */
body {
  margin: 0;
  font-family: 'Trebuchet MS', sans-serif;
  line-height: 1.6;
  transition: background 0.6s ease, color 0.6s ease;
  position: relative;
}

html,
body {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
}

header {
  text-align: center;
  padding: 2rem;
  transition: all 0.6s ease;
}

header h1 {
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
  transition: all 0.6s ease;
}

.theme-toggle {
  margin-top: 1rem;
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: bold;
  transition: all 0.3s ease;
  z-index: 10;
}

.container {
  max-width: 1200px;
  margin: auto;
  padding: 2rem;
}

section {
  margin-bottom: 3rem;
  padding: 1.5rem;
  border-radius: 10px;
  transition: all 0.6s ease;
}

section h2 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid;
  transition: all 0.6s ease;
}

ul {
  list-style: none;
  padding: 0;
}

ul li {
  margin-bottom: 0.5rem;
}

footer a {
  text-decoration: none;
  font-weight: bold;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Space Theme */
body.space footer a {
  color: #4cc9f0;
  border: 2px solid #4cc9f0;
  background: transparent;
}

body.space footer a:hover {
  background: #4cc9f0;
  color: #000;
  box-shadow: 0 0 12px #4cc9f0;
}

/* Medieval Theme */
body.medieval footer a {
  color: #fdf5e6;
  border: 2px solid #a5793a;
  background: #6e4c1e;
}

body.medieval footer a:hover {
  background: #a5793a;
  color: #fff;
  box-shadow: 0 0 12px rgba(110, 76, 30, 0.6);
}

/* Ensure visited looks the same */
footer a:visited {
  color: inherit;
}

.adventures {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.adventures img {
  width: 100%;
  border-radius: 10px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.adventures img:hover {
  transform: scale(1.05);
}

/* ===== Theme Transition Overlay ===== */
.transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: black;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
  z-index: 999;
}

.transition-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.transition-overlay.space {
  background: url('https://www.transparenttextures.com/patterns/stardust.png');
  background-color: #0a0f1f;
  background-size: cover;
}

.transition-overlay.medieval {
  background: url('https://www.transparenttextures.com/patterns/parchment.png');
  background-color: #d9c9a1;
}

/* ===== Space Theme ===== */
body.space {
  background: radial-gradient(ellipse at top, #0a0f1f, #000);
  color: #e0e0e0;
}

body.space header {
  background: linear-gradient(to right, #111, #1a1f3b);
  border-bottom: 2px solid #4cc9f0;
  color: #4cc9f0;
}

body.space header h1 {
  text-shadow: 0 0 10px #4cc9f0;
}

body.space .theme-toggle {
  background: #4cc9f0;
  color: #000;
}

body.space section {
  background: rgba(20, 20, 40, 0.8);
  border: 1px solid #4cc9f0;
  box-shadow: 0 0 15px rgba(76, 201, 240, 0.3);
}

body.space section h2 {
  color: #89fcfd;
  border-color: #4cc9f0;
}

body.space ul li::before {
  content: "✦ ";
  color: #4cc9f0;
}

body.space .adventures img {
  border: 2px solid #4cc9f0;
}

body.space .adventures img:hover {
  box-shadow: 0 0 20px #4cc9f0;
}

body.space footer {
  background: #111;
  border-top: 2px solid #4cc9f0;
  color: #aaa;
}

/* ===== Medieval Theme ===== */
body.medieval {
  background: url('https://www.transparenttextures.com/patterns/parchment.png');
  background-color: #f5ecd9;
  color: #3a2c1a;
  font-family: 'Garamond', serif;
}

body.medieval header {
  background: #6e4c1e;
  border-bottom: 5px solid #a5793a;
  color: #fdf5e6;
}

body.medieval header h1 {
  font-family: 'Cinzel Decorative', serif;
  text-shadow: 2px 2px #3a2c1a;
}

body.medieval .theme-toggle {
  background: #a5793a;
  color: #fff;
}

body.medieval section {
  background: #fdf5e6;
  border: 4px solid #a5793a;
  box-shadow: 0 0 15px rgba(58, 44, 26, 0.4);
}

body.medieval section h2 {
  font-family: 'Cinzel', serif;
  color: #5e3a1a;
  border-color: #a5793a;
}

body.medieval ul li::before {
  content: "⚔ ";
  color: #6e4c1e;
}

body.medieval .adventures img {
  border: 3px solid #6e4c1e;
}

body.medieval .adventures img:hover {
  box-shadow: 0 0 20px rgba(110, 76, 30, 0.6);
}

body.medieval footer {
  background: #6e4c1e;
  border-top: 5px solid #a5793a;
  color: #fdf5e6;
  font-family: 'Cinzel', serif;
}

/* ===== Goals / Board Section ===== */
body.space #goals {
  background: rgba(15, 20, 40, 0.85);
  border: 1px solid #89fcfd;
  box-shadow: 0 0 15px rgba(76, 201, 240, 0.3);
}

body.space #goals h2 {
  color: #89fcfd;
  border-color: #4cc9f0;
}

body.space #goals ul li::before {
  content: "🚀 ";
  color: #4cc9f0;
}

body.medieval #goals {
  background: #fff9ed;
  border: 4px solid #a5793a;
  box-shadow: 0 0 12px rgba(58, 44, 26, 0.3);
}

body.medieval #goals h2 {
  font-family: 'Cinzel', serif;
  color: #5e3a1a;
  border-color: #a5793a;
}

body.medieval #goals ul li::before {
  content: "🏹 ";
  color: #6e4c1e;
}

footer {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: clamp(1.5rem, 3.5vw, 1.8rem);
  text-align: center;
  padding: 1rem;
  height: auto;
  min-height: unset;
  line-height: 1.4;
}

#quote-text {
  display: inline-block;
  opacity: 1;
  transition: opacity 0.6s ease;
  padding: 0 0.5rem;
  max-width: 90%;
  word-wrap: break-word;
}

#quote-text.fade-out {
  opacity: 0;
}


#quote-refresh {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  transition: transform 0.3s ease;
  color: inherit;
  flex-shrink: 0;
}


.adventure-card {
  display: block;
  text-align: center;
  padding: 2rem;
  border-radius: 12px;
  font-weight: bold;
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Space Theme */
body.space .adventure-card {
  border: 2px solid #4cc9f0;
  color: #4cc9f0;
  background: rgba(20, 20, 40, 0.6);
}

body.space .adventure-card:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px #4cc9f0;
}

/* Medieval Theme */
body.medieval .adventure-card {
  border: 3px solid #6e4c1e;
  color: #6e4c1e;
  background: #fdf5e6;
}

body.medieval .adventure-card:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(110, 76, 30, 0.6);
}

/* Prevent purple visited links */
.adventure-card:visited {
  color: inherit;
}

@media (max-width: 800px) {
  #quote-refresh {
    flex-basis: 100%;
    text-align: center;
  }

  .adventures {
    grid-template-columns: 1fr !important;
  }
}