/* ===========================
   CSS VARIABLES
=========================== */
:root {
  --bg-color: #fdf6e3;
  --text-color: #3c3c3c;
  --sidebar-bg: #fffef9;
  --panel-bg: #f9f5e0;
  --border-color: #d2c69a;
  --accent-color: #3f5641;
  --highlight-color: #ccb77f;
  --banner-bg: #2f3e46;
  --banner-text: #fdf6e3;
  --tagline-color: #dcd5b1;
  --nav-bg: #3f5641;
  --dropdown-bg: #f9f5e3;
  --dropdown-hover: #e6e0c8;
}

body.dark-theme {
  --bg-color: #1f1f28;
  --text-color: #e0e0dc;
  --sidebar-bg: #2a2a38;
  --panel-bg: #353543;
  --border-color: #444;
  --accent-color: #87bfae;
  --highlight-color: #bfbfbf;
  --banner-bg: #151819;
  --banner-text: #f0f0f0;
  --tagline-color: #a7a7a7;
  --nav-bg: #2a2a38;
  --dropdown-bg: #2e2f33;
  --dropdown-hover: #3b3b4a;
}

/* ===========================
   RESET & BASE STYLES
=========================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background-color: var(--bg-color);
}

body {
  min-height: 100vh;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: "Forum", serif;
  transition: background 0.3s, color 0.3s;
  display: flex;
  flex-direction: column;
}

/* Wrapper for all content except footer */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ===========================
   BANNER
=========================== */
.banner {
  background-color: var(--banner-bg);
  color: var(--banner-text);
  padding: 20px 40px;
  text-align: center;
}

.banner h1 {
  font-size: 36px;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.banner .tagline {
  font-size: 16px;
  color: var(--tagline-color);
}

/* ===========================
   NAVIGATION BAR
=========================== */
.navbar {
  background-color: var(--nav-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  flex-wrap: wrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.nav-links a,
.dropbtn,
#theme-toggle {
  color: var(--banner-text);
  background: none;
  border: none;
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
  padding: 5px 10px;
}

.nav-links a:hover,
.dropbtn:hover,
#theme-toggle:hover {
  text-decoration: underline;
}

/* ===========================
   DROPDOWN MENU
=========================== */
.dropdown {
  position: relative;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--dropdown-bg);
  min-width: 180px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  border: 1px solid var(--border-color);
  z-index: 1000;
}

.dropdown-content a {
  color: var(--accent-color);
  padding: 10px 16px;
  text-decoration: none;
  display: block;
  font-size: 14px;
}

.dropdown-content a:hover {
  background-color: var(--dropdown-hover);
}

.dropdown:hover .dropdown-content {
  display: block;
}

.dark-theme .dropdown-content a {
  color: var(--banner-text);
}

/* ===========================
   PAGE LAYOUT
=========================== */
.wiki-layout {
  display: flex;
  padding-top: 20px;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}

/* ===========================
   SIDEBAR
=========================== */
.sidebar {
  width: 250px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  padding: 20px;
  overflow-y: auto;
}

.sidebar h2 {
  font-size: 18px;
  margin-bottom: 10px;
  color: var(--accent-color);
}

.sidebar ul {
  list-style: none;
}

.sidebar ul li {
  margin-bottom: 8px;
}

.sidebar > ul > li {
  margin-bottom: 16px;
}

.sidebar a {
  text-decoration: none;
  color: var(--accent-color);
}

.sidebar a:hover {
  text-decoration: underline;
}

/* Accordion */
.accordion {
  background: none;
  border: none;
  outline: none;
  color: var(--accent-color);
  font-family: inherit;
  font-size: 16px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 6px 0;
}

.accordion::after {
  content: "►";
  font-size: 12px;
  transition: transform 0.2s ease;
}

.accordion.active::after {
  transform: rotate(90deg);
}

.panel {
  padding-left: 16px;
  margin-top: 4px;
  display: none;
}

.panel li {
  font-size: 14px;
  margin: 4px 0;
}

/* ===========================
   MAIN CONTENT
=========================== */
.main-content {
  font-size: 18px;
  background-color: var(--sidebar-bg);
  color: var(--text-color);
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

section h3 {
  font-size: 22px;
  border-bottom: 1px solid var(--highlight-color);
  margin-bottom: 10px;
  padding-bottom: 5px;
  color: var(--accent-color);
}

ul, ol {
  padding-left: 20px;
}

a {
  color: var(--accent-color);
}

/* ===========================
   IMAGE PANEL
=========================== */
.image-panel {
  width: 250px;
  background-color: var(--sidebar-bg);
  border-left: 1px solid var(--border-color);
  padding: 20px;
  overflow-y: auto;
}

.image-wrapper {
  text-align: center;
}

.image-wrapper img {
  max-width: 100%;
  height: auto;
  margin-bottom: 10px;
  border: 1px solid var(--highlight-color);
}

.caption {
  font-size: 14px;
  color: var(--tagline-color);
}

/* Info Table */
.info-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-size: 14px;
}

.info-table td {
  border: 1px solid var(--highlight-color);
  padding: 8px;
  background-color: var(--panel-bg);
}

/* ===========================
   QUOTE BOX
=========================== */
.quote-box {
  background-color: var(--panel-bg);
  border-left: 6px solid var(--highlight-color);
  padding: 20px 60px;
  margin: 30px auto;
  font-size: 18px;
  font-style: italic;
  color: var(--accent-color);
  position: relative;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  max-width: 800px;
  line-height: 1.6;
}

.quote-box::before {
  content: "❝";
  font-size: 42px;
  color: var(--highlight-color);
  position: absolute;
  top: 10px;
  left: 20px;
  font-style: normal;
  line-height: 1;
}

.quote-box::after {
  content: "❞";
  font-size: 42px;
  color: var(--highlight-color);
  position: absolute;
  bottom: 10px;
  right: 20px;
  font-style: normal;
  line-height: 1;
}

.quote-author {
  display: block;
  margin-top: 15px;
  text-align: right;
  font-size: 16px;
  font-style: normal;
  color: var(--text-color);
}

.dark-theme .quote-box {
  background-color: var(--panel-bg);
  border-left-color: var(--highlight-color);
  color: var(--banner-text);
}

.dark-theme .quote-box::before,
.dark-theme .quote-box::after {
  color: var(--highlight-color);
}

.dark-theme .quote-author {
  color: var(--tagline-color);
}

/* ===========================
   FOOTER
=========================== */
footer {
  text-align: center;
  padding: 20px;
  background-color: var(--nav-bg);
  font-size: 14px;
  color: var(--banner-text);
  margin-top: 40px;
}

/* ===========================
   RESPONSIVE
=========================== */
@media screen and (max-width: 1024px) {
  .wiki-layout {
    flex-direction: column;
    height: auto;
  }

  .sidebar,
  .image-panel {
    width: 100%;
    position: relative;
    border: none;
    border-bottom: 1px solid var(--border-color);
  }

  .main-content {
    width: 100%;
    padding: 20px;
    position: relative;
  }

  .nav-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .dropdown-content {
    position: static;
    box-shadow: none;
    border: none;
  }

  #theme-toggle {
    margin-left: 0;
  }
}
