@import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap');

/*
 * Stylesheet for the U.S. Second Bureau front page
 *
 * This file defines the overall look and feel for the stamp landing page.
 * It uses a warm, neutral palette and classic typefaces to evoke an early
 * twentieth‑century aesthetic. The layout is responsive thanks to the
 * CSS grid, automatically adjusting the number of columns based on the
 * available screen width.
 */

/* Reset some basic elements to ensure a consistent foundation */
html,
body {
  margin: 0 auto;
  padding: 2rem 1rem;;
  font-family: Georgia, "Times New Roman", serif;
  background-color: #f9f8f5;
  color: #333;
  line-height: 1.5;
}  
body, h1, h2, h3, h4, h5, h6 {
  font-family: 'Open Sans', Arial, Helvetica, sans-serif;
}

/* Limit the width of the page content and center it */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Page header styling */
h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  text-align: center;
  color: #2e2e2e;
}

/* intro block styling — works for <p> and <div> */
.intro, p.intro {
  font-size: 1.1rem;
  margin: 0 0 1.5rem 0;
  max-width: 1200px;
  text-align: left;
}

a,
a:visited,
a:active,
a:focus {
  color: #1b8964; /* or your preferred link color */
  text-decoration: underline; /* optional, for clarity */
}

.site-header {
  background: #223366;
  color: #fff;
  padding: 0;
  margin: 0 0 2rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5em 1em;
}
.site-title {
  font-size: 1.7rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.03em;
}
.site-nav a {
  color: #fff;
  text-decoration: none;
  margin-left: 2em;
  font-size: 1.1rem;
  font-weight: 400;
  transition: color 0.2s;
}
.site-nav a:hover {
  color: #ffeb3b;
}
.site-header a,
.site-header a:visited,
.site-header a:active,
.site-header a:focus {
  color: #fff !important;
  text-decoration: none;
}
.site-header a:hover {
  color: #ffeb3b !important;
}
@media (max-width: 700px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5em;
  }
  .site-nav a {
    margin-left: 0;
    margin-right: 1.2em;
    font-size: 1rem;
  }
}

/* Flexbox container for the introduction section */
.intro-flex {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2rem;
}

/* Image styling within the introduction section */
.intro-img {
  max-width: 180px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Grid container for the stamps */
.stamp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.2rem;
  margin-top: 2rem;
}

/* Individual stamp card styling */
a.stamp-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #fff;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

a.stamp-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Ensure images fill the card width and maintain aspect ratio */
a.stamp-card img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background-color: #f0efeb;
}

/* Caption styling */
.stamp-caption {
  padding: 0.5rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: bold;
  background-color: #fdfcfa;
  width: 100%;
  box-sizing: border-box;
}

.census-group-a {
  background-color: #f9f9f2;
}
.census-group-b {
  background-color: #e6f0e6;
}
.census-group-start td {
  border-top: 3px solid #bbb !important;
}

/* Item gallery styles */
.item-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 2rem 0;
  justify-content: center;
}
.item-gallery img {
  width: 200px;
  height: 140px;
  object-fit: contain;     /* fit inside the box, may show background */
  background: #f0efeb;     /* optional: background for letterbox area */
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform 0.15s;
}
.item-gallery img:hover {
  transform: scale(1.07);
}
.gallery-item-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid #b7c9b7;
  border-radius: 14px;
  padding: 1em 1em 0.5em 1em;
  background: #f8faf7;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  margin-bottom: 0.5em;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0; top: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.85);
  align-items: center;
  justify-content: center;
}
.modal-content {
  display: block;
  max-width: 90vw;
  max-height: 90vh;
  margin: auto;
  border-radius: 8px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.25);
}
.close {
  position: absolute;
  top: 30px;
  right: 30px;
  font-size: 40px;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  z-index: 1001;
}

table.census-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  font-size: 0.9rem;
}
table.census-table th,
table.census-table td {
  border: 1px solid #ddd;
  padding: 0.5rem;
  text-align: left;
}
table.census-table th {
  background-color: #f0efeb;
  font-weight: bold;
}
/* Lightbox */
#lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  display: none;
  align-items: center; justify-content: center;
  z-index: 9999;
}
#lightbox.open { display: flex; }
#lightbox img {
  max-width: min(92vw, 1400px);
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
#lightbox .lb-close {
  position: absolute; top: 10px; right: 14px;
  font-size: 32px; line-height: 1;
  border: 0; background: transparent; color: #fff; cursor: pointer;
}

@media (max-width: 600px) {
  table.census-table {
    font-size: 0.8rem;
  }
}

/* Responsive adjustments for smaller screens */
@media (max-width: 600px) {
  h1 {
    font-size: 2rem;
  }
  p.intro {
    font-size: 1rem;
  }
  .stamp-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  a.stamp-card img {
    height: 160px;
  }
}

@media (max-width: 800px) {
  .intro-flex {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  .intro-img {
    max-width: 100%;
    margin: 0 auto;
    display: block;
  }
}

table, table td, table th {
  font-size: 0.80rem;
}

/* --- Stamp/Gallery additions from stamps.css --- */

:root {
  --card-bg: #ffffff;
  --border: #041f47;
  --radius: 8px;
  --shadow: 0 4px 10px rgba(0,0,0,0.04);
  --primary-color: #113d7c;
  --title-bar: #daeed0;
  --title-color: #151414;
  --secondary-color: #f9f9f9;
  --text-color: #333;
  --border-color: #ccc;
  --ui-font: 'Open Sans', system-ui,-apple-system,BlinkMacSystemFont,sans-serif;
      --gap: 16px;
      --max-width: 1200px;
  --stamp-box-bg: #f4f8ec;

}

/* prevent border/padding overflow math glitches */
* { box-sizing: border-box; }

/* centered, no gap, horizontal on wide screens; stacks on phones */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 300px)); /* fixed tracks */
  gap: 0;                               /* no space between boxes */
  justify-content: center;              /* center the tracks */
  width: min(1200px, 80vw);             /* cap at ~80% of page */
  margin: 0 auto;
}

/* stack on small screens */
@media (max-width: 600px) {
  .gallery {
    grid-template-columns: 1fr;
    width: 100%;
  }
}
.stamp-title {
  background: var(--title-bar);
  color: var(--title-color);
  width: 100%;
  text-align: center;
  padding: 8px 0;
  font-size: 0.95rem;
  font-weight: 400;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.01em;
}
.stamp-box {
  background: var(--stamp-box-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 1em 1em;
  padding: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
  justify-content: center;
  align-items: center;
  max-width: 300px;
  width: 95%;
}
.stamp-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.stamp-box img {
  max-width: 90%;
  max-height: 80%;
  height: auto;
  cursor: pointer;
  display: block;
  margin: 0 auto;
}
/* Lighthouse Modal Styles */


ul {
  margin-top: 0.1em;
  margin-bottom: 0.1em;
  padding-left: 1.8em;
}
li {
  margin-bottom: 0.1em;
  line-height: 1.2;
}

html {
  font-size: 18px;
}

@media (max-width: 600px) {
  html {
    font-size: 16px;
  }
}

@media (prefers-color-scheme: dark) {

  .stamp-box { background: #2a2f45; border-color: #3f4a7a; }
  .stamp-title {
    background: #4060ca;      /* a darker green, or pick what you like */
    color: #e1e6f0;           /* light text for contrast */
    border-bottom: 1px solid #3f4a7a;
  }
}
