/* ===================================================================
   DeityDB — Custom Datasette stylesheet
   Scholarly aesthetic: navy / gold / warm cream
   =================================================================== */

:root {
  --navy:        #1a2f4e;
  --navy-mid:    #2d5282;
  --navy-light:  #3d6b9e;
  --gold:        #c9a84c;
  --gold-light:  #e8c86a;
  --gold-dark:   #a07c30;
  --cream:       #faf8f5;
  --cream-mid:   #f2ede6;
  --white:       #ffffff;
  --text:        #2c2c2c;
  --muted:       #6b7280;
  --border:      #e2d9c5;
  --border-dark: #c8bfaf;
  --card-shadow: 0 1px 4px rgba(26,47,78,0.10);
  --nav-h:       62px;
}

/* ── Base ─────────────────────────────────────────────────────────── */

/* Browsers only apply display:none for [hidden] via the UA stylesheet,
   which any author-level display rule (display:flex, display:grid, etc.)
   overrides. This rule restores the correct behaviour globally. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cream);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  margin: 0;
}

a { color: var(--navy-mid); }
a:hover { color: var(--gold-dark); }

h1, h2, h3, h4 {
  font-family: Georgia, 'Palatino Linotype', 'Book Antiqua', 'Palatino', serif;
  font-weight: normal;
  color: var(--navy);
}

/* ── Site Navigation ──────────────────────────────────────────────── */

header.hd { position: sticky; top: 0; z-index: 100; }
header.hd nav { padding: 0 !important; background: var(--navy) !important; }

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  padding: 0 28px;
  background: var(--navy);
  gap: 24px;
}

.site-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  color: white !important;
  font-family: Georgia, serif;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.site-nav-brand:hover { color: var(--gold) !important; }

.brand-glyph {
  color: var(--gold);
  font-size: 1rem;
  line-height: 1;
}

.site-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  color: #c1d0e4 !important;
  text-decoration: none !important;
  font-size: 0.88rem;
  padding: 6px 14px;
  border-radius: 6px;
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
}

.nav-link:hover {
  color: white !important;
  background: rgba(255,255,255,0.10);
}

.nav-link.active {
  color: var(--gold) !important;
  background: rgba(201,168,76,0.12);
}

.nav-link-ext {
  border: 1px solid rgba(255,255,255,0.18);
  padding: 5px 13px;
}

.nav-link-ext:hover { border-color: rgba(255,255,255,0.35); }

/* divider between the visual tools and the meta links */
.nav-sep {
  width: 1px;
  align-self: stretch;
  margin: 8px 8px;
  background: rgba(255,255,255,0.16);
}

/* meta links sit slightly quieter than the primary tools */
.nav-link-meta { color: #9fb1c9 !important; }

/* hamburger (mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 7px 8px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 6px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: #c1d0e4;
  border-radius: 2px;
}

/* ── Content wrapper ──────────────────────────────────────────────── */

div.not-footer { min-height: calc(100vh - var(--nav-h)); }
section.content { padding: 0 !important; }

/* ── Page header (built-in Datasette query/table pages) ───────────── */

.page-header {
  border-left: 4px solid var(--gold) !important;
  padding: 24px 24px 16px !important;
  margin-bottom: 0 !important;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-size: 1.5rem;
  color: var(--navy);
  margin: 0 0 4px;
}

.metadata-description {
  background: var(--white);
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--muted);
}

.metadata-description p { margin: 0 0 6px; }
.metadata-description p:last-child { margin: 0; }

/* ── Section layout ───────────────────────────────────────────────── */

.db-section {
  max-width: 1160px;
  margin: 0 auto;
  padding: 40px 24px;
}

.db-section h2 {
  font-size: 1.35rem;
  color: var(--navy);
  margin: 0 0 6px;
}

.db-section-desc {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 22px;
}

/* ── Browse CTA banner ───────────────────────────────────────────── */
.browse-cta-section { border-bottom: 1px solid var(--border); padding-top: 28px; padding-bottom: 28px; }

/* Featured "comparative core" section — gold-accented to mark the headline feature. */
.featured-section {
  background: linear-gradient(135deg, rgba(201,168,76,0.10) 0%, rgba(201,168,76,0.03) 100%);
  border: 1px solid var(--gold);
  border-left: 4px solid var(--gold);
  border-radius: 10px;
  padding: 28px 32px;
  margin-top: 28px;
}
.featured-section h2 { color: var(--navy); }
.browse-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  border-radius: 10px;
  padding: 28px 32px;
  flex-wrap: wrap;
}
.browse-cta-text h2 {
  font-size: 1.25rem;
  color: var(--gold-light);
  margin: 0 0 6px;
}
.browse-cta-text p { color: #c4d8ee; margin: 0; font-size: 0.95rem; max-width: 56ch; }
.browse-cta-btn {
  display: inline-block;
  background: var(--gold);
  color: var(--navy) !important;
  font-weight: 700;
  font-size: 0.97rem;
  padding: 12px 24px;
  border-radius: 6px;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.browse-cta-btn:hover {
  background: var(--gold-light);
  box-shadow: 0 3px 12px rgba(0,0,0,0.2);
}
.browse-cta-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.browse-cta-btn-alt {
  background: transparent;
  color: var(--gold) !important;
  border: 2px solid var(--gold);
}
.browse-cta-btn-alt:hover {
  background: rgba(212,170,59,0.12);
  box-shadow: 0 3px 12px rgba(0,0,0,0.2);
}

hr.db-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ── Hero (index page) ────────────────────────────────────────────── */

.db-hero {
  background:
    linear-gradient(165deg, rgba(20,40,72,0.82) 0%, rgba(15,28,55,0.90) 100%),
    url('https://upload.wikimedia.org/wikipedia/commons/a/ae/Blake_ancient_of_days.jpg');
  background-size: cover;
  background-position: center 20%;
  color: white;
  padding: 88px 24px 96px;
  text-align: center;
}

.db-hero h1 {
  font-size: 3.2rem;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
  color: white;
  text-shadow: 0 2px 16px rgba(0,0,0,0.4);
}

.db-hero .subtitle {
  font-size: 1.08rem;
  color: #c4d8ee;
  max-width: 640px;
  margin: 0 auto 48px;
  line-height: 1.8;
  font-family: Georgia, serif;
  font-style: italic;
  text-shadow: 0 1px 8px rgba(0,0,0,0.3);
}

.hero-stats {
  display: flex;
  gap: 48px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-stat { text-align: center; }

.hero-stat-number {
  display: block;
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--gold);
  font-family: Georgia, serif;
  line-height: 1.1;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.hero-stat-label {
  font-size: 0.7rem;
  color: #a0bcd8;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  margin-top: 5px;
  display: block;
}

.hero-art-credit {
  font-size: 0.7rem;
  color: rgba(180,200,224,0.55);
  font-style: italic;
  margin: -32px 0 44px;
  letter-spacing: 0.01em;
}

/* ── Art hero (About / Contribute pages) ─────────────────────────── */

.page-art-hero {
  background-size: cover;
  background-position: center;
  position: relative;
}

.page-art-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(20,35,65,0.75) 0%, rgba(15,28,55,0.88) 100%);
}

.page-art-hero-inner {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  padding: 80px 24px 72px;
  text-align: center;
  color: white;
}

.page-art-hero-inner h1 {
  font-size: 2.8rem;
  color: white;
  margin: 0 0 16px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.page-art-hero-inner p {
  font-size: 1.05rem;
  color: #c4d8ee;
  font-family: Georgia, serif;
  font-style: italic;
  line-height: 1.75;
  margin: 0;
  text-shadow: 0 1px 6px rgba(0,0,0,0.35);
}

/* ── Database page header ─────────────────────────────────────────── */

.db-page-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 28px 24px 24px;
}

.db-page-header-inner {
  max-width: 1160px;
  margin: 0 auto;
}

.db-page-header h1 {
  font-size: 1.7rem;
  color: var(--navy);
  margin: 0 0 6px;
}

.db-page-header p {
  color: var(--muted);
  margin: 0;
  font-size: 0.9rem;
}

/* ── Query cards ──────────────────────────────────────────────────── */

.query-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.query-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 20px 18px;
  text-decoration: none !important;
  display: block;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  box-shadow: var(--card-shadow);
}

.query-card:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 18px rgba(26,47,78,0.13);
  transform: translateY(-2px);
}

.query-card-icon {
  font-size: 1.4rem;
  display: block;
  margin-bottom: 12px;
  line-height: 1;
}

.query-card-title {
  display: block;
  font-weight: 600;
  font-size: 0.94rem;
  color: var(--navy);
  margin-bottom: 7px;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.query-card-desc {
  display: block;
  font-size: 0.81rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ── Tradition grid ───────────────────────────────────────────────── */

.tradition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 8px;
}

.tradition-chip {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  text-decoration: none !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: background 0.12s, border-color 0.12s;
}

.tradition-chip:hover {
  background: var(--navy);
  border-color: var(--navy);
}

.trad-name {
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.12s;
}

.tradition-chip:hover .trad-name { color: white; }

.trad-count {
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--cream);
  border-radius: 10px;
  padding: 1px 7px;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}

.tradition-chip:hover .trad-count {
  background: rgba(255,255,255,0.15);
  color: #cfd9e8;
}

.loading-text {
  color: var(--muted);
  font-style: italic;
  font-size: 0.88rem;
  grid-column: 1 / -1;
  padding: 12px 0;
}

/* ── About strip (index page bottom) ─────────────────────────────── */

.about-strip {
  background: var(--navy);
  padding: 60px 24px;
}

.about-strip-inner {
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
}

.about-strip h3 {
  color: var(--gold);
  font-size: 0.8rem;
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-weight: 600;
}

.about-strip p {
  color: #a8c4e0;
  font-size: 0.86rem;
  line-height: 1.8;
  margin: 0 0 12px;
}

.about-strip p:last-child { margin: 0; }
.about-strip a { color: var(--gold); }
.about-strip a:hover { color: var(--gold-light); }

/* ── SQL section ──────────────────────────────────────────────────── */

.sql-section {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 36px 24px;
}

.sql-section-inner {
  max-width: 1160px;
  margin: 0 auto;
}

.sql-section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 12px;
}

form.sql { padding: 0 !important; background: none !important; }

form.sql textarea,
#sql-editor,
.CodeMirror {
  font-family: 'Courier New', Courier, monospace !important;
  font-size: 13px !important;
  border: 1px solid var(--border) !important;
  border-radius: 7px !important;
  background: #f7f5f2 !important;
  min-height: 80px;
  width: 100% !important;
}

form.sql input[type=submit],
form.sql button[type=submit] {
  background: var(--navy) !important;
  color: white !important;
  border: none !important;
  padding: 9px 24px !important;
  border-radius: 7px !important;
  cursor: pointer !important;
  font-size: 0.88rem !important;
  margin-top: 10px;
  transition: background 0.12s;
}

form.sql input[type=submit]:hover { background: var(--navy-mid) !important; }

/* ── Tables details (collapsible raw tables) ──────────────────────── */

.tables-details {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.tables-details summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--white);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tables-details summary::before {
  content: '▸';
  font-size: 0.75rem;
  transition: transform 0.15s;
}

.tables-details[open] summary::before { transform: rotate(90deg); }
.tables-details summary small { color: var(--border-dark); }

.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
  padding: 12px 16px 16px;
  background: #f7f5f2;
  border-top: 1px solid var(--border);
}

.table-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 5px;
  text-decoration: none !important;
  font-size: 0.8rem;
  transition: border-color 0.12s;
}

.table-link:hover { border-color: var(--navy-light); }

.table-name { color: var(--text); }
.table-count, .table-type {
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--cream);
  padding: 1px 5px;
  border-radius: 8px;
}

/* ── Parameter forms (parametrized query pages) ───────────────────── */

form[action*="deitydb"] p input[type=text],
input[name="tradition"], input[name="category"],
input[name="entity_name"] {
  border: 1px solid var(--border-dark) !important;
  border-radius: 7px !important;
  padding: 9px 14px !important;
  font-size: 0.9rem !important;
  width: 340px;
  max-width: 100%;
  background: var(--white);
  color: var(--text);
}

/* ── Query / table result pages ───────────────────────────────────── */

.rows-and-columns {
  padding: 0 24px 28px;
  overflow-x: auto;
}

.rows-and-columns table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85rem;
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
}

.rows-and-columns thead th {
  background: var(--navy) !important;
  color: white;
  padding: 11px 14px;
  text-align: left;
  font-weight: 500;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
  border-bottom: none;
}

.rows-and-columns tbody tr:nth-child(even) { background: #f8f5f0; }
.rows-and-columns tbody tr:hover { background: #eef4fb; }

.rows-and-columns td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
  max-width: 400px;
}

.rows-and-columns td a { color: var(--navy-mid); }

/* ── Prose sections (About / Contribute pages) ────────────────────── */

.prose-section {
  padding: 52px 24px;
}

.prose-section-alt {
  background: var(--cream-mid);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.prose-section-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.prose-section-inner h2 {
  font-size: 1.6rem;
  margin: 0 0 20px;
  color: var(--navy);
}

.prose-section-inner p {
  font-size: 0.92rem;
  line-height: 1.8;
  color: var(--text);
  max-width: 680px;
}

.prose-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
}

.prose-block h2 {
  font-size: 1.4rem;
  margin: 0 0 14px;
}

.prose-block h3 {
  font-size: 1.05rem;
  margin: 0 0 10px;
}

.prose-block p {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text);
  margin: 0 0 14px;
}

.prose-block p:last-child { margin: 0; }

/* ── Principles grid (About page) ────────────────────────────────── */

.principles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.principle-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 22px 20px;
  box-shadow: var(--card-shadow);
}

.principle-card h3 {
  font-size: 0.96rem;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-weight: 600;
  color: var(--navy);
  margin: 10px 0 8px;
}

.principle-card p {
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}

.principle-icon {
  font-size: 1.3rem;
  display: block;
  color: var(--gold-dark);
}

/* ── Tradition tags (About page) ──────────────────────────────────── */

.tradition-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 20px;
}

.trad-tag {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.82rem;
  color: var(--text);
}

.trad-tag-more {
  background: var(--navy);
  border-color: var(--navy);
  color: #a8c4e0;
  font-style: italic;
}

.coverage-note {
  background: #f0f5fc;
  border-left: 3px solid var(--navy-light);
  border-radius: 0 7px 7px 0;
  padding: 12px 18px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.7;
  max-width: 760px;
}

/* ── Citation box (About page) ────────────────────────────────────── */

.citation-box {
  background: #f7f5f2;
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  padding: 16px 18px;
  font-family: Georgia, serif;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text);
}

.citation-box p { margin: 0; }

/* ── Tech list (About page) ───────────────────────────────────────── */

.tech-list {
  padding: 0 0 0 18px;
  margin: 0;
}

.tech-list li {
  font-size: 0.87rem;
  color: var(--text);
  line-height: 1.75;
}

/* ── Contribute cards ─────────────────────────────────────────────── */

.contrib-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.contrib-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 26px 22px 22px;
  box-shadow: var(--card-shadow);
}

.contrib-card h3 {
  font-size: 0.97rem;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-weight: 600;
  color: var(--navy);
  margin: 10px 0 10px;
}

.contrib-card p {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.65;
  margin: 0 0 10px;
}

.contrib-card p:last-of-type { margin-bottom: 14px; }

.contrib-icon {
  font-size: 1.4rem;
  display: block;
}

.contrib-link {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--navy-mid) !important;
  text-decoration: none !important;
}

.contrib-link:hover { color: var(--gold-dark) !important; }

/* ── Data standards lists (Contribute page) ───────────────────────── */

.standards-list {
  padding: 0 0 0 18px;
  margin: 0;
}

.standards-list li {
  font-size: 0.87rem;
  color: var(--text);
  line-height: 1.8;
}

.standards-list-no li { color: var(--muted); }

/* ── Steps (Contribute page) ──────────────────────────────────────── */

.steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 24px;
  max-width: 720px;
}

.step {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.step-num {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: var(--navy);
  color: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, serif;
  font-size: 1rem;
  margin-top: 2px;
}

.step-body h3 {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--navy);
  margin: 0 0 6px;
}

.step-body p {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.65;
}

.inline-code {
  display: inline-block;
  background: #f2ede6;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px 12px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.82rem;
  color: var(--navy);
  margin: 4px 0;
}

/* ── Art strip (About page bottom) ───────────────────────────────── */

.art-strip {
  background-size: cover;
  background-position: center 40%;
  position: relative;
}

.art-strip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(20, 35, 65, 0.82);
}

.art-strip-inner {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 52px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}

.art-caption {
  font-size: 0.78rem;
  color: #88aacf;
  font-style: italic;
  margin: 0;
}

.art-strip-cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────────────────────────── */

.btn-primary {
  display: inline-block;
  background: var(--gold);
  color: var(--navy) !important;
  text-decoration: none !important;
  padding: 10px 24px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 0.88rem;
  transition: background 0.12s;
}

.btn-primary:hover { background: var(--gold-light); color: var(--navy) !important; }

.btn-secondary {
  display: inline-block;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.35);
  color: white !important;
  text-decoration: none !important;
  padding: 9px 22px;
  border-radius: 7px;
  font-size: 0.88rem;
  transition: border-color 0.12s, background 0.12s;
}

.btn-secondary:hover {
  border-color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.08);
}

/* ── Footer ───────────────────────────────────────────────────────── */

footer.ft {
  background: var(--navy) !important;
  color: #6a88ae !important;
  padding: 16px 24px !important;
  text-align: center;
  font-size: 0.78rem;
  border-top: 1px solid rgba(255,255,255,0.07);
}

footer.ft a { color: var(--gold) !important; }
footer.ft a:hover { color: var(--gold-light) !important; }

/* ── Pagination ───────────────────────────────────────────────────── */

.pagination {
  padding: 16px 24px;
  font-size: 0.85rem;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.pagination a {
  padding: 5px 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  background: var(--white);
  transition: border-color 0.12s, background 0.12s;
}

.pagination a:hover {
  border-color: var(--navy);
  background: var(--navy);
  color: white;
}

/* ── Datasette result page elements ───────────────────────────────── */

/* SQL block above results — keep from overflowing */
pre#sql-query {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  background: #f7f5f2;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 0 0 12px;
}

/* Export / download links row */
p.export-links {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 4px 24px 12px;
  margin: 0;
}

p.export-links a { color: var(--navy-mid); }

/* SQL form heading */
form.sql h3 {
  font-size: 0.82rem;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
}

/* Canned query edit link */
a.canned-query-edit-sql {
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: 12px;
}

/* Zero results notice */
p.zero-results {
  padding: 16px 24px;
  color: var(--muted);
  font-style: italic;
  font-size: 0.88rem;
}

/* ── Responsive ───────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .prose-two-col { grid-template-columns: 1fr; gap: 32px; }
  .about-strip-inner { grid-template-columns: 1fr; gap: 30px; }
  .art-strip-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 700px) {
  /* ── Nav ── */
  .site-nav { padding: 0 16px; }
  .site-nav-links {
    display: none;
    flex-direction: column;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--navy);
    padding: 12px 16px 18px;
    gap: 2px;
    border-top: 1px solid rgba(255,255,255,0.1);
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  }
  .site-nav-links.open { display: flex; }
  .nav-link { padding: 10px 14px; font-size: 0.92rem; }
  .nav-link-ext { border: none; }
  .nav-toggle { display: flex; }
  /* in the stacked mobile menu, show the divider as a faint horizontal rule */
  .nav-sep { width: auto; align-self: stretch; height: 1px; margin: 6px 8px; }

  /* ── Hero ── */
  .db-hero { padding: 56px 16px 64px; }
  .db-hero h1 { font-size: 2.1rem; }
  .db-hero .subtitle { font-size: 0.93rem; margin-bottom: 36px; }
  .hero-art-credit { display: none; }
  .hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 40px;
    max-width: 280px;
    margin: 0 auto;
  }
  .hero-stat-number { font-size: 2rem; }

  /* ── Art hero pages ── */
  .page-art-hero-inner { padding: 52px 16px 44px; }
  .page-art-hero-inner h1 { font-size: 1.8rem; }
  .page-art-hero-inner p { font-size: 0.92rem; }

  /* ── Section padding ── */
  .db-section { padding: 28px 16px; }
  .db-page-header { padding: 20px 16px 16px; }
  .db-page-header h1 { font-size: 1.3rem; }
  .page-header { padding: 20px 16px 14px !important; }
  .page-header h1 { font-size: 1.2rem; }
  .metadata-description { padding: 12px 16px; font-size: 0.84rem; }
  .about-strip { padding: 36px 16px; }
  .sql-section { padding: 24px 16px; }
  .prose-section { padding: 32px 16px; }

  /* ── Data tables: tighter on mobile ── */
  .rows-and-columns { padding: 0 0 20px; }
  .rows-and-columns thead th { padding: 8px 10px; font-size: 0.7rem; }
  .rows-and-columns td { padding: 7px 10px; font-size: 0.8rem; max-width: 220px; }
  p.export-links { padding: 4px 16px 10px; }
  p.zero-results { padding: 12px 16px; }

  /* ── SQL form on result pages: hide SQL block, keep inputs ── */
  pre#sql-query { display: none; }
  .show-hide-sql { display: none; }
  form.sql h3 { margin-bottom: 8px; }

  /* ── Cards ── */
  .query-grid { grid-template-columns: 1fr; }
  .principles-grid { grid-template-columns: 1fr; }
  .contrib-cards { grid-template-columns: 1fr; }
  .query-card { padding: 18px 16px 16px; }

  /* ── Tradition grid ── */
  .tradition-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
  .tradition-chip { padding: 7px 10px; }
  .trad-name { font-size: 0.79rem; }

  /* ── About strip ── */
  .about-strip-inner { padding: 0; }

  /* ── Contribute steps ── */
  .inline-code { font-size: 0.75rem; word-break: break-all; }
}


/* ===================================================================
   Entity Browser  (/explore)
   =================================================================== */

/* ── Page chrome ─────────────────────────────────────────────────── */
.explore-page { max-width: 1280px; margin: 0 auto; padding: 0 24px 64px; }

.explore-hero {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.explore-hero h1 { font-size: 2rem; color: var(--navy); margin: 0 0 8px; }
.explore-subtitle { color: var(--muted); margin: 0; font-size: 1.05rem; max-width: 68ch; }

/* ── Controls bar ────────────────────────────────────────────────── */
.explore-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 24px;
}
.explore-search {
  flex: 1 1 280px;
  padding: 10px 14px;
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  font-size: 0.97rem;
  background: var(--white);
  color: var(--text);
  outline: none;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.explore-search:focus {
  border-color: var(--navy-mid);
  box-shadow: 0 0 0 3px rgba(45,82,130,0.12);
}
.explore-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.explore-select {
  padding: 10px 32px 10px 12px;
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  font-size: 0.93rem;
  background: var(--white);
  color: var(--text);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  transition: border-color 0.15s;
}
.explore-select:focus { border-color: var(--navy-mid); }
.explore-count { color: var(--muted); font-size: 0.88rem; margin-left: 4px; }

/* ── Loading state ───────────────────────────────────────────────── */
.explore-loading { text-align: center; padding: 64px 0; color: var(--muted); }
.explore-spinner {
  width: 36px; height: 36px; margin: 0 auto 16px;
  border: 3px solid var(--border);
  border-top-color: var(--navy-mid);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.explore-error { color: #b91c1c; }

/* ── Entity card grid ────────────────────────────────────────────── */
.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.entity-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px 12px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  gap: 4px;
  font-family: inherit;
  color: var(--text);
}
.entity-card:hover {
  border-color: var(--navy-mid);
  box-shadow: 0 4px 14px rgba(26,47,78,0.14);
  transform: translateY(-2px);
}
.entity-card:focus-visible {
  outline: 2px solid var(--navy-mid);
  outline-offset: 2px;
}
.ec-top { margin-bottom: 6px; }
.ec-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.25;
  margin-bottom: 2px;
}
.ec-type {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
  flex: 1;
}
.ec-foot { margin-top: auto; padding-top: 10px; }
.ec-rels {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--muted);
}
.ec-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
}

/* ── Tradition badges ────────────────────────────────────────────── */
.ec-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: 20px;
  line-height: 1.5;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trad-greek       { background: #e8f0fc; color: #1e3a8a; }
.trad-egyptian    { background: #fef3c7; color: #92400e; }
.trad-mesopotamian{ background: #fce7f3; color: #831843; }
.trad-christian   { background: #f0fdf4; color: #14532d; }
.trad-islamic     { background: #ecfdf5; color: #065f46; }
.trad-jewish      { background: #fffbeb; color: #78350f; }
.trad-gnostic     { background: #f5f3ff; color: #4c1d95; }
.trad-northern    { background: #e0f2fe; color: #0c4a6e; }
.trad-roman       { background: #fef2f2; color: #7f1d1d; }
.trad-zoroastrian { background: #fff7ed; color: #7c2d12; }
.trad-hermetic    { background: #f0fdfa; color: #134e4a; }
.trad-cross       { background: var(--cream-mid); color: var(--navy); }
.trad-other       { background: var(--cream-mid); color: var(--muted); }

/* ── Side panel overlay ──────────────────────────────────────────── */
.ex-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 50, 0.45);
  z-index: 900;
  display: flex;
  justify-content: flex-end;
  backdrop-filter: blur(2px);
}
body.panel-open { overflow: hidden; }

.ex-panel {
  position: relative;
  width: min(480px, 100vw);
  height: 100%;
  background: var(--white);
  box-shadow: -4px 0 24px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ex-panel-close {
  position: absolute;
  top: 14px; right: 16px;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  z-index: 1;
  transition: color 0.12s, background 0.12s;
}
.ex-panel-close:hover { color: var(--navy); background: var(--cream-mid); }
.ex-panel-body {
  padding: 28px 28px 32px;
  overflow-y: auto;
  flex: 1;
}

/* ── Panel content ───────────────────────────────────────────────── */
.ex-pname {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
  margin: 0 40px 10px 0;
}
.ex-ptrad { margin-bottom: 18px; }
.ex-pmeta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 0 0 16px;
  font-size: 0.87rem;
}
.ex-pmeta dt {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  padding-top: 2px;
}
.ex-pmeta dd { color: var(--text); margin: 0; }
.ex-pnote {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
  border-left: 3px solid var(--border);
  padding-left: 12px;
  margin: 0 0 20px;
  line-height: 1.55;
}

/* ── Relationships list ──────────────────────────────────────────── */
.ex-prels-wrap { border-top: 1px solid var(--border); padding-top: 18px; }
.ex-prels-h {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 12px;
}
.ex-panel-loading { color: var(--muted); font-size: 0.9rem; }
.ex-no-rels { color: var(--muted); font-size: 0.9rem; }
.ex-rel-ul { list-style: none; margin: 0 0 12px; padding: 0; }
.ex-rel-li {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  line-height: 1.4;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
}
.ex-rel-li:last-child { border-bottom: none; }
.ex-rel-type {
  color: var(--muted);
  font-style: italic;
  flex-shrink: 0;
}
.ex-rel-target, .ex-rel-source {
  color: var(--navy);
  font-weight: 600;
}
.ex-rel-this { color: var(--muted); }
.ex-rel-conf {
  font-size: 0.7rem;
  background: var(--cream-mid);
  color: var(--muted);
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}
.ex-rel-subh {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 12px 0 8px;
}

/* ── Mobile adjustments ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .explore-page { padding: 0 14px 48px; }
  .explore-hero { padding: 32px 0 24px; }
  .explore-hero h1 { font-size: 1.55rem; }
  .explore-controls { gap: 8px; }
  .explore-search { flex-basis: 100%; }
  .explore-select { font-size: 0.87rem; padding: 9px 28px 9px 10px; }
  .explore-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .ec-name { font-size: 0.97rem; }
  .ex-panel { width: 100vw; }
  .ex-panel-body { padding: 20px 18px 28px; }
  .ex-pname { font-size: 1.3rem; }
}


/* ════════════════════════════════════════════════════════════════════
   GRAPH PAGE  /graph
   ════════════════════════════════════════════════════════════════════ */

.deitydb-graph { background: var(--bg); }

.gp-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);   /* fill below nav */
  max-height: 100vh;
  overflow: hidden;
  padding: 0;
}

/* ── Header ───────────────────────────────────────────────────────── */
.gp-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px 32px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
}
.gp-header-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 2px;
}
.gp-subtitle {
  font-size: 0.84rem;
  color: var(--muted);
  margin: 0;
}

/* Autocomplete search */
.gp-search-wrap { flex: 1; min-width: 240px; max-width: 460px; }
.gp-ac { position: relative; }
.gp-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.gp-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,111,212,0.14);
}
.gp-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 200;
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}
.gp-sug {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.gp-sug:hover, .gp-sug:focus {
  background: var(--surface);
  outline: none;
}
.gs-name { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.gs-trad { font-size: 0.78rem; color: var(--muted); margin-left: auto; white-space: nowrap; }

/* ── Canvas ───────────────────────────────────────────────────────── */
.gp-canvas {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  background: #f9f8f5;
}

/* ── SVG ──────────────────────────────────────────────────────────── */
/* Use position:absolute + explicit t/r/b/l instead of height:100%
   — height:100% on a flex-determined parent can resolve to 0 in some
   browsers.  JS also stamps explicit width/height attrs at start time. */
#gp-svg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: block;
  cursor: grab;
}
#gp-svg:active { cursor: grabbing; }

/* ── Centred state (empty / loading / error) ──────────────────────── */
.gp-empty,
.gp-loading,
.gp-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
}

/* Loading spinner */
.gp-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: gpSpin 0.8s linear infinite;
}
@keyframes gpSpin { to { transform: rotate(360deg); } }
.gp-loading p {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0;
}

/* Error state */
.gp-error-msg {
  font-size: 0.95rem;
  color: #b91c1c;
  text-align: center;
  max-width: 380px;
  margin: 0;
}

/* ── Empty state ──────────────────────────────────────────────────── */
.gp-empty {
.gp-empty-icon {
  font-size: 3rem;
  opacity: 0.18;
  line-height: 1;
  color: var(--text);
}
.gp-empty-title {
  font-size: 1.1rem;
  color: var(--muted);
  font-weight: 500;
  margin: 0;
}
.gp-empty-seeds {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
}
.gp-seed {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.88rem;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.gp-seed:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Floating toolbar ─────────────────────────────────────────────── */
.gp-toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  z-index: 100;
}
.gp-stats {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  padding-right: 6px;
  border-right: 1px solid var(--border);
}
.gp-tbtn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s, color 0.1s;
}
.gp-tbtn:hover { background: var(--surface); }

/* ── Tooltip ──────────────────────────────────────────────────────── */
.gp-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(10,20,40,0.92);
  color: #f0eee8;
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 0.82rem;
  line-height: 1.5;
  max-width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  z-index: 300;
}
.gp-tooltip strong { display: block; font-size: 0.9rem; margin-bottom: 3px; color: #fff; }
.gt-trad, .gt-type { display: block; opacity: 0.7; font-size: 0.77rem; }
.gt-deg  { display: block; margin-top: 4px; opacity: 0.65; font-size: 0.75rem; }
.gt-hint { display: block; margin-top: 6px; font-size: 0.78rem; color: #93c5fd; }
.gt-done { color: #6ee7b7 !important; }
.gt-rel  { display: block; font-weight: 600; font-size: 0.88rem; color: #fff; }
.gt-conn { display: block; opacity: 0.75; font-size: 0.77rem; margin-top: 3px; }

/* ── Legend ───────────────────────────────────────────────────────── */
.gp-legend {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 10px 32px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
}
.gp-legend-hint {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  align-self: center;
}
.gp-legend-trads {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.gp-leg-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text);
  white-space: nowrap;
}
.gp-leg-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Mobile ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .gp-page { height: calc(100dvh - 56px); }
  .gp-header { padding: 12px 16px 10px; gap: 12px; }
  .gp-header-text h1 { font-size: 1.05rem; }
  .gp-subtitle { display: none; }
  .gp-search-wrap { max-width: 100%; }
  .gp-toolbar { top: 8px; right: 8px; padding: 5px 8px; gap: 6px; }
  .gp-legend { padding: 8px 16px 10px; }
  .gp-legend-hint { display: none; }
}
