/* ===== Spook Squad — dark theme with purple accents ===== */
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap");

/* ----- Dark + purple palette ----- */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
  --fantasy-bg: #0f0d14;
  --fantasy-bg-subtle: #1a1625;
  --fantasy-surface: #221e2e;
  --fantasy-border: #3d3550;
  --fantasy-border-strong: #5b4d72;
  --fantasy-text: #e8e4f0;
  --fantasy-text-muted: #9d94b0;
  --fantasy-accent: #6d28d9;
  --fantasy-accent-hover: #8b5cf6;
  --fantasy-gold: #8b5cf6;
  --fantasy-shadow: rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] {
  --bs-body-bg: var(--fantasy-bg);
  --bs-body-color: var(--fantasy-text);
  --bs-border-color: var(--fantasy-border);
  --bs-secondary-bg: var(--fantasy-bg-subtle);
  --bs-secondary-border-subtle: var(--fantasy-border);
}

:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
  --bs-body-font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  --bs-heading-font-family: "DM Sans", system-ui, -apple-system, sans-serif;
}

body,
.nav-link,
.dropdown-item,
.dropdown-menu,
.card,
.modal-title,
footer {
  font-family: "DM Sans", system-ui, -apple-system, sans-serif !important;
}

h1, h2, h3, h4, h5, h6,
.navbar-brand {
  font-family: "DM Sans", system-ui, -apple-system, sans-serif !important;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ----- Layout and colors ----- */
body {
  background-color: var(--fantasy-bg) !important;
  color: var(--fantasy-text) !important;
}
body::before {
  background-color: var(--fantasy-bg) !important;
  background-image:
    radial-gradient(ellipse 85% 55% at 15% -15%, rgba(109, 40, 217, 0.28), transparent 58%),
    radial-gradient(ellipse 70% 45% at 105% 25%, rgba(139, 92, 246, 0.14), transparent 52%),
    radial-gradient(ellipse 55% 40% at -5% 95%, rgba(109, 40, 217, 0.12), transparent 48%) !important;
  background-repeat: no-repeat !important;
}

/* External nav links: small “opens elsewhere” cue */
.nav-link .nav-external-mark,
.dropdown-item .nav-external-mark,
a.nav-link-external .nav-external-mark {
  font-size: 0.72em;
  opacity: 0.65;
  margin-left: 0.12em;
  vertical-align: 0.08em;
  font-weight: 400;
}
body > .container {
  background: var(--fantasy-surface);
  box-shadow: 0 0 40px var(--fantasy-shadow);
  border-radius: 4px;
  border: 1px solid var(--fantasy-border);
  padding: 1.5rem 2rem 2rem;
  max-width: 100%;
}
@media (min-width: 768px) {
  body > .container {
    padding: 2rem 2.5rem 2.5rem;
  }
}

/* Larger base font for readability */
html {
  font-size: 18px;
}
@media (min-width: 768px) {
  html {
    font-size: 19px;
  }
}
body {
  font-size: 1rem;
}
.col-md-9[role="main"] {
  font-size: 1.05rem;
}
.col-md-9[role="main"] h1 { font-size: 1.95rem; }
.col-md-9[role="main"] h2 { font-size: 1.6rem; }
.col-md-9[role="main"] h3 { font-size: 1.35rem; }
.col-md-9[role="main"] h4 { font-size: 1.2rem; }
.col-md-9[role="main"] h5 { font-size: 1.1rem; }
.col-md-9[role="main"] h6 { font-size: 1rem; }
.navbar,
.nav-link {
  font-size: 1.05rem;
}
/* Navbar brand: Spook Squad mascot (ghost); text replaced for accessibility */
.navbar-brand {
  font-size: 0;
  color: transparent !important;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background: url("../img/ghost.png") center / contain no-repeat;
  overflow: hidden;
}
.navbar-brand:hover {
  color: transparent !important;
  opacity: 0.9;
}
@media (min-width: 768px) {
  .navbar-brand {
    width: 3.25rem;
    height: 3.25rem;
  }
}

/* ----- Navbar ----- */
.navbar {
  background: var(--fantasy-bg-subtle) !important;
  border-bottom: 2px solid var(--fantasy-border) !important;
  box-shadow: 0 2px 8px var(--fantasy-shadow);
}
.navbar .navbar-toggler {
  border-color: var(--fantasy-border);
  color: var(--fantasy-text);
}
.nav-link {
  color: var(--fantasy-text) !important;
}
.nav-link:hover,
.nav-link:focus {
  color: var(--fantasy-accent) !important;
}
/* No focus/hover ring on main nav dropdown toggles (hover opens; ring was visible and distracting) */
.navbar .nav-item.dropdown .nav-link.dropdown-toggle:hover,
.navbar .nav-item.dropdown .nav-link.dropdown-toggle:focus {
  outline: none;
  box-shadow: none;
}
.nav-link.active {
  color: var(--fantasy-gold) !important;
  font-weight: 600;
}

/* TOC column: hidden except on Foods & Watchlist (see overrides/main.html) */
.container .row > .col-md-3.mkdocs-toc-sidebar--hidden {
  display: none !important;
}

/* ----- Links and emphasis ----- */
.col-md-9[role="main"] a {
  color: var(--fantasy-accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.col-md-9[role="main"] a:hover {
  color: var(--fantasy-accent-hover);
  border-bottom-color: var(--fantasy-accent-hover);
}
.col-md-9[role="main"] hr {
  border-top-color: var(--fantasy-border);
  opacity: 0.8;
}
.col-md-9[role="main"] h1,
.col-md-9[role="main"] h2,
.col-md-9[role="main"] h3,
.col-md-9[role="main"] h4,
.col-md-9[role="main"] h5,
.col-md-9[role="main"] h6 {
  color: var(--fantasy-text);
}
footer {
  color: var(--fantasy-text-muted) !important;
  border-top: 1px solid var(--fantasy-border);
  padding-top: 1rem;
}
/* MkDocs theme adds an <hr> inside the footer; we use border-top instead, so hide the extra line */
footer hr {
  display: none;
}
footer a {
  color: var(--fantasy-accent) !important;
}
footer .footer-extra-links {
  display: block;
  margin-top: 0.75em;
}

/* Keep monospace for code */
code, kbd, pre, .highlight {
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
}

/* Main content full width when TOC column is hidden */
.container .row:has(> .mkdocs-toc-sidebar--hidden) > .col-md-9[role="main"] {
  flex: 1 1 0%;
  max-width: 100%;
}

/* Spacing before headers (main content only). !important overrides Bootstrap reboot. */
div.col-md-9[role="main"] h2,
div.col-md-9[role="main"] h3,
div.col-md-9[role="main"] h4,
div.col-md-9[role="main"] h5,
div.col-md-9[role="main"] h6 {
  margin-top: 2.5em !important;
}

/* Keep page title (first h1) at top; first-of-type covers hero image before h1 */
div.col-md-9[role="main"] h1:first-child,
div.col-md-9[role="main"] h1:first-of-type {
  margin-top: 0 !important;
}

/* ----- Blockquotes and code ----- */
.col-md-9[role="main"] blockquote {
  border-left: 4px solid var(--fantasy-accent);
  background: var(--fantasy-bg-subtle);
  color: var(--fantasy-text-muted);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 4px 4px 0;
  font-style: italic;
}
.col-md-9[role="main"] blockquote {
  background: rgba(0, 0, 0, 0.2);
}

/* Code and pre */
.col-md-9[role="main"] code {
  background: var(--fantasy-bg-subtle) !important;
  border: 1px solid var(--fantasy-border) !important;
  color: var(--fantasy-text) !important;
  border-radius: 3px;
}
.col-md-9[role="main"] pre {
  background: var(--fantasy-bg-subtle) !important;
  border: 1px solid var(--fantasy-border) !important;
  border-radius: 4px;
  box-shadow: inset 0 1px 2px var(--fantasy-shadow);
}
.col-md-9[role="main"] pre code {
  border: none !important;
}

/* Tables */
.col-md-9[role="main"] table {
  border-collapse: collapse;
  border: 1px solid var(--fantasy-border);
  border-radius: 4px;
  overflow: hidden;
}
.col-md-9[role="main"] th,
.col-md-9[role="main"] td {
  border: 1px solid var(--fantasy-border);
  padding: 0.5rem 0.75rem;
}
.col-md-9[role="main"] th {
  background: var(--fantasy-bg-subtle);
  color: var(--fantasy-accent);
  font-weight: 600;
}
.col-md-9[role="main"] tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.15);
}

/* Main content stacking */
.col-md-9[role="main"] {
  position: relative;
  z-index: 1;
}
/* Contain floats (home hero, folk splash) so footer/layout stays below media */
.col-md-9[role="main"]::after {
  content: "";
  display: table;
  clear: both;
}

/* Images */
.col-md-9[role="main"] img {
  border: 1px solid var(--fantasy-border) !important;
  border-radius: 4px;
  box-shadow: 2px 2px 12px var(--fantasy-shadow);
}

/* Page banner / hero image: scaled down, left aligned */
.col-md-9[role="main"] img.banner-img {
  width: 100%;
  max-width: 42rem;
  height: auto;
  display: block;
  margin-left: 0;
  margin-right: auto;
}

/* Home hero: image left, body text to the right on desktop; stacked on mobile */
.col-md-9[role="main"] p.home-hero-img,
.col-md-9[role="main"] p:has(img.home-hero-img) {
  float: left;
  clear: left;
  max-width: 42%;
  margin: 0 2.75rem 1rem 0;
}
.col-md-9[role="main"] p.home-hero-img img,
.col-md-9[role="main"] p:has(img.home-hero-img) img {
  width: 100%;
  height: auto;
  display: block;
}
@media (max-width: 767px) {
  .col-md-9[role="main"] p.home-hero-img,
  .col-md-9[role="main"] p:has(img.home-hero-img) {
    float: none;
    clear: none;
    max-width: 100%;
    margin: 0 0 1.5rem 0;
  }
}

/* Folk splash: image as column beside text on desktop, above text on mobile */
.col-md-9[role="main"] p.folk-splash-img,
.col-md-9[role="main"] p:has(img.folk-splash-img) {
  float: right;
  max-width: 42%;
  margin: 0 0 1rem 2.75rem;
}
.col-md-9[role="main"] p.folk-splash-img img,
.col-md-9[role="main"] p:has(img.folk-splash-img) img {
  width: 100%;
  height: auto;
  display: block;
}
@media (max-width: 767px) {
  .col-md-9[role="main"] p.folk-splash-img,
  .col-md-9[role="main"] p:has(img.folk-splash-img) {
    float: none;
    max-width: 100%;
    margin: 0 0 1.5rem 0;
  }
}

/* ----- Password gate overlay ----- */
/* Reused for /lines-list/login/ form styling. */
.password-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fantasy-bg);
  padding: 1.5rem;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.password-gate-overlay.password-gate-unlocking {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.password-gate-box {
  width: 100%;
  max-width: 22rem;
  padding: 2rem;
  background: var(--fantasy-surface);
  border: 2px solid var(--fantasy-border);
  border-radius: 8px;
  box-shadow: 0 8px 32px var(--fantasy-shadow);
}
.password-gate-title {
  font-family: var(--bs-heading-font-family);
  font-size: 1.5rem;
  color: var(--fantasy-text);
  margin: 0 0 0.5rem;
  text-align: center;
}
.password-gate-subtitle {
  font-size: 1rem;
  color: var(--fantasy-text-muted);
  margin: 0 0 1.5rem;
  text-align: center;
}
.password-gate-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.password-gate-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--fantasy-text);
  background: var(--fantasy-bg);
  border: 1px solid var(--fantasy-border);
  border-radius: 4px;
  box-sizing: border-box;
}
.password-gate-input::placeholder {
  color: var(--fantasy-text-muted);
}
.password-gate-input:focus {
  outline: none;
  border-color: var(--fantasy-accent);
  box-shadow: 0 0 0 2px rgba(109, 40, 217, 0.35);
}
.password-gate-btn {
  padding: 0.6rem 1rem;
  font-family: var(--bs-heading-font-family);
  font-size: 1rem;
  font-weight: 600;
  color: var(--fantasy-surface);
  background: var(--fantasy-accent);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.password-gate-btn:hover {
  background: var(--fantasy-accent-hover);
}
.password-gate-error {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: #c0392b;
  text-align: center;
  min-height: 1.25em;
}
[data-bs-theme="dark"] .password-gate-error {
  color: #e74c3c;
}

/* ----- Inline tags in page content ----- */
.col-md-9[role="main"] .mkdocs-inline-tag {
  display: inline;
  padding: 0.15em 0.45em;
  font-size: 0.9em;
  border-radius: 4px;
  border: 1px solid var(--fantasy-border);
  background: var(--fantasy-bg-subtle);
  color: var(--fantasy-accent);
  font-family: var(--bs-body-font-family);
  font-weight: 500;
  white-space: nowrap;
}
.col-md-9[role="main"] .mkdocs-inline-tag:hover {
  border-color: var(--fantasy-accent);
  background: rgba(109, 40, 217, 0.2);
}

/* ----- Search modal: tag filter ----- */
.mkdocs-tag-filter-section {
  margin-bottom: 1rem;
}
.mkdocs-tag-filter-section .form-label {
  font-size: 0.9rem;
  color: var(--fantasy-text-muted);
  font-weight: 500;
}
.mkdocs-tag-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  max-height: 8rem;
  overflow-y: auto;
  padding: 0.25rem 0;
}
.mkdocs-tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  border-radius: 4px;
  border: 1px solid var(--fantasy-border);
  background: var(--fantasy-bg-subtle);
  color: var(--fantasy-text);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.mkdocs-tag-chip:hover {
  border-color: var(--fantasy-accent);
  color: var(--fantasy-accent);
}
.mkdocs-tag-chip input {
  margin: 0 0.35rem 0 0;
  cursor: pointer;
}
.mkdocs-tag-chip:has(input:checked) {
  border-color: var(--fantasy-accent);
  background: rgba(109, 40, 217, 0.25);
  color: var(--fantasy-accent);
}

/* Ente shared album embed (Photos page) — full width of main column */
.ente-photo-embed {
  position: relative;
  width: 100%;
  max-width: none;
  aspect-ratio: 800 / 600;
  margin: 1rem 0;
}
.ente-photo-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
@media (max-width: 767px) {
  .ente-photo-embed {
    /* Narrow viewports: taller than 4:3 so more of the Ente gallery is visible without scrolling the iframe as much */
    aspect-ratio: 8 / 11;
    min-height: 72vh;
  }
}
