/* ============================================================
   Niles Historical Society — style.css
   ============================================================ */

/* === Custom Properties === */
:root {
  --navy:          #1c2b3a;
  --navy-light:    #253545;
  --navy-dark:     #141f2a;
  --burgundy:      #8b2635;
  --burgundy-light:#a83042;
  --bg:            #ffffff;
  --bg-warm:       #f8f6f2;
  --text:          #1a1a1a;
  --text-muted:    #5a5a5a;
  --text-light:    #888;
  --border:        #e5e2dd;
  --border-light:  #f0ede9;
  --font:          "Helvetica Neue", Arial, sans-serif;
  --max-width:     1200px;
  --radius:        4px;
  --shadow:        0 1px 3px rgba(0,0,0,0.09), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:     0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.14);
  --transition:    0.18s ease;
}

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

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

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--burgundy);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

address {
  font-style: normal;
}

ul, ol {
  list-style: none;
}

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

.section {
  padding: 64px 0;
}

.section--warm {
  background: var(--bg-warm);
}

/* === Site Header === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  flex-shrink: 0;
}

.site-logo img {
  height: 38px;
  width: auto;
  border-radius: 2px;
  object-fit: cover;
  flex-shrink: 0;
}

.site-name {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.site-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.site-subtitle {
  font-size: 0.68rem;
  opacity: 0.6;
  white-space: nowrap;
}

/* === Navigation === */
.site-nav ul {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.site-nav a {
  display: block;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 6px 9px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
}

.site-nav a:hover {
  color: #fff;
  background: rgba(255,255,255,0.12);
  text-decoration: none;
}

.site-nav a.nav-contact {
  background: var(--burgundy);
  color: #fff;
  padding: 6px 13px;
}

.site-nav a.nav-contact:hover {
  background: var(--burgundy-light);
  text-decoration: none;
}

/* === Mobile Nav Toggle === */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* === Main === */
#main {
  min-height: 60vh;
}

/* === Page Hero (generic) === */
.page-hero {
  background: var(--navy);
  color: #fff;
  padding: 48px 0 40px;
}

.page-hero .container {
  position: relative;
}

/* === Homepage Hero === */
.page-hero--home {
  background-image: linear-gradient(
    to bottom,
    rgba(28,43,58,0.72) 0%,
    rgba(28,43,58,0.88) 100%
  ), url('webpx/Housex.jpg');
  background-size: cover;
  background-position: center 30%;
  padding: 88px 0 72px;
  min-height: 400px;
  display: flex;
  align-items: center;
}

.hero-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 14px;
}

.hero-title {
  font-size: clamp(1.9rem, 4.5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 18px;
  letter-spacing: -0.01em;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.78);
  max-width: 520px;
  line-height: 1.65;
  margin-bottom: 0;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 30px;
}

/* === Article Header === */
.article-header {
  background: var(--navy);
  color: #fff;
  padding: 40px 0 32px;
}

.article-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  margin-bottom: 12px;
}

.article-breadcrumb a {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
}

.article-breadcrumb a:hover {
  color: #fff;
}

.article-breadcrumb .sep {
  opacity: 0.4;
}

.article-title {
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

/* === Buttons === */
.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  line-height: 1.3;
}

.btn-primary {
  background: var(--burgundy);
  color: #fff;
  border-color: var(--burgundy);
}

.btn-primary:hover {
  background: var(--burgundy-light);
  border-color: var(--burgundy-light);
  text-decoration: none;
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,0.45);
}

.btn-outline:hover {
  border-color: #fff;
  background: rgba(255,255,255,0.08);
  text-decoration: none;
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--burgundy);
  border-color: var(--burgundy);
}

.btn-ghost:hover {
  background: rgba(139,38,53,0.06);
  text-decoration: none;
}

/* === Section Headers === */
.section-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--burgundy);
  margin-bottom: 8px;
}

.section-title {
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

.section-header {
  margin-bottom: 36px;
}

/* === Stories Category Sections === */
.stories-category {
  margin-bottom: 48px;
}

.stories-category-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--navy);
  border-bottom: 2px solid var(--burgundy);
  padding-bottom: 8px;
  margin-bottom: 20px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* === Card Grid === */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}

.card-image {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--bg-warm);
  flex-shrink: 0;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card:hover .card-image img {
  transform: scale(1.04);
}

.card-body {
  padding: 12px 14px 14px;
  flex: 1;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin: 0;
}

/* === Homepage Sections === */
.home-intro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}

.home-intro-text {
  max-width: 540px;
}

.home-intro-text h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 16px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.home-intro-text p {
  color: var(--text-muted);
  margin-bottom: 14px;
  font-size: 0.975rem;
  line-height: 1.7;
}

.home-intro-text p:last-child {
  margin-bottom: 0;
}

.home-intro-image img {
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  height: 360px;
  object-fit: cover;
}

/* === Quick Links === */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.quick-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 16px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--navy);
  text-decoration: none;
  text-align: center;
  min-height: 64px;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.quick-link:hover {
  border-color: var(--burgundy);
  color: var(--burgundy);
  background: rgba(139,38,53,0.03);
  text-decoration: none;
}

/* === Events === */
.event-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.event-item {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
}

.event-item:last-child {
  border-bottom: none;
}

.event-item:nth-child(even) {
  background: var(--bg-warm);
}

.event-date {
  flex-shrink: 0;
  width: 90px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--burgundy);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding-top: 2px;
}

.event-info h3 {
  font-size: 0.975rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}

.event-info p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* === News Item === */
.news-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: flex-start;
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.news-item img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius);
}

.news-item h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

.news-item p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* === Membership Box === */
.membership-box {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.membership-box h3 {
  font-size: 1.3rem;
  font-weight: 700;
}

.membership-box p {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
}

.membership-tiers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.membership-tier {
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
}

.tier-level {
  font-size: 0.68rem;
  opacity: 0.65;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.tier-price {
  font-size: 1.15rem;
  font-weight: 700;
}

.membership-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* === Article Layout === */
.article-body {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.article-body p {
  margin-bottom: 1em;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
}

.article-body h1, .article-body h2, .article-body h3,
.article-body h4, .article-body h5 {
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
  margin: 1.5em 0 0.5em;
}

.article-body h1 { font-size: 1.6rem; }
.article-body h2 { font-size: 1.35rem; }
.article-body h3 { font-size: 1.1rem; }

.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

.article-body strong, .article-body b { font-weight: 600; }
.article-body em, .article-body i { font-style: italic; }

.article-body a {
  color: var(--burgundy);
  text-decoration: underline;
}

.article-body a:hover {
  color: var(--burgundy-light);
}

/* Legacy content tables from converted pages */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}

.article-body table td {
  vertical-align: top;
  padding: 10px 12px;
}

.article-body table img {
  max-width: 100%;
  height: auto;
  border-radius: 2px;
}

/* Suppress legacy font/presentational tags that converter may have missed */
.article-body font {
  font-size: inherit !important;
  font-family: inherit !important;
  color: inherit !important;
}

.article-body [bgcolor] { background: transparent !important; }
.article-body [color]   { color: inherit !important; }
.article-body [face]    { font-family: inherit !important; }

/* Center-aligned images from legacy content */
.article-body div[align="center"],
.article-body p[align="center"],
.article-body td[align="center"] {
  text-align: center;
}

/* Lightbox trigger links around images */
.article-body a[href$=".jpg"] img,
.article-body a[href$=".JPG"] img,
.article-body a[href$=".jpeg"] img {
  cursor: zoom-in;
}

/* === Lightbox === */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.93);
  padding: 20px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.lightbox-overlay.is-open {
  display: flex;
}

.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.5);
}

.lightbox-caption {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  margin-top: 14px;
  text-align: center;
  max-width: 640px;
  line-height: 1.5;
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 20px;
  background: rgba(255,255,255,0.12);
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 1.4rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  line-height: 1;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.22);
  color: #fff;
}

/* === Footer === */
.site-footer {
  background: var(--navy-dark);
  color: rgba(255,255,255,0.75);
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 24px 48px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 36px;
}

.site-footer h4 {
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.site-footer p {
  font-size: 0.85rem;
  margin-bottom: 6px;
  line-height: 1.65;
}

.site-footer address p {
  margin-bottom: 4px;
}

.site-footer a {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
}

.site-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-nav li {
  margin-bottom: 7px;
}

.footer-nav a {
  font-size: 0.85rem;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
}

.footer-bottom-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-bottom p {
  font-size: 0.77rem;
  color: rgba(255,255,255,0.35);
}

.footer-bottom a {
  color: rgba(255,255,255,0.4);
  font-size: 0.77rem;
}

.footer-bottom a:hover {
  color: rgba(255,255,255,0.7);
}

/* === Utility === */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }

/* === Responsive: Tablet === */
@media (max-width: 900px) {
  .home-intro-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .home-intro-image {
    order: -1;
  }

  .home-intro-image img {
    height: 280px;
  }
}

/* === Responsive: Mobile === */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--navy-light);
    padding: 12px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    z-index: 199;
  }

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

  .site-nav ul {
    flex-direction: column;
    gap: 0;
    padding: 0 12px;
  }

  .site-nav li {
    width: 100%;
  }

  .site-nav a {
    padding: 11px 14px;
    font-size: 0.9rem;
    border-radius: var(--radius);
    width: 100%;
  }

  .site-nav a.nav-contact {
    margin-top: 8px;
    display: block;
  }

  .page-hero--home {
    padding: 56px 0 48px;
    min-height: 300px;
    background-position: center 20%;
  }

  .section {
    padding: 44px 0;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .card-body {
    padding: 10px 12px 12px;
  }

  .membership-box {
    padding: 28px 20px;
  }

  .membership-tiers {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer-inner {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
    padding: 40px 24px 32px;
  }

  /* Stack content tables on mobile */
  .article-body table,
  .article-body tbody,
  .article-body tr,
  .article-body td {
    display: block;
    width: 100% !important;
  }

  .article-body td {
    padding: 8px 0 !important;
  }

  .news-item {
    grid-template-columns: 1fr;
  }

  .news-item img {
    width: 100%;
    height: 160px;
  }

  .event-item {
    flex-direction: column;
    gap: 6px;
    padding: 16px 20px;
  }

  .event-date {
    width: auto;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 0 16px;
  }

  .site-subtitle {
    display: none;
  }

  .container {
    padding: 0 16px;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

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

  .footer-inner {
    grid-template-columns: 1fr;
  }

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

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    text-align: center;
  }

  .article-body {
    padding: 32px 16px 48px;
  }
}

/* === Print === */
@media print {
  .site-header,
  .site-footer,
  .lightbox-overlay,
  .nav-toggle {
    display: none !important;
  }

  .article-body {
    padding: 0;
    max-width: 100%;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  a[href^="mailto"]::after,
  a[href^="tel"]::after {
    content: none;
  }
}
