/* ciscomani.org - white, neutral grays, one deep Italian green accent (+ Sonoran terracotta for migration lines). */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --surface-3: #eceef1;
  --line: #dfe2e6;
  --line-strong: #bcc2c9;
  --text: #14181c;
  --muted: #565e67;
  --accent: #1b6b43;
  --accent-strong: #145233;
  --accent-ink: #ffffff;
  --accent-soft: #e9f3ed;
  --accent-2: #b4532a;
  --focus: #0b57d0;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --c-verified: #1b6b43;
  --c-probable: #1f5fa8;
  --c-unverified: #b4532a;
  --on-conf: #ffffff;
  --shadow: 0 1px 2px rgba(20, 24, 28, .06), 0 6px 20px rgba(20, 24, 28, .08);
  --radius: 12px;
  --header-h: 64px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #181c21;
    --surface-2: #1e2328;
    --surface-3: #262c33;
    --line: #2c333b;
    --line-strong: #444d58;
    --text: #eceff2;
    --muted: #a3abb4;
    --accent: #5cc08a;
    --accent-strong: #86d6aa;
    --accent-ink: #0b1f14;
    --accent-soft: #16281f;
    --accent-2: #e8946a;
    --focus: #8ab4ff;
    --danger: #ff8a80;
    --danger-soft: #3a1f1d;
    --c-verified: #5cc08a;
    --c-probable: #7fb1ec;
    --c-unverified: #e8946a;
    --on-conf: #0e1411;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 1.0625rem/1.65 var(--font);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.015em; font-weight: 700; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -.025em; font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2rem); margin-top: 1.6em; }
h3 { font-size: 1.25rem; margin-top: 1.2em; }
h4 { font-size: 1.125rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
code { background: var(--surface-3); padding: .1em .4em; border-radius: 6px; font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.bare { border: 0; }
.muted { color: var(--muted); }
.small { font-size: .9375rem; }
.block { display: block; }
.grow { flex: 1 1 260px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.req { color: var(--danger); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 3000; background: var(--accent); color: var(--accent-ink); padding: 12px 16px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.skip-link:focus { top: 8px; }
main:focus { outline: none; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.container-pad { padding: 0 16px; }
.page { padding-top: 32px; padding-bottom: 56px; }
.prose { max-width: 760px; }
.lead { font-size: clamp(1.125rem, 2.2vw, 1.375rem); line-height: 1.55; color: var(--muted); max-width: 46rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-weight: 700; font-size: .9375rem; color: var(--accent); margin: 0 0 .75rem; }
.crumbs { font-size: .9375rem; color: var(--muted); margin-bottom: 12px; }

/* ---------- header / nav ---------- */
.site-header { position: sticky; top: 0; z-index: 2000; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1120px; margin: 0 auto; padding: 0 16px; min-height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--accent); min-height: 44px; }
.brand-text { font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; color: var(--text); }
.nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 10px; cursor: pointer; }
.nav-menu { display: none; width: 100%; padding-bottom: 12px; }
.nav-menu.is-open { display: block; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; min-height: 48px; padding: 0 14px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }
.nav-cta { background: var(--accent); color: var(--accent-ink); }
.nav-cta:hover { background: var(--accent-strong); color: var(--accent-ink); }
.nav-cta[aria-current="page"] { background: var(--accent-strong); color: var(--accent-ink); }
.lang-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; margin-top: 8px; }
.lang-btn { min-width: 52px; min-height: 44px; border: 0; background: var(--surface); color: var(--text); font: 600 1rem var(--font); cursor: pointer; }
.lang-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .nav-menu { display: flex; align-items: center; gap: 16px; width: auto; padding: 0; }
  .nav-list { flex-direction: row; gap: 4px; }
  .lang-toggle { margin: 0; }
}

/* ---------- buttons, inputs, badges ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text); font: 600 1rem/1 var(--font); border-radius: 10px; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; text-align: center; }
.btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
.btn-outline { border-color: var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.btn-lg { min-height: 54px; padding: 0 24px; font-size: 1.0625rem; }
.btn-icon { min-width: 46px; padding: 0; font-size: 1.5rem; line-height: 1; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 1.25rem 0; }
.btn-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.btn-stack .btn { width: 100%; }
.linklike { background: none; border: 0; padding: 10px 0; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; text-align: left; min-height: 44px; }

.input { width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: 400 1rem/1.4 var(--font); }
.input:hover { border-color: var(--muted); }
.input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
textarea.input { min-height: 120px; resize: vertical; }
.select { appearance: auto; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field label, .field legend { font-weight: 600; font-size: 1rem; }
.help { color: var(--muted); font-size: .9375rem; margin: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0; }
.check input { width: 24px; height: 24px; flex: none; margin-top: 2px; accent-color: var(--accent); }
.grid-2 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .9375rem; font-weight: 600; border: 1.5px solid currentColor; white-space: nowrap; }
.badge-mark { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--badge-c); color: var(--on-conf); font-size: 12px; font-weight: 800; }
.badge.conf-verified, .badge.rel-primary { --badge-c: var(--c-verified); color: var(--c-verified); }
.badge.conf-probable, .badge.rel-secondary { --badge-c: var(--c-probable); color: var(--c-probable); }
.badge.conf-unverified, .badge.rel-user-tree { --badge-c: var(--c-unverified); color: var(--c-unverified); }
.chip { display: inline-block; margin-left: 8px; padding: 1px 10px; border-radius: 999px; background: var(--surface-3); font-size: .9375rem; }

.notice { padding: 14px 18px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); margin: 16px 0; }
.notice p:last-child { margin-bottom: 0; }
.notice-error { background: var(--danger-soft); border-color: var(--danger); color: var(--text); }
.notice-privacy { background: var(--accent-soft); border-color: var(--accent); }
.card-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 20px 0; box-shadow: var(--shadow); }
.card-box h2:first-child { margin-top: 0; }
.loading { display: flex; align-items: center; gap: 12px; padding: 48px 16px; justify-content: center; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.plain-list { list-style: none; margin: 0 0 1em; padding: 0; }
.plain-list li { padding: 6px 0; }
.plain-list.bullet { list-style: disc; padding-left: 1.25rem; }

/* ---------- picker (combobox) ---------- */
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 300; margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); max-height: 340px; overflow: auto; }
.picker-item, .picker-empty { padding: 10px 12px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; min-height: 44px; align-items: center; }
.picker-item.is-active, .picker-item:hover { background: var(--accent-soft); }
.picker-name { font-weight: 600; }
.picker-meta, .picker-empty { color: var(--muted); font-size: .9375rem; }
.picker-empty { cursor: default; }

/* ---------- home ---------- */
.hero { background: linear-gradient(180deg, var(--bg) 0%, var(--surface-2) 100%); border-bottom: 1px solid var(--line); padding: 48px 0 40px; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, var(--accent-soft), transparent 70%); pointer-events: none; }
.hero-inner { position: relative; }
.hero-grid { display: grid; gap: 28px; align-items: center; }
.hero-photo { margin: 0; order: -1; } /* photo first on phones */
.hero-photo img { display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .12); background: var(--surface-2); }
.hero-photo figcaption { margin-top: 10px; font-size: 1rem; color: var(--muted); }
.hero-photo .cap-main, .hero-photo .cap-credit { display: block; }
.hero-photo .cap-credit { margin-top: 2px; font-size: .9375rem; }
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; }
  .hero-photo { order: 0; }
}
.hero h1 { max-width: 18ch; }
.hero-search { max-width: 560px; margin: 24px 0 8px; }
.hero-search .input { min-height: 56px; font-size: 1.125rem; padding-left: 18px; }
.stats { list-style: none; padding: 0; margin: -24px 0 8px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; position: relative; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 12px; text-align: center; box-shadow: var(--shadow); }
.stat-n { display: block; font-size: clamp(1.75rem, 5vw, 2.75rem); font-weight: 800; color: var(--accent); line-height: 1.1; }
.stat-l { color: var(--muted); font-weight: 600; }
.section { padding-top: 24px; padding-bottom: 8px; }
.founder-card { display: grid; gap: 24px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; padding: 28px; margin-top: 32px; }
.founder-card h2 { margin-top: 0; }
.founder-art svg { width: 100%; max-height: 220px; }
.art-arc { stroke: var(--accent-2); animation: dash 1.4s linear infinite; }
.art-dot { fill: var(--accent); } .art-dot.b { fill: var(--accent-2); }
.art-ring { fill: none; stroke: var(--line-strong); stroke-width: 2; }
@keyframes dash { to { stroke-dashoffset: -32; } }
.route-line { font-weight: 600; }
.arrow { color: var(--accent-2); }
.steps { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 16px; }
.step { display: flex; gap: 16px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.step h3 { margin: 0 0 4px; font-size: 1.1875rem; } .step p { margin: 0; color: var(--muted); }
.step-n { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
/* instructions read top to bottom, not in columns */
.share-tree .steps { grid-template-columns: 1fr; }
.share-tree .step p { color: var(--text); }
@media (min-width: 780px) {
  .founder-card { grid-template-columns: 1.4fr 1fr; align-items: center; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .hero { padding: 72px 0 64px; }
}

/* ---------- tool views (tree + map) ---------- */
.tool-view { max-width: 1400px; margin: 0 auto; padding: 14px 16px 28px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; margin-bottom: 8px; }
.toolbar .field { margin-bottom: 4px; }
.field-btn { justify-content: flex-end; }
.tree-view .toolbar .select { width: auto; min-width: 88px; }
@media (max-width: 720px) { .toolbar { gap: 4px 12px; } .legend { gap: 4px 14px; } .tool-view { padding-top: 8px; } }
.seg-group { flex: none; }
.seg-row { display: inline-flex; border: 1.5px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.seg { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; min-height: 46px; padding: 0 16px; background: var(--surface); font-weight: 600; border-right: 1px solid var(--line); cursor: pointer; }
.seg:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }
.seg-btn { min-width: 48px; min-height: 40px; border: 0; background: var(--surface); color: var(--text); font: 600 1rem var(--font); cursor: pointer; border-right: 1px solid var(--line); }
.seg-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.small-seg { margin-bottom: 8px; }
.zoom-btns { display: flex; gap: 8px; margin-bottom: 4px; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0; margin: 4px 0 10px; font-size: .9375rem; }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend-dot { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-weight: 800; font-size: 13px; color: var(--on-conf); }
.legend-dot.conf-verified { background: var(--c-verified); }
.legend-dot.conf-probable { background: var(--c-probable); }
.legend-dot.conf-unverified { background: var(--c-unverified); }
.legend-dot.living { background: var(--muted); border: 2px dashed var(--bg); }

.canvas-wrap { position: relative; isolation: isolate; border: 1px solid var(--line-strong); border-radius: 14px; overflow: hidden; height: clamp(460px, 74dvh, 940px); background: var(--surface-2); }
.tree-svg { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; background-image: radial-gradient(var(--line) 1.2px, transparent 1.2px); background-size: 24px 24px; }
.tree-svg:active { cursor: grabbing; }
.canvas-hint { position: absolute; left: 12px; bottom: 8px; margin: 0; padding: 4px 10px; background: color-mix(in srgb, var(--surface) 88%, transparent); border-radius: 8px; font-size: .9375rem; color: var(--muted); pointer-events: none; }
.link { fill: none; stroke: var(--line-strong); stroke-width: 2.25; }
.marriage { stroke: var(--accent-2); stroke-width: 3; stroke-linecap: round; }
.card { cursor: pointer; outline: none; }
.card .box { fill: var(--surface); stroke: var(--line-strong); stroke-width: 2.5; transition: stroke-width .1s; }
.card:hover .box { stroke-width: 4; }
.card.conf-verified .box { stroke: var(--c-verified); }
.card.conf-probable .box { stroke: var(--c-probable); }
.card.conf-unverified .box { stroke: var(--c-unverified); }
.card.conf-verified .mark-bg { fill: var(--c-verified); }
.card.conf-probable .mark-bg { fill: var(--c-probable); }
.card.conf-unverified .mark-bg { fill: var(--c-unverified); }
.card .mark { fill: var(--on-conf); font-weight: 800; font-size: 16px; }
.card .nm { fill: var(--text); font-weight: 600; font-size: 16px; }
.card .sn { fill: var(--text); font-size: 15px; }
.card .dt { fill: var(--muted); font-size: 13px; }
.card.is-living .box { stroke: var(--line-strong); stroke-dasharray: 6 5; fill: var(--surface-2); }
.card.is-living .mark-bg { fill: var(--muted); }
.card.is-living .nm { fill: var(--muted); font-style: italic; }
.card.is-root .box { stroke-width: 4; }
.card.is-selected .box { stroke: var(--accent); stroke-width: 5; }
.card:focus-visible .box { stroke: var(--focus); stroke-width: 5; }
.more rect { fill: var(--surface-3); stroke: var(--line-strong); }
.more text { fill: var(--muted); font-size: 14px; font-weight: 700; }
.tree-svg text { font-family: var(--font); user-select: none; }

.side-panel { position: absolute; z-index: 1100; top: 0; right: 0; bottom: 0; width: min(390px, 100%); overflow: auto; background: var(--surface); border-left: 1px solid var(--line-strong); padding: 20px 20px 24px; box-shadow: var(--shadow); }
.side-panel[hidden] { display: none; }
.side-panel h2 { margin: 0 44px 8px 0; font-size: 1.5rem; }
.side-panel h2:focus { outline: none; }
.panel-close { position: absolute; top: 10px; right: 10px; }
.lifespan { font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.panel-bio { margin-top: 12px; }
@media (max-width: 720px) {
  .side-panel { top: auto; width: 100%; max-height: 62%; border-left: 0; border-top: 1px solid var(--line-strong); border-radius: 16px 16px 0 0; }
  .canvas-hint { display: none; }
}

/* ---------- map ---------- */
.map-canvas { position: absolute; inset: 0; z-index: 0; background: var(--surface-2); font-family: var(--font); }
.map-canvas .leaflet-control-zoom a { width: 40px; height: 40px; line-height: 40px; font-size: 22px; }
.leaflet-container a { color: var(--accent); }
/* Neutralise OSM's warm land colour to match the gray palette */
.map-canvas .leaflet-tile-pane { filter: grayscale(.9) contrast(1.03) brightness(1.02); }
@media (prefers-color-scheme: dark) {
  .map-canvas .leaflet-tile-pane { filter: grayscale(.9) invert(1) hue-rotate(180deg) brightness(.92) contrast(.88); }
}
.leaflet-tooltip { font: 600 .9375rem var(--font); }
.mig-line { stroke-dasharray: 9 11; animation: flow 1.1s linear infinite; stroke-linecap: round; cursor: pointer; }
@keyframes flow { to { stroke-dashoffset: -20; } }
.place-marker { cursor: pointer; }
.map-controls { margin: 12px 0 4px; }
.timeline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.slider { flex: 1 1 240px; min-width: 160px; height: 36px; accent-color: var(--accent); cursor: pointer; }
.year-label { min-width: 4ch; font-weight: 800; font-size: 1.5rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.tl-end { color: var(--muted); font-size: .9375rem; }
.map-summary { margin: 8px 0 0; color: var(--muted); }
.places-details { margin-top: 12px; } .places-details summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.places-list { list-style: none; padding: 0; columns: 2 260px; }
.map-empty { position: absolute; left: 16px; top: 16px; z-index: 1000; margin: 0; }

/* ---------- person ---------- */
.person-head { display: grid; gap: 16px; align-items: start; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.person-head h1 { margin-bottom: .2em; }
@media (min-width: 800px) { .person-head { grid-template-columns: 1fr 320px; } .head-actions { margin-top: 0; } }
.bio-text { font-size: 1.1875rem; max-width: 46rem; }
.facts { display: grid; grid-template-columns: 1fr; gap: 2px 20px; margin: 0 0 1em; }
.facts dt { font-weight: 700; color: var(--muted); font-size: .9375rem; margin-top: 10px; }
.facts dd { margin: 0; }
@media (min-width: 640px) { .facts { grid-template-columns: 170px 1fr; } .facts dt { margin-top: 0; padding: 8px 0; } .facts dd { padding: 8px 0; border-bottom: 1px solid var(--line); } .facts dt { border-bottom: 1px solid var(--line); } }
.rel-grid { display: grid; gap: 4px 28px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.rel-grid h3 { margin-top: .6em; font-size: 1.0625rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.person-link { font-weight: 600; }
.person-link.is-redacted { color: var(--muted); font-style: italic; }
.place-trail { padding-left: 1.25rem; } .place-trail li { padding: 4px 0; }
.sources { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.source, .finding, .story-card, .notice { overflow-wrap: anywhere; }
.source { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.source p { margin: 4px 0 0; }
.source-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; font-weight: 600; }
.notes summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.gallery-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.gallery-head h2 { margin: 1em 0 .4em; }
.empty-gallery { background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 24px; text-align: center; }
.photo-grid { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.photo-btn { display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: zoom-in; background: var(--surface-3); }
.photo-btn img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.video-list { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.video-item { margin: 0; } .video-item video { width: 100%; border-radius: 10px; background: #000; }
.story-list { display: grid; gap: 16px; }
.story-card { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: var(--radius); padding: 18px 20px; max-width: 52rem; }
.story-card h3, .story-card h4 { margin: 0 0 .4em; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100%; height: 100%; color: #fff; }
.lightbox::backdrop { background: rgba(0, 0, 0, .88); }
.lightbox figure { margin: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 64px 24px; }
.lb-img { max-width: 100%; max-height: calc(100vh - 190px); object-fit: contain; border-radius: 6px; }
.lb-cap { text-align: center; max-width: 52rem; margin-top: 12px; } .lb-cap .muted { color: #c6ccd2; }
.lb-close, .lb-prev, .lb-next { position: fixed; background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .5); }
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: rgba(255, 255, 255, .3); color: #fff; border-color: #fff; }
.lb-close { top: 10px; right: 10px; } .lb-prev { left: 8px; top: 50%; } .lb-next { right: 8px; top: 50%; }
@media (max-width: 600px) { .lightbox figure { padding: 56px 8px 80px; } .lb-prev, .lb-next { top: auto; bottom: 12px; } .lb-prev { left: 12px; } .lb-next { right: 12px; } }

.lead-sm { font-size: 1.1875rem; max-width: 46rem; }
.findings { list-style: none; padding: 0; display: grid; gap: 12px; max-width: 52rem; }
.finding { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; background: var(--surface); }
.finding p { margin: 0 0 8px; }
.hypothesis { border-left-color: var(--accent-2); }
.source-line a { overflow-wrap: anywhere; }

/* ---------- contribute ---------- */
.contribute { max-width: 860px; }
.trust-list { padding-left: 1.2rem; color: var(--muted); }
.invite-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.invite-form .field { margin-bottom: 0; }
.type-set legend { float: left; width: 100%; font-weight: 700; font-size: 1.25rem; padding: 0; margin-bottom: 12px; }
.type-set legend + * { clear: both; }
.type-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.type-card { position: relative; display: block; padding: 14px 14px 14px 48px; border: 1.5px solid var(--line-strong); border-radius: 12px; cursor: pointer; background: var(--surface); min-height: 76px; }
.type-card input { position: absolute; left: 14px; top: 16px; width: 22px; height: 22px; accent-color: var(--accent); margin: 0; }
.type-card:hover { border-color: var(--text); }
.type-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.type-card:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.type-title { display: block; font-weight: 700; }
.type-desc { display: block; color: var(--muted); font-size: .9375rem; line-height: 1.4; }
.file-input { padding: 10px; border: 1.5px dashed var(--line-strong); border-radius: 10px; width: 100%; background: var(--surface-2); font: inherit; min-height: 56px; }
.preview { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.preview img, .preview video { max-height: 320px; border-radius: 8px; display: block; margin-bottom: 8px; }
.progress-row { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.progress { flex: 1; height: 16px; accent-color: var(--accent); }
.progress-text { font-weight: 700; min-width: 4ch; }
.success h2 { color: var(--accent); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface-2); padding: 28px 0 40px; margin-top: 24px; }
.footer-inner p { margin: 0 0 8px; }
.footer-links { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 0; margin: 0 0 8px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; }

body.immersive .site-footer { margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mig-line, .art-arc, .spinner { animation: none; }
  .btn, .card .box { transition: none; }
}
