/* CSS variables for theme colors - can be overridden in base.html */
:root {
  --dark-bg: #0B0E14;
  --dark-card-bg: #23272b;
  --light-bg: #ffffff;
  --light-card-bg: #f8f9fa;

  /* Editorial type + palette (open-source fonts, our own standard palette) */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --ink: #1c1e21;
  --muted: #6b7280;
  --accent: #2f5fd0;
  --accent-hover: #1f3f9c;
  --rule: #e7e7e2;
  --panel: #ffffff;
  --panel-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);
}

/* ---- Base editorial typography (applies to every page via base.html) ---- */
body {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.65;
  letter-spacing: -0.001em;
  color: var(--ink);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}
a:hover { color: var(--accent-hover); }

/* ---- Modern content cards ---- */
.panel {
  max-width: 52rem;
  margin: 0 auto 1.25rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: var(--panel-shadow);
  padding: 1.75rem 2rem;
}

/* Readable measure for long-form content */
.prose { text-align: left; }
.prose p { margin-bottom: 1rem; }
.prose p:last-child { margin-bottom: 0; }

/* Homepage hero */
.hero { padding: 2.25rem 1.5rem; text-align: center; }
.hero h1 {
  font-size: clamp(1.9rem, 3.4vw, 2.5rem);
  margin-bottom: 0;
}
.hero .eyebrow {
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.hero .hero-tagline {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: clamp(0.95rem, 1.6vw, 1.1rem);
  line-height: 1.55;
  color: var(--muted);
  max-width: 38rem;
  margin: 0.85rem auto 0;
}

/* Dark-theme editorial overrides */
body.dark-theme {
  --panel: #12161f;
  --rule: #232a36;
  --panel-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 18px rgba(0, 0, 0, 0.35);
}
body.dark-theme a { color: #7ea9ff; }
body.dark-theme a:hover { color: #a9c6ff; }
body.dark-theme .hero .eyebrow { color: #7ea9ff; }
body.dark-theme .hero .hero-tagline { color: #a7adba; }
/* Cards manage their own background; don't let the broad dark-theme .container rule flatten them */
body.dark-theme .panel { background: var(--panel) !important; }

/* "Powered by cMeta" footer line */
.powered-by {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  margin-top: 0.25rem;
  opacity: 0.7;
}
.powered-by a { text-decoration: underline; }

body.dark-theme, .dark-theme .card, .dark-theme .container {
  background-color: var(--dark-bg) !important;
  color: #e8e6e3 !important;
}
.dark-theme .card {
  background-color: var(--dark-card-bg) !important;
  color: #e8e6e3 !important;
}
.dark-theme .btn-outline-secondary, .dark-theme .btn-outline-danger {
  color: #e8e6e3;
  border-color: #888;
  background: transparent;
}
.dark-theme .btn-outline-secondary:hover, .dark-theme .btn-outline-danger:hover {
  background: #333;
  color: #fff;
}
.dark-theme code {
  background: #222;
  color: #e8e6e3;
}

body.dark-theme .navbar,
.dark-theme .navbar.navbar-light,
.dark-theme .navbar.navbar-default {
  background-color: #20232c !important;
  color: #e8e6e3 !important;
  border-bottom: 1px solid #333;
}

body.dark-theme .navbar a,
body.dark-theme .navbar .navbar-brand,
body.dark-theme .navbar .nav-link {
  color: #e8e6e3 !important;
}

body.dark-theme .footer {
  background-color: var(--dark-card-bg) !important;
  color: #e8e6e3 !important;
  border-top: 1px solid #333;
}

/* Light theme - uses CSS variables for background */
body:not(.dark-theme), body:not(.dark-theme) .container, body:not(.dark-theme) .container-fluid {
  background-color: var(--light-bg) !important;
}

/* Light theme footer (navbar style) */
body:not(.dark-theme) .footer,
body:not(.dark-theme) .footer .py-2 {
  background-color: #e5f5ff !important;
  color: #286eb1 !important;
  border-top: 1px solid #dee2e6;
}
body:not(.dark-theme) .footer a {
  color: #286eb1 !important;
  text-decoration: underline;
}

/* Dark theme footer */
body.dark-theme .footer,
body.dark-theme .footer .py-2 {
  background-color: var(--dark-card-bg) !important;
  color: #e8e6e3 !important;
  border-top: 1px solid #333;
}
body.dark-theme .footer a {
  color: #e8e6e3 !important;
  text-decoration: underline;
}

/* Ensure the API Access Token (`#api-key` and related code) always uses `#3f7fc3` in both themes */
#api-key,
.access-token-row code,
.access-token-row #api-key {
  color: #3f7fc3 !important;
  background: inherit !important;
}

.access-token-row .btn-outline-danger {
  color: #3f7fc3 !important;
  border-color: #3f7fc3 !important;
  background: transparent !important;
}
.access-token-row .btn-outline-danger:hover,
.access-token-row .btn-outline-danger:focus {
  background: #3f7fc3 !important;
  color: #fff !important;
  border-color: #3f7fc3 !important;
}

/* Remove conflicting color from .dark-theme code for access token */
.dark-theme code#api-key,
.dark-theme .access-token-row code,
.dark-theme .access-token-row #api-key {
  color: #3f7fc3 !important;
}

/* Remove background color from API Access URL in both themes */
#api-access-url,
code#api-access-url,
.access-token-row #api-access-url {
  background: inherit !important;
}

#vspace4
{
 padding:4px 0px 0px 0px;
}

#vspace8
{
 padding:8px 0px 0px 0px;
}

/* User projects page: a project pointer with "group": "<name>" is listed under this heading
   (see project_v1.py). Users may restyle it from their project_extra_html. */
li.ctp-project-group {
  display: block;
  list-style: none;
  margin: 24px 0 6px 0;
  padding: 0 0 4px 0;
  font-weight: 600;
  font-size: 1.05em;
  color: #1f3c88;
  border-bottom: 1px solid #e1e5ee;
}
li.ctp-project-group:empty { border-bottom: none; margin: 10px 0 0 0; padding: 0; }
.dark-theme li.ctp-project-group { color: #8fb3ff; border-color: #2c3242; }
