@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;600;700;800;900&display=swap');

/* ==========================================================================
   Bible Learning Hub - Unified Standard Web Design System
   Applies to BOTH index.html and all note pages (pages/*.html)
   
   Design Principles:
   1. Unified Web Standards: Single stylesheet, consistent header & layout.
   2. Zero AnuPpuccin: No rainbow headings, no red/purple bolds, no Catppuccin variables.
   3. Zero Gradients: Strictly solid/flat color fills.
   4. Zero Emojis: Functional SVG micro-interaction icons only.
   5. Palette: 土黃色 (Earth Yellow), 米白色 (Rice-White), 黑色 (Black).
   6. Verified WCAG AA / AAA color contrast.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens & Theme Variables
   -------------------------------------------------------------------------- */
:root {
  /* 土黃色 (Earth Yellow / Warm Ochre) */
  --c-yellow-primary: #c68a2c;          /* Solid Ochre accent */
  --c-yellow-hover: #b57a1e;            /* Darker Ochre on hover */
  --c-yellow-active: #9e6513;           /* Active state */
  --c-yellow-dark: #8f590b;             /* Deep Earth Yellow for text/links (Contrast > 5.8:1 on white, AA) */
  --c-yellow-deeper: #6e4204;           /* Deepest Ochre (Contrast > 8.7:1 on white, AAA) */
  --c-yellow-light: #dfb268;            /* Light Ochre */
  --c-yellow-soft: #f5ecd8;             /* Soft warm sand background */
  --c-yellow-border: #d4a964;           /* Earth yellow border */
  --c-yellow-ring: rgba(198, 138, 44, 0.35); /* Focus ring */

  /* 米白色 (Rice-White / Warm Neutral Surfaces) */
  --c-white-page: #f7f4ee;              /* Page & viewport background */
  --c-white-card: #ffffff;              /* Card / main content surface */
  --c-white-surface: #faf7f2;           /* Controls, toolbar, secondary surface */
  --c-white-hover: #f1ebd9;             /* Interactive element hover */
  --c-white-border: #e3dcca;            /* Standard component border */
  --c-white-border-subtle: #ede7db;     /* Subtle divider line */

  /* 黑色 (Black / Deep Charcoal Typography) */
  --c-black-title: #111111;             /* Headings H1-H6, key titles (Contrast > 17:1, AAA) */
  --c-black-body: #222222;              /* Body copy (Contrast > 15:1, AAA) */
  --c-black-secondary: #555555;         /* Metadata, secondary labels (Contrast > 7.4:1, AAA) */
  --c-black-muted: #6e685f;             /* Hints, placeholders (Contrast > 5.4:1, AA) */
  --c-black-faint: #8a8277;             /* Footers, faint icons */

  /* Category Tag Colors (Exempt from 3-color rule, soft pastel + high contrast text) */
  --tag-sunday-bg: #e8f0fe;
  --tag-sunday-text: #174ea6;
  --tag-sunday-border: #c2d7fa;

  --tag-fellowship-bg: #edf7ed;
  --tag-fellowship-text: #1e6827;
  --tag-fellowship-border: #c4e6c7;

  --tag-devotion-bg: #fef7e6;
  --tag-devotion-text: #8c5108;
  --tag-devotion-border: #fadcb0;

  --tag-tool-bg: #f3e8fd;
  --tag-tool-text: #6b21a8;
  --tag-tool-border: #e2c5fa;

  /* Typography Stack - Noto Sans TC First */
  --font-sans: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-mono: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
  --font-size-base: 16px;
  --line-height-base: 1.75;

  /* Component Layout */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(35, 30, 20, 0.05);
  --shadow-md: 0 4px 14px rgba(35, 30, 20, 0.07);
  --shadow-lg: 0 10px 28px rgba(35, 30, 20, 0.10);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.22s ease;
}

/* --------------------------------------------------------------------------
   2. Reset & Global Setup
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Metadata tags: strictly hide from rendering flow to prevent overlapping back button */
metadata {
  display: none !important;
}

html {
  background-color: var(--c-white-page);
  color: var(--c-black-body);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  font-weight: 500;
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100%;
  overflow-x: auto;
  overflow-y: scroll;
}

body {
  margin: 0;
  padding: 0;
  color: var(--c-black-body);
  background-color: var(--c-white-page);
  font-family: var(--font-sans);
  font-weight: 500;
}

/* Standard focus styling */
:focus-visible {
  outline: 2px solid var(--c-yellow-primary);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   3. Unified Layout Containers (80vw Width Standard)
   -------------------------------------------------------------------------- */
/* Database Catalog View (index.html) */
body.database-page {
  width: 80vw;
  max-width: 80vw;
  margin: 24px auto;
  padding: 0;
  background-color: var(--c-white-card);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: visible;
}

/* Note Reading View (pages/*.html) */
body:not(.database-page) {
  width: 80vw;
  max-width: 80vw;
  margin: 28px auto;
  padding: 36px 44px;
  background-color: var(--c-white-card);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  word-wrap: break-word;
}

@media (max-width: 920px) {
  body.database-page,
  body:not(.database-page) {
    width: 92vw;
    max-width: 92vw;
    margin: 16px auto;
    border-radius: var(--radius-md);
  }
  body:not(.database-page) {
    padding: 24px 20px;
  }
}

@media (max-width: 640px) {
  body.database-page,
  body:not(.database-page) {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
}

/* --------------------------------------------------------------------------
   4. Site Navigation Bar (Clean Web Standard)
   -------------------------------------------------------------------------- */
.site-nav,
.notion-breadcrumb-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 36px;
  background-color: var(--c-white-surface);
  border-bottom: 1px solid var(--c-white-border);
}

body.database-page .site-nav {
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

@media (max-width: 768px) {
  .site-nav,
  .notion-breadcrumb-nav {
    padding: 14px 18px;
  }
}

.site-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--c-black-title);
}

.site-nav-brand .brand-icon {
  color: var(--c-yellow-dark);
  flex-shrink: 0;
}

.site-nav-brand .brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.site-nav-brand .brand-subtitle {
  font-size: 0.82rem;
  color: var(--c-black-secondary);
  font-weight: 600;
  padding-left: 6px;
  border-left: 1px solid var(--c-white-border);
}

@media (max-width: 580px) {
  .site-nav-brand .brand-subtitle {
    display: none;
  }
}

.site-nav-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Breadcrumb in note reading view */
.notion-breadcrumb-nav {
  margin: -36px -44px 28px -44px;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

@media (max-width: 920px) {
  .notion-breadcrumb-nav {
    margin: -24px -20px 20px -20px;
  }
}

.nav-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--c-black-title);
  background-color: var(--c-white-card);
  border: 1px solid var(--c-white-border);
  padding: 7px 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.nav-back-link:hover {
  background-color: var(--c-yellow-soft);
  border-color: var(--c-yellow-border);
  color: var(--c-yellow-dark);
  transform: translateX(-2px);
}

.nav-back-link .nav-icon {
  font-size: 1rem;
  line-height: 1;
  transition: transform var(--transition-fast);
}

.nav-back-link:hover .nav-icon {
  transform: translateX(-2px);
}

/* --------------------------------------------------------------------------
   5. Page Header & Hero Section (Standard Web Layout)
   -------------------------------------------------------------------------- */
.page-hero,
.notion-header-container {
  padding: 32px 36px 24px 36px;
  background-color: var(--c-white-card);
  border-bottom: 1px solid var(--c-white-border);
}

@media (max-width: 768px) {
  .page-hero,
  .notion-header-container {
    padding: 24px 18px 20px 18px;
  }
}

/* Breadcrumb trail */
.page-breadcrumbs,
.notion-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--c-black-secondary);
  margin-bottom: 12px;
}

.breadcrumb-sep,
.notion-breadcrumbs span:nth-child(2) {
  color: var(--c-black-muted);
}

/* Titles */
.page-title,
.notion-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--c-black-title);
  margin: 0 0 10px 0;
  line-height: 1.3;
  letter-spacing: -0.3px;
}

.page-description,
.notion-description {
  margin: 0 0 20px 0;
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.65;
  color: var(--c-black-secondary);
  max-width: 820px;
}

/* Top Actions Row */
.notion-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 8px;
}

.notion-header-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Hide old notion fake cover & floating icon */
.notion-cover,
.notion-page-icon {
  display: none !important;
}

/* --------------------------------------------------------------------------
   6. Statistics Summary Bar (Clean Web Standard)
   -------------------------------------------------------------------------- */
.stats-bar,
.notion-stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 14px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  background-color: var(--c-white-surface);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--c-black-secondary);
}

.stat-pill strong {
  color: var(--c-black-title);
  margin-left: 4px;
  font-weight: 800;
}

/* --------------------------------------------------------------------------
   7. Database Controls & Toolbar
   -------------------------------------------------------------------------- */
.controls-toolbar,
.notion-controls {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: var(--c-white-card);
  border-bottom: 1px solid var(--c-white-border);
  padding: 14px 36px;
}

@media (max-width: 768px) {
  .controls-toolbar,
  .notion-controls {
    padding: 12px 18px;
  }
}

.notion-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

/* View Switcher Segmented Tabs */
.view-switcher {
  display: inline-flex;
  background-color: var(--c-white-surface);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.view-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--c-black-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.view-tab:hover {
  color: var(--c-black-title);
  background-color: var(--c-white-hover);
}

.view-tab.active {
  color: var(--c-black-title);
  background-color: var(--c-white-card);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.count-badge {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--c-black-secondary);
}

/* Filter & Search Bar */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.search-box {
  flex: 1 1 240px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  color: var(--c-black-muted);
  pointer-events: none;
}

.search-box input[type="text"] {
  width: 100%;
  padding: 8px 34px 8px 36px;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--c-black-title);
  background-color: var(--c-white-surface);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.search-box input[type="text"]:focus {
  background-color: var(--c-white-card);
  border-color: var(--c-yellow-primary);
  box-shadow: 0 0 0 3px var(--c-yellow-ring);
  outline: none;
}

.search-clear {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--c-black-muted);
  cursor: pointer;
  padding: 4px;
  display: none;
  border-radius: var(--radius-sm);
}

.search-clear:hover {
  color: var(--c-black-title);
}

.filter-dropdowns {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.select-filter {
  padding: 8px 12px;
  font-size: 0.88rem;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--c-black-title);
  background-color: var(--c-white-surface);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.select-filter:hover {
  border-color: var(--c-yellow-border);
}

.select-filter:focus {
  outline: none;
  border-color: var(--c-yellow-primary);
  box-shadow: 0 0 0 3px var(--c-yellow-ring);
}

.btn-reset-filters {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--c-black-secondary);
  background-color: var(--c-white-surface);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-reset-filters:hover {
  background-color: var(--c-white-hover);
  color: var(--c-black-title);
}

/* --------------------------------------------------------------------------
   8. Buttons & Action Components
   -------------------------------------------------------------------------- */
.btn-action,
.btn-notion {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--c-black-title);
  background-color: var(--c-white-card);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-action:hover,
.btn-notion:hover {
  background-color: var(--c-white-surface);
  border-color: var(--c-yellow-border);
  color: var(--c-yellow-dark);
}

.btn-action-primary,
.btn-notion-primary {
  background-color: var(--c-yellow-primary);
  border-color: var(--c-yellow-hover);
  color: var(--c-black-title);
  font-weight: 800;
}

.btn-action-primary:hover,
.btn-notion-primary:hover {
  background-color: var(--c-yellow-hover);
  border-color: var(--c-yellow-active);
  color: var(--c-black-title);
}

.btn-preview {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--c-black-title);
  background-color: var(--c-white-surface);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-preview:hover {
  background-color: var(--c-yellow-soft);
  border-color: var(--c-yellow-border);
  color: var(--c-yellow-dark);
}

.btn-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  color: var(--c-black-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.btn-open-link:hover {
  color: var(--c-yellow-dark);
  background-color: var(--c-yellow-soft);
  border-color: var(--c-yellow-border);
}

/* --------------------------------------------------------------------------
   9. Standard Typography & Note Reading Layout (Zero AnuPpuccin)
   -------------------------------------------------------------------------- */
main {
  display: block;
  width: 100%;
}

/* Headings: Unified dark charcoal/black, strict web hierarchy */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  color: var(--c-black-title);
  line-height: 1.35;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
  scroll-margin-top: 24px;
}

/* Note Header H1 */
header h1 {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--c-black-title);
  margin: 0 0 16px 0;
  letter-spacing: -0.3px;
  line-height: 1.25;
}

/* In-body H1 */
main h1 {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--c-black-title);
  border-bottom: 1px solid var(--c-white-border);
  padding-bottom: 8px;
  margin-top: 2rem;
  margin-bottom: 0.8em;
}

/* In-body H2 */
main h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--c-black-title);
  border-bottom: 1px solid var(--c-white-border-subtle);
  padding-bottom: 6px;
  margin-top: 1.6em;
  margin-bottom: 0.65em;
}

/* In-body H3 */
main h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--c-black-body);
  margin-top: 1.35em;
  margin-bottom: 0.5em;
}

/* In-body H4, H5, H6 */
main h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-black-body);
  margin-top: 1.2em;
  margin-bottom: 0.45em;
}

main h5 {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--c-black-secondary);
  margin-top: 1.1em;
  margin-bottom: 0.4em;
}

main h6 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--c-black-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 1em;
  margin-bottom: 0.35em;
}

/* Note Header Metadata Badges */
header {
  border-bottom: 1px solid var(--c-white-border);
  padding-bottom: 20px;
  margin-bottom: 28px;
}

header ul,
header ol {
  list-style: none;
  padding: 0;
  margin: 10px 0 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}

header ul li,
header ol li {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 0.88rem;
  color: var(--c-black-secondary);
  background-color: var(--c-white-surface);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-md);
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
}

header ul li:hover,
header ol li:hover {
  background-color: var(--c-yellow-soft);
  border-color: var(--c-yellow-border);
  color: var(--c-yellow-dark);
}

/* Paragraphs & Text Elements */
p {
  margin: 0.9em 0;
  line-height: var(--line-height-base);
  color: var(--c-black-body);
  font-weight: 500;
}

/* STRICT: bold is dark black, NOT red or purple! */
strong,
b {
  font-weight: 800;
  color: var(--c-black-title);
}

em,
i {
  font-style: italic;
  color: var(--c-black-secondary);
}

mark {
  background-color: var(--c-yellow-soft);
  color: var(--c-black-title);
  padding: 0.15em 0.35em;
  border-radius: var(--radius-sm);
  border-bottom: 1.5px solid var(--c-yellow-border);
}

del,
s {
  text-decoration: line-through;
  color: var(--c-black-muted);
}

/* Links */
a {
  color: var(--c-yellow-dark);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all var(--transition-fast);
  font-weight: 600;
}

a:hover,
a:focus {
  color: var(--c-yellow-active);
  border-bottom-color: var(--c-yellow-active);
}

/* Blockquotes: Editorial style with solid Earth Yellow border */
blockquote {
  margin: 1.4em 0;
  padding: 14px 20px;
  border-left: 4px solid var(--c-yellow-primary);
  background-color: var(--c-white-surface);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--c-black-body);
  font-weight: 500;
  position: relative;
}

blockquote > p:first-child,
blockquote > ul:first-child,
blockquote > ol:first-child {
  margin-top: 0;
}

blockquote > p:last-child,
blockquote > ul:last-child,
blockquote > ol:last-child {
  margin-bottom: 0;
}

/* Lists */
ul,
ol {
  padding-left: 24px;
  margin: 0.9em 0;
}

li {
  margin: 0.4em 0;
  line-height: var(--line-height-base);
  font-weight: 500;
}

ul > li::marker {
  color: var(--c-yellow-dark);
}

ol > li::marker {
  color: var(--c-yellow-dark);
  font-weight: 700;
}

/* Code & Preformatted */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background-color: var(--c-white-surface);
  color: var(--c-yellow-deeper);
  padding: 0.18em 0.42em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-white-border);
  vertical-align: baseline;
}

pre {
  background-color: var(--c-white-surface);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 1.3em 0;
  line-height: 1.55;
}

pre code {
  background: transparent;
  color: var(--c-black-body);
  padding: 0;
  border: none;
  font-size: 0.9em;
}

/* Horizontal Divider */
hr {
  border: none;
  height: 1px;
  background: var(--c-white-border);
  margin: 2.2em 0;
}

/* Article Tables */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.6em 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--c-white-border);
  overflow: hidden;
  font-size: 0.95em;
}

thead {
  background-color: var(--c-white-surface);
}

th {
  padding: 10px 14px;
  font-weight: 800;
  text-align: left;
  color: var(--c-black-title);
  border-bottom: 1.5px solid var(--c-white-border);
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-white-border-subtle);
  color: var(--c-black-body);
  font-weight: 500;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background-color: var(--c-yellow-soft);
}

/* Details & Summary */
details {
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin: 1.2em 0;
  background-color: var(--c-white-surface);
  transition: all var(--transition-fast);
}

summary {
  font-weight: 700;
  color: var(--c-black-title);
  cursor: pointer;
  outline: none;
  margin: -12px -16px;
  padding: 12px 16px;
  user-select: none;
}

details[open] summary {
  border-bottom: 1px solid var(--c-white-border-subtle);
  margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   10. Category Badges & Tags (Clean Solid Pills)
   -------------------------------------------------------------------------- */
.notion-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.tag-sunday {
  background-color: var(--tag-sunday-bg);
  color: var(--tag-sunday-text);
  border: 1px solid var(--tag-sunday-border);
}

.tag-fellowship {
  background-color: var(--tag-fellowship-bg);
  color: var(--tag-fellowship-text);
  border: 1px solid var(--tag-fellowship-border);
}

.tag-devotion {
  background-color: var(--tag-devotion-bg);
  color: var(--tag-devotion-text);
  border: 1px solid var(--tag-devotion-border);
}

.tag-tool {
  background-color: var(--tag-tool-bg);
  color: var(--tag-tool-text);
  border: 1px solid var(--tag-tool-border);
}

.tag-scripture {
  background-color: var(--c-white-surface);
  color: var(--c-yellow-deeper);
  border: 1px solid var(--c-white-border);
}

.tag-date {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--c-black-secondary);
  background-color: var(--c-white-surface);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.tag-default {
  background-color: var(--c-white-surface);
  color: var(--c-black-body);
  border: 1px solid var(--c-white-border);
}

/* --------------------------------------------------------------------------
   11. Database Views: Table, Board, Gallery, List
   -------------------------------------------------------------------------- */
.database-content {
  padding: 20px 36px 36px 36px;
}

@media (max-width: 768px) {
  .database-content {
    padding: 16px 14px 28px 14px;
  }
}

/* --- View 1: Table --- */
.notion-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-md);
  background-color: var(--c-white-card);
}

.notion-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  border: none;
  font-size: 0.9rem;
}

.notion-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--c-white-surface);
}

.notion-table th {
  padding: 12px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--c-black-secondary);
  text-align: left;
  border-bottom: 1.5px solid var(--c-white-border);
  white-space: nowrap;
}

.notion-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--c-white-border-subtle);
  vertical-align: middle;
}

.notion-table tbody tr:hover {
  background-color: var(--c-yellow-soft);
}

.notion-table .col-title {
  min-width: 220px;
  font-weight: 700;
}

.table-title-link {
  color: var(--c-black-title);
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
}

.table-title-link:hover {
  color: var(--c-yellow-dark);
}

.notion-table .col-category { min-width: 100px; }
.notion-table .col-date { min-width: 110px; }
.notion-table .col-scripture { min-width: 180px; }
.notion-table .col-speaker { min-width: 100px; }
.notion-table .col-summary {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-black-secondary);
  font-size: 0.85rem;
  font-weight: 500;
}
.notion-table .col-actions {
  min-width: 120px;
  text-align: right;
  white-space: nowrap;
}

/* --- View 2: Board (Kanban) --- */
.notion-board {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
}

.board-column {
  flex: 0 0 300px;
  background-color: var(--c-white-surface);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.board-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--c-white-border);
}

.board-col-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--c-black-title);
}

.board-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
}

.board-card {
  background-color: var(--c-white-card);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.board-card:hover {
  border-color: var(--c-yellow-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.board-card-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--c-black-title);
  margin-bottom: 8px;
  line-height: 1.4;
}

.board-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.board-card-summary {
  font-size: 0.84rem;
  color: var(--c-black-secondary);
  font-weight: 500;
  line-height: 1.5;
  margin-top: 6px;
}

/* --- View 3: Gallery (Cards Grid) --- */
.notion-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.gallery-card {
  background-color: var(--c-white-card);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.gallery-card:hover {
  border-color: var(--c-yellow-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.gallery-cover {
  height: 44px;
  background-color: var(--c-white-surface);
  border-bottom: 1px solid var(--c-white-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
}

.gallery-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.gallery-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-black-title);
  line-height: 1.35;
  margin-bottom: 8px;
}

.gallery-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.gallery-card-outline {
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.55;
  color: var(--c-black-secondary);
  flex: 1;
  margin-bottom: 14px;
}

.gallery-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--c-white-border-subtle);
}

/* --- View 4: List --- */
.notion-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: var(--c-white-card);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.list-item:hover {
  background-color: var(--c-yellow-soft);
  border-color: var(--c-yellow-border);
}

.list-item-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--c-black-title);
}

.list-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--c-black-muted);
}

.empty-icon {
  margin-bottom: 14px;
  color: var(--c-black-muted);
}

.empty-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--c-black-title);
  margin-bottom: 6px;
}

/* --------------------------------------------------------------------------
   12. Modal Preview Dialog (Web Standard Drawer - 80vw Width Standard)
   -------------------------------------------------------------------------- */
.notion-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: rgba(17, 17, 17, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.notion-modal-backdrop.open {
  display: flex;
}

.notion-modal-container {
  width: 80vw;
  max-width: 80vw;
  height: 88vh;
  background-color: var(--c-white-card);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (max-width: 768px) {
  .notion-modal-backdrop {
    padding: 0;
  }
  .notion-modal-container {
    height: 100vh;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    border: none;
  }
}

.modal-header {
  padding: 14px 24px;
  background-color: var(--c-white-surface);
  border-bottom: 1px solid var(--c-white-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.modal-title-wrap h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--c-black-title);
}

.modal-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-modal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--c-black-title);
  background-color: var(--c-white-card);
  border: 1px solid var(--c-white-border);
  border-radius: var(--radius-md);
  text-decoration: none;
}

.btn-modal:hover {
  background-color: var(--c-yellow-soft);
  border-color: var(--c-yellow-border);
  color: var(--c-yellow-dark);
}

.btn-close-modal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--c-black-secondary);
}

.btn-close-modal:hover {
  background-color: var(--c-white-hover);
  color: var(--c-black-title);
}

.modal-iframe-wrap {
  flex: 1;
  width: 100%;
  height: 100%;
}

.modal-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Toast Message */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  background-color: var(--c-black-title);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all var(--transition-normal);
}

.toast-msg.show {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   13. Footer (Shared Standard Web Footer)
   -------------------------------------------------------------------------- */
.site-footer,
footer {
  margin-top: 40px;
  padding: 24px 36px;
  border-top: 1px solid var(--c-white-border);
  text-align: center;
  font-size: 0.88rem;
  color: var(--c-black-secondary);
  background-color: var(--c-white-surface);
}

body.database-page .site-footer {
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* --------------------------------------------------------------------------
   14. Animate-UI Standard Micro-Interactions (Vectors Only, No Emojis)
   -------------------------------------------------------------------------- */
.nav-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.external-nav-icon {
  transition: transform 0.18s cubic-bezier(0.2, 0, 0.2, 1);
}

a:hover .external-nav-icon,
button:hover .external-nav-icon {
  transform: translate(2px, -2px);
}

.preview-nav-icon {
  transition: transform 0.18s ease;
}

button:hover .preview-nav-icon {
  transform: scale(1.15);
}

.shuffle-nav-icon {
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

button:hover .shuffle-nav-icon {
  transform: rotate(20deg);
}

.reset-nav-icon {
  transition: transform 0.3s ease;
}

button:hover .reset-nav-icon {
  transform: rotate(-90deg);
}

.close-nav-icon {
  transition: transform 0.18s ease;
}

button:hover .close-nav-icon {
  transform: rotate(90deg);
}

.view-tab:hover .nav-icon {
  transform: translateY(-1.5px);
}

.view-tab.active .nav-icon {
  transform: scale(1.08);
}

/* --------------------------------------------------------------------------
   15. Print Optimization
   -------------------------------------------------------------------------- */
@media print {
  .site-nav,
  .notion-breadcrumb-nav,
  .controls-toolbar,
  .notion-controls,
  .site-footer,
  footer,
  .btn-preview,
  .btn-open-link {
    display: none !important;
  }

  html,
  body,
  body.database-page,
  body:not(.database-page) {
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  h1, h2, h3, h4, h5, h6 {
    color: #000000 !important;
    border-color: #cccccc !important;
  }

  a {
    color: #000000 !important;
    text-decoration: underline;
  }

  blockquote {
    border-left-color: #666666 !important;
    background: #f9f9f9 !important;
  }
}
