/* ============================================================
   Stanley Rawlinson Society — Website Stylesheet
   Victorian parchment theme
   ============================================================ */

:root {
  --parchment:      #f5edd8;
  --parchment-dark: #ead6b0;
  --text:           #2c1a0e;
  --text-muted:     #5a3e2a;
  --header-bg:      #1a0b04;
  --header-text:    #d4aa6e;
  --accent:         #8b3a0f;
  --border-color:   #8b6914;
  --quote-bg:       #ede0c0;
  --link-color:     #7a2b0f;
}

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

body {
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--parchment);
  color: var(--text);
  line-height: 1.75;
  font-size: 16px;
}

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

/* ---- Hamburger button (hidden on desktop) ------------ */

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--header-text);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  border-radius: 3px;
  margin-left: auto;
}

/* ---- Header ------------------------------------------ */

header {
  background: var(--header-bg);
  border-bottom: 3px solid var(--border-color);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.5rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}

.site-logo img {
  height: 72px;
}

.site-title {
  color: var(--header-text);
  font-size: 1rem;
  letter-spacing: 0.08em;
  font-variant: small-caps;
  line-height: 1.3;
}

.top-nav {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.top-nav a {
  color: var(--header-text);
  text-decoration: none;
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: 'Trebuchet MS', Arial, sans-serif;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}

.top-nav a:hover,
.top-nav a.active {
  color: #fff;
  border-bottom-color: var(--header-text);
}

/* ---- Layout ------------------------------------------ */

.page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
}

/* ---- Sidebar ----------------------------------------- */

.sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--parchment-dark);
  border-right: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
}

.sidebar-section {
  padding: 1rem 0;
}

.sidebar-heading {
  font-size: 0.63rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  padding: 0 1rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  font-family: 'Trebuchet MS', Arial, sans-serif;
  margin-bottom: 0.3rem;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav li a {
  display: block;
  padding: 0.45rem 1rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.83rem;
  line-height: 1.3;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  background: rgba(139, 58, 15, 0.12);
  border-left-color: var(--accent);
  color: var(--accent);
}

/* ---- Main content ------------------------------------ */

.content {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem;
}

/* ---- Chapter header ---------------------------------- */

.chapter-header {
  margin-bottom: 2rem;
  padding-bottom: 1.2rem;
  border-bottom: 2px solid var(--border-color);
}

.chapter-header h1 {
  font-size: 2.2rem;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.chapter-epigraph {
  font-style: italic;
  color: var(--text-muted);
  border-left: 3px solid var(--border-color);
  padding: 0.4rem 0 0.4rem 1rem;
  margin-top: 0.8rem;
}

/* ---- Typography -------------------------------------- */

h2 {
  font-size: 1.35rem;
  color: var(--text);
  margin: 2rem 0 0.7rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.25rem;
}

h3 {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 1.5rem 0 0.4rem;
}

p { margin-bottom: 1rem; }

ul, ol {
  margin: 0.3rem 0 1rem 1.5rem;
}

li { margin-bottom: 0.3rem; }

.clearfix::after {
  content: '';
  display: table;
  clear: both;
}

/* ---- Floating images --------------------------------- */

.img-right {
  float: right;
  margin: 0.5rem 0 1rem 1.5rem;
  max-width: 210px;
}

.img-left {
  float: left;
  margin: 0.5rem 1.5rem 0 0;
  max-width: 210px;
}

.img-right img,
.img-left  img {
  width: 100%;
  border: 2px solid var(--border-color);
  box-shadow: 2px 2px 6px rgba(0,0,0,0.18);
  display: block;
}

.img-caption {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.3rem;
  margin-bottom: 0;
}

.img-center {
  text-align: center;
  margin: 1.5rem 0;
  clear: both;
}

.img-center img {
  max-width: 100%;
  border: 2px solid var(--border-color);
  box-shadow: 2px 2px 6px rgba(0,0,0,0.18);
}

/* ---- Portrait rows ----------------------------------- */

.portrait-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.5rem 0;
  justify-content: center;
  clear: both;
}

.portrait-item {
  text-align: center;
  flex: 0 1 110px;
}

.portrait-item img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border: 2px solid var(--border-color);
  display: block;
}

.portrait-item .cap {
  font-size: 0.72rem;
  font-style: italic;
  margin-top: 0.3rem;
  color: var(--text-muted);
}

/* ---- Blockquotes / Letters --------------------------- */

blockquote {
  background: var(--quote-bg);
  border-left: 4px solid var(--accent);
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  font-style: italic;
  clear: both;
}

blockquote.no-clear {
  clear: none;
  overflow: auto;
}

blockquote p { margin-bottom: 0.5rem; }
blockquote p:last-child { margin-bottom: 0; }

.letter {
  background: var(--quote-bg);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent);
  padding: 1.2rem 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  clear: both;
}

.letter-source {
  font-size: 0.82rem;
  font-weight: bold;
  font-style: normal;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

/* ---- Home page chapter grid -------------------------- */

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.chapter-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  border: 2px solid var(--border-color);
  background: var(--parchment-dark);
  transition: transform 0.2s, box-shadow 0.2s, color 0.2s;
}

.chapter-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  color: var(--accent);
}

.chapter-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-bottom: 2px solid var(--border-color);
  display: block;
}

.chapter-card-title {
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  font-weight: bold;
  text-align: center;
}

/* ---- Obituary / document image grid ------------------ */

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  clear: both;
}

.doc-grid figure {
  margin: 0;
}

.doc-grid img {
  width: 100%;
  border: 2px solid var(--border-color);
  display: block;
}

.doc-grid figcaption {
  font-size: 0.74rem;
  font-style: italic;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.3rem;
}

/* ---- Review blocks (poetry page) -------------------- */

.review-block {
  background: var(--quote-bg);
  border: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  margin: 1.2rem 0;
  font-style: italic;
  clear: both;
}

.review-source {
  font-size: 0.82rem;
  font-weight: bold;
  font-style: normal;
  text-align: right;
  color: var(--text-muted);
  margin-top: 0.6rem;
}

/* ---- Dining rules ------------------------------------ */

.dining-rules {
  background: var(--quote-bg);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent);
  padding: 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
}

/* ---- Footer ------------------------------------------ */

footer {
  background: var(--header-bg);
  color: var(--header-text);
  text-align: center;
  padding: 1.5rem;
  font-size: 0.82rem;
  border-top: 3px solid var(--border-color);
  margin-top: 3rem;
  font-family: 'Trebuchet MS', Arial, sans-serif;
  letter-spacing: 0.05em;
}

/* ---- Responsive -------------------------------------- */

@media (max-width: 800px) {
  .menu-toggle {
    display: block;
  }

  .top-nav {
    display: none;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .page-wrapper {
    flex-direction: column;
  }

  /* Sidebar hidden by default on mobile; shown as dropdown when toggled */
  .sidebar {
    display: none;
    width: 100%;
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 2px solid var(--border-color);
    z-index: 100;
  }

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

  .content {
    padding: 1.5rem;
  }

  .img-right,
  .img-left {
    float: none;
    max-width: 100%;
    margin: 1rem 0;
  }

  .chapter-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .chapter-header h1 {
    font-size: 1.7rem;
  }
}
