/* ============================================================
   Heritage Family Roots — Main Stylesheet
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --cream:       #f5f0e8;
  --parchment:   #ede6d6;
  --warm-brown:  #6b4c2a;
  --gold:        #b8860b;
  --gold-light:  #d4a843;
  --olive:       #8b7355;
  --text-dark:   #3a2e1e;
  --text-mid:    #5c4a32;
  --text-light:  #8b7355;
  --white:       #ffffff;
  --border:      #d4c4a0;
  --shadow:      rgba(107, 76, 42, 0.15);
  --font-serif:  'Playfair Display', 'Georgia', serif;
  --font-body:   'Lato', 'Arial', sans-serif;
  --nav-height:  46px;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
  padding-top: var(--nav-height);
}

img { max-width: 100%; height: auto; display: block; }
a  { color: var(--warm-brown); text-decoration: none; }
a:hover { color: var(--gold); }

h1,h2,h3,h4 { font-family: var(--font-serif); color: var(--warm-brown); }

ul { list-style: none; }

/* ---------- Utility ---------- */
.container      { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.section-title  { font-size: clamp(1.6rem, 3vw, 2.2rem); text-align: center; margin-bottom: .5rem; }
.section-sub    { text-align: center; color: var(--text-light); margin-bottom: 2.5rem; font-style: italic; }
.btn            { display: inline-block; padding: .75rem 1.75rem; border-radius: 4px; font-family: var(--font-body); font-size: .95rem; cursor: pointer; transition: background .2s, color .2s, transform .15s; border: none; }
.btn:hover      { transform: translateY(-2px); }
.btn-primary    { background: var(--gold); color: var(--white); }
.btn-primary:hover { background: var(--warm-brown); color: var(--white); }
.btn-outline    { background: transparent; border: 2px solid var(--warm-brown); color: var(--warm-brown); }
.btn-outline:hover { background: var(--warm-brown); color: var(--white); }
.badge-construction { display: inline-block; background: var(--gold-light); color: var(--white); font-size: .7rem; padding: 2px 8px; border-radius: 20px; margin-left: .4rem; vertical-align: middle; font-family: var(--font-body); font-weight: 600; }

/* ============================================================
   NAVIGATION
   ============================================================ */
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: var(--warm-brown);
  height: var(--nav-height);
  box-shadow: 0 2px 8px var(--shadow);
}

.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%;
}

.nav-logo { display: flex; align-items: center; gap: .7rem; }
.nav-logo img { height: 44px; width: 44px; border-radius: 50%; object-fit: cover; }
.nav-logo-text { color: var(--white); font-family: var(--font-serif); font-size: 1.25rem; line-height: 1.2; }
.nav-logo-text span { display: block; font-size: .75rem; opacity: .8; font-style: italic; font-family: var(--font-body); }

.nav-links {
  display: flex; gap: .25rem; align-items: center;
}
.nav-links a {
  color: rgba(255,255,255,.85);
  padding: .5rem .85rem;
  border-radius: 4px;
  font-size: .9rem;
  transition: background .2s, color .2s;
}
.nav-links a:hover, .nav-links a.active { background: rgba(255,255,255,.15); color: var(--white); }

.nav-lang { display: flex; gap: .3rem; margin-left: .5rem; }
.lang-btn {
  background: transparent; border: 1px solid rgba(255,255,255,.4);
  color: rgba(255,255,255,.8); padding: 3px 10px; border-radius: 3px;
  font-size: .8rem; cursor: pointer; transition: background .2s;
}
.lang-btn:hover, .lang-btn.active { background: rgba(255,255,255,.2); color: var(--white); }

.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: .5rem; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--white); margin: 5px 0; border-radius: 2px; transition: transform .3s, opacity .3s; }

/* ============================================================
   HERO
   ============================================================ */
#hero {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 50%, #a5d6a7 100%);
  padding: 3rem 0 2.5rem;
  position: relative;
  overflow: hidden;
}
#hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23b8860b' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: .6;
}

.hero-inner {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center;
  position: relative;
}
.hero-eyebrow { font-size: .85rem; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); margin-bottom: .75rem; font-weight: 600; }
.hero-title { font-size: clamp(2rem, 4.5vw, 3.2rem); line-height: 1.2; margin-bottom: .5rem; }
.hero-title span { display: block; }
.hero-subtitle { font-style: italic; color: var(--text-light); margin-bottom: 2rem; font-size: 1.05rem; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Mini family tree preview */
.hero-tree { position: relative; }
.tree-preview {
  background: var(--white); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.5rem; box-shadow: 0 8px 32px var(--shadow);
}
.tree-row { display: flex; justify-content: center; gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap; }
.tree-node {
  background: var(--parchment); border: 1px solid var(--border); border-radius: 6px;
  padding: .4rem .9rem; font-size: .8rem; font-family: var(--font-serif); color: var(--text-mid);
  white-space: nowrap; box-shadow: 0 2px 4px var(--shadow);
}
.tree-connector { text-align: center; color: var(--border); font-size: 1.1rem; }

/* ============================================================
   STORIES & MEMORIES
   ============================================================ */
#stories { padding: 4rem 0; }

.stories-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.5rem;
}
.story-card {
  background: var(--white); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; box-shadow: 0 2px 10px var(--shadow); transition: transform .25s, box-shadow .25s;
}
.story-card:hover { transform: translateY(-5px); box-shadow: 0 10px 24px var(--shadow); }
.story-card-img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  background: linear-gradient(135deg, var(--parchment), var(--border));
}
.story-card-img-placeholder {
  width: 100%; aspect-ratio: 4/3;
  background: linear-gradient(135deg, #e8dcc8, #d4c4a0);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: var(--olive);
}
.story-card-body { padding: .85rem 1rem; }
.story-card-body h4 { font-size: .95rem; margin-bottom: .25rem; }
.story-card-body p { font-size: .82rem; color: var(--text-light); }

/* ============================================================
   TIMELINE HIGHLIGHTS
   ============================================================ */
#timeline { padding: 4rem 0; background: var(--parchment); }

.timeline-wrapper {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1.5rem;
}
.timeline-item {
  background: var(--white); border-radius: 10px; padding: 1.25rem;
  border-left: 4px solid var(--gold); box-shadow: 0 2px 10px var(--shadow);
}
.timeline-year { font-family: var(--font-serif); font-size: 1.8rem; color: var(--gold); line-height: 1; margin-bottom: .4rem; }
.timeline-event { font-weight: 700; font-size: .9rem; color: var(--warm-brown); margin-bottom: .3rem; }
.timeline-desc { font-size: .82rem; color: var(--text-light); }

/* ============================================================
   ANCESTRY BLOG (homepage teaser)
   ============================================================ */
#blog-teaser { padding: 4rem 0; }

.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.75rem; }
.blog-card {
  background: var(--white); border: 1px solid var(--border); border-radius: 10px;
  padding: 1.5rem; box-shadow: 0 2px 10px var(--shadow);
  transition: transform .25s, box-shadow .25s;
}
.blog-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px var(--shadow); }
.blog-category { font-size: .75rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--gold); font-weight: 700; margin-bottom: .5rem; }
.blog-card h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.blog-card p  { font-size: .85rem; color: var(--text-light); margin-bottom: .85rem; }
.blog-date    { font-size: .78rem; color: var(--border); }
.blog-actions { text-align: center; margin-top: 2.5rem; }

/* ============================================================
   PAGE HERO (inner pages)
   ============================================================ */
.page-hero {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  color: var(--text-dark); padding: .75rem 0 .35rem; text-align: center;
}
.page-hero h1 { color: var(--warm-brown); font-size: clamp(2.2rem, 4vw, 3.6rem); margin: 0; line-height: 1.05; }
.page-hero p  { color: var(--text-mid); font-style: italic; font-size: clamp(1rem, 1.8vw, 1.45rem); margin: 0; }
.breadcrumb   { font-size: .82rem; color: var(--text-light); margin-top: .2rem; }
.breadcrumb a { color: var(--gold); }
.breadcrumb a:hover { color: var(--warm-brown); }

#family-tree-page {
  margin-top: 0;
  padding-top: 0;
}


/* ============================================================
   UNDER CONSTRUCTION
   ============================================================ */
.construction-wrap {
  max-width: 600px; margin: 5rem auto; text-align: center; padding: 0 1.5rem;
}
.construction-icon { font-size: 5rem; margin-bottom: 1.5rem; }
.construction-wrap h2 { margin-bottom: 1rem; }
.construction-wrap p  { color: var(--text-light); margin-bottom: 2rem; }

/* ============================================================
   BLOG (full page)
   ============================================================ */
#blog-page { padding: 4rem 0; }
.blog-page-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 2.5rem; }
.blog-article {
  background: var(--white); border: 1px solid var(--border); border-radius: 10px;
  padding: 2rem; margin-bottom: 2rem; box-shadow: 0 2px 10px var(--shadow);
}
.blog-article h2 { font-size: 1.35rem; margin-bottom: .5rem; }
.blog-article .meta { font-size: .8rem; color: var(--text-light); margin-bottom: 1rem; }
.blog-article p { margin-bottom: 1rem; font-size: .95rem; color: var(--text-mid); }
.blog-article .read-more { color: var(--gold); font-weight: 600; font-size: .9rem; }
.sidebar-widget { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 1.5rem; margin-bottom: 1.5rem; }
.sidebar-widget h4 { margin-bottom: 1rem; font-size: 1rem; }
.sidebar-widget ul li { padding: .4rem 0; border-bottom: 1px solid var(--parchment); font-size: .88rem; }
.sidebar-widget ul li:last-child { border-bottom: none; }

/* ============================================================
   FAMILY TREE PAGE
   ============================================================ */
#family-tree-page { padding: 3rem 0; }

.tree-controls {
  background: var(--white); border: 1px solid var(--border); border-radius: 10px;
  padding: 1.5rem 2rem; margin-bottom: 2rem; display: flex; align-items: center;
  gap: 1rem; flex-wrap: wrap; box-shadow: 0 2px 10px var(--shadow);
}
.tree-title-input {
  flex: 1; min-width: 200px; padding: .6rem 1rem; border: 1px solid var(--border);
  border-radius: 6px; font-family: var(--font-serif); font-size: 1.05rem;
  color: var(--warm-brown); background: var(--cream);
}
.tree-title-input:focus { outline: 2px solid var(--gold); border-color: transparent; }

.tree-canvas {
  background: var(--white); border: 1px solid var(--border); border-radius: 10px;
  min-height: 500px; padding: 2rem; box-shadow: 0 2px 10px var(--shadow);
  overflow-x: auto;
}
.tree-display { display: flex; flex-direction: column; align-items: center; gap: 0; }
.tree-level { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 0; }

.tree-person {
  position: relative;
  background: var(--parchment); border: 2px solid var(--border); border-radius: 10px;
  padding: .85rem 1.1rem; min-width: 130px; text-align: center;
  box-shadow: 0 3px 10px var(--shadow); cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.tree-person:hover { border-color: var(--gold); box-shadow: 0 4px 16px var(--shadow); }
.tree-person.root { border-color: var(--gold); background: #fef9ec; }
.tree-person-name { font-family: var(--font-serif); font-size: .9rem; font-weight: 700; color: var(--warm-brown); }
.tree-person-dates { font-size: .72rem; color: var(--text-light); }
.tree-add-btn {
  display: block; margin: .5rem auto 0;
  background: var(--gold); color: var(--white); border: none; border-radius: 50%;
  width: 22px; height: 22px; cursor: pointer; font-size: 1rem; line-height: 22px;
  transition: background .2s;
}
.tree-add-btn:hover { background: var(--warm-brown); }

.tree-lines { display: flex; justify-content: center; height: 30px; position: relative; }
.tree-vline { width: 2px; background: var(--border); margin: 0 auto; height: 100%; }
.tree-hline { height: 2px; background: var(--border); align-self: center; flex: 1; }

.share-section {
  background: var(--white); border: 1px solid var(--border); border-radius: 10px;
  padding: 1.75rem 2rem; margin-top: 2rem; box-shadow: 0 2px 10px var(--shadow);
}
.share-section h3 { margin-bottom: .5rem; font-size: 1.15rem; }
.share-section p  { font-size: .88rem; color: var(--text-light); margin-bottom: 1.25rem; }
.share-form { display: flex; gap: .75rem; flex-wrap: wrap; }
.share-form input, .share-form select {
  flex: 1; min-width: 220px; padding: .6rem 1rem; border: 1px solid var(--border);
  border-radius: 6px; font-size: .9rem;
}
.share-form input:focus, .share-form select:focus { outline: 2px solid var(--gold); border-color: transparent; }
.share-note { font-size: .8rem; color: var(--text-light); margin-top: .5rem; font-style: italic; }

/* ============================================================
   CONTACT PAGE
   ============================================================ */
#contact-page { padding: 4rem 0; }

.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; }
.contact-info h2 { margin-bottom: 1rem; }
.contact-info p  { color: var(--text-mid); margin-bottom: 1.5rem; font-size: .95rem; }
.contact-detail { display: flex; align-items: flex-start; gap: .85rem; margin-bottom: 1.25rem; }
.contact-detail-icon { font-size: 1.4rem; margin-top: .1rem; }
.contact-detail-text strong { display: block; font-size: .85rem; color: var(--warm-brown); }
.contact-detail-text span  { font-size: .9rem; color: var(--text-mid); }
.contact-form { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 2rem; box-shadow: 0 2px 10px var(--shadow); }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: var(--warm-brown); margin-bottom: .4rem; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: .65rem 1rem; border: 1px solid var(--border); border-radius: 6px;
  font-family: var(--font-body); font-size: .9rem; background: var(--cream); color: var(--text-dark);
}
.form-group input:focus, .form-group textarea:focus { outline: 2px solid var(--gold); border-color: transparent; }
.form-group textarea { min-height: 120px; resize: vertical; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
#login-page { padding: 4rem 0; display: flex; justify-content: center; }
.auth-box {
  background: var(--white); border: 1px solid var(--border); border-radius: 12px;
  padding: 2.5rem; width: 100%; max-width: 440px; box-shadow: 0 8px 32px var(--shadow);
}
.auth-box .auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-box .auth-logo h2 { font-size: 1.5rem; }
.auth-box .auth-logo p  { font-size: .85rem; color: var(--text-light); }
.auth-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 2rem; }
.auth-tab {
  flex: 1; padding: .75rem; text-align: center; cursor: pointer;
  font-weight: 600; font-size: .9rem; color: var(--text-light);
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .2s;
}
.auth-tab.active { color: var(--warm-brown); border-bottom-color: var(--warm-brown); }
.auth-pane { display: none; }
.auth-pane.active { display: block; }
.auth-divider { text-align: center; color: var(--text-light); font-size: .82rem; margin: 1.25rem 0; position: relative; }
.auth-divider::before, .auth-divider::after { content: ''; position: absolute; top: 50%; width: 42%; height: 1px; background: var(--border); }
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }
.terms-check { font-size: .82rem; color: var(--text-mid); }
.terms-check a { color: var(--gold); font-weight: 600; }
.forgot-link { font-size: .82rem; color: var(--gold); float: right; }

/* ============================================================
   TERMS PAGE
   ============================================================ */
#terms-page { padding: 4rem 0; }
.terms-box {
  background: var(--white); border: 1px solid var(--border); border-radius: 10px;
  padding: 2.5rem; box-shadow: 0 2px 10px var(--shadow); max-width: 860px; margin: 0 auto;
}
.terms-box h1 { font-size: 1.8rem; margin-bottom: .5rem; }
.terms-box .updated { font-size: .82rem; color: var(--text-light); margin-bottom: 2rem; }
.terms-box h2 { font-size: 1.15rem; margin: 2rem 0 .75rem; color: var(--warm-brown); }
.terms-box p  { font-size: .9rem; color: var(--text-mid); margin-bottom: .9rem; line-height: 1.7; }

/* ============================================================
   PRIVACY PAGE
   ============================================================ */
#privacy-page { padding: 4rem 0; }
.privacy-box {
  background: var(--white); border: 1px solid var(--border); border-radius: 10px;
  padding: 2.5rem; box-shadow: 0 2px 10px var(--shadow); max-width: 860px; margin: 0 auto;
}
.privacy-box h1 { font-size: 1.8rem; margin-bottom: .5rem; }
.privacy-box .updated { font-size: .82rem; color: var(--text-light); margin-bottom: 2rem; }
.privacy-box h2 { font-size: 1.15rem; margin: 2rem 0 .75rem; }
.privacy-box p  { font-size: .9rem; color: var(--text-mid); margin-bottom: .9rem; line-height: 1.7; }
.privacy-box ul { margin: .5rem 0 1rem 1.5rem; }
.privacy-box ul li { font-size: .9rem; color: var(--text-mid); margin-bottom: .4rem; list-style: disc; }

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  background: #d4edda; color: #000080;
  padding: 3.5rem 0 1.5rem;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 2.5rem; margin-bottom: 2.5rem; }
.footer-brand h3 { color: #000080; font-size: 1.2rem; margin-bottom: .5rem; }
.footer-brand p  { font-size: .85rem; line-height: 1.7; }
footer h4 { color: #000080; font-size: .95rem; margin-bottom: 1rem; letter-spacing: .5px; }
footer ul li { margin-bottom: .5rem; }
footer ul li a { color: #000080; font-size: .88rem; transition: color .2s; }
footer ul li a:hover { color: #000080; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.15); padding-top: 1.25rem;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem;
}
.footer-bottom p { font-size: .82rem; color: #000080; }
.footer-bottom-links { display: flex; gap: 1.25rem; }
.footer-bottom-links a { font-size: .82rem; color: #000080; }
.footer-bottom-links a:hover { color: #000080; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 2000; align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white); border-radius: 12px; padding: 2rem;
  max-width: 500px; width: 100%; box-shadow: 0 16px 48px rgba(0,0,0,.25);
  position: relative;
}
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-light);
}
.modal h3 { margin-bottom: 1rem; }
.modal p  { font-size: .9rem; color: var(--text-mid); margin-bottom: 1.25rem; }

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
#toast {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 3000;
  background: var(--warm-brown); color: var(--white);
  padding: .85rem 1.5rem; border-radius: 8px; font-size: .9rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  transform: translateY(100px); opacity: 0;
  transition: transform .35s, opacity .35s;
}
#toast.show { transform: translateY(0); opacity: 1; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .hero-inner        { grid-template-columns: 1fr; }
  .hero-tree         { display: none; }
  .blog-page-grid    { grid-template-columns: 1fr; }
  .contact-grid      { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: rgba(107, 76, 42, 0.98);
    padding: .5rem 1rem 1rem;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 12px 24px rgba(37, 24, 12, 0.2);
    z-index: 1100;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    display: block; width: 100%; padding: .8rem 0.5rem; font-size: .95rem;
  }
  .nav-lang { display: none; }
  .nav-toggle { display: block; }

  .nav-inner { position: relative; flex-wrap: wrap; height: auto; padding: .75rem 0; }
  #navbar     { height: auto; position: sticky; top: 0; }

  .tree-controls { flex-direction: column; align-items: stretch; }
  .share-form    { flex-direction: column; }
}

@media (max-width: 480px) {
  .hero-actions { flex-direction: column; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .auth-box { padding: 1.75rem 1.25rem; }
}
