/* Ensure canvas overscroll background matches dark mode default */
html {
  background-color: #0d0f12;
  min-height: 100%;
}

/* DARK MODE (New Default) */
:root {
  --bg-image: url('assets/chandolbg_dark.png');
  --bg-overlay: rgba(13, 15, 18, 0);
  --card-bg: rgba(22, 25, 32, 0.8);
  --card-hover-bg: rgba(30, 35, 45, 0.95);
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.1);
  --footer-text: #94a3b8;
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

/* LIGHT MODE OVERRIDES */
[data-theme="light"] {
  --bg-image: url('assets/chandolbg_light.png');
  --bg-overlay: rgba(255, 255, 255, 0);
  --card-bg: rgba(255, 255, 255, 0.75);
  --card-hover-bg: rgba(255, 255, 255, 0.9);
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --text: #0f172a;
  --muted: #475569;
  --border: rgba(226, 232, 240, 0.8);
  --footer-text: #334155;
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

[data-theme="light"],
[data-theme="light"] body {
  background-color: #f8fafc;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: #0d0f12;
  background-image: linear-gradient(var(--bg-overlay), var(--bg-overlay)), var(--bg-image);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  transition: background-image 0.3s ease, color 0.3s ease, background-color 0.3s ease;
}

/* Navigation Buttons (Top Bar) */
.home-btn {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.6rem 1rem;
  color: var(--text);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: var(--card-shadow);
}

.home-btn:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.theme-toggle-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.6rem 1rem;
  color: var(--text);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: var(--card-shadow);
}

.theme-toggle-btn:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* Header Styling */
header {
  text-align: center;
  margin-bottom: 2.5rem;
  max-width: 600px;
}

header h1 {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.75rem;
}

header p {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.5;
}

/* Hub Grid Container */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  width: 100%;
  max-width: 800px;
  justify-content: center;
  align-items: start;
}

@media (max-width: 640px) {
  .hub-grid {
    grid-template-columns: 1fr;
  }
}

/* Search Bar Container */
.search-container {
  grid-column: 1 / -1;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  backdrop-filter: blur(12px);
  box-shadow: var(--card-shadow);
  outline: none;
  transition: all 0.25s ease;
}

.search-input::placeholder {
  color: var(--muted);
}

.search-input:focus {
  border-color: var(--accent);
  background: var(--card-hover-bg);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Official Website Button (Wide & Short) */
.official-site-container {
  grid-column: 1 / -1;
  width: 100%;
}

.official-site-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 0.85rem 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  backdrop-filter: blur(12px);
  box-shadow: var(--card-shadow);
  transition: all 0.25s ease;
}

.official-site-btn:hover {
  background: var(--card-hover-bg);
  border-color: var(--accent);
  color: var(--accent-hover);
  transform: translateY(-2px);
}

/* Dropdown Grid Cards (2-Column Side-by-Side) */
.dropdown-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  min-height: 160px;
  width: 100%;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(12px);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
  align-self: start;
}

.dropdown-card:hover {
  background: var(--card-hover-bg);
  border-color: var(--accent);
  transform: translateY(-4px);
}

.dropdown-card[open] {
  border-color: var(--accent);
  background: var(--card-hover-bg);
}

/* Fully Clickable Header with Centered Title */
.dropdown-header {
  width: 100%;
  min-height: 160px;
  padding: 1.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  list-style: none;
  user-select: none;
  text-align: center;
  transition: color 0.2s ease;
}

.dropdown-header::-webkit-details-marker {
  display: none;
}

.dropdown-header:hover {
  color: var(--accent-hover);
}

.dropdown-card[open] .dropdown-header {
  min-height: auto;
  padding: 1.5rem 1.75rem 1rem 1.75rem;
}

/* Right-Pinned Arrow Indicator */
.dropdown-header .chevron {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 1.1rem;
  transition: transform 0.25s ease;
  pointer-events: none;
}

.dropdown-card[open] .dropdown-header .chevron {
  transform: translateY(-50%) rotate(90deg);
}

/* Dropdown Submenu Links */
.dropdown-list {
  list-style: none;
  padding: 0.5rem 1.25rem 1.5rem 1.25rem;
  margin: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-top: 1px solid var(--border);
}

.dropdown-list li a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.85rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  transition: all 0.2s ease;
  width: 100%;
}

.dropdown-list li a:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent-hover);
  transform: translateY(-2px);
}

/* Footer Styling */
footer {
  margin-top: 4rem;
  color: var(--footer-text);
  font-size: 0.85rem;
  text-align: center;
}