:root {
  --bg: #e7dcc7;
  --bg-deep: #d3c0a0;
  --paper: #f8f2e7;
  --paper-strong: #fffaf2;
  --ink: #1d140f;
  --muted: #6e5e50;
  --line: rgba(61, 34, 16, 0.16);
  --accent: #9b2c1f;
  --accent-dark: #5d190f;
  --gold: #b98a3b;
  --nav: #19110d;
  --nav-soft: #2a1b14;
  --shadow: 0 20px 45px rgba(48, 28, 13, 0.14);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  background:
    radial-gradient(circle at top left, rgba(255, 248, 231, 0.85), transparent 28%),
    radial-gradient(circle at right 15%, rgba(155, 44, 31, 0.10), transparent 22%),
    linear-gradient(180deg, #f2e8d8 0%, var(--bg) 26%, var(--bg-deep) 100%);
  color: var(--ink);
  line-height: 1.6;
}
a::selection, body::selection {
  background: rgba(155, 44, 31, 0.18);
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto !important; display: block; }
.shell {
  max-width: 1520px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0)),
    linear-gradient(180deg, var(--nav) 0%, var(--nav-soft) 100%);
  color: #f2e6d5;
  padding: 28px 22px 40px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid rgba(255,255,255,.08);
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.04);
}
.brand {
  margin-bottom: 26px;
  padding: 12px 12px 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
}
.brand h1 {
  margin: 0;
  font-size: 1.95rem;
  line-height: .95;
  letter-spacing: .01em;
}
.brand p {
  margin: 10px 0 0;
  color: #d5c2ae;
  font-size: .88rem;
  line-height: 1.45;
}
.nav-section { margin-bottom: 20px; }
.nav-section h2 {
  margin: 0 0 9px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #d8c0a5;
}
.nav-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
}
.nav-section:has(a.active) ul { display: block; }
.nav-section li { margin: 0 0 4px; }
.nav-section a {
  color: #f7eee3;
  opacity: .78;
  font-size: .92rem;
  display: block;
  padding: 5px 8px;
  border-left: 2px solid transparent;
  transition: opacity .2s ease, border-color .2s ease, transform .2s ease;
}
.nav-section a.active,
.nav-section a:hover {
  opacity: 1;
  border-color: var(--gold);
  transform: translateX(2px);
}
.main {
  padding: 32px 40px 70px;
}
.hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.55), rgba(255,255,255,0.10)),
    linear-gradient(180deg, #f8f2e4 0%, #efe0c6 100%);
  border: 1px solid rgba(91, 57, 25, 0.12);
  box-shadow: var(--shadow);
  padding: 34px 38px 36px;
  margin-bottom: 26px;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at right top, rgba(185, 138, 59, 0.30), transparent 22%),
    linear-gradient(90deg, rgba(155, 44, 31, 0.10), transparent 45%);
  pointer-events: none;
}
.eyebrow {
  position: relative;
  z-index: 1;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
  margin-bottom: 10px;
}
.hero h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -.01em;
  overflow-wrap: break-word;
}
.hero p {
  position: relative;
  z-index: 1;
  margin: 12px 0 0;
  color: var(--muted);
  max-width: 56ch;
  font-size: 1.02rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.panel {
  background: linear-gradient(180deg, var(--paper-strong), var(--paper));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.panel h2, .panel h3 { margin: 0 0 10px; line-height: 1.15; }
.panel p { margin: 0; color: var(--muted); }
.category-card {
  position: relative;
  min-height: 180px;
}
.category-card::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(185, 138, 59, 0.20), rgba(185, 138, 59, 0));
}
.category-card h3 {
  font-size: 1.35rem;
  max-width: 12ch;
}
.count {
  display: inline-block;
  margin-top: 18px;
  color: var(--muted);
  font-size: .88rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}
.article-main, .article-aside {
  background: linear-gradient(180deg, var(--paper-strong), var(--paper));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 26px;
}
.article-main p:first-child { margin-top: 0; }
.article-main table, .article-main img, .article-aside img {
  max-width: 100%;
}
.article-main font, .article-main span, .article-main p, .article-main em,
.article-main i, .article-main b, .article-main strong, .article-main address,
.article-aside font, .article-aside span, .article-aside p, .article-aside em,
.article-aside i {
  font-family: Georgia, "Times New Roman", serif !important;
  color: var(--ink) !important;
}
.article-main a, .article-aside a { word-break: break-word; }
.article-main {
  font-size: 1.02rem;
}
.article-main img,
.article-aside img {
  background: #fff;
  padding: 6px;
  border: 1px solid rgba(61, 34, 16, 0.08);
}
.article-aside {
  font-size: .93rem;
  position: sticky;
  top: 24px;
}
.article-list { list-style: none; padding: 0; margin: 0; }
.article-list li { padding: 14px 0; border-top: 1px solid var(--line); }
.article-list li:first-child { border-top: 0; padding-top: 0; }
.article-list a {
  display: block;
  font-weight: 600;
  margin-bottom: 5px;
  font-size: 1.05rem;
}
.meta {
  color: var(--muted);
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.breadcrumbs {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.breadcrumbs a { color: inherit; }
@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
  }
  .article-layout { grid-template-columns: 1fr; }
  .article-aside { position: relative; top: 0; }
}
@media (max-width: 720px) {
  .main { padding: 18px; }
  .hero, .panel, .article-main, .article-aside { padding: 18px; }
  .grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: clamp(1.4rem, 6vw, 2rem); }
}


/* ── Category card with cover image ─────────────────────── */
.category-card { overflow: hidden; display: flex; flex-direction: column; }
.ci-img {
  display: block;
  width: calc(100% + 44px);
  margin: -20px -22px 16px;
  height: 155px;
  object-fit: cover;
  flex-shrink: 0;
}

/* ── Article list with thumbnails (category pages) ───────── */
.article-list li { padding: 0; border-top: 1px solid var(--line); }
.article-list li:first-child { border-top: 0; }
.article-list li.ac { padding: 0; }

.ac-inner {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0;
  align-items: stretch;
  min-height: 74px;
}

.ac-thumb {
  display: block;
  width: 110px;
  height: 74px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-deep);
  border-right: 1px solid var(--line);
  padding: 0;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  margin: 0;
}

.ac-body {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.ac-title {
  display: block;
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--accent-dark);
  line-height: 1.3;
  text-decoration: none;
}
.ac-title:hover { color: var(--accent); }

.ac-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: .84rem;
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 720px) {
  .ac-inner { grid-template-columns: 80px 1fr; }
  .ac-thumb { width: 80px; height: 60px; }
  .ci-img { height: 120px; }
}


/* ── Lightbox ─────────────────────────────── */
#lb {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
#lb.lb-on { display: flex; }
#lb-bg {
  position: absolute;
  inset: 0;
  background: rgba(20, 10, 4, 0.93);
  cursor: zoom-out;
}
#lb-img {
  position: relative;
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  object-position: center;
  height: auto !important;
  background: #fff;
  padding: 6px;
  border: 1px solid rgba(61, 34, 16, 0.15);
  box-shadow: 0 32px 80px rgba(0,0,0,0.55);
}
#lb-x {
  position: fixed;
  top: 18px;
  right: 24px;
  background: none;
  border: none;
  color: #f2e6d5;
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 10000;
  opacity: 0.7;
  padding: 4px 8px;
  font-family: serif;
  transition: opacity 0.15s;
}
#lb-x:hover { opacity: 1; }

/* ── Hero overlay (for bg image) ─────────── */
.hero { isolation: isolate; }
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(248,242,228,0.94) 0%, rgba(248,242,228,0.82) 55%, rgba(220,195,160,0.60) 100%),
    linear-gradient(90deg, rgba(155,44,31,0.08), transparent 50%);
  z-index: 0;
}
.hero > * { position: relative; z-index: 1; }

/* ── Aside gallery grid ──────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.gallery-cell {
  margin: 0;
  display: flex;
  flex-direction: column;
}
.gallery-cell a { display: block; line-height: 0; }
.gallery-cell img {
  width: 100% !important;
  height: auto !important;
  background: #fff;
  padding: 4px;
  border: 1px solid rgba(61, 34, 16, 0.08) !important;
  display: block;
  box-sizing: border-box;
}
.gallery-cell figcaption {
  font-size: .68rem;
  color: var(--muted);
  text-align: center;
  padding: 3px 2px 6px;
  line-height: 1.3;
  font-style: italic;
  font-family: Georgia, serif;
}

/* ── Article body image rows ─────────────── */
.img-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
  align-items: flex-start;
}
.img-row a {
  flex: 0 0 auto;
  line-height: 0;
  display: block;
}
.img-row img {
  display: block;
  height: auto !important;
  max-width: 100%;
  background: #fff;
  padding: 4px;
  border: 1px solid rgba(61,34,16,.08) !important;
  box-sizing: border-box;
}

/* ── Mobile sidebar collapse ─────────────── */
.nav-toggle { display: none; }

@media (max-width: 1100px) {
  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 4px;
    padding: 9px 12px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.10);
    color: #f2e6d5;
    font-family: inherit;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .10em;
    cursor: pointer;
    transition: background .15s;
  }
  .nav-toggle:hover { background: rgba(255,255,255,.12); }

  /* Collapse all nav sections on mobile */
  .sidebar .nav-section { display: none; }
  .sidebar.nav-open .nav-section { display: block; }
}
