/* ============================================================================
   JG-COMMUNITY-TREES.CSS  -  Jewish Communities Tree
   Project Shorashim / JG40-Build
   CHW - 27 July 2026
   ----------------------------------------------------------------------------
   Loaded ONLY by /Communities/Trees/. Stylesheet load order on that page:
       1. Bootstrap CDN
       2. /jg-global.css
       3. /Communities/jg-community-trees.css   <-- this file

   NOTE: the tree page does NOT load jg-community.css. It was checked class by
   class - the page uses 22 .ct-* rules from this file plus .page-title-band,
   .tagline, .hero-subtitle and .jump-bar, all of which are global. Nothing in
   jg-community.css (town pages, search form, search results, Leaflet map) is
   referenced, so loading it would be dead weight on every visit.
   ----------------------------------------------------------------------------
   DUPLICATION WARNING, READ THIS FIRST.
   These rules are near-identical to the .inv-* block currently sitting inline
   inside /databases/Cemetery/tree/CemList.php. Two copies of one pattern is
   exactly the drift the style standards warn about.

   RECOMMENDED FIX (not done here, because it means editing jg-global.css and
   touching a working JOWBR page): promote the shared parts - tree, folder,
   chevron, leaf, filter bar, spinner, mark - to jg-global.css as a .jg-tree-*
   component, then have BOTH pages use it and keep only their genuinely local
   bits. The era tabs below are genuinely local to Communities; JOWBR has no
   eras. Everything else is shared.

   Until that happens: if you change one, change the other.
   ----------------------------------------------------------------------------
   TOKEN DISCIPLINE
   Navy is never used as a background via var(--navy) - it flips to light gray
   in dark mode. The one navy fill (the selected era tab) is hardcoded
   #09497a / #0d2a45 per the dark mode hazard.
============================================================================ */

.ct-wrapper { background-color: var(--ecru); padding: 0 1.5rem 3rem; }
.ct-inner   { max-width: 1000px; margin: 0 auto; }


/* -- Era tabs -------------------------------------------------------------
   Three time periods over the same 6,359 communities. Not the same thing as
   the section sub-nav above them, so they are deliberately styled as segmented
   controls rather than a second tab strip - two identical-looking nav bars
   stacked would be unreadable.
------------------------------------------------------------------------- */
.ct-eras {
    display: flex;
    gap: 8px;
    padding: 22px 0 4px;
    flex-wrap: wrap;
}
.ct-era {
    flex: 0 1 auto;
    background: var(--white);
    border: 1px solid #c9c2b6;
    border-radius: 8px;
    padding: 10px 18px;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: bold;
    color: var(--charcoal);
    cursor: pointer;
    text-align: left;
    line-height: 1.25;
    transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.ct-era:hover { border-color: var(--sage); color: var(--navy); }
.ct-era:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
/* Selected: navy fill hardcoded - var(--navy) flips to light gray in dark mode */
.ct-era.is-active {
    background-color: #09497a;
    border-color: #09497a;
    color: #ffffff;
}
.ct-era__sub {
    display: block;
    font-size: 0.6875rem;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.65;
    margin-top: 2px;
}
body.dark-mode .ct-era { background: #1e1e1e; border-color: #333; color: #a0a0a0; }
body.dark-mode .ct-era:hover { border-color: #a8b361; color: #e0e0e0; }
body.dark-mode .ct-era.is-active {
    background-color: #0d2a45;
    border-color: #0d2a45;
    color: #ffffff;
}


/* -- Filter controls ------------------------------------------------------ */
.ct-controls {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 0 8px; flex-wrap: wrap;
}
.ct-search {
    flex: 1; min-width: 240px;
    padding: 11px 16px; font-size: 14px; font-family: inherit;
    border: 1.5px solid #c9c2b6; border-radius: 6px;
    background: #ffffff; color: var(--charcoal);
}
body.dark-mode .ct-search { background: #1a1a1a; border-color: #444; color: #e0e0e0; }
.ct-search:focus {
    outline: 2px solid var(--sage); outline-offset: 1px; border-color: var(--sage);
}
.ct-clear {
    padding: 9px 16px; font-size: 13px; font-weight: bold; font-family: inherit;
    border: 1.5px solid var(--navy); border-radius: 6px;
    background: none; color: var(--navy); cursor: pointer;
}
.ct-clear:hover { background: #09497a; color: #ffffff; }
.ct-clear:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
body.dark-mode .ct-clear { color: #8ab4d4; border-color: #8ab4d4; }
body.dark-mode .ct-clear:hover { background: #8ab4d4; color: #121212; }

.ct-status {
    font-size: 12px; color: #5b6161;
    padding: 2px 0 14px; min-height: 18px;
}
body.dark-mode .ct-status { color: #a8a8a8; }


/* -- A-Z sections. The .jump-bar component itself lives in jg-global.css. -- */
.ct-alpha { scroll-margin-top: 64px; margin-bottom: 8px; }
.ct-alpha-head {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.5rem; font-weight: normal; color: var(--navy);
    margin: 18px 0 4px; padding-bottom: 4px;
    border-bottom: 2px solid var(--sage); width: 34px; text-align: center;
}
body.dark-mode .ct-alpha-head { color: #8ab4d4; border-bottom-color: #a8b361; }


/* -- Tree ----------------------------------------------------------------- */
.ct-tree, .ct-tree ul { list-style: none; margin: 0; padding: 0; }
.ct-tree ul { padding-left: 22px; }
.ct-tree li { margin: 0; }

/* Folder row = disclosure button */
.ct-folder {
    display: flex; align-items: baseline; gap: 8px; width: 100%;
    text-align: left; background: none; border: none;
    padding: 7px 6px; cursor: pointer; border-radius: 5px;
    color: var(--charcoal); font-family: inherit;
}
.ct-folder:hover { background: rgba(147,155,81,0.12); }
.ct-folder:focus-visible { outline: 2px solid var(--sage); outline-offset: 1px; }

.ct-chevron {
    flex: 0 0 auto; width: 14px; font-size: 11px; line-height: 1.4;
    color: var(--sage); transition: transform 0.15s ease; transform: rotate(0deg);
}
body.dark-mode .ct-chevron { color: #a8b361; }
.ct-folder[aria-expanded="true"] .ct-chevron { transform: rotate(90deg); }

.ct-name {
    font-weight: bold; color: var(--navy);
    font-family: Georgia, 'Times New Roman', serif;
}
body.dark-mode .ct-name { color: #8ab4d4; }
/* Deeper levels step down slightly so the hierarchy reads at a glance */
.ct-folder[data-level="province"] .ct-name,
.ct-folder[data-level="region"]   .ct-name { font-size: 0.95rem; }
.ct-folder[data-level="district"] .ct-name { font-size: 0.9rem; }

.ct-counts { font-size: 11.5px; color: #5b6161; font-family: Arial, sans-serif; }
body.dark-mode .ct-counts { color: #a8a8a8; }

/* Leaf row = town link */
.ct-leaf { display: flex; align-items: baseline; gap: 8px; padding: 6px 6px 6px 22px; }
.ct-leaf::before {
    content: "\2022"; color: var(--sage); flex: 0 0 auto;
    font-size: 12px; line-height: 1.4;
}
body.dark-mode .ct-leaf::before { color: #a8b361; }
.ct-leaf a {
    color: var(--navy); text-decoration: underline dotted;
    text-underline-offset: 3px; font-weight: 600;
}
.ct-leaf a:hover { color: var(--sage); }
.ct-leaf a:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
body.dark-mode .ct-leaf a { color: #8ab4d4; }

/* Modern name, e.g. "now Kostelec nad Orlici". Present on 3,270 pre-WWI and
   1,993 inter-war towns - often the only way a researcher recognises a place. */
.ct-modern { font-size: 11.5px; color: #5b6161; font-style: italic; }
body.dark-mode .ct-modern { color: #a8a8a8; }

/* Filter highlight */
.ct-tree mark { background: #f3e9a8; color: inherit; padding: 0 1px; border-radius: 2px; }
body.dark-mode .ct-tree mark { background: #6b6326; color: #fff; }


/* -- States --------------------------------------------------------------- */
.ct-state { text-align: center; padding: 60px 20px; color: var(--charcoal); }
.ct-spinner {
    display: inline-block; width: 26px; height: 26px;
    border: 3px solid #e8edf0; border-top-color: var(--navy);
    border-radius: 50%; animation: ct-spin 0.7s linear infinite; margin-bottom: 10px;
}
@keyframes ct-spin { to { transform: rotate(360deg); } }
body.dark-mode .ct-spinner { border-color: #333; border-top-color: #8ab4d4; }
.ct-empty { font-size: 14px; color: #5b6161; padding: 24px 6px; }
body.dark-mode .ct-empty { color: #a8a8a8; }


/* -- Back links ----------------------------------------------------------- */
.ct-back {
    display: flex; gap: 20px; flex-wrap: wrap;
    margin-top: 30px; padding-top: 16px;
    border-top: 1px solid rgba(147,155,81,0.3);
}
.ct-back a {
    font-size: 13px; font-weight: bold; color: var(--navy);
    text-decoration: underline dotted; text-underline-offset: 3px;
}
.ct-back a:hover { color: var(--sage); }
body.dark-mode .ct-back a { color: #8ab4d4; }
body.dark-mode .ct-back { border-color: #333; }


/* -- Responsive ----------------------------------------------------------- */
@media (max-width: 600px) {
    .ct-counts, .ct-modern { display: block; }
    .ct-folder, .ct-leaf { flex-wrap: wrap; }
    .ct-era { flex: 1 1 100%; }
}
