﻿/* Color variables used throughout the site */
:root {
  --bg: #ffffff;           /* Background color (white) */
  --text: #111;            /* Main text color (dark gray) */
  --muted: #555;           /* Muted/secondary text (lighter gray) */
  --link: #0b57d0;         /* Link color (blue) */
  --border: #e5e5e5;       /* Border color (light gray) */
  --hl: #fff3b0;           /* Highlight color (light yellow) */
}

/* Main page styling */
html, body {
  background: var(--bg);   /* Set background color to white */
  color: var(--text);      /* Set default text color to dark gray */
  margin: 0;               /* Remove default spacing around the page */
  padding: 0;              /* Remove default padding around the page */
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; /* Use system fonts */
  line-height: 1.375;       /* Add space between lines for readability */
}

/* Link styling */
a {
  color: var(--link);      /* Make links blue */
  text-decoration: none;   /* Remove underline from links */
}

a:hover {
  text-decoration: underline; /* Show underline when hovering over links */
}

/* Header bar at top of page */
.site-header {
  position: sticky;        /* Header stays at top when scrolling */
  top: 0;                  /* Position at the very top */
  background: rgba(255, 255, 255, 0.95); /* White background with slight transparency */
  backdrop-filter: blur(6px); /* Add blur effect behind the header */
  border-bottom: 1px solid var(--border); /* Add light gray line below header */
  z-index: 10;             /* Keep header on top of other elements */
}

/* Navigation menu */
.nav {
  display: flex;           /* Arrange items in a row */
  gap: 1rem;               /* Add space between navigation items */
  padding: 0.75rem 1rem;   /* Add space inside the navigation container */
  max-width: 980px;        /* Limit width for better readability */
  margin: 0 auto;          /* Center the navigation */
}

.nav a {
  font-weight: 600;        /* Make navigation links bold */
}

.font-size-controls {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.font-size-label {
  font-size: 0.9rem;
  color: #444;
}

.font-size-btn {
  border: 1px solid #cfcfcf;
  background: #fff;
  color: #222;
  border-radius: 4px;
  width: 1.9rem;
  height: 1.9rem;
  line-height: 1;
  font-size: 1.05rem;
  cursor: pointer;
  padding: 0;
}

.font-size-btn:hover {
  background: #f3f3f3;
}

.font-size-btn:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 1px;
}

@media (max-width: 900px) {
  .font-size-label {
    display: none;
  }
}

/* Main content area */
.container {
  max-width: 980px;        /* Limit content width for readability */
  margin: 0 auto;          /* Center the content */
  padding: 1.25rem 1rem 4rem; /* Add space around content */
}

/* Heading styles */
h1 {
  font-size: 1.75rem;         /* Make largest headings large */
  line-height: 1.2;        /* Reduce space between heading lines */
  margin: 3.5rem 0 1rem;   /* Add space above and below heading */
}

.article-title-row {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.article-title-photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

h2 {
  font-size: 1.35rem;      /* Make section headings medium sized */
  margin-top: 2rem;        /* Add space above heading */
}

h3 {
  font-size: 1.15rem;      /* Make sub-headings slightly larger */
  margin-top: 1.5rem;      /* Add space above heading */
}

/* Paragraph styling */
p {
  margin: 0.75rem 0;       /* Add space between paragraphs */
}


/* Bullet list readability */
ul {
  margin: 0.95rem 0 1.55rem;  /* Clearer separation after list sections */
  padding-left: 1.35rem;      /* Slightly wider indent for scanability */
}

li {
  margin: 0.45rem 0;         /* Breathing room between bullet points */
}

/* Metadata text (like "Back to Summary") */
.chapter-meta {
  color: var(--muted);     /* Use muted gray color */
  font-size: 0.95rem;      /* Make text slightly smaller */
}

/* Table of contents list */
.toc ul {
  list-style: none;        /* Remove bullet points */
  padding-left: 0;         /* Remove default indentation */
}

.toc li {
  margin: 0.35rem 0;       /* Add small space between list items */
}

.toc a {
  font-weight: 600;        /* Make chapter links bold */
}

.article-list li.article-entry {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.author-photo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Small text styling */
.small {
  color: var(--muted);     /* Use muted gray color */
  font-size: 0.95rem;      /* Make text slightly smaller */
}

/* Summary statement containers */
.summary-stmt {
  position: relative;      /* Allow child elements to position themselves */
}

/* Citation link styling */
.cite-link {
  display: inline-block;   /* Allow padding and sizing */
  padding: 0 0.15rem;      /* Add small horizontal padding */
  border-radius: 0.25rem;  /* Slightly round the corners */
}

.cite-link sup {
  font-size: 0.75em;       /* Make reference numbers small */
}

.cite-link:focus {
  outline: 2px solid var(--link); /* Show blue outline when focused */
  outline-offset: 2px;     /* Space the outline away from element */
}

/* Citation preview on hover */
.cite-link[data-preview] {
  position: relative;      /* Allow positioning of preview popup */
}

.cite-link[data-preview]:hover::after,
.cite-link[data-preview]:focus::after {
  content: none;           /* Disabled: handled by JS body-level tooltip */
}

/* Triangle pointer above preview */
.cite-link[data-preview]:hover::before,
.cite-link[data-preview]:focus::before {
  content: none;           /* Disabled: handled by JS body-level tooltip */
}

/* Body-level tooltip for citation previews (not clipped by split panes) */
.cite-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  width: fit-content;
  max-width: min(980px, calc(100vw - 16px));
  min-width: min(320px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  overflow: auto;
  padding: 0.65rem 0.75rem;
  background: #111;
  color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: normal;
  pointer-events: auto;
  z-index: 2147483647;
  visibility: hidden;
}

/* Highlight citations when clicked */
.cite-target:target,
.cite-frag.is-linked {
  background: var(--hl);   /* Yellow highlight background */
  border-radius: 0.25rem;  /* Slightly round the corners */
  box-shadow: 0 0 0 3px rgba(255, 243, 176, 0.65); /* Yellow glow around highlighted text */
}

/* Animated highlight effect */
.cite-target.flash,
.cite-frag.flash {
  background: var(--hl);   /* Yellow highlight background */
  border-radius: 0.25rem;  /* Slightly round the corners */
  box-shadow: 0 0 0 3px rgba(255, 243, 176, 0.65); /* Yellow glow around highlighted text */
}

/* Backlink area styling */
.backlink-slot {
  margin: 0.4rem 0 1rem;   /* Add space around backlinks */
}

.backlink-slot a {
  display: inline-block;   /* Allow styling as a box */
  padding: 0.25rem 0.5rem; /* Add space inside the link box */
  border: 1px solid var(--border); /* Add light gray border */
  border-radius: 0.5rem;   /* Round the corners */
  color: var(--muted);     /* Use muted gray color */
  font-size: 0.9rem;       /* Make backlinks slightly smaller */
}

/* Missing citation indicator */
.cite-missing {
  color: #b00020;          /* Show missing citations in red */
}


