/* =============================================================================
   style.css
   =========
   Single stylesheet for the blog template.

   TABLE OF CONTENTS
   -----------------
   1.  Fonts
   2.  Custom Properties (design tokens)
   3.  Dark Theme Overrides
   4.  Theme Transition
   5.  Document / Reset
   6.  Layout (sidebar + main grid)
   7.  Sidebar
   8.  Header
   9.  Main Content Area
   10. Typography — Headings
   11. Typography — Body & Inline
   12. Links
   13. Blockquotes
   14. Code
   15. Lists
   16. Horizontal Rules
   17. Figures & Images
   18. Tables
   19. Post List (index page)
   20. Single Post — Header & Metadata
   21. Single Post — Table of Contents
   22. Single Post — Footnotes
   23. Single Post — Prev/Next Navigation
   24. Footer
   25. Link Preview Popup
   26. Reading Progress Bar
   27. Search Input
   28. Utility Classes
   29. Print Styles
   ============================================================================= */


/* =============================================================================
   1. FONTS
   Google Fonts import. To self-host instead (no external request):
     1. Download files from https://gwfh.mranftl.com/fonts/eb-garamond
     2. Place .woff2 files in a /fonts directory
     3. Replace this @import with @font-face declarations
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=JetBrains+Mono:wght@400;500&display=swap');


/* =============================================================================
   2. CUSTOM PROPERTIES — LIGHT THEME (default)
   ============================================================================= */

:root {
  /* ── Color palette ── */
  --bg:          #fffff8;   /* warm off-white */
  --bg-alt:      #f4f4ec;   /* slightly darker; code blocks, TOC, search */
  --border:      #dad9d0;   /* subtle separator lines */
  --text:        #111110;   /* near-black body text */
  --text-muted:  #6b6a62;   /* secondary text, captions */
  --text-faint:  #a09e95;   /* timestamps, labels, faint UI */
  --accent:      #a0522d;   /* sienna — warm, bookish highlight */
  --accent-dim:  #c07850;   /* lighter accent for hovers and badges */
  --link:        #4a6da7;
  --link-hover:  #2a4d87;
  --selection:   #d4c8a0;

  /* ── Elevation ── */
  --shadow-popup:
    0 4px 16px rgba(0, 0, 0, 0.10),
    0 1px  4px rgba(0, 0, 0, 0.07),
    0 0   0 1px rgba(0, 0, 0, 0.05);

  /* ── Typography ── */
  --font-body:   'EB Garamond', Georgia, 'Times New Roman', serif;
  --font-mono:   'JetBrains Mono', 'Courier New', monospace;
  --font-size:   21px;
  --line-height: 1.72;
  --measure:     68ch;      /* comfortable max line length */

  /* ── Spacing ── */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  2rem;
  --space-xl:  4rem;

  /* ── Transitions ── */
  --ease:   cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 120ms;
  --t-med:  240ms;
}


/* =============================================================================
   3. DARK THEME OVERRIDES
   Applied when JavaScript sets data-theme="dark" on <html>.
   ============================================================================= */

[data-theme="dark"] {
  --bg:          #1a1a18;
  --bg-alt:      #222220;
  --border:      #36352e;
  --text:        #e8e6df;
  --text-muted:  #a09d92;
  --text-faint:  #6b6860;
  --accent:      #c47840;
  --accent-dim:  #d49060;
  --link:        #7fa8d4;
  --link-hover:  #a8c8e8;
  --selection:   #4a3e28;

  --shadow-popup:
    0 4px 24px rgba(0, 0, 0, 0.45),
    0 1px  6px rgba(0, 0, 0, 0.30),
    0 0   0 1px rgba(255, 255, 255, 0.06);
}


/* =============================================================================
   4. THEME TRANSITION
   Smooth color crossfade when switching between light and dark mode.
   Applied only to the elements whose backgrounds visibly change.
   ============================================================================= */

body,
.site-sidebar,
.site-header,
.site-footer,
#link-preview,
.toc,
.search-input,
code,
pre {
  transition:
    background-color var(--t-med) var(--ease),
    color            var(--t-med) var(--ease),
    border-color     var(--t-med) var(--ease);
}


/* =============================================================================
   5. DOCUMENT / RESET
   ============================================================================= */

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

html {
  font-size: var(--font-size);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  /*
   * font-weight: 500 (medium) rather than the default 400 (regular).
   *
   * EB Garamond at weight 400 is a beautifully elegant typeface, but it is
   * noticeably thinner than the fallback fonts (Georgia, Times New Roman).
   * Setting 500 gives it a slightly sturdier stroke that:
   *   a) looks intentional and consistent at all screen densities, and
   *   b) is visually closer to the fallback fonts, so the page feels stable
   *      whether or not the web font has loaded yet.
   */
  font-weight: 500;
  line-height: var(--line-height);
  font-feature-settings: "kern" 1, "liga" 1, "onum" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--selection); }


/* =============================================================================
   6. LAYOUT
   Two-column grid: fixed 220px sidebar, flexible content column.
   Collapses to single column below 860px.
   ============================================================================= */

.site-wrapper {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "sidebar header"
    "sidebar main"
    "sidebar footer";
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 860px) {
  .site-wrapper {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "sidebar"
      "main"
      "footer";
  }
}


/* =============================================================================
   7. SIDEBAR
   ============================================================================= */

.site-sidebar {
  grid-area: sidebar;
  padding: var(--space-xl) var(--space-lg) var(--space-xl) var(--space-md);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
}

.site-sidebar::-webkit-scrollbar { display: none; }

@media (max-width: 860px) {
  .site-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: var(--space-md);
  }
}

.sidebar-brand {
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  margin-bottom: var(--space-xl);
  transition: color var(--t-fast) var(--ease);
}

.sidebar-brand:hover { color: var(--text); }

.sidebar-nav { list-style: none; }

.sidebar-nav li { margin-bottom: var(--space-xs); }

.sidebar-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  display: block;
  padding: 3px 0;
  transition: color var(--t-fast) var(--ease);
}

.sidebar-nav a:hover,
.sidebar-nav a.active { color: var(--accent); }

.sidebar-nav .nav-section {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

/* The dark/light toggle sits at the bottom of the sidebar */
.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-lg);
}

#theme-toggle {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text-faint);
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px 10px;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition:
    color            var(--t-fast) var(--ease),
    border-color     var(--t-fast) var(--ease);
}

#theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
}


/* =============================================================================
   8. HEADER
   ============================================================================= */

.site-header {
  grid-area: header;
  padding: var(--space-xl) var(--space-xl) var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.site-header h1 {
  font-size: 2.2rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: var(--space-sm);
}

.site-header .subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
}


/* =============================================================================
   9. MAIN CONTENT AREA
   ============================================================================= */

.site-main {
  grid-area: main;
  padding: var(--space-xl);
  min-width: 0; /* prevent content overflowing the grid column */
}

.content-body { max-width: var(--measure); }


/* =============================================================================
   10. TYPOGRAPHY — HEADINGS
   ============================================================================= */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: 500;
  line-height: 1.25;
  color: var(--text);
}

h1 { font-size: 2rem;   margin-bottom: var(--space-md); }
h2 { font-size: 1.5rem; margin-top: var(--space-xl);  margin-bottom: var(--space-md); }
h3 { font-size: 1.2rem; margin-top: var(--space-lg);  margin-bottom: var(--space-sm); }
h4 { font-size: 1rem;   margin-top: var(--space-lg);  margin-bottom: var(--space-sm); font-style: italic; }

/* Section anchor links (§) — injected by main.js, hidden until heading hovered */
h2 .section-link,
h3 .section-link {
  opacity: 0;
  color: var(--text-faint);
  margin-left: 0.5ch;
  text-decoration: none;
  font-weight: 400;
  font-size: 0.75em;
  transition: opacity var(--t-fast) var(--ease);
}

h2:hover .section-link,
h3:hover .section-link { opacity: 1; }


/* =============================================================================
   11. TYPOGRAPHY — BODY & INLINE
   ============================================================================= */

p {
  margin-bottom: var(--space-md);
  hanging-punctuation: first;
}

/* Drop cap on the opening paragraph of an article */
.post-content > p:first-of-type::first-letter {
  float: left;
  font-size: 3.5em;
  line-height: 0.78;
  margin-right: 0.1em;
  margin-top: 0.1em;
  color: var(--accent);
  font-weight: 500;
}

strong { font-weight: 600; }
em     { font-style: italic; }

small,
.small {
  font-size: 0.82rem;
  color: var(--text-muted);
}


/* =============================================================================
   12. LINKS
   ============================================================================= */

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition:
    color                 var(--t-fast) var(--ease),
    text-decoration-color var(--t-fast) var(--ease);
}

a:hover {
  color: var(--link-hover);
  text-decoration-color: var(--link-hover);
}

/* Superscript footnote reference numbers */
a.footnote-ref {
  font-size: 0.72rem;
  vertical-align: super;
  line-height: 0;
  color: var(--accent-dim);
  text-decoration: none;
  padding: 0 1px;
}

a.footnote-ref:hover { color: var(--accent); }

/* External link ↗ icon */
a[href^="http"]::after,
a[href^="https"]::after {
  content: "\2009↗";
  font-size: 0.7em;
  opacity: 0.5;
  vertical-align: super;
  line-height: 0;
  margin-left: 1px;
}

/* Add class="no-ext-icon" to suppress the icon on a specific link */
a.no-ext-icon::after { content: none; }


/* =============================================================================
   13. BLOCKQUOTES
   ============================================================================= */

blockquote {
  border-left: 2px solid var(--border);
  margin: var(--space-lg) 0 var(--space-lg) var(--space-md);
  padding: var(--space-sm) var(--space-lg);
  color: var(--text-muted);
  font-style: italic;
}

blockquote p { margin-bottom: var(--space-sm); }

blockquote footer,
blockquote cite {
  display: block;
  font-style: normal;
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-top: var(--space-sm);
}

blockquote footer::before { content: "— "; }


/* =============================================================================
   14. CODE
   ============================================================================= */

code {
  font-family: var(--font-mono);
  font-size: 0.78em;
  font-weight: 400; /* monospace at normal weight */
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: var(--space-md) var(--space-lg);
  overflow-x: auto;
  margin: var(--space-lg) 0;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8rem;
  line-height: 1.6;
}


/* =============================================================================
   15. LISTS
   ============================================================================= */

ul, ol {
  padding-left: 1.5em;
  margin-bottom: var(--space-md);
}

li { margin-bottom: 0.3em; }

li ul,
li ol { margin-top: 0.3em; margin-bottom: 0; }


/* =============================================================================
   16. HORIZONTAL RULES
   ============================================================================= */

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-xl) 0;
}

hr.ornament {
  border: none;
  text-align: center;
  color: var(--text-faint);
  letter-spacing: 0.5em;
  margin: var(--space-xl) 0;
}
hr.ornament::after { content: "· · ·"; }


/* =============================================================================
   17. FIGURES & IMAGES
   ============================================================================= */

figure { margin: var(--space-lg) 0; }

img {
  max-width: 100%;
  height: auto;
  display: block;
}

figcaption {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: var(--space-sm);
  text-align: center;
}


/* =============================================================================
   18. TABLES
   ============================================================================= */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: var(--space-lg) 0;
}

th {
  text-align: left;
  font-weight: 500;
  border-bottom: 2px solid var(--border);
  padding: var(--space-sm) var(--space-md);
}

td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
}

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


/* =============================================================================
   19. POST LIST (index page)
   ============================================================================= */

.post-list {
  list-style: none;
  padding: 0;
}

.post-list-item {
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--border);
}

.post-list-item:first-child { padding-top: 0; }

.post-meta {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}

.post-date {
  font-size: 0.78rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.post-tags {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.tag {
  font-size: 0.7rem;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 1px 6px;
  text-decoration: none;
  transition:
    color        var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}

.tag:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.tag::after { content: none !important; }

.post-title {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: var(--space-sm);
  line-height: 1.3;
}

.post-title a {
  color: var(--text);
  text-decoration: none;
}

.post-title a:hover { color: var(--accent); }
.post-title a::after { content: none !important; }

.post-excerpt {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 0;
}

.read-more {
  font-size: 0.82rem;
  color: var(--accent-dim);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-sm);
  transition: color var(--t-fast) var(--ease);
}

.read-more::after { content: none !important; }
.read-more:hover  { color: var(--accent); }
.read-more .arrow { transition: transform var(--t-fast) var(--ease); }
.read-more:hover .arrow { transform: translateX(3px); }


/* =============================================================================
   20. SINGLE POST — HEADER & METADATA
   ============================================================================= */

.post-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

.post-header .post-meta { margin-bottom: var(--space-md); }

.post-header .post-abstract {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.95rem;
  border-left: 2px solid var(--border);
  padding-left: var(--space-md);
  margin-top: var(--space-md);
}


/* =============================================================================
   21. SINGLE POST — TABLE OF CONTENTS
   ============================================================================= */

.toc {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-lg) 0;
  font-size: 0.85rem;
}

.toc-title {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--space-sm);
}

.toc ol  { padding-left: 1.25em; margin-bottom: 0; }
.toc li  { margin-bottom: 0.2em; }
.toc a   { color: var(--text-muted); text-decoration: none; }
.toc a:hover { color: var(--link); }
.toc a::after { content: none !important; }


/* =============================================================================
   22. SINGLE POST — FOOTNOTES
   ============================================================================= */

.footnotes {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footnotes h2 {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 0;
  margin-bottom: var(--space-md);
}

.footnotes ol { padding-left: 1.5em; }
.footnotes li { margin-bottom: var(--space-sm); }


/* =============================================================================
   23. SINGLE POST — PREV / NEXT NAVIGATION
   ============================================================================= */

.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  gap: var(--space-lg);
  font-size: 0.85rem;
}

.post-nav a {
  color: var(--text-muted);
  text-decoration: none;
  max-width: 45%;
}

.post-nav a:hover { color: var(--accent); }
.post-nav a::after { content: none !important; }

.post-nav .nav-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: block;
  margin-bottom: 3px;
}

.post-nav .prev { text-align: left; }
.post-nav .next { text-align: right; }


/* =============================================================================
   24. FOOTER
   ============================================================================= */

.site-footer {
  grid-area: footer;
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-faint);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.site-footer a        { color: var(--text-faint); text-decoration: none; }
.site-footer a:hover  { color: var(--text-muted); }
.site-footer a::after { content: none !important; }


/* =============================================================================
   25. LINK PREVIEW AND SCRIPTURE PREVIEW POPUPS
   ============================================================================= */

/*
 * Both popups (#link-preview from preview.js, #scripture-preview from
 * scripture.js) share identical layout and visual styles via the grouped
 * selector. They coordinate so only one ever shows at a time.
 *
 * pointer-events: auto — required so the iframe inside #link-preview is
 * scrollable, and so mouseenter/mouseleave fire on both popups to cancel
 * the hide timer while the cursor is inside.
 *
 * visibility: hidden (not display: none) — keeps the popup in the layout
 * tree for measurement while blocking pointer events and screen display.
 */
#link-preview,
#scripture-preview {
  position: fixed;
  z-index: 9999;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: var(--shadow-popup);
  overflow: hidden;
  max-width: calc(100vw - 2rem);
  pointer-events: auto;

  opacity: 0;
  transform: translateY(4px);
  visibility: hidden;
  transition:
    opacity   var(--t-med) var(--ease),
    transform var(--t-med) var(--ease);
}

#link-preview.visible,
#scripture-preview.visible {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

/* ── Header bar: domain label + ↗ open-in-new-tab button ── */
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  min-height: 34px;
  flex-shrink: 0;
}

.preview-domain {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 85%;
}

/* ↗ open-in-new-tab link */
.preview-open {
  font-size: 0.9rem;
  color: var(--text-faint);
  text-decoration: none;
  flex-shrink: 0;
  margin-left: 8px;
  transition: color var(--t-fast) var(--ease);
}

.preview-open:hover { color: var(--link); }

/* ── iframe layout ── */

/* Fills all height below the header bar */
.preview-iframe-wrap {
  width: 100%;
  height: calc(100% - 34px);
  overflow: hidden;
}

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

/* ── Metadata / Wikipedia / footnote card ── */

.preview-image {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}

.preview-card-content {
  padding: var(--space-sm) var(--space-md);
}

/* Small coloured label, e.g. "Wikipedia" or "Footnote" */
.preview-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dim);
  border: 1px solid var(--accent-dim);
  border-radius: 2px;
  padding: 1px 5px;
  margin-bottom: 5px;
  opacity: 0.8;
}

.preview-title {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 5px;
  line-height: 1.35;
}

.preview-excerpt {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/*
 * Scrollable excerpt variant — used for Wikipedia cards.
 *
 * Wikipedia's REST API returns a full article introduction (often 300–800
 * words). Truncating it would lose useful context. Instead, the excerpt area
 * becomes a fixed-height scrollable region so the user can read as much as
 * they want without the popup growing to an unwieldy size.
 */
.preview-excerpt--scroll {
  max-height: 220px;
  overflow-y: auto;
  /* Custom scrollbar for a clean look */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.preview-excerpt--scroll::-webkit-scrollbar {
  width: 4px;
}

.preview-excerpt--scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ── Loading state ── */
.preview-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-faint);
  font-size: 0.78rem;
  font-family: var(--font-body);
  padding: var(--space-md);
}

.preview-spinner {
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--border);
  border-top-color: var(--text-faint);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================================================
   25a. SCRIPTURE REFERENCE SPANS
   Inline styling for <span class="scripture-ref"> elements injected by
   scripture.js. The dotted accent underline signals interactivity without
   looking like a regular hyperlink.
   ============================================================================= */

/*
 * The span is inline so it flows naturally within prose. The cursor changes
 * to "help" to communicate that hovering reveals information.
 * font-style: normal overrides any inherited italic context (e.g. a
 * scripture reference inside a blockquote should not be doubly italicised).
 */
.scripture-ref {
  display: inline;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--accent-dim);
  text-underline-offset: 3px;
  cursor: help;
  font-style: normal;
  transition: color var(--t-fast) var(--ease);
}

.scripture-ref:hover,
.scripture-ref:focus {
  color: var(--accent);
  text-decoration-style: solid;
  outline: none;
}

/* Translation indicator ("KJV") shown after the badge in Bible verse popups */
.preview-translation {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-left: 6px;
  vertical-align: middle;
}

/* "Read on OpenBible.com →" link shown in error fallback cards */
.scripture-read-link {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--link);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}

.scripture-read-link:hover { color: var(--link-hover); }
/* Suppress the auto ↗ icon (the arrow is already in the link text) */
.scripture-read-link::after { content: none !important; }


/* =============================================================================
   26. READING PROGRESS BAR
   ============================================================================= */

#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  width: 0%;
  z-index: 1000;
  transition: width 80ms linear;
  pointer-events: none;
}


/* =============================================================================
   27. SEARCH INPUT
   ============================================================================= */

.search-form { margin-bottom: var(--space-xl); }

.search-input {
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition:
    border-color     var(--t-fast) var(--ease),
    background-color var(--t-fast) var(--ease);
}

.search-input::placeholder { color: var(--text-faint); }
.search-input:focus        { border-color: var(--accent-dim); }


/* =============================================================================
   28. UTILITY CLASSES
   ============================================================================= */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-0        { margin-top: 0; }
.mb-0        { margin-bottom: 0; }


/* =============================================================================
   30. STICKY FLOATING TABLE OF CONTENTS
   Generated by main.js on post pages. Hidden entirely below 1300px viewport
   width so it never overlaps the content column on narrower screens.
   ============================================================================= */

#toc-float {
  /* Hidden at all times on narrower viewports. */
  display: none;
}

@media (min-width: 1300px) {
  #toc-float {
    display: block;
    position: fixed;
    top: 5rem;
    right: 2rem;
    width: 200px;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: var(--space-md);
    font-size: 0.78rem;
    z-index: 100;

    /* Hidden until the inline TOC scrolls off screen. */
    opacity: 0;
    transform: translateX(8px);
    pointer-events: none;
    transition:
      opacity   var(--t-med) var(--ease),
      transform var(--t-med) var(--ease),
      background-color var(--t-med) var(--ease),
      border-color     var(--t-med) var(--ease);
  }

  #toc-float.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
  }

  /* Section label */
  #toc-float .toc-title {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: var(--space-sm);
  }

  #toc-float ol {
    padding-left: 1em;
    margin-bottom: 0;
  }

  #toc-float li { margin-bottom: 0.25em; }

  #toc-float a {
    color: var(--text-faint);
    text-decoration: none;
    font-size: 0.76rem;
    line-height: 1.4;
    display: block;
    padding: 1px 0;
    transition: color var(--t-fast) var(--ease);
  }

  #toc-float a::after { content: none !important; }
  #toc-float a:hover  { color: var(--link); }

  /* Currently-visible section */
  #toc-float a.active {
    color: var(--accent);
    font-weight: 500;
  }
}


/* =============================================================================
   31. SCRIPTURE TRANSLATION TOGGLE
   The KJV ↔ BSB switch button shown at the bottom of Bible verse popups.
   ============================================================================= */

/*
 * Footer bar that holds the current translation label and the toggle button.
 * Sits below the verse excerpt inside the popup card.
 */
.preview-translation-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
  gap: var(--space-sm);
}

/* The "KJV" or "BSB" label on the left */
.preview-translation {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* "Switch to BSB" / "Switch to KJV" button on the right */
.preview-translation-toggle {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--link);
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 8px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    color        var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}

.preview-translation-toggle:hover {
  color: var(--link-hover);
  border-color: var(--link);
}


/* =============================================================================
   29. PRINT STYLES
   ============================================================================= */

@media print {
  .site-sidebar,
  #link-preview,
  #reading-progress,
  .post-nav {
    display: none;
  }

  .site-wrapper { display: block; }

  body {
    font-size: 12pt;
    background: white;
    color: black;
  }

  a { color: black; text-decoration: underline; }
  a::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}
