/* ==========================================================================
   Gaffney & Cassidy Family Website — Global Stylesheet
   ========================================================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Base palette */
  --bg-warm: #f5f0e8;
  --bg-dark: #1a1a2e;
  --text-dark: #2c2c2c;
  --text-light: #e0d8c8;
  --text-muted: #666;
  --text-muted-light: #a0967e;

  /* Accent colors */
  --gold: #d4a017;
  --gold-light: #e8c859;
  --gold-dark: #a07a10;
  --link-color: #5a3e1b;
  --link-hover: #d4a017;

  /* Branch colors — Gaffney */
  --branch-john: #28a745;
  --branch-john-light: #d4edda;
  --branch-patrick: #ffc107;
  --branch-patrick-light: #fff3cd;
  --branch-andrew: #dc3545;
  --branch-andrew-light: #f8d7da;
  --branch-matthew: #17a2b8;
  --branch-matthew-light: #d1ecf1;
  --branch-gort: #17a2b8;
  --branch-hunt: #d63384;
  --branch-keash: #6f42c1;

  /* Branch colors — Cassidy */
  --branch-philip: #2563eb;
  --branch-philip-light: #dbeafe;
  --branch-peggy: #059669;
  --branch-peggy-light: #d1fae5;

  /* Era colors */
  --era-prefamine: #3A5A40;
  --era-famine: #8B0000;
  --era-postfamine: #2E4057;
  --era-landwar: #856404;
  --era-late: #4a4a4a;

  /* Map layer colors */
  --layer-ancient: #8b5cf6;
  --layer-griffiths: #f59e0b;
  --layer-family: #10b981;
  --layer-independence: #ef4444;
  --layer-emigration: #d97706;
  --layer-churches: #6c757d;

  /* Spacing */
  --nav-height: 60px;
  --content-max-width: 960px;
  --content-wide-max: 1200px;
  --section-padding: 3rem 2rem;

  /* Fonts */
  --font-heading: 'Cinzel', Georgia, 'Times New Roman', serif;
  --font-body: Georgia, 'Times New Roman', serif;
  --font-ui: Arial, Helvetica, sans-serif;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-medium: 0.3s ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 1rem);
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-dark);
  background: var(--bg-warm);
  min-height: 100vh;
}

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

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

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.3;
}

h1 {
  font-size: 2.2rem;
  color: var(--gold-dark);
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.6rem;
  color: var(--era-prefamine);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #ddd;
}

h3 {
  font-size: 1.25rem;
  color: #555;
  margin: 1.5rem 0 0.75rem;
}

h4 {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 1.2rem 0 0.5rem;
}

p {
  margin-bottom: 1rem;
}

.dark-theme h1 { color: var(--gold); }
.dark-theme h2 { color: var(--gold-light); border-bottom-color: #444; }
.dark-theme h3 { color: var(--text-muted-light); }

/* ---------- Navigation ---------- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.nav-brand-icon {
  flex-shrink: 0;
  display: inline-block;
  width: 18px;
  height: 28px;
  color: var(--gold);
  fill: var(--gold);
}
.nav-brand-icon svg {
  width: 100%;
  height: 100%;
  fill: var(--gold);
}

.nav-brand-text {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-light);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(212, 160, 23, 0.15);
  color: var(--gold);
}

/* Dropdown menus */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.nav-dropdown-toggle::after {
  content: '▾';
  font-size: 0.7rem;
  opacity: 0.7;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-dark);
  border: 1px solid #444;
  border-radius: 6px;
  padding: 0.4rem 0;
  min-width: 180px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 1rem;
  border-radius: 0;
}

/* Hamburger menu */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--gold);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

.nav-mobile-overlay {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-dark);
  z-index: 999;
  padding: 1.5rem;
  overflow-y: auto;
}

.nav-mobile-overlay.open {
  display: block;
}

.nav-mobile-overlay a {
  display: block;
  color: var(--text-light);
  font-family: var(--font-ui);
  font-size: 1.1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #333;
}

.nav-mobile-overlay a:hover {
  color: var(--gold);
}

.nav-mobile-overlay .mobile-section-label {
  color: var(--gold);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 1rem;
  padding-bottom: 0.25rem;
}

@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-hamburger { display: block; }
}

/* ---------- Main Content ---------- */
.page-body {
  margin-top: var(--nav-height);
}

.content-container {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--section-padding);
}

.content-wide {
  max-width: var(--content-wide-max);
  margin: 0 auto;
  padding: var(--section-padding);
}

/* ---------- Hero Section ---------- */
.hero {
  background: linear-gradient(135deg, #1a3a1a 0%, #2E4057 50%, #1a1a2e 100%);
  color: var(--text-light);
  padding: 4rem 2rem 3rem;
  text-align: center;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.hero .subtitle {
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: var(--text-muted-light);
  font-style: italic;
  margin-bottom: 1.5rem;
}

.hero .intro-text {
  max-width: 700px;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.8;
  color: #ccc;
}

/* ---------- Section Styling ---------- */
.section-break {
  border: none;
  border-top: 1px solid #ddd;
  margin: 3rem 0;
}

.dark-theme .section-break {
  border-top-color: #444;
}

.callout-box {
  background: #f9f6ef;
  border-left: 4px solid var(--gold);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 6px 6px 0;
}

.callout-box.green {
  background: #e8f5e9;
  border-left-color: var(--branch-john);
}

.callout-box.blue {
  background: #e3f2fd;
  border-left-color: var(--branch-philip);
}

.callout-box.red {
  background: #fce4ec;
  border-left-color: var(--era-famine);
}

.callout-box h4 {
  margin-top: 0;
  color: inherit;
}

.dark-theme .callout-box {
  background: rgba(212, 160, 23, 0.08);
  border-left-color: var(--gold);
}

/* ---------- Navigation Cards (Homepage) ---------- */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.nav-card {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text-dark);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  border-top: 4px solid var(--gold);
}

.nav-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  color: var(--text-dark);
}

.nav-card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.nav-card h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--gold-dark);
  margin: 0 0 0.5rem;
}

.nav-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ---------- Family Tree (Interactive) ---------- */
.tree-container {
  overflow-x: auto;
  padding: 1rem 0;
}

.person-card {
  display: inline-block;
  background: white;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0.25rem;
  max-width: 240px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  text-decoration: none;
  color: var(--text-dark);
}

.person-card:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  color: var(--text-dark);
}

.person-card .name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.person-card .dates {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.person-card .detail {
  font-size: 0.78rem;
  color: #888;
  margin-top: 0.25rem;
}

.person-card.gaffney-john { border-color: var(--branch-john); background: var(--branch-john-light); }
.person-card.gaffney-patrick { border-color: var(--branch-patrick); background: var(--branch-patrick-light); }
.person-card.gaffney-andrew { border-color: var(--branch-andrew); background: var(--branch-andrew-light); }
.person-card.gaffney-matthew { border-color: var(--branch-matthew); background: var(--branch-matthew-light); }
.person-card.cassidy-philip { border-color: var(--branch-philip); background: var(--branch-philip-light); }
.person-card.cassidy-peggy { border-color: var(--branch-peggy); background: var(--branch-peggy-light); }

/* ---------- Photo Figures ---------- */
.photo-figure {
  margin: 1.5rem 0;
  text-align: center;
}

.photo-figure img {
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  margin: 0 auto;
}

.photo-figure figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.5rem;
}

.photo-inline {
  float: right;
  max-width: 280px;
  margin: 0 0 1rem 1.5rem;
}

@media (max-width: 600px) {
  .photo-inline {
    float: none;
    max-width: 100%;
    margin: 1rem 0;
  }
}

/* ---------- Document Thumbnails ---------- */
.doc-thumbnail {
  display: inline-block;
  background: white;
  border: 1px solid #e0ddd5;
  border-radius: 8px;
  padding: 0.75rem;
  margin: 0.5rem;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  color: var(--text-dark);
  max-width: 200px;
  vertical-align: top;
}

.doc-thumbnail:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.doc-thumbnail img {
  width: 100%;
  max-width: 180px;
  height: 140px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #eee;
}

.doc-thumbnail .doc-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  line-height: 1.3;
}

.doc-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.5rem 0;
  justify-content: center;
}

.photo-figure.wide img {
  max-width: 100%;
  width: 100%;
}

.photo-figure.medium img {
  max-width: 600px;
  width: 100%;
}

/* ---------- Record Cards ---------- */
.record-card {
  background: white;
  border: 1px solid #e0ddd5;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.record-card h4 {
  margin-top: 0;
  color: var(--era-postfamine);
}

.record-card .record-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.record-card .record-significance {
  font-size: 0.9rem;
}

.record-card a {
  font-size: 0.85rem;
}

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

th {
  background: #3A5A40;
  color: white;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 0.7rem 1rem;
  text-align: left;
}

td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid #e0ddd5;
}

tr:nth-child(even) td {
  background: #faf8f3;
}

.dark-theme th { background: #333; }
.dark-theme td { border-bottom-color: #444; }
.dark-theme tr:nth-child(even) td { background: rgba(255,255,255,0.03); }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #ddd;
  margin-bottom: 2rem;
}

.tab-btn {
  font-family: var(--font-heading);
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.tab-btn:hover {
  color: var(--gold-dark);
}

.tab-btn.active {
  color: var(--gold-dark);
  border-bottom-color: var(--gold);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-dark);
  color: var(--text-muted-light);
  text-align: center;
  padding: 2rem;
  font-size: 0.85rem;
  margin-top: 3rem;
}

.site-footer a {
  color: var(--gold);
}

/* ---------- Utility Classes ---------- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 2rem; }

/* ---------- Persona Pages ---------- */
.persona-hero {
  background: linear-gradient(135deg, #1a3a1a 0%, #2E4057 50%, #1a1a2e 100%);
  color: var(--text-light);
  padding: 5rem 2rem 3rem;
  text-align: center;
  position: relative;
}

.persona-hero h1 {
  font-family: var(--font-heading);
  font-size: 2.6rem;
  color: var(--gold);
  margin-bottom: 0.25rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.persona-hero .persona-dates {
  font-size: 1.1rem;
  color: var(--text-muted-light);
  font-style: italic;
  margin-bottom: 0.75rem;
}

.persona-hero .persona-tagline {
  font-size: 1.15rem;
  color: #ccc;
  max-width: 600px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}

.persona-hero .persona-relation {
  display: inline-block;
  background: rgba(212, 160, 23, 0.2);
  border: 1px solid rgba(212, 160, 23, 0.4);
  padding: 0.4rem 1.2rem;
  border-radius: 20px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--gold-light);
  letter-spacing: 0.5px;
}

.persona-vitals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}

.vital-card {
  background: white;
  border: 1px solid #e0ddd5;
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
  border-top: 3px solid var(--gold);
}

.vital-card .vital-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.vital-card .vital-value {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--text-dark);
}

.persona-timeline {
  position: relative;
  padding-left: 2.5rem;
  margin: 2rem 0;
}

.persona-timeline::before {
  content: '';
  position: absolute;
  left: 0.75rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--gold), #ddd);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.75rem;
  padding-bottom: 0.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.05rem;
  top: 0.4rem;
  width: 10px;
  height: 10px;
  background: var(--gold);
  border-radius: 50%;
  border: 2px solid var(--bg-warm);
  z-index: 1;
}

.timeline-item.highlight::before {
  width: 14px;
  height: 14px;
  left: -2.15rem;
  background: var(--branch-john);
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

.timeline-year {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--gold-dark);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.timeline-event {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-dark);
}

.persona-back-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2rem 0;
}

.persona-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: white;
  border: 1px solid #e0ddd5;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--link-color);
  text-decoration: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.persona-back-link:hover {
  border-color: var(--gold);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  color: var(--gold-dark);
}

.persona-back-link::before {
  content: '\2190';
}

.persona-doc-strip {
  display: flex;
  overflow-x: auto;
  gap: 1rem;
  padding: 1rem 0;
  margin: 1.5rem 0;
}

.persona-doc-strip .doc-thumbnail {
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .persona-hero h1 { font-size: 2rem; }
  .persona-hero .persona-tagline { font-size: 1rem; }
  .persona-vitals { grid-template-columns: 1fr 1fr; }
}

/* ---------- Print Styles ---------- */
@media print {
  .site-nav, .site-footer, .nav-cards { display: none; }
  .page-body { margin-top: 0; }
  body { font-size: 12pt; }
}
