/* ============================================================================
   welty.css — The Welty Project shared design system (single source of truth)
   ----------------------------------------------------------------------------
   Linked on EVERY page by scripts/inject_seo.py. Define fonts, colours, the
   page background, and heading style HERE so the pages can't drift apart.

   Type system (settled 12 Jul 2026):
     • Body / running text ....... EB Garamond            → var(--font-body)
     • Headings / page titles .... Cormorant SC (sm-caps) → var(--font-display)
     • The interactive tree ONLY . Iowan Old Style        → var(--font-tree)
       (scoped to #chart — more legible for the small card details)

   When a page needs to override something, it can; but the shared defaults
   below are the canonical values every page should match.
   ============================================================================ */

:root{
  /* fonts */
  --font-body:'EB Garamond',Georgia,serif;
  --font-display:'Cormorant SC',Georgia,serif;
  --font-tree:"Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;

  /* core palette */
  --ink:#1c1a17;            /* body text */
  --muted:#6e6353;          /* secondary text */
  --crimson:#7a1f1f;        /* accent — links, page titles */
  --navy:#1e2a4a;           /* section headings */
  --gold:#b8912f;           /* rules / borders */
  --gold-bright:#d4af37;
  --rule:#cbb98d;
  --line:#c9bfae;
  --card:#fbf7ec;           /* card / panel background */

  /* page background */
  --parchment:#f5efe2;
  --parchment-deep:#ede4cf;

  /* ------------------------------------------------------------------
     Box-accent MEANING system (settled 13 Jul 2026)
     Every panel/card edge should signal WHAT it is, not decorate at
     random. Use these semantic names on box borders instead of raw
     colours, so the meaning is defined once, here.
       --accent-nav .... GOLD    → wayfinding: portal cards, "how this works"
       --accent-thesis . CRIMSON → the argument: thesis panels, the open
                                    question, and key ("big") finds
       --accent-cta .... NAVY    → DNA appeal / call-to-action
       --accent-quiet .. TAN     → ordinary journal entries & quiet asides
     ------------------------------------------------------------------ */
  --accent-nav:var(--gold);
  --accent-thesis:var(--crimson);
  --accent-cta:var(--navy);
  --accent-quiet:var(--rule);
}

/* ---- base typography + background -------------------------------------- */
*{box-sizing:border-box;}
body{
  font-family:var(--font-body);
  color:var(--ink);
  background:var(--parchment);
  background-image:radial-gradient(ellipse at 50% -10%,#fdf9ee 0%,#f5efe2 55%,#ede4cf 100%);
  margin:0;
  font-size:19px;
  line-height:1.55;
}

/* Page titles / headings use the Cormorant SC small-caps display face. */
h1,h2,h3{font-family:var(--font-display);}

/* Canonical page-title (hero) — crimson Cormorant SC, centred. */
.page-title,h1.hero{
  font-family:var(--font-display);
  font-weight:700;
  font-size:2.15rem;
  letter-spacing:.5px;
  color:var(--crimson);
  text-align:center;
  margin:0 0 4px;
}

/* ---- the interactive tree is the one deliberate exception -------------- */
/* Iowan Old Style only inside the tree canvas; everything else stays body. */
#chart{font-family:var(--font-tree);}

/* ============================================================================
   SITE-WIDE POLISH (added 13 Jul 2026)
   Small, purely-additive touches that make every page feel like one site.
   Nothing here changes page layout — it adds behaviours/states no page had:
   a brand-tinted text selection, one consistent keyboard-focus ring, and
   smooth in-page anchor scrolling (disabled for reduced-motion users).
   ============================================================================ */
html{scroll-behavior:smooth;}

::selection{background:rgba(184,145,47,.30);color:var(--ink);}   /* gold-tinted highlight */

/* One accessible focus ring everywhere, in the site's gold — replaces the
   browser's default blue so keyboard focus looks intentional and on-brand. */
:focus-visible{outline:2px solid var(--gold-bright);outline-offset:2px;border-radius:2px;}

@media (prefers-reduced-motion: reduce){
  html{scroll-behavior:auto;}
  *,*::before,*::after{
    animation-duration:.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
    scroll-behavior:auto !important;
  }
}

/* ============================================================================
   CROSS-PAGE MASTHEAD CONSISTENCY (added 13 Jul 2026)
   Moving between the non-home pages (Family Tree, Timeline, Family Papers, 404)
   used to feel jumpy: each set a different top gap below the shared 64px header
   and coloured its title crimson at a slightly different size. Fixed centrally
   here so it applies everywhere — including the regenerated tree page — instead
   of drifting per page. Specificity is raised just enough to win over each
   page's own inline rules; the home page (index) is deliberately untouched.

     • one consistent gap between the header and the first title
     • sub-page titles are ink-black — crimson stays reserved for the home page
   ============================================================================ */
body .wrap        { padding-top: 32px; }   /* all-families + timeline mastheads */
body main > .intro{ margin-top: 32px; }    /* family-papers archive intro       */

.wrap > h1,
body .intro h1,
body > .card > h1 {
  color: var(--ink); text-align: center;          /* black + centred */
  font-size: 2.15rem; letter-spacing: .5px;       /* ONE title size on every sub-page */
}

/* Keep the subtitle line under each masthead title centred too, so all three
   sub-pages share the same title + subtitle rhythm (not just the title). */
body .intro > .lede { text-align: center; }


/* ============================================================================
   INDEX / JOURNAL PAGE (theweltyproject.com/index.html)
   Migrated out of index.html's inline <style> 13 Jul 2026 so welty.css is the
   single source of truth. These selectors are used only by the journal page
   (portal cards, the finds feed, thesis/crux/dna panels, etc.). :root and body
   were merged into the shared blocks above and are NOT duplicated here.
   ============================================================================ */
  main { max-width: 880px; margin: 0 auto; padding: 0 20px 60px; }

  /* ---------- HOW THIS WORKS ---------- */
  details.howto {
    background: var(--card);
    border: 1px solid var(--rule);
    border-top: 4px solid var(--accent-nav);
    border-radius: 8px;
    padding: 4px 24px 18px;
    margin: 22px 0 10px;
    box-shadow: 0 1px 4px rgba(90,70,30,.08);
  }
  details.howto > summary {
    font-family: 'Cormorant SC', serif;
    font-size: 1.55rem; font-weight: 700; letter-spacing: .06em;
    color: var(--crimson);
    cursor: pointer; list-style: none;
    padding: 12px 0 6px;
  }
  details.howto > summary::-webkit-details-marker { display: none; }
  details.howto > summary::after { content: " \25B8"; color: var(--gold); font-size: 1rem; }
  details.howto[open] > summary::after { content: " \25BE"; }
  details.howto[open] > summary { border-bottom: 1px solid var(--rule); margin-bottom: 12px; }
  details.howto:not([open]) { padding-bottom: 8px; }
  /* ---------- DNA APPEAL ---------- */
  .dna-call {
    background: linear-gradient(180deg, #fbf7ec 0%, #f3ece0 100%);
    border: 1px solid var(--rule);
    border-top: 4px solid var(--accent-cta);
    border-radius: 8px;
    padding: 16px 24px 18px;
    margin: 20px 0 6px;
    box-shadow: 0 1px 4px rgba(30,42,74,.10);
  }
  .dna-call .dna-head {
    font-family: 'Cormorant SC', serif;
    font-size: 1.5rem; font-weight: 700; letter-spacing: .05em;
    color: var(--navy); margin-bottom: 8px;
  }
  .dna-call p { font-size: .92rem; line-height: 1.5; color: #3c3529; margin: 0 0 10px; }
  .dna-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
  .dna-btn {
    display: inline-block; text-decoration: none;
    font-family: 'EB Garamond',Georgia,serif; font-weight: 600; letter-spacing: .02em;
    font-size: .86rem; padding: 6px 14px; border-radius: 6px;
    background: var(--navy); color: #f3ead2; border: 1px solid var(--navy);
    transition: .15s;
  }
  .dna-btn:hover { background: #16203a; }
  .dna-btn.ghost { background: transparent; color: var(--navy); border-color: var(--rule); }
  .dna-btn.ghost:hover { background: #efe6cf; }
  .dna-note { font-size: .82rem; font-style: italic; color: var(--muted); margin: 12px 0 0; line-height: 1.45; }

  /* ---------- THE ONE OPEN QUESTION (crux) ---------- */
  .crux {
    background: linear-gradient(180deg, #fbf7ec 0%, #f3ece0 100%);
    border: 1px solid var(--rule);
    border-top: 4px solid var(--accent-thesis);
    border-radius: 8px;
    padding: 16px 24px 18px;
    margin: 20px 0 6px;
    box-shadow: 0 1px 4px rgba(122,31,31,.10);
  }
  .crux .crux-head {
    font-family: 'Cormorant SC', serif;
    font-size: 1.5rem; font-weight: 700; letter-spacing: .05em;
    color: var(--crimson); margin-bottom: 8px;
  }
  .crux p { font-size: .92rem; line-height: 1.5; color: #3c3529; margin: 0 0 10px; }
  .crux p.crux-tail { margin-bottom: 0; }
  .crux a { color: var(--crimson); font-weight: 600; border-bottom: 1px solid var(--rule); text-decoration: none; }
  .crux a:hover { color: #1c1a17; }

  /* ---------- THESIS + BIG DISCOVERY (lead) ---------- */
  .thesis {
    background: linear-gradient(180deg, #fdf7e6 0%, #f4ecd8 100%);
    border: 1px solid var(--rule);
    border-top: 4px solid var(--accent-thesis);
    border-radius: 8px;
    padding: 16px 24px 18px;
    margin: 22px 0 14px;
    box-shadow: 0 1px 4px rgba(184,145,47,.12);
  }
  .thesis .thesis-head {
    font-family: 'Cormorant SC', serif;
    font-size: 1.5rem; font-weight: 700; letter-spacing: .05em;
    color: var(--accent-thesis); margin-bottom: 8px;
  }
  .thesis p { font-size: .92rem; line-height: 1.5; color: #3c3529; margin: 0 0 10px; }
  .thesis p.thesis-tail { margin-bottom: 0; }
  .thesis a { color: var(--crimson); font-weight: 600; border-bottom: 1px solid var(--rule); text-decoration: none; }
  .thesis a:hover { color: #1c1a17; }

  .howto p { font-size: .92rem; line-height: 1.5; color: #3c3529; margin: 0 0 11px; }
  .howto p.verify {
    background: #fbf3e0;
    border-left: 3px solid var(--gold);
    padding: 9px 14px; border-radius: 4px;
    font-size: .95rem; margin: 4px 0 12px;
  }
  .howto p.verify b { color: var(--crimson); }
  .howto p.signoff { font-style: italic; color: var(--muted); margin-bottom: 2px; }


  /* ---------- HERO ---------- */
  header.hero {
    text-align: center;
    padding: 16px 16px 14px;
    background: linear-gradient(180deg, var(--navy) 0%, #16203a 100%);
    color: #efe6cf;
    border-bottom: 3px solid var(--gold);
    box-shadow: 0 2px 12px rgba(20,25,45,.3);
  }
  .crest-row {
    display: flex; align-items: center; justify-content: center;
    gap: clamp(14px, 4vw, 40px);
    flex-wrap: wrap;
  }
  .crest { text-align: center; }
  .crest img {
    width: 58px; height: auto;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.45));
  }
  .crest .place {
    font-family: 'Cormorant SC', serif;
    font-size: .8rem; font-weight: 600; letter-spacing: .06em;
    color: var(--gold-bright); margin-top: 2px;
  }
  .hero-title h1 {
    font-family: 'Cormorant SC', serif;
    font-size: clamp(1.7rem, 4vw, 2.3rem);
    font-weight: 700; letter-spacing: .04em;
    margin: 0; line-height: 1.1;
    color: #f3ead2;
    text-shadow: 0 2px 8px rgba(0,0,0,.5);
  }
  .hero-rule {
    width: 180px; margin: 8px auto 0; border: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
  }
  .hero-tag { font-size: .85rem; color: #b6ab8d; font-style: italic; margin-top: 5px; }

  /* ---------- ORNAMENT ---------- */
  .fleuron { text-align: center; color: var(--gold); font-size: 1.5rem; margin: 34px 0 6px; letter-spacing: .5em; }

  /* ---------- JOURNAL NOTE ---------- */
  .journal-note {
    background: var(--card);
    border: 1px solid var(--rule);
    border-left: 4px solid var(--accent-quiet);
    border-radius: 5px;
    padding: 10px 16px;
    margin: 0 0 16px;
    text-align: left;
    font-size: .88rem;
    line-height: 1.45;
    color: var(--ink);
  }
  .journal-note b { font-family: 'Cormorant SC', serif; letter-spacing: .04em; color: var(--crimson); font-size: .98rem; }
  .journal-note .quote { font-style: italic; color: var(--muted); margin: 3px 0 2px; }
  .journal-note .stamp { font-size: .8rem; color: var(--crimson); font-weight: 600; }

  /* ---------- SECTION HEADS ---------- */
  h2.section {
    font-family: 'Cormorant SC', serif;
    font-size: 1.9rem; font-weight: 700; letter-spacing: .08em;
    color: var(--navy); text-align: center;
    margin: 44px 0 4px;
  }
  h2.section + .sub { text-align: center; font-style: italic; color: var(--muted); margin: 0 0 24px; font-size: 1rem; }

  /* ---------- FINDS FEED ---------- */
  .feed { margin-top: 6px; }
  .feed-day { margin-bottom: 18px; }
  .feed-day .date {
    font-family: 'Cormorant SC', serif;
    font-weight: 700; font-size: 1.1rem; letter-spacing: .07em;
    color: var(--crimson);
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 6px;
  }
  .feed-day .date::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--rule), transparent); }
  .find {
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: 5px;
    padding: 6px 13px;
    margin-bottom: 5px;
    box-shadow: 0 1px 3px rgba(90,70,30,.06);
    border-left: 3px solid var(--accent-quiet);
    font-size: .9rem;
    line-height: 1.4;
  }
  .find.big { border-left-color: var(--accent-thesis); }
  .find .kicker {
    font-family: 'Cormorant SC', serif;
    font-weight: 700; letter-spacing: .04em; font-size: .98rem;
    color: var(--navy);
    display: inline;
  }
  .find.big .kicker { color: var(--crimson); }
  .find .kicker::after { content: " \2014 "; color: var(--gold); }
  .find p { margin: 0; display: inline; color: #3c3529; }

  /* ---------- CARDS ---------- */
  .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 12px; }
  a.card {
    display: block; background: var(--card);
    border: 1px solid var(--rule); border-top: 4px solid var(--accent-nav);
    border-radius: 8px; padding: 20px 24px;
    text-decoration: none; color: var(--ink);
    box-shadow: 0 2px 8px rgba(90,70,30,.10);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  }
  a.card:hover, a.card:focus {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(90,70,30,.18);
    border-top-color: var(--gold-bright);
  }
  a.card .title {
    font-family: 'Cormorant SC', serif;
    font-size: 1.35rem; font-weight: 700; letter-spacing: .04em;
    color: var(--navy); margin-bottom: 4px;
  }
  a.card .desc { font-size: .98rem; color: #55493a; line-height: 1.45; }

  /* ---------- LEDE (one-line hook under the crest strip) ---------- */
  .lede {
    max-width: 720px; margin: 26px auto 2px; text-align: center;
    font-family: 'EB Garamond',Georgia,serif; font-style: italic;
    font-size: 1.14rem; line-height: 1.5; color: #4a4234;
  }
  .lede b { font-style: normal; font-weight: 600; color: var(--crimson); }

  /* ---------- PORTAL CARDS (promoted navigation) ---------- */
  .portal-label {
    text-align: center; font-family: 'Cormorant SC', serif;
    font-size: .82rem; font-weight: 700; letter-spacing: .28em; text-transform: uppercase;
    color: var(--gold); margin: 22px 0 12px;
  }
  .cards.portals { grid-template-columns: repeat(auto-fit, minmax(184px, 1fr)); gap: 11px; margin-top: 0; }
  .cards.portals a.card {
    padding: 12px 15px 11px;
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, #fdfaf1 0%, #f6f0e1 100%);
    border-top-width: 3px; border-radius: 7px;
  }
  .cards.portals .eyebrow {
    font-family: 'EB Garamond',Georgia,serif;
    font-size: .6rem; letter-spacing: .2em; text-transform: uppercase;
    color: var(--gold); font-weight: 700; margin-bottom: 3px;
  }
  .cards.portals .title { margin-bottom: 3px; font-size: 1.08rem; }
  .cards.portals .desc { flex: 1 1 auto; font-size: .82rem; line-height: 1.34; }
  .cards.portals .go {
    margin-top: 9px; font-family: 'Cormorant SC', serif; font-weight: 700;
    letter-spacing: .04em; font-size: .82rem; color: var(--crimson);
    display: inline-flex; align-items: center; gap: 6px;
  }
  .cards.portals .go .arrow { transition: transform .15s ease; }
  .cards.portals a.card:hover .go .arrow,
  .cards.portals a.card:focus .go .arrow { transform: translateX(5px); }

  /* ---------- MERGED INTRO PANEL (short version + open question) ---------- */
  .thesis .subhead {
    font-family: 'Cormorant SC', serif;
    font-size: 1.12rem; font-weight: 700; letter-spacing: .04em;
    color: var(--crimson); margin: 16px 0 6px;
  }

  footer {
    text-align: center; font-size: .9rem; color: var(--muted);
    margin-top: 52px; padding-top: 20px;
    border-top: 1px solid var(--rule);
    line-height: 1.7;
  }
  footer .arms-note { font-style: italic; font-size: .84rem; }
  .contact-card { max-width: 520px; margin: 40px auto 0; padding: 16px 22px; text-align: center;
    background: var(--card); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 1px 4px rgba(60,45,20,.06); }
  .contact-card b { font-family: 'Cormorant SC', serif; color: var(--crimson); letter-spacing: .03em; font-size: 1.05rem; display: block; margin-bottom: 5px; }
  .contact-card a { color: var(--crimson); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--rule); }
  .contact-card a:hover { color: var(--ink); }

  /* ---------- STICKY HEADER ---------- */
  .wsite-hdr { position: sticky; top: 0; z-index: 50; }

  /* ---------- FEED CONTROLS ---------- */
  .feed-controls {
    display: flex; flex-wrap: wrap; align-items: center;
    justify-content: space-between; gap: 10px 16px;
    margin: 4px 0 18px;
  }
  .feed-jump { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); }
  .feed-jump label { font-style: italic; letter-spacing: .02em; }
  .feed-jump select {
    font-family: 'EB Garamond',Georgia,serif; font-size: .88rem; color: var(--ink);
    background: var(--card); border: 1px solid var(--rule); border-radius: 6px;
    padding: 5px 10px; cursor: pointer; max-width: 62vw;
  }
  .feed-jump select:hover { border-color: var(--gold); }
  .feed-expand { display: flex; gap: 6px; }
  .feed-expand button {
    font-family: 'EB Garamond',Georgia,serif; font-size: .8rem; font-weight: 600;
    color: var(--navy); background: var(--card); border: 1px solid var(--rule);
    border-radius: 6px; padding: 5px 12px; cursor: pointer; transition: .15s; letter-spacing: .02em;
  }
  .feed-expand button:hover { background: #efe6cf; border-color: var(--gold); }

  /* ---------- COLLAPSIBLE DAYS ---------- */
  .feed-day { scroll-margin-top: 78px; }
  .feed-day .date.toggle { cursor: pointer; user-select: none; }
  .feed-day .date.toggle::before {
    content: "\25BE"; color: var(--gold); font-size: .8em; margin-right: 4px;
    flex: 0 0 auto; transition: transform .15s;
  }
  .feed-day.collapsed .date.toggle::before { content: "\25B8"; }
  .feed-day .day-count {
    font-family: 'EB Garamond',Georgia,serif; font-weight: 400; font-style: normal;
    font-size: .68rem; letter-spacing: .05em; color: var(--muted);
    background: #efe6cf; border: 1px solid var(--rule); border-radius: 20px;
    padding: 1px 10px; flex: 0 0 auto; text-transform: uppercase;
  }
  .feed-day.collapsed .day-body { display: none; }
  .feed-day.flash > .date { animation: dayflash 1.1s ease; }
  @keyframes dayflash { 0%,100% { color: var(--crimson); } 35% { color: var(--gold-bright); } }

  /* ---------- PAGER ---------- */
  .pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 22px 0 4px; }
  .pager button {
    font-family: 'EB Garamond',Georgia,serif; font-size: .86rem; font-weight: 600;
    color: var(--navy); background: var(--card); border: 1px solid var(--rule);
    border-radius: 6px; padding: 7px 18px; cursor: pointer; transition: .15s;
  }
  .pager button:hover:not(:disabled) { background: #efe6cf; border-color: var(--gold); }
  .pager button:disabled { opacity: .38; cursor: default; }
  .pager .pageinfo {
    font-family: 'Cormorant SC', serif; font-size: .95rem; letter-spacing: .06em; color: var(--muted);
  }

  /* ---------- BACK TO TOP ---------- */
  #toTop {
    position: fixed; right: 18px; bottom: 18px; z-index: 60;
    width: 46px; height: 46px; border-radius: 50%;
    border: 1px solid var(--gold); background: var(--navy); color: #f3ead2;
    font-size: 1.25rem; line-height: 1; cursor: pointer;
    box-shadow: 0 3px 12px rgba(20,25,45,.32);
    opacity: 0; pointer-events: none; transition: opacity .2s, transform .15s;
    display: flex; align-items: center; justify-content: center;
  }
  #toTop.show { opacity: 1; pointer-events: auto; }
  #toTop:hover { background: #16203a; transform: translateY(-2px); }

/* ---- journey crest strip (index hero navigation) ---------------------- */
  .journey{background:linear-gradient(180deg,#fdf9ee 0%,var(--parchment) 100%);
    padding:26px 16px 28px;text-align:center;}
  .journey h1{font-family:'Cormorant SC',Georgia,serif;font-size:clamp(1.7rem,4.5vw,2.35rem);
    font-weight:700;letter-spacing:.05em;color:var(--navy);margin:0 0 18px;line-height:1.05;}
  .jstrip{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;
    gap:4px;margin:0 auto;max-width:900px;}
  .jstop{display:flex;align-items:center;justify-content:center;text-decoration:none;
    padding:6px;border-radius:8px;transition:background .15s,transform .15s;}
  .jstop:hover{background:rgba(184,145,47,.14);transform:translateY(-3px);}
  .jshield,.jcrest{height:82px;width:auto;display:block;filter:drop-shadow(0 2px 5px rgba(60,45,20,.28));}
  .jsep{width:7px;height:7px;background:var(--gold);transform:rotate(45deg);border-radius:1px;opacity:.7;flex:0 0 auto;}
  @media(max-width:560px){.jshield,.jcrest{height:63px;}}
