/* ==========================================================================
   San Francisco Memoirs (sanfranciscomemoirs.net)
   Modern Responsive Stylesheet - Preserving Original Index Page Aesthetic
   ========================================================================== */

:root {
  --bg-peach: #FFCC99;
  --bg-peach-light: #FFE0BF;
  --bg-brown: #663300;
  --bg-brown-dark: #4D2600;
  --bg-brown-deeper: #3A1C00;
  --text-brown: #663300;
  --text-body: #3D1F00;
  --accent-orange: #FF6600;
  --accent-orange-hover: #CC5200;
  --accent-maroon: #800000;
  --text-light: #FFCC99;
  --text-white: #FFFFFF;
  --border-brown: #663300;
  --border-peach: #FFCC99;
  --sidebar-width: 240px;
  --max-site-width: 1020px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-peach);
  color: var(--text-body);
  font-family: "Times New Roman", Times, Georgia, serif;
  line-height: 1.6;
  min-height: 100vh;
}

/* Links */
a {
  color: var(--accent-orange);
  text-decoration: underline;
  transition: color 0.15s ease;
}

a:visited {
  color: #7A3B00;
}

a:hover,
a:focus-visible {
  color: var(--accent-maroon);
}

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

/* ==========================================================================
   Site Shell & Layout (Matches Original index.html Sidebar + Main Content)
   ========================================================================== */

.site-wrapper {
  max-width: var(--max-site-width);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  background-color: var(--bg-peach);
  box-shadow: 0 0 24px rgba(77, 38, 0, 0.15);
}

/* Mobile Header Bar (Hidden on Desktop) */
.mobile-topbar {
  display: none;
  background-color: var(--bg-brown);
  color: var(--text-light);
  padding: 0.65rem 1rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--accent-orange);
  position: sticky;
  top: 0;
  z-index: 1001;
}

.mobile-topbar-title {
  color: var(--text-light);
  text-decoration: none;
  font-weight: bold;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
}

.mobile-topbar-title:visited,
.mobile-topbar-title:hover {
  color: var(--text-white);
}

.hamburger-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background-color: transparent;
  color: var(--text-light);
  border: 1px solid var(--text-light);
  border-radius: 4px;
  padding: 0.4rem 0.65rem;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hamburger-btn:hover,
.hamburger-btn:focus-visible {
  background-color: var(--accent-orange);
  color: var(--text-white);
  border-color: var(--accent-orange);
}

.hamburger-icon {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  width: 18px;
  height: 14px;
}

.hamburger-icon span {
  display: block;
  height: 2px;
  width: 100%;
  background-color: currentColor;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.hamburger-btn[aria-expanded="true"] .hamburger-icon span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.hamburger-btn[aria-expanded="true"] .hamburger-icon span:nth-child(2) {
  opacity: 0;
}

.hamburger-btn[aria-expanded="true"] .hamburger-icon span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ==========================================================================
   Left Sidebar Navigation
   ========================================================================== */

.site-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background-color: var(--bg-brown);
  color: var(--text-light);
  padding: 5.25rem 0.75rem 2rem;
  border-right: 2px solid var(--bg-brown-dark);
}

.sidebar-nav {
  position: sticky;
  top: 1.5rem;
}

.nav-list,
.subnav-list,
.subnav-level2 {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  margin-bottom: 0.2rem;
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 3px;
  transition: background-color 0.15s ease;
}

.nav-row:hover {
  background-color: var(--bg-brown-dark);
}

/* Recreates the original FrontPage Simple Arrow 4 button look cleanly */
.nav-link {
  display: flex;
  align-items: center;
  flex: 1;
  padding: 0.42rem 0.5rem;
  color: var(--text-light);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.92rem;
  font-weight: bold;
  text-decoration: none;
  line-height: 1.25;
  transition: color 0.15s ease;
}

.nav-link:visited {
  color: var(--text-light);
}

.nav-link::before {
  content: "\25B8"; /* Small right triangle arrow matching original button */
  display: inline-block;
  margin-right: 0.45rem;
  color: var(--accent-orange);
  font-size: 0.85em;
  transition: transform 0.15s ease, color 0.15s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--text-white);
}

.nav-link:hover::before {
  color: var(--text-white);
  transform: translateX(2px);
}

.nav-link:active,
.nav-link.active {
  color: var(--accent-orange);
}

.nav-link.active::before {
  color: var(--accent-orange);
}

/* Submenu Toggle Button */
.subnav-toggle {
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  line-height: 1;
  border-radius: 3px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.subnav-toggle:hover,
.subnav-toggle:focus-visible {
  color: var(--text-white);
  background-color: rgba(255, 255, 255, 0.1);
}

.subnav-toggle-icon {
  display: inline-block;
  transition: transform 0.2s ease;
}

.subnav-toggle[aria-expanded="true"] .subnav-toggle-icon {
  transform: rotate(180deg);
}

/* Indented Sub-navigation (Level 1 & Level 2) */
.subnav-list {
  display: none;
  margin: 0.15rem 0 0.4rem 0.85rem;
  padding-left: 0.55rem;
  border-left: 1px solid rgba(255, 204, 153, 0.35);
}

.nav-item.is-open > .subnav-list {
  display: block;
}

.subnav-item {
  margin-bottom: 0.12rem;
}

.subnav-link {
  display: block;
  padding: 0.28rem 0.45rem;
  color: var(--text-light);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  text-decoration: none;
  line-height: 1.3;
  border-radius: 3px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.subnav-link:visited {
  color: var(--text-light);
}

.subnav-link:hover,
.subnav-link:focus-visible {
  color: var(--text-white);
  background-color: var(--bg-brown-dark);
}

.subnav-link.active {
  color: var(--accent-orange);
  font-weight: bold;
  background-color: var(--bg-brown-deeper);
}

/* Level 2 Sub-navigation (e.g. under individual Books) */
.subnav-level2 {
  display: none;
  margin: 0.1rem 0 0.3rem 0.65rem;
  padding-left: 0.5rem;
  border-left: 1px dotted rgba(255, 204, 153, 0.3);
}

.subnav-item.is-open > .subnav-level2 {
  display: block;
}

.subnav-level2 .subnav-link {
  font-size: 0.78rem;
  padding: 0.22rem 0.4rem;
  opacity: 0.92;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */

.site-main {
  flex: 1;
  min-width: 0;
  padding: 1.25rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.site-banner {
  text-align: center;
  margin-bottom: 1.25rem;
}

.site-banner a {
  display: inline-block;
  text-decoration: none;
}

.site-banner img {
  width: 436px;
  max-width: 100%;
  height: auto;
  border: 0;
}

.page-content {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

/* Headings */
.page-title {
  text-align: center;
  color: var(--accent-orange);
  font-family: "Times New Roman", Times, Georgia, serif;
  font-size: 2.35rem;
  font-weight: bold;
  margin: 0.2rem 0 1rem;
  line-height: 1.15;
}

.page-subtitle {
  text-align: center;
  color: var(--text-brown);
  font-family: "Times New Roman", Times, Georgia, serif;
  font-size: 1.4rem;
  font-weight: bold;
  margin: -0.6rem 0 1.25rem;
}

.article-title {
  text-align: center;
  color: var(--text-brown);
  font-family: "Times New Roman", Times, Georgia, serif;
  font-size: 1.85rem;
  font-weight: bold;
  margin: 0.25rem 0 0.75rem;
  line-height: 1.25;
}

.article-byline {
  text-align: center;
  color: var(--text-brown);
  font-size: 1.15rem;
  margin: -0.4rem 0 1.2rem;
}

/* Content Typography */
.page-content p {
  margin: 0 0 1rem;
  font-size: 1.08rem;
  color: var(--text-body);
}

.intro-lead {
  font-weight: bold;
  color: var(--text-brown);
  margin-bottom: 1.15rem !important;
}

.drop-cap {
  font-size: 1.65em;
  font-weight: bold;
  color: var(--text-brown);
  line-height: 1;
}

.indent-para {
  text-indent: 2rem;
}

.signature {
  text-align: right;
  font-weight: bold;
  color: var(--text-brown);
  margin-top: 1rem;
}

.extract-credit {
  font-weight: bold;
  color: var(--text-brown);
  padding-top: 0.5rem;
}

hr.section-divider {
  border: 0;
  border-top: 1px solid var(--border-brown);
  margin: 1.5rem 0;
  opacity: 0.5;
}

/* Framed Figures & Historical Photos */
.photo-figure {
  margin: 1.25rem auto;
  text-align: center;
}

.photo-frame {
  display: inline-block;
  border: 2px solid var(--border-brown);
  background-color: var(--bg-brown);
  line-height: 0;
  box-shadow: 0 2px 8px rgba(102, 51, 0, 0.2);
}

.photo-frame-orange {
  border-color: var(--accent-orange);
}

.photo-caption {
  margin-top: 0.45rem;
  font-size: 0.98rem;
  color: var(--accent-orange);
  font-weight: bold;
  line-height: 1.4;
}

.photo-credit {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--text-brown);
}

/* Dark Brown Callout Boxes (used on About Us, Earthquake!, Testimonials, Stories) */
.brown-callout {
  background-color: var(--bg-brown);
  color: var(--text-light);
  border: 1px solid var(--border-brown);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem auto;
  border-radius: 2px;
}

.brown-callout p {
  color: var(--text-light);
}

.brown-callout a {
  color: var(--text-white);
  font-weight: bold;
}

.brown-callout a:visited {
  color: var(--text-light);
}

.brown-callout a:hover {
  color: var(--accent-orange);
}

/* Home Page Two-Column Feature Layout */
.home-hero {
  display: grid;
  grid-template-columns: minmax(220px, 308px) 1fr;
  gap: 2rem;
  align-items: start;
  margin: 1rem 0 1.5rem;
}

.home-cover-wrap {
  text-align: center;
}

.home-cover-wrap img {
  border: 1px solid var(--border-brown);
  box-shadow: 0 4px 12px rgba(77, 38, 0, 0.25);
}

.home-feature-text h2 {
  color: var(--accent-orange);
  font-size: 2rem;
  margin: 0 0 0.75rem;
}

.home-feature-text p {
  font-size: 1.12rem;
  color: #483526;
  margin-bottom: 1.1rem;
}

.home-cta-link {
  font-size: 1.35rem;
  font-weight: bold;
  display: inline-block;
  margin-top: 0.5rem;
}

/* Earthquake Page Layout */
.earthquake-top {
  display: grid;
  grid-template-columns: minmax(220px, 350px) 1fr;
  gap: 1.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.poem-block {
  color: var(--text-brown);
  font-weight: bold;
  font-size: 1.15rem;
  line-height: 1.75;
}

.poem-author {
  margin-top: 1rem;
  color: var(--accent-orange);
  font-style: italic;
  font-weight: bold;
}

.excerpts-box {
  max-width: 480px;
  text-align: center;
}

.excerpts-box h2 {
  color: var(--accent-orange);
  font-size: 1.75rem;
  margin: 0 0 0.75rem;
}

.excerpts-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.excerpts-links li {
  margin-bottom: 0.45rem;
  font-size: 1.15rem;
}

/* Stories Page Timeline List & Search Widget */
.search-box {
  max-width: 540px;
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-input-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.search-input-row label {
  font-weight: bold;
  color: var(--text-light);
  font-size: 1.05rem;
}

.search-input {
  flex: 1;
  min-width: 180px;
  padding: 0.45rem 0.65rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--border-peach);
  border-radius: 3px;
  background-color: var(--text-white);
  color: var(--text-body);
}

.search-buttons {
  display: flex;
  gap: 0.6rem;
}

.btn {
  padding: 0.4rem 0.9rem;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  border-radius: 3px;
  border: 1px solid var(--border-peach);
  background-color: var(--bg-peach);
  color: var(--text-brown);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn:hover,
.btn:focus-visible {
  background-color: var(--accent-orange);
  color: var(--text-white);
  border-color: var(--accent-orange);
}

.search-results {
  margin-top: 1rem;
  border-top: 1px solid rgba(255, 204, 153, 0.4);
  padding-top: 0.85rem;
  display: none;
}

.search-results.is-visible {
  display: block;
}

.search-results-count {
  font-size: 0.95rem;
  color: var(--text-light);
  margin-bottom: 0.65rem;
  font-weight: bold;
}

.search-result-item {
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px dotted rgba(255, 204, 153, 0.3);
}

.search-result-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.search-result-item a {
  color: var(--accent-orange) !important;
  font-size: 1.05rem;
  font-weight: bold;
}

.search-result-item a:hover {
  color: var(--text-white) !important;
}

.search-result-snippet {
  font-size: 0.92rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}

.stories-timeline {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
}

.stories-timeline li {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.55rem;
  font-size: 1.08rem;
  font-weight: bold;
}

.story-year {
  color: var(--text-brown);
  min-width: 3.2rem;
  flex-shrink: 0;
}

/* Books Index Table / Cards */
.books-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.25rem 0;
}

.book-row {
  display: grid;
  grid-template-columns: 1fr 140px;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 2px solid var(--border-brown);
  background-color: var(--bg-peach);
}

.book-row-title {
  text-align: center;
}

.book-row-cover {
  text-align: center;
}

/* Individual Book Showcase Page */
.book-showcase {
  display: grid;
  grid-template-columns: 110px 1fr;
  border: 2px solid var(--border-brown);
  background-color: var(--bg-peach);
  margin: 0.5rem 0 1.5rem;
}

.book-showcase-spine {
  background-color: var(--bg-brown);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 0.35rem;
}

.book-showcase-body {
  padding: 1.5rem;
  text-align: center;
}

.book-showcase-body.theme-brown {
  background-color: var(--bg-brown);
  color: var(--text-light);
}

.book-showcase-body.theme-brown p {
  color: var(--text-light);
}

.book-showcase-body.theme-green {
  background-color: #006633;
  color: var(--text-light);
}

.book-showcase-body.theme-green p {
  color: var(--text-light);
}

.book-showcase-spine.theme-green {
  background-color: #006633;
}

.book-series-heading {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.35rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.book-meta {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.95rem;
  margin-top: 1rem;
}

.book-publisher {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.05rem;
  font-weight: bold;
}

.book-subpages-links {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 204, 153, 0.35);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
}

.book-showcase-body:not(.theme-brown):not(.theme-green) .book-subpages-links {
  border-top-color: rgba(102, 51, 0, 0.25);
}

.book-subpages-links a {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border: 1px solid currentColor;
  border-radius: 3px;
  text-decoration: none;
  font-weight: bold;
}

.book-showcase-body.theme-brown .book-subpages-links a,
.book-showcase-body.theme-green .book-subpages-links a {
  color: var(--text-light);
}

.book-showcase-body.theme-brown .book-subpages-links a:hover,
.book-showcase-body.theme-green .book-subpages-links a:hover {
  background-color: var(--accent-orange);
  color: var(--text-white);
  border-color: var(--accent-orange);
}

/* Two-Column Lists (Illustrations) */
.two-col-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin: 1rem 0;
}

.two-col-list p {
  margin: 0;
  line-height: 1.65;
}

/* Then and Now Hub Links */
.then-now-links {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
  text-align: center;
}

.then-now-links li {
  margin-bottom: 0.75rem;
  font-size: 1.35rem;
  font-weight: bold;
}

/* Footer */
.site-footer {
  text-align: center;
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(102, 51, 0, 0.2);
  font-size: 0.85rem;
  color: var(--text-brown);
}

/* ==========================================================================
   Responsive Breakpoints (Tablet & Mobile Devices)
   ========================================================================== */

@media (max-width: 768px) {
  .site-wrapper {
    flex-direction: column;
  }

  .mobile-topbar {
    display: flex;
  }

  .site-sidebar {
    width: 100%;
    padding: 0.75rem 1rem 1.25rem;
    border-right: none;
    border-bottom: 2px solid var(--accent-orange);
    display: none;
  }

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

  .sidebar-nav {
    position: static;
  }

  .nav-link {
    font-size: 1rem;
    padding: 0.55rem 0.5rem;
  }

  .subnav-toggle {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }

  .subnav-link {
    font-size: 0.92rem;
    padding: 0.4rem 0.5rem;
  }

  .subnav-level2 .subnav-link {
    font-size: 0.86rem;
    padding: 0.35rem 0.5rem;
  }

  .site-main {
    padding: 1.25rem 1.15rem 1.75rem;
  }

  .home-hero,
  .earthquake-top {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .book-showcase {
    grid-template-columns: 1fr;
  }

  .book-showcase-spine {
    display: none;
  }

  .two-col-list {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 1.9rem;
  }

  .article-title {
    font-size: 1.5rem;
  }

  .book-row {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .stories-timeline li {
    flex-direction: column;
    gap: 0.15rem;
    margin-bottom: 0.85rem;
  }
}
