:root {
  --ink: #1e1d1a;
  --ink-soft: #4c4a44;
  --paper: #faf7f1;
  --paper-soft: #f1ece1;
  --rule: #ddd6c5;
  --accent: #7d4a1e;        /* sienna brown */
  --accent-soft: #c89262;
  --link: #3a5a40;          /* forest */
  --link-hover: #1b3a23;
  --shadow: 0 8px 28px rgba(0,0,0,.08);
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

a { color: var(--link); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .15s; }
a:hover { color: var(--link-hover); border-bottom-color: var(--accent-soft); }

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

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 680px; }

/* ---------- HEADER ---------- */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding: 1rem 0;
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(140%) blur(4px);
  background: rgba(250,247,241,.92);
}
.site-header .wrap { display: block; }
.primary-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: .4rem;
  font-size: .92rem;
}
.primary-nav .search { margin-left: .25rem; display: inline-flex; }
.primary-nav a {
  color: var(--ink);
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .35rem .85rem;
  white-space: nowrap;
  line-height: 1.2;
  transition: background .15s, color .15s, border-color .15s;
}
.primary-nav a:hover {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
.search { margin: 0; }
.search input { padding: .4rem .8rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper-soft); font-size: .9rem; min-width: 11rem; }

@media (max-width: 1000px) {
  .primary-nav { font-size: .88rem; }
}

/* ---------- HERO ---------- */
.hero {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(200,146,98,.18), transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(58,90,64,.15), transparent 60%),
    var(--paper-soft);
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--rule);
}
.hero h1 { font-family: var(--serif); font-size: clamp(2.6rem, 5vw, 4rem); margin: 0 0 .5rem; font-weight: 600; }
.hero-tagline { font-family: var(--serif); font-style: italic; font-size: 1.4rem; color: var(--ink-soft); margin: 0 0 1.5rem; }
.hero-intro { font-size: 1.1rem; max-width: 56ch; color: var(--ink-soft); }
.hero-intro p { margin: 0 0 .9rem; }

.hero { padding-bottom: 2rem; }
.hero-layout {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title doors"
    "intro intro";
  column-gap: 2.5rem;
  row-gap: 1.5rem;
  align-items: center;
}
.hero-title { grid-area: title; align-self: center; }
.hero-title h1 { margin: 0 0 .5rem; }
.doors-frame { grid-area: doors; justify-self: end; margin: 0; max-width: 480px; width: 100%; }
.hero-intro {
  grid-area: intro;
  text-align: center;
  margin: 1rem auto 0;
  max-width: 68ch;
  font-size: 1.05rem;
  color: var(--ink-soft);
}
.hero-intro p { margin: 0 0 .6rem; }

@media (max-width: 800px) {
  .hero-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "title" "doors" "intro";
    text-align: center;
  }
  .doors-frame { justify-self: center; max-width: 100%; }
}

/* Three-doors image with clickable overlays */
.doors-frame {
  position: relative;
  display: block;
  margin: 2.5rem auto 0;
  max-width: 900px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow);
  line-height: 0;
}
.doors-img {
  width: 100%;
  height: auto;
  display: block;
}
.door-link {
  position: absolute;
  border: none;
  border-radius: 4px;
  transition: box-shadow .25s ease, transform .25s ease, background .25s ease;
  /* placement is percentage-based so it scales with the image */
  top: 8%;
  height: 84%;
  width: 18%;
}
.door-link::after {
  content: attr(title);
  position: absolute;
  left: 50%;
  bottom: -2.2rem;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: .2rem .6rem;
  border-radius: 3px;
  font-size: .8rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, bottom .2s;
}
.door-link:hover::after { opacity: 1; bottom: -2.6rem; }

/* Blue and red are placeholders until they get wired up */
.door-blue  { left: 14%; }
.door-green { left: 41%; }
.door-red   { left: 68%; }

.door-link:hover {
  box-shadow: 0 0 0 3px rgba(255, 217, 138, .55), 0 14px 26px rgba(0,0,0,.25);
  transform: translateY(-2px);
}
.door-green:hover {
  box-shadow: 0 0 0 3px rgba(70, 208, 119, .85), 0 18px 32px rgba(31,142,76,.45);
}
/* mute the placeholder doors slightly */
.door-blue, .door-red { cursor: not-allowed; }
.door-green { cursor: pointer; }

/* ---------- SECTIONS ---------- */
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; color: var(--ink); line-height: 1.15; }
.section-cards { padding: 3rem 1.25rem; }
.section-cards h2,
.latest h2,
.latest-photos h2 { font-size: 1.5rem; margin: 0 0 1.25rem; color: var(--ink-soft); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; font-family: var(--sans); font-size: .85rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.section-card {
  display: block; padding: 2rem 1.25rem; text-align: center;
  background: var(--paper-soft); border: 1px solid var(--rule); border-radius: 6px;
  color: var(--ink); border-bottom: 1px solid var(--rule);
  transition: transform .15s, box-shadow .15s;
}
.section-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent-soft); }
.section-card h3 { margin: 0; font-size: 1.3rem; }

/* ---------- POST GRID ---------- */
.latest, .latest-photos { padding: 3rem 1.25rem; }
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
}
.post-card {
  display: flex; flex-direction: column;
  background: var(--paper-soft); border-radius: 6px; overflow: hidden;
  border: 1px solid var(--rule);
  transition: transform .15s, box-shadow .15s;
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.post-card img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.post-card h3 { margin: .9rem 1rem .25rem; font-size: 1.3rem; }
.post-card h3 a { color: var(--ink); border: none; }
.post-card h3 a:hover { color: var(--accent); }
.post-card p { margin: 0 1rem .9rem; color: var(--ink-soft); font-size: .95rem; }
.post-card .meta { color: var(--ink-soft); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- PHOTO STRIP / GRID ---------- */
.photo-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .5rem;
}
.photo-strip a { border: none; }
.photo-strip img { aspect-ratio: 1; object-fit: cover; border-radius: 4px; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.photo-grid figure { margin: 0; }
.photo-grid img { aspect-ratio: 1; object-fit: cover; border-radius: 4px; }
.photo-grid figcaption { font-size: .85rem; color: var(--ink-soft); margin-top: .35rem; }

/* ---------- ALBUM GRID ---------- */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}
.album-card {
  display: block; background: var(--paper-soft); border: 1px solid var(--rule); border-radius: 6px;
  overflow: hidden; color: var(--ink); border-bottom-color: var(--rule);
  transition: transform .15s, box-shadow .15s;
}
.album-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.album-card img { aspect-ratio: 4 / 3; object-fit: cover; }
.album-card .no-cover { aspect-ratio: 4/3; display: grid; place-items: center; background: var(--paper); color: var(--ink-soft); }
.album-card h3 { margin: .7rem 1rem .25rem; font-size: 1.2rem; }
.album-card .meta { margin: 0 1rem .8rem; color: var(--ink-soft); font-size: .85rem; }

/* ---------- SINGLE POST ---------- */
.single-post { padding: 2.5rem 1.25rem; max-width: 760px; }
.single-post .crumbs { color: var(--ink-soft); font-size: .85rem; margin: 0 0 1rem; }
.single-post h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin: 0 0 .5rem; }
.single-post .meta { color: var(--ink-soft); font-size: .85rem; margin: 0 0 2rem; }
.single-post .cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; margin-bottom: 2rem; }
.prose { font-size: 1.1rem; line-height: 1.7; }
.prose p { margin: 0 0 1.2rem; }
.prose h2 { margin: 2rem 0 .8rem; font-size: 1.6rem; }
.prose h3 { margin: 1.5rem 0 .6rem; font-size: 1.3rem; }
.prose img { margin: 1.5rem 0; border-radius: 4px; }
.prose blockquote { border-left: 3px solid var(--accent-soft); padding-left: 1.25rem; margin: 1.5rem 0; color: var(--ink-soft); font-style: italic; }
.prose code { background: var(--paper-soft); padding: .1em .35em; border-radius: 3px; font-family: var(--mono); font-size: .9em; }
.prose pre { background: var(--paper-soft); padding: 1rem; border-radius: 6px; overflow-x: auto; }

/* ---------- SECTION PAGE ---------- */
.section-page { padding: 2.5rem 1.25rem; }
.section-page h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin: 0 0 1rem; }
.section-intro { color: var(--ink-soft); max-width: 60ch; margin: 0 0 2.5rem; font-size: 1.05rem; }

/* ---------- TIMELINE ---------- */
.timeline-page { padding: 2.5rem 1.25rem; max-width: 800px; }
.timeline-page .lead { color: var(--ink-soft); margin: 0 0 2rem; }
.year-header { font-size: 2.2rem; margin: 2.5rem 0 .5rem; color: var(--accent); border-bottom: 2px solid var(--accent-soft); padding-bottom: .25rem; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--rule); padding-left: 1.5rem; }
.tl-event { margin: 0 0 2rem; position: relative; }
.tl-event::before { content: ''; position: absolute; left: -1.85rem; top: .4rem; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--paper); }
.tl-date { font-size: .85rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .25rem; }
.tl-body h3 { margin: 0 0 .25rem; font-size: 1.2rem; }
.tl-body p { margin: 0 0 .5rem; }
.tl-body img { max-width: 320px; border-radius: 4px; margin-top: .5rem; }

/* ---------- ANCESTRY ---------- */
.ancestry-page { padding: 2.5rem 1.25rem; }
.family-split { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; margin: 2rem 0; }
@media (max-width: 700px) { .family-split { grid-template-columns: 1fr; } }
.family-col { background: var(--paper-soft); padding: 1.5rem; border-radius: 6px; border: 1px solid var(--rule); }
.family-col h2 { margin: 0 0 1rem; font-size: 1.6rem; }
.family-col h2 a { color: var(--ink); border: none; }
.family-col h3 { margin: 1.5rem 0 .5rem; font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.post-list, .people-list { list-style: none; padding: 0; margin: 0; }
.post-list li, .people-list li { padding: .35rem 0; border-bottom: 1px dotted var(--rule); }
.people-list .dates { color: var(--ink-soft); font-size: .85rem; }
.people-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.people-table th, .people-table td { padding: .5rem .8rem; text-align: left; border-bottom: 1px solid var(--rule); }
.people-table th { background: var(--paper-soft); font-weight: 600; }

/* ---------- FORMS ---------- */
.form-stack { display: flex; flex-direction: column; gap: 1rem; max-width: 720px; }
.form-stack label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--ink-soft); }
.form-stack label.inline { flex-direction: row; align-items: center; gap: .5rem; }
.form-stack input, .form-stack select, .form-stack textarea {
  padding: .55rem .7rem; border: 1px solid var(--rule); border-radius: 4px;
  background: var(--paper); font: inherit; color: var(--ink);
}
.form-stack textarea { font-family: var(--mono); font-size: .95rem; }
.form-stack .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.form-stack button, .btn {
  display: inline-block; padding: .55rem 1.25rem; border-radius: 4px; border: none;
  background: var(--accent); color: white; font: inherit; cursor: pointer;
  text-decoration: none; border-bottom: none;
}
.form-stack button:hover, .btn:hover { background: var(--link); color: white; border-bottom: none; }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
.btn-danger { background: #8b2a1e; }
.btn-danger:hover { background: #5a1a12; }

.big-search { display: flex; gap: .5rem; margin: 1.5rem 0; }
.big-search input { flex: 1; padding: .75rem 1rem; font-size: 1.1rem; border: 1px solid var(--rule); border-radius: 4px; }

/* ---------- FLASH ---------- */
.flashes { padding: .75rem 1.25rem; }
.flash { padding: .5rem .9rem; border-radius: 4px; margin: .25rem 0; font-size: .9rem; border: 1px solid var(--rule); }
.flash-success { background: #e8f5e8; border-color: #6b9e6b; color: #1c3d1c; }
.flash-error   { background: #fbe7e3; border-color: #c97262; color: #5a1a12; }
.flash-info    { background: #eef1f7; border-color: #7a8db0; color: #2d3a55; }

/* ---------- FOOTER ---------- */
.site-footer { border-top: 1px solid var(--rule); padding: 2rem 0; margin-top: 4rem; background: var(--paper-soft); color: var(--ink-soft); font-size: .9rem; }
.site-footer p { margin: .25rem 0; }
.site-footer a { color: var(--ink-soft); }
.footer-admin { font-size: .8rem; }

/* ---------- MISC ---------- */
.empty { color: var(--ink-soft); font-style: italic; }
.meta { color: var(--ink-soft); font-size: .85rem; }
.crumbs { font-size: .85rem; color: var(--ink-soft); margin: 0 0 1rem; }
.lead { font-size: 1.1rem; color: var(--ink-soft); }

/* ---------- LIGHTBOX ---------- */
.lb-overlay {
  position: fixed; inset: 0; background: rgba(20,18,14,.92); display: grid; place-items: center;
  z-index: 999; padding: 2rem; cursor: zoom-out;
}
.lb-overlay img { max-width: 100%; max-height: 100%; box-shadow: var(--shadow); border-radius: 4px; }
.lb-close { position: absolute; top: 1rem; right: 1.5rem; color: white; font-size: 2rem; background: none; border: none; cursor: pointer; }

/* ---------- v2 additions: visibility badges, maps, mobile upload ---------- */
.vis-badge {
  display: inline-block; margin-left: .4rem; padding: .1rem .5rem;
  border-radius: 999px; font-size: .7rem; letter-spacing: .03em;
  background: #e7ddc8; color: #6b5636; border: 1px solid #d5c6a4;
  text-transform: uppercase; vertical-align: middle;
}

.photo-map, .trip-map {
  width: 100%; height: 520px; border-radius: 6px; border: 1px solid var(--rule);
  margin: 1.5rem 0; box-shadow: var(--shadow);
}
.map-page h1 { margin-bottom: .25rem; }

.quick-upload { padding: 2rem 1.25rem; }
.big-file-label {
  display: block; border: 2px dashed var(--rule); border-radius: 8px;
  background: var(--paper-soft); text-align: center; padding: 3rem 1rem;
  font-size: 1.1rem; color: var(--ink-soft); cursor: pointer;
}
.big-file-label input[type=file] { display: none; }
.big-btn { padding: 1rem !important; font-size: 1.2rem !important; }
.inline-form { display: inline; }
.inline-form input { padding: .25rem .5rem; border: 1px solid var(--rule); border-radius: 4px; }
