/*
Theme Name: LeaveRules
Theme URI: https://leaverules.com/
Author: Singh
Author URI: https://leaverules.com/
Description: Custom theme for leaverules.com — Leave Rules content for Central Government employees. Navy palette, 5 dedicated hub page templates, Customizer-driven Quick Reference values, JSON-LD schema for Article + Person + Organization + BreadcrumbList. Compact slim-trim layout optimised for both desktop and mobile.
Version: 1.0.5
Tested up to: 6.5
Requires PHP: 8.2
License: GPL-2.0+
Text Domain: leaverules
Tags: blog, news, government, education, custom-colors, custom-logo, custom-menu, featured-images, full-width-template, threaded-comments, translation-ready
*/

/* ==========================================================================
   CSS Variables
   ========================================================================== */
:root {
  --lr-primary: #0C447C;
  --lr-primary-dark: #042C53;
  --lr-primary-light: #185FA5;
  --lr-primary-pale: #E6F1FB;
  --lr-primary-50: #B5D4F4;

  --lr-success: #27500A;
  --lr-success-pale: #E8F2DD;
  --lr-warning: #8B5A00;
  --lr-warning-pale: #FFF3DD;
  --lr-danger: #8B1A1A;
  --lr-danger-pale: #FCEAEA;

  --lr-text: #1A1A1A;
  --lr-text-soft: #4A4A4A;
  --lr-text-muted: #6B6B6B;
  --lr-text-faint: #8A8A8A;

  --lr-bg: #FFFFFF;
  --lr-bg-soft: #F8F9FA;
  --lr-bg-mute: #EFEFEF;
  --lr-border: #E1E4E8;
  --lr-border-soft: #F0F2F5;

  --lr-radius: 5px;
  --lr-radius-lg: 8px;
  --lr-shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --lr-shadow: 0 2px 8px rgba(0,0,0,0.06);

  --lr-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lr-font-serif: 'Source Serif 4', Georgia, "Times New Roman", serif;

  --lr-container: 1100px;
  --lr-container-narrow: 860px;
}

/* ==========================================================================
   Reset and base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100%;
}
body {
  margin: 0;
  font-family: var(--lr-font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--lr-text);
  background: var(--lr-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100%;
}

/* ==========================================================================
   Images: bulletproof overflow protection
   Any image of any size must stay within device screen width.
   Covers raw img tags, Gutenberg image blocks (all alignment variants),
   featured images on single posts, captions, galleries, and embeds.
   ========================================================================== */

/* Base: everything stays inside its container */
img, svg, video, iframe, embed, object, picture, canvas {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  display: inline-block;
}

picture { display: block; }
picture img { width: 100%; }

/* Iframes/embeds expand to fill, but never overflow */
iframe, embed, object { width: 100%; max-width: 100%; }

/* Gutenberg image block - all variants */
.wp-block-image,
.wp-block-image figure,
.wp-block-image .components-resizable-box__container {
  max-width: 100% !important;
  height: auto !important;
}
.wp-block-image img,
.wp-block-image .aligncenter img,
.wp-block-image .alignleft img,
.wp-block-image .alignright img,
.wp-block-image .alignwide img,
.wp-block-image .alignfull img,
.wp-block-image.size-full img,
.wp-block-image.size-large img,
.wp-block-image.size-medium img {
  max-width: 100% !important;
  height: auto !important;
  width: auto;
  display: block;
  margin: 0 auto;
}

/* Image with caption */
.wp-block-image figcaption,
.wp-caption-text {
  text-align: center;
  font-size: 0.82rem;
  color: var(--lr-text-muted);
  margin-top: 6px;
  font-style: italic;
}
.wp-caption {
  max-width: 100% !important;
  height: auto;
}
.wp-caption img { max-width: 100%; height: auto; }

/* Gallery */
.wp-block-gallery,
.wp-block-gallery figure {
  max-width: 100%;
}
.wp-block-gallery img { max-width: 100%; height: auto; }

/* Featured image wrapper in single.php */
.lr-article-featured {
  margin: 16px 0;
  max-width: 100%;
  overflow: hidden;
  border-radius: var(--lr-radius);
}
.lr-article-featured img,
.lr-featured-img {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  display: block;
  border-radius: var(--lr-radius);
}
.lr-article-featured img,
.lr-article img,
.lr-content img {
  max-width: 100% !important;
  height: auto !important;
  display: block;
  margin: 0 auto;
}

/* Cover block (Gutenberg) */
.wp-block-cover {
  max-width: 100% !important;
}

/* Embed responsive wrapper (YouTube etc.) */
.wp-block-embed,
.wp-block-embed__wrapper {
  max-width: 100%;
  margin: 14px 0;
}
.wp-block-embed iframe { aspect-ratio: 16 / 9; width: 100%; height: auto; }
a {
  color: var(--lr-primary);
  text-decoration: none;
  word-break: break-word;
  overflow-wrap: break-word;
}
a:hover { color: var(--lr-primary-dark); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--lr-font-serif);
  color: var(--lr-text);
  margin-top: 0;
  line-height: 1.25;
  font-weight: 700;
  word-break: break-word;
  overflow-wrap: break-word;
}
h1 { font-size: 1.6rem; margin-bottom: 0.35em; }
h2 { font-size: 1.22rem; margin: 1.3em 0 0.4em; padding-bottom: 0.2em; border-bottom: 2px solid var(--lr-primary); display: inline-block; max-width: 100%; }
h3 { font-size: 1.05rem; margin: 1em 0 0.3em; }
h4 { font-size: 0.96rem; margin: 0.85em 0 0.25em; }

p { margin: 0 0 0.75em; word-break: break-word; overflow-wrap: break-word; }
ul, ol { padding-left: 1.2em; margin: 0 0 0.75em; }
li { margin-bottom: 0.25em; word-break: break-word; overflow-wrap: break-word; }

/* Tables: wrap container scrolls if too wide */
table {
  border-collapse: collapse;
  width: 100%;
  max-width: 100%;
  margin: 0.85em 0;
  font-size: 0.92em;
  display: table;
}
th, td { padding: 7px 9px; border: 1px solid var(--lr-border); text-align: left; vertical-align: top; word-break: break-word; overflow-wrap: break-word; }
th { background: var(--lr-bg-soft); font-weight: 600; }
tr:nth-child(even) td { background: var(--lr-bg-soft); }

blockquote {
  margin: 0.9em 0;
  padding: 0.6em 0.9em;
  border-left: 3px solid var(--lr-primary);
  background: var(--lr-primary-pale);
  color: var(--lr-text-soft);
  font-style: italic;
  word-break: break-word;
  overflow-wrap: break-word;
}

code {
  background: var(--lr-bg-mute);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.9em;
  word-break: break-word;
  overflow-wrap: break-word;
}

pre, .wp-block-preformatted {
  background: var(--lr-bg-soft);
  padding: 11px 13px;
  border-radius: 5px;
  font-size: 0.85rem;
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--lr-border);
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
}
pre code { background: transparent; padding: 0; }

/* ==========================================================================
   Layout
   ========================================================================== */
.lr-container { max-width: var(--lr-container); margin: 0 auto; padding: 0 14px; }
.lr-container-narrow { max-width: var(--lr-container-narrow); margin: 0 auto; padding: 0 14px; }

.lr-grid { display: grid; grid-template-columns: 1fr 270px; gap: 26px; }
.lr-grid > * { min-width: 0; }
.lr-article-main { min-width: 0; max-width: 100%; }
@media (max-width: 900px) { .lr-grid { grid-template-columns: 1fr; gap: 18px; } }

/* ==========================================================================
   Top announcement bar
   ========================================================================== */
.lr-topbar {
  background: var(--lr-primary-dark);
  color: #fff;
  padding: 6px 0;
  font-size: 0.8rem;
}
.lr-topbar .lr-container { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lr-topbar-text { flex: 1; min-width: 0; }
.lr-topbar-cta {
  background: rgba(255,255,255,0.15);
  color: #fff;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.74rem;
  white-space: nowrap;
}
.lr-topbar-cta:hover { background: rgba(255,255,255,0.25); color: #fff; text-decoration: none; }

/* ==========================================================================
   Header
   ========================================================================== */
.lr-header {
  background: #fff;
  border-bottom: 1px solid var(--lr-border);
  padding: 10px 0;
}
.lr-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; position: relative; }

.lr-logo { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.lr-logo:hover { text-decoration: none; }
.lr-logo-badge {
  width: 34px; height: 34px;
  background: var(--lr-primary);
  color: #fff;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.92rem; letter-spacing: 0.5px;
  font-family: var(--lr-font-serif);
}
.lr-logo-img {
  max-height: 34px;
  max-width: 180px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.lr-logo-text { display: flex; flex-direction: column; }
.lr-logo-name { font-family: var(--lr-font-serif); font-weight: 700; font-size: 1.05rem; color: var(--lr-text); line-height: 1.1; }
.lr-logo-tag { font-size: 0.68rem; color: var(--lr-text-muted); }

.lr-nav { display: flex; align-items: center; gap: 2px; list-style: none; padding: 0; margin: 0; }
.lr-nav-list { display: flex; align-items: center; gap: 2px; list-style: none; padding: 0; margin: 0; }
.lr-nav ul, .lr-nav li { list-style: none; padding: 0; margin: 0; display: inline-flex; align-items: center; }
.lr-nav a {
  display: inline-block;
  padding: 6px 9px;
  font-size: 0.86rem;
  color: var(--lr-text-soft);
  font-weight: 500;
  border-radius: 4px;
  white-space: nowrap;
}
.lr-nav a:hover { background: var(--lr-bg-soft); color: var(--lr-primary); text-decoration: none; }
.lr-nav .current-menu-item a, .lr-nav .current_page_item a { color: var(--lr-primary); font-weight: 600; }

.lr-mobile-toggle { display: none; background: none; border: 1px solid var(--lr-border); padding: 6px 9px; border-radius: 4px; cursor: pointer; font-size: 1.05rem; line-height: 1; }

@media (max-width: 800px) {
  .lr-nav { display: none; }
  .lr-mobile-toggle { display: block; }
  .lr-nav.is-open {
    display: flex; flex-direction: column; align-items: stretch; gap: 0;
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: #fff; border: 1px solid var(--lr-border); border-radius: 5px;
    padding: 6px 12px; z-index: 50; box-shadow: var(--lr-shadow);
  }
  .lr-nav.is-open .lr-nav-list,
  .lr-nav.is-open ul {
    display: flex; flex-direction: column; align-items: stretch;
    width: 100%; gap: 0;
  }
  .lr-nav.is-open li {
    display: block; width: 100%;
  }
  .lr-nav.is-open a {
    display: block; padding: 9px 0; border-bottom: 1px solid var(--lr-border-soft);
    white-space: normal;
  }
  .lr-nav.is-open li:last-child a { border-bottom: none; }
}

/* ==========================================================================
   Verified stamp
   ========================================================================== */
.lr-verified {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--lr-success-pale);
  color: var(--lr-success);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.74rem;
  font-weight: 600;
}
.lr-verified::before { content: "✓"; font-weight: 700; }

/* ==========================================================================
   Hero (homepage + hub pages)
   ========================================================================== */
.lr-hub-hero {
  background: linear-gradient(135deg, var(--lr-primary) 0%, var(--lr-primary-dark) 100%);
  color: #fff;
  padding: 28px 0 26px;
  margin-bottom: 18px;
}
.lr-hub-hero h1 { color: #fff; font-size: 1.7rem; margin: 0 0 6px; line-height: 1.2; }
.lr-hub-hero p { color: rgba(255,255,255,0.92); font-size: 0.96rem; max-width: 660px; margin: 0 0 14px; line-height: 1.5; }

/* Hero search - inside hero, both desktop and mobile */
.lr-hero-search {
  display: flex;
  max-width: 480px;
  margin-top: 14px;
}
.lr-hero-search input[type="search"] {
  flex: 1;
  padding: 9px 13px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 5px 0 0 5px;
  border-right: 0;
  font: inherit;
  font-size: 0.92rem;
  background: rgba(255,255,255,0.95);
  outline: none;
  min-width: 0;
  color: var(--lr-text);
}
.lr-hero-search input[type="search"]:focus {
  background: #fff;
  border-color: rgba(255,255,255,0.6);
}
.lr-hero-search input[type="search"]::placeholder { color: var(--lr-text-muted); }
.lr-hero-search button {
  padding: 0 16px;
  background: rgba(255,255,255,0.95);
  color: var(--lr-primary);
  border: 1px solid rgba(255,255,255,0.3);
  border-left: 0;
  border-radius: 0 5px 5px 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lr-hero-search button:hover { background: #fff; }

/* ==========================================================================
   Stats strip
   ========================================================================== */
.lr-stats-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 14px 0 6px;
}
.lr-stat-card {
  background: #fff;
  border: 1px solid var(--lr-border);
  border-radius: var(--lr-radius);
  padding: 11px 10px;
  text-align: center;
  box-shadow: var(--lr-shadow-sm);
}
.lr-stat-value { font-size: 1.35rem; font-weight: 700; color: var(--lr-primary); display: block; line-height: 1.1; }
.lr-stat-label { font-size: 0.7rem; color: var(--lr-text-muted); text-transform: uppercase; letter-spacing: 0.3px; }

/* ==========================================================================
   Cards grid
   ========================================================================== */
.lr-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.lr-card {
  background: #fff;
  border: 1px solid var(--lr-border);
  border-radius: var(--lr-radius);
  padding: 12px 14px;
  transition: transform 0.15s, box-shadow 0.15s;
  max-width: 100%;
  overflow: hidden;
}
.lr-card img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 8px;
}
.lr-card:hover { transform: translateY(-1px); box-shadow: var(--lr-shadow); }
.lr-card-cat { color: var(--lr-primary); font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.lr-card-title { font-family: var(--lr-font-serif); font-size: 0.98rem; margin: 4px 0 6px; line-height: 1.25; }
.lr-card-title a { color: var(--lr-text); }
.lr-card-title a:hover { color: var(--lr-primary); text-decoration: none; }
.lr-card-meta { font-size: 0.74rem; color: var(--lr-text-muted); }

/* ==========================================================================
   Article body
   ========================================================================== */
.lr-article { padding: 16px 0 32px; }
.lr-article-header { margin-bottom: 16px; }
.lr-article-meta {
  display: flex; flex-wrap: wrap; gap: 9px;
  font-size: 0.78rem; color: var(--lr-text-muted);
  margin-bottom: 10px;
}
.lr-article-cat {
  background: var(--lr-primary-pale);
  color: var(--lr-primary);
  padding: 1px 7px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.lr-article-title {
  font-size: 1.55rem;
  line-height: 1.22;
  margin: 0 0 10px;
  color: var(--lr-text);
}
.lr-article-excerpt {
  font-size: 0.98rem;
  color: var(--lr-text-soft);
  line-height: 1.5;
  margin: 0 0 14px;
}
.lr-article-author {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 0;
  border-top: 1px solid var(--lr-border);
  border-bottom: 1px solid var(--lr-border);
}
.lr-author-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--lr-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
}
.lr-author-meta { font-size: 0.82rem; }
.lr-author-name { font-weight: 600; color: var(--lr-text); }
.lr-author-title { color: var(--lr-text-muted); font-size: 0.74rem; }

.lr-content { max-width: 100%; overflow-wrap: break-word; word-wrap: break-word; }
.lr-content > h2:first-of-type { margin-top: 0.7em; }
.lr-content table th { background: var(--lr-primary); color: #fff; font-weight: 600; }
.lr-content table tr:nth-child(even) td { background: var(--lr-bg-soft); }
.lr-content figure { max-width: 100%; margin: 14px 0; }

/* Gutenberg align-wide / align-full: keep within container on mobile */
.lr-content .alignwide,
.lr-content .alignfull,
.alignwide, .alignfull {
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}
.lr-content .alignleft, .alignleft { float: left; margin: 0.3em 1em 0.5em 0; max-width: 50%; }
.lr-content .alignright, .alignright { float: right; margin: 0.3em 0 0.5em 1em; max-width: 50%; }
.lr-content .aligncenter, .aligncenter { display: block; margin-left: auto; margin-right: auto; }
@media (max-width: 600px) {
  .lr-content .alignleft, .lr-content .alignright,
  .alignleft, .alignright { float: none; margin: 0.5em 0; max-width: 100%; display: block; }
}

.lr-callout {
  background: var(--lr-warning-pale);
  border-left: 3px solid var(--lr-warning);
  padding: 10px 13px;
  border-radius: 0 5px 5px 0;
  margin: 14px 0;
}
.lr-callout-title {
  font-weight: 700;
  color: var(--lr-warning);
  font-size: 0.82rem;
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.lr-tldr {
  background: var(--lr-primary-pale);
  border-left: 3px solid var(--lr-primary);
  padding: 10px 13px;
  border-radius: 0 5px 5px 0;
  margin: 14px 0;
}
.lr-tldr-title {
  font-weight: 700;
  color: var(--lr-primary);
  font-size: 0.82rem;
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.lr-source {
  background: var(--lr-success-pale);
  border-left: 3px solid var(--lr-success);
  padding: 10px 13px;
  border-radius: 0 5px 5px 0;
  margin: 14px 0;
  font-size: 0.88rem;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */
.lr-sidebar { font-size: 0.86rem; }
.lr-widget {
  background: var(--lr-bg-soft);
  border: 1px solid var(--lr-border);
  border-radius: var(--lr-radius);
  padding: 12px;
  margin-bottom: 13px;
}
.lr-widget-title {
  font-family: var(--lr-font-serif);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--lr-primary);
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--lr-primary);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
}
.lr-widget-asof {
  font-family: var(--lr-font);
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--lr-text-muted);
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}
.lr-quickref-row {
  display: flex; justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed var(--lr-border);
  font-size: 0.82rem;
}
.lr-quickref-row:last-child { border-bottom: none; }
.lr-quickref-label { color: var(--lr-text-muted); }
.lr-quickref-value { font-weight: 700; color: var(--lr-text); }

.lr-calc-cta {
  display: block;
  background: var(--lr-primary);
  color: #fff;
  padding: 7px 11px;
  border-radius: 4px;
  text-align: center;
  font-weight: 600;
  font-size: 0.84rem;
}
.lr-calc-cta:hover { background: var(--lr-primary-dark); color: #fff; text-decoration: none; }

/* Sidebar search widget - compact */
.lr-widget-search { padding: 8px; }
.lr-sidebar-search { display: flex; }
.lr-sidebar-search input[type="search"] {
  flex: 1; padding: 6px 10px;
  border: 1px solid var(--lr-border); border-radius: 4px 0 0 4px;
  border-right: 0; font: inherit; font-size: 0.84rem;
  background: #fff; outline: none; min-width: 0;
}
.lr-sidebar-search input[type="search"]:focus { border-color: var(--lr-primary-light); }
.lr-sidebar-search button {
  padding: 0 10px; background: var(--lr-primary); color: #fff;
  border: 1px solid var(--lr-primary); border-radius: 0 4px 4px 0;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.lr-sidebar-search button:hover { background: var(--lr-primary-dark); }

/* ==========================================================================
   Footer
   ========================================================================== */
.lr-footer {
  background: var(--lr-primary-dark);
  color: rgba(255,255,255,0.85);
  padding: 26px 0 12px;
  margin-top: 36px;
  font-size: 0.84rem;
}
.lr-footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 22px; }
@media (max-width: 720px) { .lr-footer-grid { grid-template-columns: 1fr 1fr; gap: 16px; } }

.lr-footer h4 { color: #fff; font-size: 0.92rem; margin: 0 0 8px; font-family: var(--lr-font); }
.lr-footer a { color: rgba(255,255,255,0.85); display: block; padding: 2px 0; }
.lr-footer a:hover { color: #fff; text-decoration: underline; }
.lr-footer-bottom { border-top: 1px solid rgba(255,255,255,0.15); margin-top: 20px; padding-top: 12px; text-align: center; font-size: 0.76rem; }

/* ==========================================================================
   Author box (E-E-A-T)
   ========================================================================== */
.lr-author-box {
  background: var(--lr-bg-soft);
  border: 1px solid var(--lr-border);
  border-radius: var(--lr-radius);
  padding: 13px;
  margin: 20px 0;
  display: flex;
  gap: 12px;
  max-width: 100%;
}
.lr-author-box > * { min-width: 0; }
.lr-author-box-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--lr-primary);
  color: #fff;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.15rem;
}
.lr-author-box-name { font-size: 1rem; font-weight: 700; color: var(--lr-text); margin: 0 0 2px; }
.lr-author-box-title { font-size: 0.8rem; color: var(--lr-primary); font-weight: 600; margin: 0 0 6px; }
.lr-author-box-bio { font-size: 0.85rem; color: var(--lr-text-soft); margin: 0 0 6px; line-height: 1.5; }
.lr-author-box-links { display: flex; gap: 10px; font-size: 0.78rem; }
@media (max-width: 600px) {
  .lr-author-box { flex-direction: column; text-align: center; gap: 9px; }
  .lr-author-box-avatar { margin: 0 auto; }
}

/* ==========================================================================
   Related posts
   ========================================================================== */
.lr-related { margin: 24px 0; padding: 14px; background: var(--lr-bg-soft); border-radius: var(--lr-radius); border: 1px solid var(--lr-border); }
.lr-related h3 { margin-top: 0; font-size: 1rem; }
.lr-related-list { list-style: none; padding: 0; margin: 0; }
.lr-related-list li { padding: 6px 0; border-bottom: 1px solid var(--lr-border); }
.lr-related-list li:last-child { border-bottom: none; }
.lr-related-list a { font-weight: 500; font-size: 0.88rem; }

/* ==========================================================================
   Breadcrumb
   ========================================================================== */
.lr-breadcrumb {
  font-size: 0.74rem;
  color: var(--lr-text-muted);
  padding: 8px 0;
  border-bottom: 1px solid var(--lr-border-soft);
  margin-bottom: 12px;
}
.lr-breadcrumb a { color: var(--lr-text-muted); }
.lr-breadcrumb a:hover { color: var(--lr-primary); }
.lr-breadcrumb-sep { margin: 0 5px; color: var(--lr-text-faint); }

/* ==========================================================================
   Forms (search.php fallback)
   ========================================================================== */
.lr-search-form { display: flex; gap: 6px; }
.lr-search-form input[type="search"] {
  flex: 1; padding: 6px 10px; border: 1px solid var(--lr-border); border-radius: 4px; font: inherit;
}
.lr-search-form button {
  padding: 6px 12px; background: var(--lr-primary); color: #fff; border: none; border-radius: 4px; cursor: pointer; font-weight: 600;
}

/* ==========================================================================
   Mobile (<= 720px) — further trim, hide topbar, hide header search relics
   ========================================================================== */
@media (max-width: 720px) {
  body { font-size: 14.5px; line-height: 1.5; }

  h1 { font-size: 1.35rem; margin-bottom: 0.3em; }
  h2 { font-size: 1.1rem; margin: 1.1em 0 0.35em; padding-bottom: 0.18em; }
  h3 { font-size: 0.98rem; margin: 0.85em 0 0.3em; }
  h4 { font-size: 0.92rem; margin: 0.75em 0 0.22em; }

  p, li { margin-bottom: 0.55em; }
  ul, ol { padding-left: 1.1em; margin: 0 0 0.55em; }

  .lr-container, .lr-container-narrow { padding: 0 12px; }

  /* HIDE topbar on mobile */
  .lr-topbar { display: none; }

  /* Header tighter */
  .lr-header { padding: 8px 0; }
  .lr-logo-badge { width: 32px; height: 32px; font-size: 0.88rem; }
  .lr-logo-img { max-height: 32px; }
  .lr-logo-name { font-size: 1rem; }
  .lr-logo-tag { font-size: 0.66rem; }

  /* Hero - tighter on mobile */
  .lr-hub-hero { padding: 22px 0 22px; margin-bottom: 14px; }
  .lr-hub-hero h1 { font-size: 1.35rem; margin-bottom: 5px; }
  .lr-hub-hero p { font-size: 0.9rem; line-height: 1.45; margin-bottom: 12px; }
  .lr-hero-search { margin-top: 10px; max-width: none; }
  .lr-hero-search input[type="search"] { padding: 8px 11px; font-size: 0.88rem; }
  .lr-hero-search button { padding: 0 13px; }

  /* Stats strip - 2 columns on mobile */
  .lr-stats-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 12px 0 4px;
  }
  .lr-stat-card { padding: 9px 8px; }
  .lr-stat-value { font-size: 1.15rem; }
  .lr-stat-label { font-size: 0.66rem; letter-spacing: 0.2px; }

  /* Cards single column */
  .lr-cards-grid { grid-template-columns: 1fr; gap: 9px; }
  .lr-card { padding: 11px 12px; }
  .lr-card-cat { font-size: 0.66rem; }
  .lr-card-title { font-size: 0.94rem; margin: 3px 0 5px; }
  .lr-card-meta { font-size: 0.72rem; }

  /* Article tighter */
  .lr-article { padding: 12px 0 24px; }
  .lr-article-header { margin-bottom: 12px; }
  .lr-article-title { font-size: 1.25rem; line-height: 1.22; margin: 0 0 8px; }
  .lr-article-excerpt { font-size: 0.92rem; line-height: 1.45; margin: 0 0 10px; }
  .lr-article-meta { gap: 7px; font-size: 0.74rem; margin-bottom: 8px; }

  /* Author meta strip on article */
  .lr-article-author { padding: 7px 0; gap: 8px; }
  .lr-author-avatar { width: 32px; height: 32px; font-size: 0.78rem; }
  .lr-author-meta { font-size: 0.8rem; }
  .lr-author-title { font-size: 0.7rem; }

  /* Content */
  .lr-content { font-size: 0.92rem; }
  .lr-content table { font-size: 0.82rem; }
  .lr-content table th, .lr-content table td { padding: 5px 7px; }
  .lr-content pre,
  .lr-content .wp-block-preformatted {
    font-size: 0.76rem;
    padding: 9px 11px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
  }

  /* Sidebar - tighter and below content */
  .lr-sidebar { font-size: 0.84rem; margin-top: 18px; }
  .lr-widget { padding: 11px; margin-bottom: 11px; }
  .lr-widget-search { padding: 7px; }
  .lr-widget-title { font-size: 0.9rem; margin: 0 0 7px; padding-bottom: 5px; }
  .lr-quickref-row { padding: 3px 0; font-size: 0.78rem; }

  /* Author box */
  .lr-author-box { padding: 12px; margin: 18px 0; gap: 11px; }
  .lr-author-box-avatar { width: 50px; height: 50px; font-size: 1.05rem; }
  .lr-author-box-name { font-size: 0.96rem; }
  .lr-author-box-title { font-size: 0.74rem; }
  .lr-author-box-bio { font-size: 0.82rem; line-height: 1.45; }
  .lr-author-box-links { font-size: 0.74rem; gap: 9px; }

  /* Related */
  .lr-related { margin: 20px 0; padding: 12px; }
  .lr-related h3 { font-size: 0.96rem; }
  .lr-related-list li { padding: 6px 0; }
  .lr-related-list a { font-size: 0.86rem; }

  /* Breadcrumb */
  .lr-breadcrumb { font-size: 0.7rem; padding: 6px 0; margin-bottom: 10px; }

  /* Footer */
  .lr-footer { padding: 22px 0 11px; margin-top: 26px; font-size: 0.8rem; }
  .lr-footer h4 { font-size: 0.88rem; margin: 0 0 6px; }
  .lr-footer a { padding: 2px 0; }
  .lr-footer-bottom { font-size: 0.7rem; margin-top: 14px; padding-top: 10px; }

  /* Callouts */
  .lr-callout, .lr-tldr, .lr-source { padding: 8px 11px; margin: 10px 0; font-size: 0.85rem; }
  .lr-callout-title, .lr-tldr-title { font-size: 0.74rem; }
}

/* Extra-narrow phones (<= 380px) */
@media (max-width: 380px) {
  .lr-container, .lr-container-narrow { padding: 0 10px; }
  .lr-stats-strip { grid-template-columns: 1fr 1fr; gap: 7px; }
  .lr-stat-card { padding: 8px 6px; }
  .lr-stat-value { font-size: 1.05rem; }
  .lr-article-title { font-size: 1.18rem; }
  h1 { font-size: 1.25rem; }
  h2 { font-size: 1.02rem; }
  .lr-hub-hero h1 { font-size: 1.22rem; }
  .lr-hub-hero p { font-size: 0.86rem; }
}

/* ==========================================================================
   Print
   ========================================================================== */
@media print {
  .lr-topbar, .lr-header, .lr-footer, .lr-sidebar, .lr-related, .lr-hero-search { display: none; }
  .lr-grid { grid-template-columns: 1fr; }
  body { font-size: 11pt; }
  .lr-hub-hero { background: none; color: #000; padding: 0; }
  .lr-hub-hero h1, .lr-hub-hero p { color: #000; }
}
