/* =============================================================================
   sanefaith.org — Hand-written utility CSS
   Single light theme. No framework, no preprocessor.
   ============================================================================= */

/* =============================================================================
   1. Custom Properties
   ============================================================================= */

:root {
  /* Colors */
  --color-bg:          #F5F0E8;
  --color-sidebar-bg:  #EDE8DC;
  --color-text:        #1A1A18;
  --color-text-sec:    #4A4A44;
  --color-text-muted:  #7A7A72;
  --color-rust:        #8B3A2A;
  --color-link:        #7A3020;
  --color-link-visited:#A0685A;
  --color-rule:        #C8C0B0;
  --color-focus:       #8B3A2A;

  /* Spacing (4px base unit) */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Fonts */
  --font-body: "Gentium Plus", "Gentium", Georgia, "Times New Roman", serif;
  --font-ui:   "Gentium Plus", "Gentium", Georgia, serif;
  --font-mono: "Courier Prime", "Courier New", Courier, monospace;
}


/* =============================================================================
   2. Reset / Base
   ============================================================================= */

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

html {
  font-size: 16px;
  background: var(--color-bg);
  color: var(--color-text);
}

body {
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.75;
}

a {
  color: var(--color-link);
}

a:visited {
  color: var(--color-link-visited);
}

/* Keyboard focus ring — never suppress without a visible replacement */
*:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

code,
pre {
  font-family: var(--font-mono);
}

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


/* =============================================================================
   3. Layout
   ============================================================================= */

.layout {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-rule);
  padding: var(--sp-4);
}

.content {
  flex: 1;
  min-width: 0;
  padding: var(--sp-16) var(--sp-8);
}


/* =============================================================================
   4. Article / Section / Home column centering
   ============================================================================= */

.article,
.section-index,
.home {
  max-width: 680px;
  margin-inline: auto;
}


/* =============================================================================
   5. Sidebar
   ============================================================================= */

/* Site name at top of sidebar */
.sidebar--header {
  margin-bottom: var(--sp-6);
}

.sidebar--header a {
  display: block;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}

.sidebar--header a:visited {
  color: var(--color-text);
}

/* "TABLE OF CONTENTS" label above the tree */
.sidebar--nav {
  font-variant: small-caps;
  font-size: 0.75rem;
  color: var(--color-text-sec);
  margin-bottom: var(--sp-4);
  letter-spacing: 0.05em;
}

/* Tree list */
.sidebar--tree {
  list-style: none;
}

/* Each item in the tree */
.sidebar--item {
  border-left: 3px solid transparent;
}

.sidebar--item.is-active {
  border-left-color: var(--color-rust);
}

/* Leaf node links */
.sidebar--link {
  display: block;
  padding: 6px 0;
  font-size: 0.9375rem;
  color: var(--color-text-sec);
  text-decoration: none;
}

.sidebar--link:visited {
  color: var(--color-text-sec);
}

.sidebar--item.is-active .sidebar--link {
  font-weight: 700;
  color: var(--color-text);
}

.sidebar--item.is-active .sidebar--link:visited {
  color: var(--color-text);
}

/* Section (folder) labels in the tree */
.sidebar--section-label {
  display: block;
  padding: 6px 0;
  font-size: 0.75rem;
  font-variant: small-caps;
  color: var(--color-text-sec);
  letter-spacing: 0.05em;
}

/* Nesting indent — applied per level via inline style or extra class */
.sidebar--indent {
  padding-left: var(--sp-5);
}

/* Mobile toggle trigger — hidden on desktop */
.mobile-trigger {
  display: none;
}


/* =============================================================================
   6. Breadcrumb
   ============================================================================= */

.breadcrumb {
  font-size: 0.8125rem;
  color: var(--color-text-sec);
  margin-bottom: var(--sp-6);
}

.breadcrumb--item {
  color: var(--color-text-sec);
}

.breadcrumb--item:visited {
  color: var(--color-text-sec);
}

.breadcrumb--sep {
  margin-inline: var(--sp-2);
  color: var(--color-text-muted);
}


/* =============================================================================
   7. Article header
   ============================================================================= */

.article--header {
  margin-bottom: var(--sp-8);
}

.article--title {
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.2;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-4);
}

.article--pdf {
  font-size: 0.875rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.article--meta {
  font-size: 0.8125rem;
  color: var(--color-text-sec);
  margin-top: var(--sp-2);
}


/* =============================================================================
   8. Article body
   ============================================================================= */

.article--body h2 {
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.3;
  margin-top: var(--sp-8);
  margin-bottom: var(--sp-4);
}

.article--body h3 {
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.35;
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-3);
}

.article--body p {
  margin-bottom: var(--sp-6);
}

.article--body ul,
.article--body ol {
  margin-bottom: var(--sp-6);
  padding-left: var(--sp-8);
}

.article--body li {
  margin-bottom: var(--sp-2);
}

.article--body blockquote {
  border-left: 3px solid var(--color-rule);
  padding-left: var(--sp-6);
  color: var(--color-text-sec);
  margin-bottom: var(--sp-6);
}

.article--body code {
  font-size: 0.9em;
}

.article--body pre {
  margin-bottom: var(--sp-6);
  overflow-x: auto;
}

/* Inline footnote references in body text */
.footnote-ref {
  color: var(--color-rust);
  text-decoration: none;
  font-size: 0.75em;
  vertical-align: super;
  line-height: 0;
}

.footnote-ref:visited {
  color: var(--color-rust);
}


/* =============================================================================
   9. Footnotes
   ============================================================================= */

.article--footnotes {
  margin-top: var(--sp-10);
}

/* Short horizontal rule separating footnotes from body */
.footnotes--rule {
  width: 40px;
  border: none;
  border-top: 1px solid var(--color-rule);
  margin-bottom: var(--sp-6);
}

.footnotes--list {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--color-text);
  padding-left: var(--sp-6);
}

.footnotes--list li {
  margin-bottom: var(--sp-4);
}

/* Back-link arrow inside each footnote */
.footnote-backref {
  color: var(--color-text-muted);
  text-decoration: none;
  margin-left: var(--sp-1);
}

.footnote-backref:visited {
  color: var(--color-text-muted);
}


/* =============================================================================
   10. Section index page
   ============================================================================= */

.section-index--intro {
  margin-bottom: var(--sp-6);
}

.section-index--rule,
.home--sections-rule {
  border: none;
  border-top: 1px solid var(--color-rule);
  margin: var(--sp-8) 0 var(--sp-6);
}

.section-index--label,
.home--sections-label {
  font-variant: small-caps;
  font-size: 0.75rem;
  color: var(--color-text-sec);
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-4);
}

.section-index--list {
  list-style: none;
}

.section-index--item {
  display: flex;
  justify-content: space-between;
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--color-rule);
  font-size: 1rem;
  line-height: 1.6;
}

.section-index--time {
  color: var(--color-text-sec);
  font-size: 0.8125rem;
  white-space: nowrap;
  margin-left: var(--sp-4);
}


/* =============================================================================
   11. Home page
   ============================================================================= */

.home--sections-list {
  list-style: none;
}

.home--sections-item {
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--color-rule);
  font-size: 1rem;
  line-height: 1.6;
}


/* =============================================================================
   12. Search
   ============================================================================= */

.search {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--color-rule);
  background: var(--color-bg);
}

.search--input {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--color-rule);
  background: var(--color-bg);
  color: var(--color-text);
  border-radius: 2px;
}

.search--input:focus {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.search--results {
  margin-top: var(--sp-3);
}

.search--results a {
  display: block;
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--color-rule);
  font-size: 0.9375rem;
}


/* =============================================================================
   13. Mobile (max-width: 640px)
   ============================================================================= */

@media (max-width: 640px) {
  .sidebar {
    display: none;
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--color-rule);
  }

  .sidebar.is-open {
    display: block;
  }

  .layout {
    flex-direction: column;
  }

  .content {
    padding: var(--sp-4);
  }

  .article,
  .section-index,
  .home {
    max-width: none;
  }

  .mobile-trigger {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--color-bg);
    border: none;
    border-bottom: 1px solid var(--color-rule);
    padding: var(--sp-3) var(--sp-4);
    font-family: var(--font-ui);
    font-size: 0.875rem;
    font-variant: small-caps;
    color: var(--color-text-sec);
    cursor: pointer;
    letter-spacing: 0.05em;
  }
}


/* =============================================================================
   14. Utilities
   ============================================================================= */

/* Screen-reader only — visually hidden but accessible */
.u-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.u-small-caps {
  font-variant: small-caps;
}
