/*
==========================================================================
  Font Face Declarations
  - Self-hosted fonts for better performance and privacy
==========================================================================
*/

/* IBM Plex Sans */
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/ibm-plex-sans-v23-latin-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/ibm-plex-sans-v23-latin-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/ibm-plex-sans-v23-latin-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/ibm-plex-sans-v23-latin-700italic.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* IBM Plex Serif */
@font-face {
  font-family: 'IBM Plex Serif';
  src: url('../fonts/ibm-plex-serif-v20-latin-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Serif';
  src: url('../fonts/ibm-plex-serif-v20-latin-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Serif';
  src: url('../fonts/ibm-plex-serif-v20-latin-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Serif';
  src: url('../fonts/ibm-plex-serif-v20-latin-700italic.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* UnifrakturCook */
@font-face {
  font-family: 'UnifrakturCook';
  src: url('../fonts/unifrakturcook-v25-latin-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/*
==========================================================================
  Root Variables & Themes
  - Defines color, font, and layout variables for light and dark mode.
  - Changing these will update the look and feel site-wide.
==========================================================================
*/

:root {
  --bg-translucent-light: rgba(255, 255, 255, 0.65);
  --bg-translucent-dark: rgba(18, 18, 18, 0.65);  
  --font-heading: 'PT Serif', serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --bg: #ffffff;
  --text: #111111;
  --link: #cc0000;        /* Deep red */
  --link-hover: #990000;  /* Dimmer red */
  --border: #dddddd;
  --panel-bg: #fdfdfd;
  --overlay: rgba(0, 0, 0, 0.5);
  --submenu-text: #555555;
  --submenu-bg: #e8e8e8;  /* Light mode: slightly darker than current */
}

[data-theme="dark"] {
  --bg: #121212;
  --text: #eeeeee;
  --link: #cc0000;
  --link-hover: #990000;  /* Match light mode red */
  --border: #333333;
  --panel-bg: #2c2c2e;
  --overlay: rgba(255, 255, 255, 0.1);
  --submenu-text: #aaaaaa;
  --submenu-bg: #2d2d2d;  /* Dark mode: lighter than current for better contrast */
}

/*
==========================================================================
  Base Styles
  - Sets up default body, html, link, and image styles.
  - Controls overall typography, background, and link appearance.
==========================================================================
*/

body, html {
  min-height: 0;
  display: block;
  flex-direction: unset;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
}

body.no-scroll {
  overflow: hidden;
}

/* Typography */
body, main#mainContent, main#mainContent p {
  font-family: 'IBM Plex Serif', serif;
}

.site-name, h1, h2, h3, h4, h5, h6, nav, .footer-bar {
  font-family: 'IBM Plex Sans', sans-serif;
}

/* Links */
a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

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

/* Search highlighting */
mark {
  background-color: transparent;
  color: var(--link);
  font-weight: 600;
}

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

/* Figures and captions */
figure {
  margin: 2rem auto;
  text-align: center;
}

figcaption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--text);
  opacity: 0.7;
  text-align: center;
  font-style: italic;
}

/* Homepage site header type */
@font-face {
  font-family: 'ATKyriosDisplay';
  src: url('../fonts/ATKyriosDisplay-Ultra.woff2') format('woff2'),
       url('../fonts/ATKyriosDisplay-Ultra.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

.siteheader {
  font-family: 'ATKyriosDisplay', 'AT Kyrios Display', serif;
  text-align: center;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0.25rem 0 0.5rem;
  font-size: clamp(2.5rem, 8vw, 6rem);
}

/*
==========================================================================
  Header Styles
  - Styles the sticky site header, navigation, logo, and progress bar.
  - Includes dark mode and responsive navigation.
==========================================================================
*/

/* Main Header */
header.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  flex-shrink: 0;
}

/* Translucent header variant - softer at very top of page */
header.site-header.header-translucent {
  background: var(--bg-translucent-light);
  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.06);
  backdrop-filter: blur(8px);
  transition: background 0.3s, box-shadow 0.3s, backdrop-filter 0.3s;
}

/* Stronger glass effect when scrolled past 60px */
header.site-header.header-translucent.header-scrolled {
  box-shadow: 0 4px 24px 0 rgba(0,0,0,0.12);
  backdrop-filter: blur(16px);
}

[data-theme="dark"] header.site-header.header-translucent {
  background: var(--bg-translucent-dark);
  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.18);
  backdrop-filter: blur(8px);
  transition: background 0.3s, box-shadow 0.3s, backdrop-filter 0.3s;
}

[data-theme="dark"] header.site-header.header-translucent.header-scrolled {
  box-shadow: 0 4px 24px 0 rgba(0,0,0,0.38);
  backdrop-filter: blur(16px);
}

/* Header Bar */
.header-bar {
  max-width: 1200px; /* Increased for wider screens */
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem 0.25rem;
  gap: 1.5rem; /* More breathing room */
  /* Safe area insets for notch devices */
  padding-top: max(0.5rem, env(safe-area-inset-top));
  transition: max-width 0.3s ease; /* Smooth max-width transitions */
}

/* Increased vertical padding on larger screens for better breathing room */
@media (min-width: 901px) {
  .header-bar {
    padding-top: max(0.5rem, env(safe-area-inset-top));
    padding-bottom: 0.35rem;
  }
}

/* Always hide desktop subnav by default (prevents showing on mobile) */
.desktop-subnav { display: none; }

.header-bar img {
  height: 4.2rem;
  margin-right: 1.5rem;
  transition: height 0.2s, transform 0.2s;
}

/* Logo optical alignment on larger sizes */
@media (min-width: 1024px) {
  .header-bar img {
    transform: translateY(-1px);
  }
}

@media (min-width: 1280px) {
  .header-bar img {
    transform: translateY(-2px);
  }
}

/* Logo Container */
.logo-container {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
  flex: 1 1 auto; /* let this area flex but not overlap toggles */
  padding-right: 0.25rem;
}

/* Site Name */
.site-name, a.site-name {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: clamp(1rem, 5vw, 2.5rem);
  font-weight: bold !important;
  letter-spacing: -0.01em;
  color: inherit !important;
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 1;
}

a.site-name:hover {
  color: var(--link-hover) !important;
  text-decoration: none;
}

[data-theme="dark"] .site-name {
  color: #fff;
}

/* Header Links */
header.site-header a {
  color: black;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

header.site-header a:hover {
  color: #cc0000;
}

/* Focus-visible outlines for keyboard navigation */
header.site-header a:focus-visible,
header.site-header button:focus-visible {
  outline: 2px solid var(--link-hover);
  outline-offset: 3px;
  border-radius: 2px;
}

[data-theme="dark"] header.site-header a {
  color: #fff;
}

[data-theme="dark"] header.site-header a:hover {
  color: var(--link-hover);
}

/* Header Toggles */
.header-toggles {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Dark Mode Toggle */
.dark-toggle {
  background: none;
  border: none;
  color: var(--text);
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  box-sizing: border-box;
  transition: color 0.2s ease;
  /* Ensure at least 44px for touch targets */
  min-width: 44px;
  min-height: 44px;
}

.dark-toggle:hover {
  color: var(--link-hover);
}

.dark-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
  /* Smooth icon transition with subtle rotation */
  transition: transform 0.12s ease-out, opacity 0.12s ease-out;
}

/* Micro-interaction: slight rotation on icon change */
.dark-toggle:active svg {
  transform: rotate(15deg);
}

/* Dark toggle icons with crossfade effect */
.dark-toggle .icon-moon {
  display: inline-block;
  opacity: 1;
}

.dark-toggle .icon-sun {
  display: none;
  opacity: 0;
}

[data-theme="dark"] .dark-toggle .icon-moon {
  display: none;
  opacity: 0;
}

[data-theme="dark"] .dark-toggle .icon-sun {
  display: inline-block;
  opacity: 1;
}

/* Search Toggle */
.search-toggle {
  background: none;
  border: none;
  color: var(--text);
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  box-sizing: border-box;
  transition: color 0.2s ease;
  text-decoration: none;
  opacity: 1;
  visibility: visible;
  /* Ensure at least 44px for touch targets */
  min-width: 44px;
  min-height: 44px;
}

.search-toggle:hover {
  color: var(--link-hover);
}

.search-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Menu Toggle */
.menu-toggle {
  display: none;
  background: none;
  color: var(--text);
  padding: 0.5rem;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  transition: color 0.12s ease;
  z-index: 1100;
  border: none;
  /* Ensure at least 44px for touch targets */
  min-width: 44px;
  min-height: 44px;
}

/* Micro-interaction: quick color lift on hover/focus */
.menu-toggle:hover,
.menu-toggle:focus-visible {
  color: var(--link-hover);
}

/* Site Navigation */
.site-nav {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  gap: 1rem;
  padding: 0 1rem 0.25rem;
}

.site-nav a {
  color: var(--text);
  transition: color 0.3s;
}

.site-nav a:hover {
  color: var(--link-hover);
}

/* Inline desktop navigation (replaces site name) */
.site-nav-inline {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;     /* keep on one line until hamburger */
  max-width: 100%;
  overflow: hidden;      /* prevent long labels from nudging toggles */
  padding-right: 1rem; /* More buffer before toggles */
  justify-content: flex-start; /* Left-aligned by default to prevent shifting */
  transition: gap 0.3s ease, padding-right 0.3s ease; /* Smooth transitions for responsive changes */
}

/* Keep nowrap until mobile breakpoint */
@media (max-width: 900px) {
  .site-nav-inline {
    flex-wrap: nowrap;
  }
}

.site-nav-inline a {
  color: var(--text);
  transition: color 0.3s, font-size 0.3s ease; /* Smooth font-size transitions */
  white-space: nowrap;
  font-size: clamp(1rem, 1.2vw, 1.2rem); /* Minimum 1rem to match body text */
  font-weight: 600;
  padding: 0.25rem 0.5rem; /* Add padding for better touch targets */
  position: relative;
}

.site-nav-inline a:hover {
  color: var(--link-hover);
}

/* Current page indication - add .current-page class from templates */
.site-nav-inline a.current-page {
  color: var(--link-hover);
}

/* Moderate sizing for inline nav (desktop) */
.site-nav-inline {
  gap: clamp(0.75rem, 1.5vw, 2rem);
}

@media (min-width: 1024px) {
  .header-bar img {
    height: 6.5rem !important; /* Reverted crest size */
  }
  .header-bar {
    padding-top: max(0.45rem, env(safe-area-inset-top));
    padding-bottom: 0.3rem;
  }
}

@media (min-width: 1280px) {
  .header-bar img {
    height: 8rem !important; /* Reverted crest size */
  }
  .header-bar {
    max-width: 1400px;
    padding-top: max(0.5rem, env(safe-area-inset-top));
    padding-bottom: 0.35rem;
  }
  .site-nav-inline {
    gap: 2.5rem;
    padding-right: 2rem; /* Extra buffer on very wide screens */
    justify-content: center; /* Center on very wide screens only */
  }
  .site-nav-inline a {
    font-size: 1.2rem; /* Larger font on wide screens */
  }
  .desktop-subnav-inner a {
    font-size: 1.2rem; /* Match main navigation on wide screens */
  }
}

/* Scale header elements down as width gets tight (before hamburger) */
@media (max-width: 1200px) {
  .header-bar { max-width: 1000px; }
  .site-nav-inline { gap: 1.2rem; }
  .header-bar img { height: 5.8rem !important; }
}
@media (max-width: 1000px) {
  .header-bar { max-width: 900px; }
  .site-nav-inline { gap: 1rem; }
  .header-bar img { height: 5.2rem !important; }
}
@media (max-width: 920px) {
  .header-bar { max-width: 800px; }
  .site-nav-inline { gap: 0.8rem; }
  .header-bar img { height: 4.8rem !important; }
}
@media (max-width: 900px) {
  .site-nav-inline { gap: 0.7rem; }
  .site-nav-inline a { font-size: 1rem; }
  .desktop-subnav-inner a { font-size: 1rem; }
  .header-bar img { height: 4.2rem !important; }
}

/* Dropdown Navigation */
.dropdown {
  position: relative;
}

.submenu {
  opacity: 0;
  visibility: hidden;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--submenu-bg);
  border-radius: 0;
  min-width: 200px;
  z-index: 1000;
  padding: 0.5rem 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.dropdown:hover .submenu {
  opacity: 1;
  visibility: visible;
}

.submenu li {
  list-style: none;
}

.submenu a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.submenu a:hover {
  color: var(--link-hover);
}

/* Desktop dropdown: keep header, drop a full-width subnav below it */
@media (min-width: 901px) {
  /* Hide inline dropdown list in desktop inline nav */
  .site-nav-inline .dropdown .submenu { display: none !important; }

  /* Dedicated full-width subnav under the header-bar, shown when open */
  .desktop-subnav {
    display: block;            /* allow height animation */
    width: 100%;
    background: var(--submenu-bg);  /* darker grey to offset header */
    border-top: 1px solid var(--border);
    /* Hairline border at bottom with soft inner shadow to "seat" the bar */
    border-bottom: 1px solid var(--border);
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.03);
    padding: 0.75rem 0;        /* increased vertical padding for breathing room */
    box-sizing: border-box;
    max-height: 0;             /* collapsed */
    opacity: 0;
    transform: translateY(-6px);
    overflow: hidden;
    transition: max-height 0.35s ease-in, opacity 0.25s ease-in, transform 0.35s ease-in;
  }
  header.site-header.subnav-open .desktop-subnav {
    max-height: 420px;         /* expanded */
    opacity: 1;
    transform: translateY(0);
  }
  /* Longer, softer open; quicker close */
  header.site-header.subnav-opening .desktop-subnav {
    transition: max-height 0.5s ease-out, opacity 0.35s ease-out, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  }
  header.site-header.subnav-closing .desktop-subnav {
    transition: max-height 0.3s ease-in, opacity 0.25s ease-in, transform 0.3s ease-in;
  }

  /* Inner container aligned with header content width */
  .desktop-subnav-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;        /* one item per line */
    gap: 0.25rem;                  /* vertical spacing between items */
    align-items: flex-start;
    justify-content: flex-start;   /* align with primary nav */
  }
  .desktop-subnav-inner a {
    color: var(--text);
    text-decoration: none;
    display: block;                /* occupy its own line */
    width: 100%;                   /* span inner container width */
    padding: 0.5rem 0.75rem;
    transition: color 0.2s ease;
    white-space: nowrap;
    font-size: clamp(1rem, 1.2vw, 1.2rem); /* Match main navigation font size */
    font-weight: 600;              /* Match main navigation font weight */
    line-height: 1.3;              /* Increased for readability */
  }
  .desktop-subnav-inner a:hover {
    color: var(--link-hover);
  }

  /* Desktop + icon animation on submenu toggle (mirrors mobile) */
  .site-nav-inline .submenu-toggle {
    position: relative;
    padding-right: 1.5rem;
    display: flex;
    align-items: center;
  }
  .site-nav-inline .submenu-toggle {
    position: relative;
  }
  .site-nav-inline .toggle-icon {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
    width: 0.8rem;
    height: 0.8rem;
    opacity: 0.8;
    margin-left: 0.25rem;
  }
  .site-nav-inline .submenu-toggle.active .toggle-icon {
    transform: translateY(-50%) rotate(405deg); /* 360deg + 45deg = full spin + X */
  }
  }

  /* Keep subnav solid and offset, even when header is translucent */
  header.site-header.header-translucent .desktop-subnav {
    background: var(--submenu-bg);
    box-shadow: none;
    backdrop-filter: none;
  }
  [data-theme="dark"] header.site-header.header-translucent .desktop-subnav {
    background: var(--submenu-bg);
    box-shadow: none;
    backdrop-filter: none;
  }
}
/* Secondary Header */
.secondary-header {
  width: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  margin-bottom: 0;
}

.secondary-header-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.15) brightness(0.92);
  opacity: 0.9;
  box-shadow: 0 4px 24px 0 rgba(0,0,0,0.18), 0 0 0 4px rgba(255,255,255,0.12);
}

/* Article inline images with hover effect */
main#mainContent img {
  filter: grayscale(100%) contrast(1.15) brightness(0.92);
  transition: filter 0.3s ease;
  max-width: min(600px, 80%);
  margin: 2rem auto;
  display: block;
  height: auto;
}

main#mainContent img:hover {
  filter: grayscale(0%);
}

/* Progress Bar */
.progress-container {
  position: relative;
  height: 3px;
  width: 100%;
  background: transparent;
  z-index: 1001;
}

.progress-bar {
  height: 3px;
  /* Faint gradient for premium feel */
  background: linear-gradient(to right, var(--link), #ff0000);
  width: 0%;
  transition: width 0.2s ease, height 0.15s ease;
}

/* Bump size slightly when active (width > 0) */
.progress-bar[style*="width"][style*="%"]:not([style*="width: 0%"]) {
  height: 4px;
}

/*
==========================================================================
  Main Content Styles
  - Styles the main content area, paragraphs, drop caps, TOC, tags, and footnotes.
  - Controls layout and appearance of the main reading area.
==========================================================================
*/

/* Main Content Wrapper */
.main-centered {
  display: flex;
  justify-content: center;
  flex: unset;
}

main#mainContent {
  background: none;
  margin: 0;
  padding: 0;
  max-width: 800px;
  width: 100%;
  box-sizing: border-box;
  line-height: 1.6;
}

main#mainContent > * {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Article titles - tighten multi-line spacing */
main#mainContent h1 {
  line-height: 1.15;
  margin-top: 0.6rem;
  margin-bottom: 0.6rem;
}

/* H4 for image captions - small, centered, italic */
main#mainContent h4 {
  font-size: 0.75rem;
  line-height: 1.4;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  font-weight: 400;
  font-style: italic;
  text-align: center;
  color: var(--text);
  opacity: 0.8;
}

/* Image Gallery: Auto-masonry for consecutive images */
main#mainContent p:has(img:only-child) {
  display: inline-block;
  width: calc(50% - 0.5rem);
  margin: 0.5rem 0.25rem;
  vertical-align: top;
  text-align: center;
  text-indent: 0;
}

/* Images in gallery paragraphs - grayscale with color on hover */
main#mainContent p:has(img:only-child) img {
  width: 100%;
  height: auto;
  display: block;
  filter: grayscale(100%) contrast(1.15) brightness(0.92);
  transition: filter 0.3s ease;
}

main#mainContent p:has(img:only-child) img:hover {
  filter: none;
}

/* Single image (not part of consecutive group) - reset to normal display */
main#mainContent p:has(img:only-child):not(:has(+ p img)):not(p:has(img) + p) {
  display: block !important;
  width: auto !important;
  margin: 1rem 0 !important;
  text-align: center !important;
  /* Keep the paragraph padding inherited from main#mainContent > * */
}

/* Ensure single images are centered - more specific rule */
main#mainContent p:has(img:only-child):not(:has(+ p img)):not(p:has(img) + p) img {
  display: block;
  margin: 2rem auto;
  max-width: min(600px, 80%);
  height: auto;
  filter: none; /* Remove grayscale from single images */
}

/* Mobile: stack gallery images vertically */
@media (max-width: 600px) {
  main#mainContent p:has(img:only-child) {
    display: block;
    width: 100%;
    margin: 0.5rem 0;
  }
}

main#mainContent p {
  margin-top: 0;
  margin-bottom: 0;
  text-indent: 2em;
  line-height: 1.6;
}

main#mainContent h1 + p,
main#mainContent h2 + p,
main#mainContent h3 + p,
main#mainContent > p:first-child {
  text-indent: 0;
}

/* Remove indent on first paragraph */
main p:first-of-type {
  text-indent: 0;
  margin-top: 0;
}

/* Lists: align markers with the text column and prevent paragraph indents inside list items */
main#mainContent ul,
main#mainContent ol {
  /* Keep marker in its own gutter and align wrapped lines with text */
  list-style-position: outside;
  margin: 0 0 1rem; /* 1rem bottom margin creates space after the list */
  padding-left: 2rem; /* gutter for marker + spacing */
}

/* Add breathing room when a list follows a paragraph 
   Combined with the bottom margin above, this gives consistent 1rem spacing before and after lists */
main#mainContent p + ul,
main#mainContent p + ol {
  margin-top: 1rem; /* 1rem top margin creates space before the list */
}

/* Ensure list item content doesn't inherit paragraph indent */
main#mainContent li,
main#mainContent li p {
  text-indent: 0;
}

/* Link lists like the homepage "Recent" sections should not show bullets */
main#mainContent ul.recent-list {
  list-style: none;
}

/* Drop Cap */
.drop-cap:first-letter {
  float: left;
  font-size: 6em;
  line-height: 0.7;
  font-family: 'ATKyriosDisplay', 'UnifrakturCook', cursive;
  margin-right: 0.15em;
  font-weight: 700;
  color: #222;
  text-shadow: 1px 1px 0 #fff, 2px 2px 4px #bbb;
}

@media (max-width: 768px) {
  .drop-cap:first-letter {
    font-size: 3.5em;
  }
}

/* Table of Contents */
.toc-container {
  float: left;
  width: 260px;
  max-width: 45%;
  max-height: none;
  margin: 1.5rem 2rem 1rem 0;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  padding: 1rem;
  font-size: 0.98rem;
  line-height: 1.4;
  z-index: 1;
  transition: background-color 0.3s, border-color 0.3s;
  position: relative;
}

/* Mobile Article Date Display */
.article-date-mobile {
  display: none; /* Hidden by default, shown on mobile */
  font-size: 0.9rem;
  color: var(--text);
  opacity: 0.7;
  margin: 0.5rem 0 1.5rem 0;
  font-style: italic;
  text-align: left;
}

.toc-header {
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.toc-container ul {
  list-style: none;
  padding-left: 1rem;
  margin: 0;
}

.toc-container li {
  margin: 0.25em 0;
}

.toc-container a {
  text-decoration: none;
  color: var(--text);
  transition: color 0.2s ease;
}

.toc-container a:hover {
  color: var(--link-hover);
}

/* Post Tags */
.post-tags {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.post-tags .tag {
  display: inline-block;
  margin: 0.2rem 0.5rem 0.2rem 0;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  text-decoration: none !important;
  font-size: 0.85rem;
  color: var(--text);
  transition: background 0.2s, color 0.2s;
}

.post-tags a.tag {
  text-decoration: none !important;
}

.post-tags .tag:hover {
  background: var(--text);
  color: var(--bg);
}

[data-theme="dark"] .post-tags .tag {
  color: #fff;
}

[data-theme="dark"] .post-tags .tag:hover {
  background: #fff;
  color: var(--bg);
}

/* Footnotes & Overlay */
.footnote-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100%;
  background-color: var(--panel-bg);
  border-left: 1px solid var(--border);
  padding: 1rem;
  overflow-y: auto;
  z-index: 1001;
  box-shadow: -3px 0 5px rgba(0,0,0,0.1);
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
  box-sizing: border-box;
}

/* Dark mode: make footnote panel match true dark reading background */
[data-theme="dark"] .footnote-panel {
  background-color: var(--bg);
  border-left-color: var(--border);
  box-shadow: -3px 0 8px rgba(0,0,0,0.4);
  color: var(--text);
}

.footnote-panel.visible {
  transform: translateX(0);
}

.footnote-panel.hidden {
  display: none;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.footnote-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1em;
}

#closeBtn {
  cursor: pointer;
  font-size: 24px;
}

.back-to-ref {
  margin-top: 1em;
  display: block;
  font-size: 0.9em;
}

.footnote-label {
  font-size: 0.75em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.5em;
  padding-bottom: 0.5em;
  border-bottom: 1px solid var(--border);
}

/* Mobile-specific footnote panel adjustments */
@media (max-width: 600px) {
  .footnote-panel {
    width: 100vw;
    border-left: none;
    padding: 1.5rem; /* Increased padding to prevent text cutoff on edges */
    box-sizing: border-box; /* Ensure padding is included in width calculation */
  }
  
  .footnote-label {
    font-size: 0.85em; /* Slightly larger on mobile for better readability */
  }
  
  #closeBtn {
    font-size: 28px; /* Larger touch target for mobile */
    padding: 0.25rem;
  }
}

/* Superscript/Footnote Styling */
sup {
  font-size: 0.8em;
  line-height: 1;
  vertical-align: super;
  margin-left: 0.1em;
  display: inline-block;
}

/* Footnote markers: bind to previous word to avoid dangling superscripts */
a.footnote-ref { white-space: nowrap; }
a.footnote-ref::before { content: "\00a0"; }
a.footnote-ref sup { display: inline; margin-left: 0; }

sup[id^="fnref"] {
  color: var(--link-hover);
}

/*
==========================================================================
  Section Headers (Full-Width Bars)
  - Use .section-header for full-width, centered section bars (e.g., "Books").
  - Example: <div class="section-header">Books</div>
==========================================================================
*/

/*
==========================================================================
  Hero Banner Styles
  - Styles for hero banners with background images and titles
  - Used on pages like About, Focus, etc.
==========================================================================
*/

.hero-banner {
  filter: grayscale(100%) contrast(1.15) brightness(0.92) !important;
  opacity: 0.9 !important;
  background-size: cover;
  background-position: center;
  height: auto;
  width: 100%;
  min-height: unset;
  max-height: unset;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0;
}

.hero-title {
  color: rgba(255,255,255,0.6); /* Translucent white text */
  padding: 0.5em 1.5em;
  border-radius: 0.5em;
  font-family: 'ATKyriosDisplay', 'AT Kyrios Display', serif;
  font-size: clamp(2.5rem, 8vw, 6em);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 16px rgba(0,0,0,0.4);
  display: inline-block;
}

/*
==========================================================================
  Footer Styles
  - Styles the site footer and social icons.
  - Handles layout, color, and dark mode for the footer area.
==========================================================================
*/

.footer-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.footer-bar span,
.footer-bar a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

/* Add pipe separators via CSS */
.footer-text::after,
.footer-link::after {
  content: " |";
  margin-left: 0.3rem;
  opacity: 0.7;
}

.footer-bar a:hover {
  color: var(--link-hover);
}

[data-theme="dark"] .footer-bar span,
[data-theme="dark"] .footer-bar a {
  color: #fff;
}

[data-theme="dark"] .footer-bar a:hover {
  color: red;
}

/* Social Icons */
.social-icons {
  display: flex;
  gap: 1rem;
  margin-left: 0;
}

.social-icons a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.3s ease;
}

.social-icons a:hover {
  color: red;
}

[data-theme="dark"] .social-icons a {
  color: #fff;
}

[data-theme="dark"] .social-icons a:hover {
  color: red;
}

.footer-socials {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/*
==========================================================================
  Responsive Design
  - Media queries for tablets and phones.
  - Adjusts font sizes, layout, and navigation for smaller screens.
  - The following rules specifically address the mobile navigation menu:
    * .site-nav: Hides the desktop nav and enables mobile nav layout.
    * .menu-toggle: Shows the hamburger menu button on mobile.
    * .site-nav.active: Displays the mobile nav when toggled.
    * .dropdown > a, .submenu, .submenu-toggle: Adjusts dropdown and submenu for mobile usability.
    * .submenu.active: Shows submenus when toggled on mobile.
    * .submenu li a: Styles submenu links for mobile.
==========================================================================
*/

@media (max-width: 900px) {
  .site-name, a.site-name {
    font-size: 2.2rem;
  }
}

@media (max-width: 900px) {
  /* Ensure the desktop subnav is never visible on mobile */
  .desktop-subnav { display: none !important; }

  /* Hide inline desktop nav on mobile; keep hamburger + mobile .site-nav */
  .site-nav-inline {
    display: none !important;
  }

  /* Hide desktop navigation, show hamburger menu */
  .site-nav {
    display: flex;                 /* keep in flow to animate */
    flex-direction: column;
    padding: 0;
    margin: 0;
    border-top: 1px solid var(--border);
    transition: max-height 0.35s ease-in, opacity 0.25s ease-in;
    max-height: 0;                 /* collapsed */
    opacity: 0;
    overflow: hidden;
    gap: 0;
  }
  .menu-toggle {
    display: block; /* Hamburger menu appears */
  }
  .header-bar {
    padding: 0.5rem 1rem;
  }
  .header-bar img {
    height: 2.5rem;
    margin-right: 0.7rem;
  }
  .toc-container {
    display: none;
  }
  .article-date-mobile {
    display: block; /* Show date on mobile when TOC is hidden */
  }
  .main-centered {
    display: block;
  }
  .site-name, a.site-name {
    font-size: 2.0rem;
  }

  /* Mobile navigation menu: shown when .active is added */
  .site-nav.active {
    max-height: 70vh;              /* expanded */
    opacity: 1;
  }
  header.site-header.mobile-nav-opening .site-nav {
    transition: max-height 0.5s ease-out, opacity 0.35s ease-out;
  }
  header.site-header.mobile-nav-closing .site-nav {
    transition: max-height 0.3s ease-in, opacity 0.25s ease-in;
  }
  .site-nav.active.header-translucent {
    background: var(--bg-translucent-light);
    backdrop-filter: blur(16px);
    box-shadow: 0 4px 24px 0 rgba(0,0,0,0.12);
  }
  [data-theme="dark"] .site-nav.active.header-translucent {
    background: var(--bg-translucent-dark);
    box-shadow: 0 4px 24px 0 rgba(0,0,0,0.38);
  }
  .site-nav a {
    padding: 0 !important;
    margin: 0 !important;
    text-align: center;
    width: 100%;
    display: block;
    line-height: 2.5rem;
    min-height: 44px; /* Ensure 44px tap target for touch */
    border: none;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .dropdown {
    margin: 0 !important;
    padding: 0 !important;
    border: none;
    outline: none;
  }
  .dropdown > a {
    text-align: center;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
  }
  .site-nav a:hover,
  .dropdown > a:hover,
  .submenu-toggle:hover {
    background: var(--text);
    color: var(--bg);
    width: 100%; /* Remove 100vw hack for clean alignment */
    margin-left: 0; /* Remove calc hack */
    border: none;
    outline: none;
  }

  /* Submenu toggle button for mobile */
  .submenu-toggle {
    display: block;
    width: 100%; /* Remove 100vw hack for clean alignment */
    padding: 0 !important;
    margin: 0 !important;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    position: relative;
    line-height: 2.5rem;
    outline: none;
  }
  
  /* Plus icon for submenu toggle */
  .submenu-toggle {
    position: relative;
  }
  .submenu-toggle .toggle-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.6s ease;
    width: 0.9rem;
    height: 0.9rem;
    opacity: 0.7;
  }
  
  /* Full spin and rotate plus to X when active */
  .submenu-toggle.active .toggle-icon {
    transform: translateY(-50%) rotate(405deg); /* 360deg + 45deg = full spin + X */
  }
  /* Submenu container for mobile (animate open/close) */
  .submenu {
    position: static;
    opacity: 0;
    visibility: visible;
    display: block;                /* allow height animation */
    flex-direction: column;
    padding: 0;
    margin: 0;
    width: 100%; /* Changed from 100vw - remove hack for clean alignment */
    margin-left: 0; /* Changed from calc(-50vw + 50%) - remove hack */
    box-shadow: none;
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-in, opacity 0.25s ease-in;
  }
  .submenu.active {
    max-height: 1000px;
    opacity: 1;
  }
  .submenu.opening { transition: max-height 0.5s ease-out, opacity 0.35s ease-out; }
  .submenu.closing { transition: max-height 0.3s ease-in, opacity 0.25s ease-in; }
  /* Submenu links for mobile */
  .submenu li {
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .submenu li a {
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    word-wrap: break-word;
    white-space: normal;
    line-height: 2.5rem;
    min-height: 44px; /* Ensure 44px tap target for touch */
    text-align: center;
    width: 100%; /* Changed from 100vw - remove hack for clean alignment */
    margin-left: 0; /* Changed from calc(-50vw + 50%) - remove hack */
  }
  .submenu li a:hover {
    background: var(--text);
    color: var(--bg);
    border: none;
    outline: none;
  }
}

/* On wider screens, hide the mobile nav bar beneath the header bar */
@media (min-width: 901px) {
  .site-nav {
    display: none !important;
  }
}

@media (max-width: 700px) {
  .site-name, a.site-name {
    font-size: 1.8rem;
  }
}

@media (max-width: 600px) {
  .main-centered {
    display: block;
    padding: 0;
  }
  
  main#mainContent {
    max-width: 100vw;
    width: 100vw;
  }
  
  main#mainContent > * {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  .site-name, a.site-name {
    font-size: 1.6rem;
  }
  
  .header-bar img {
    height: 2rem;
    margin-right: 0.5rem;
  }
  
  .header-bar {
    padding: 0.5rem 0.75rem;
  }
  
  .header-toggles {
    gap: 0.25rem;
  }
  
  .dark-toggle {
    width: 2rem;
    height: 2rem;
    padding: 0.25rem;
  }
  
  .dark-toggle svg {
    width: 1rem;
    height: 1rem;
  }
  
  .search-toggle {
    width: 2rem;
    height: 2rem;
    padding: 0.25rem;
  }
  
  .search-toggle svg {
    width: 1rem;
    height: 1rem;
  }
  
  .menu-toggle {
    padding: 0.25rem;
    font-size: 1rem;
  }
  
  .menu-toggle svg {
    width: 1rem;
    height: 1rem;
  }
  
  .search-link {
    display: none; /* Hide mobile search link since we have the icon */
  }
  
  .secondary-header {
    padding: 0rem 0;
  }
  
  .footer-bar {
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
    padding: 0.75rem 0.5rem;
    justify-content: center;
    align-items: center;
    text-align: center;
  }
  
  /* Hide pipe separators on mobile */
  .footer-text::after,
  .footer-link::after {
    display: none;
  }
  
  .section-header {
    font-size: 1.2rem;
    padding: 0.7rem 0;
  }
}

@media (max-width: 500px) {
  .site-name, a.site-name {
    font-size: 1.4rem;
  }
}

@media (max-width: 400px) {
  .site-name, a.site-name {
    font-size: 1.2rem;
  }
} 

/* Related content block - matches footnotes styling */
.related-section {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.related-block { 
  margin-bottom: 2rem;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 1.5rem;
}

/* Collection image styling for homepage cards */
.collection-image {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 1rem;
  border-radius: 0;
}

/* Match footnotes heading style */
.related-heading, .related-subheading {
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

/* Match footnotes list styling */
.recent-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recent-list li {
  margin: 0.75rem 0;
  line-height: 1.6;
}

.recent-list a {
  text-decoration: none;
  font-weight: 600;
  color: var(--link);
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.recent-list a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.recent-date {
  color: var(--submenu-text);
  font-weight: 400;
  font-size: 0.95rem;
  font-style: italic;
}

/* Last Nine list - with white bullets and italic dates (like Chronicon) */
.last-nine-list {
  list-style: disc;
  padding-left: 1.5rem;
  margin: 0;
}

.last-nine-list li {
  margin: 0.75rem 0;
  line-height: 1.6;
  color: var(--text);
}

.last-nine-list a {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.last-nine-list a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.last-nine-list em {
  color: var(--text);
  font-style: italic;
  font-weight: 400;
}

.reading-time {
  color: var(--submenu-text);
  font-weight: 400;
  font-size: 0.95rem;
}

.reading-time-separator {
  color: var(--submenu-text);
  font-weight: 400;
  font-size: 0.95rem;
  padding: 0 0.3rem;
}

/* Homepage sections grid - displays section pairs in two columns */
.sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-bottom: 2rem;
}

@media (max-width: 700px) {
  .sections-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

.section-column {
  display: flex;
  flex-direction: column;
}



/* Book Layout Styles */
.book-title-centered {
  text-align: center;
  margin: 3rem 0 2rem 0;
}

.book-title {
  font-family: 'ATKyriosDisplay', 'AT Kyrios Display', serif;
  font-size: 4rem;
  font-weight: 900;
  color: #000;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 3px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  line-height: 1.1;
}

[data-theme="dark"] .book-title {
  color: #fff;
  text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.1);
}

.book-layout {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
  margin: 2rem 0;
}

.book-cover-section {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.book-cover-container {
  margin-bottom: 2rem;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-radius: 0;
  overflow: hidden;
}

.book-cover-image {
  width: 100%;
  height: auto;
  display: block;
  filter: grayscale(100%);
  transition: filter 0.3s ease;
}

.book-cover-image:hover {
  filter: grayscale(0%);
}

.purchase-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.purchase-button {
  background: #333;
  color: white;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0;
  text-align: center;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
}

.purchase-button:hover {
  background: #333;
  color: #cc0000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  text-decoration: none;
}

.book-review-section {
  background-color: #333;
  color: white;
  padding: 2rem;
  margin: 2rem auto;
  max-width: 100%;
  border-radius: 8px;
  text-align: center;
}

.book-review-section h2 {
  margin: 0 0 0.5rem 0;
}

.book-review-section h4 {
  margin: 0;
  font-weight: normal;
  opacity: 0.9;
}

[data-theme="dark"] .book-review-section {
  background-color: #444;
}

.book-description-section {
  flex: 1;
  padding-left: 1rem;
}

/* Responsive design */
@media (max-width: 768px) {
  .book-title {
    font-size: 2.5rem;
    letter-spacing: 2px;
  }
  
  .book-layout {
    flex-direction: column;
    gap: 2rem;
  }
  
  .book-cover-section {
    flex: none;
    width: 100%;
  }
  
  .book-description-section {
    padding-left: 0;
  }
  
  .purchase-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .purchase-button {
    flex: 1;
    min-width: 120px;
  }
}

/*
==========================================================================
  Newsletter Signup Styles
  - Inline newsletter subscription form styling
  - Matches the site's design language and color scheme
==========================================================================
*/

.newsletter-signup {
  margin: 2rem 1rem;
  padding: 2rem;
  background: var(--panel-bg);
  border: 2px solid var(--border);
  border-radius: 0;
  text-align: center;
}

.newsletter-intro {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--text);
}

.newsletter-intro strong {
  color: var(--link);
  text-decoration: underline;
}

.newsletter-form {
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  gap: 0.75rem;
  max-width: 400px;
  margin: 0 auto;
}

.newsletter-email {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #ccc;
  border-radius: 0;
  background: #f8f8f8;
  color: #333;
  font-size: 1rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.newsletter-email:focus {
  border-color: #333;
  background: #fff;
}

.newsletter-email::placeholder {
  color: #888;
}

.newsletter-subscribe {
  background: #333;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.newsletter-subscribe:hover {
  background: #333;
  color: #cc0000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.newsletter-subscribe:active {
  transform: translateY(0);
}

.newsletter-note {
  margin-top: 1rem;
}

.newsletter-note small {
  color: #666;
  font-size: 0.85rem;
}

.newsletter-note a {
  color: var(--link);
  text-decoration: none;
}

.newsletter-note a:hover {
  text-decoration: underline;
}

/* Search Page */
.search-page { max-width: 800px; margin: 2rem auto 4rem; padding: 0 1rem; }
.search-description { margin: 1rem 0 2rem; color: var(--text-muted, #666); font-style: italic; font-size: 1.1rem; padding-left: 0; list-style: none; }
.search-box { position: sticky; top: 0.75rem; margin-bottom: 1rem; background: var(--bg); }
#q { width: 100%; padding: .8rem 1rem; border: 1px solid var(--border); border-radius: 0; font: inherit; }
.search-status { min-height: 1.5rem; margin: 0.5rem 0; color: var(--text-muted, #666); font-style: italic; font-size: 0.9rem; }
.search-results { list-style: none; padding: 0; margin: 1rem 0 4rem; display: grid; gap: 1rem; }
.hit { padding: 1rem; border-radius: 0; border: 1px solid var(--border); background: var(--panel-bg); }
.hit-title { font-weight: 600; text-decoration: none; color: var(--text); }
.hit-title:hover { text-decoration: underline; }
.hit-excerpt { margin: .5rem 0 0; color: var(--text); line-height: 1.5; }
.no-results { padding: 1rem; color: var(--text-muted, #666); font-style: italic; list-style: none; }

/* Search suggestions (autocomplete dropdown) */
.search-suggestions { 
  list-style: none; 
  margin: 0.25rem 0 0 0; 
  padding: 0; 
  max-height: 220px; 
  overflow-y: auto; 
  border-top: 1px solid var(--border); 
}

.suggest-item { 
  padding: 0.75rem 1rem; 
  cursor: pointer; 
  transition: background 0.15s ease;
}

.suggest-item:hover {
  background: var(--panel-bg);
}

/* Mobile search adjustments */
@media (max-width: 768px) {
  .search-page {
    margin: 1rem auto 3rem;
    padding: 0 0.75rem;
  }
  
  .search-box {
    position: relative; /* Disable sticky on mobile to avoid keyboard overlap */
    top: auto;
  }
  
  #q {
    padding: 1rem; /* Larger touch target */
    font-size: 16px; /* Prevent iOS zoom on focus */
  }
  
  .suggest-item {
    padding: 1rem; /* Better touch targets for suggestions */
    font-size: 16px;
  }
  
  .hit {
    padding: 0.875rem;
  }
}

/* Dark mode adjustments */
[data-theme="dark"] .newsletter-signup {
  background: var(--panel-bg);
  border-color: var(--border);
}

[data-theme="dark"] .newsletter-email {
  background: #2a2a2a;
  color: #fff;
  border-color: #555;
}

[data-theme="dark"] .newsletter-email:focus {
  border-color: #fff;
  background: #333;
  color: #fff;
}

[data-theme="dark"] .newsletter-email::placeholder {
  color: #aaa;
}

[data-theme="dark"] .newsletter-note small {
  color: #aaa;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .newsletter-signup {
    margin: 1.5rem 0;
    padding: 1.5rem;
  }
  
  .form-group {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .newsletter-subscribe {
    padding: 0.875rem 1.5rem;
  }
}
