/* Modifica questi colori per personalizzare il tema. */
:root {
    --background: #171918;
    --surface: #202320;
    --text: #e8dfcf;
    --muted: #b4ac9d;
    --accent: #a76e64;
    --line: #3c4039;
    --serif: Georgia, "Times New Roman", serif;
    --sans: "Segoe UI", Arial, sans-serif;
    --content-width: 1380px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }

/* SFONDO GENERALE - ARCHIVIO VINCENZI */


body {
    margin: 0;
    min-height: 100vh;

    display: flex;
    flex-direction: column;

    font-family: var(--sans);
    line-height: 1.65;
    color: var(--text);

    background-color: #171918;
    background-image: url('./images/Sfondo botanico vintage antracite.png');

    background-repeat: repeat;
    background-position: top left;
    background-size: auto;
}

a { color: inherit; text-underline-offset: 5px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
img { max-width: 100%; height: auto; display: block; }
.site-header, .site-main, .site-footer { width: min(var(--content-width), calc(100% - 64px)); margin-inline: auto; }
.site-header { padding-block: 25px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.site-brand { text-decoration: none; font-family: var(--serif); font-size: 23px; }
.site-brand span { font-style: italic; }
.site-header nav { display: flex; gap: 28px; font-size: 13px; }
.site-header nav a { text-decoration: none; color: var(--muted); }
.site-header nav a:hover { color: var(--text); }
.site-main { flex: 1; }
.archive-intro { padding: 68px 0 48px; }
.eyebrow { color: var(--accent); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; margin: 0 0 24px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; }
h1 { font-size: clamp(64px, 9vw, 116px); line-height: .98; letter-spacing: -.045em; margin: 0 0 36px; }
h1 em { font-weight: 400; }
.intro-bottom { display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.intro-bottom p { color: var(--muted); max-width: 600px; margin: 0; font-size: 16px; }
.archive-link { font-size: 13px; text-decoration: none; border-bottom: 1px solid var(--accent); padding-bottom: 7px; white-space: nowrap; }
.archive-link span { margin-left: 22px; color: var(--accent); }
.archive-section { border-top: 1px solid var(--line); padding: 30px 0 70px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.section-heading h2 { font-size: 29px; margin: 0; }
.section-heading p { color: var(--muted); font-size: 12px; margin: 0; }
.portrait-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.portrait-card { margin: 0; min-width: 0; }
.portrait-image { background: var(--surface); padding: 9px; border: 1px solid var(--line); }
.portrait-image img { width: 100%; aspect-ratio: 2/3; object-fit: cover; }
figcaption { display: flex; gap: 16px; padding: 19px 2px 0; }
.portrait-number { font-size: 11px; color: var(--accent); padding-top: 6px; }
figcaption h3 { font-size: 23px; line-height: 1.3; margin: 0; }
figcaption p { color: var(--muted); font-size: 11px; margin: 5px 0 0; letter-spacing: .05em; }
.site-footer { border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: end; gap: 30px; padding-block: 28px; }
.site-footer p { font-size: 11px; color: var(--muted); margin: 4px 0; }
.site-footer .footer-title { font-family: var(--serif); font-size: 17px; color: var(--text); }
.footer-logo { width: 110px; height: auto; flex-shrink: 0; }
.skip-link { position: absolute; left: 16px; top: -100px; background: var(--text); color: var(--background); padding: 10px 16px; z-index: 10; }
.skip-link:focus { top: 12px; }
@media (max-width: 700px) {
    .site-header, .site-main, .site-footer { width: calc(100% - 36px); }
    .site-header { align-items: start; flex-direction: column; gap: 12px; padding-block: 20px; }
    .site-header nav { gap: 24px; }
    .archive-intro { padding-top: 46px; }
    .intro-bottom, .section-heading { align-items: start; flex-direction: column; gap: 20px; }
    .portrait-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
    figcaption { gap: 9px; }
    figcaption h3 { font-size: 20px; }
    .site-footer { align-items: center; }
}
@media (max-width: 420px) { .portrait-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ALBERO GENEALOGICO — segnaposto e collegamenti */
.family-archive { --tree-line: #777368; --card-width: 148px; }
.family-card { width: var(--card-width, 148px); min-width: 0; text-align: center; position: relative; z-index: 1; }
.photo-placeholder { aspect-ratio: 2 / 3; background: linear-gradient(145deg, #2a2c27, #1d201d); border: 1px solid #56564c; outline: 1px solid #353a32; outline-offset: -7px; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 15px; color: #aaa18e; }
.photo-placeholder span { font: italic 32px var(--serif); opacity: .48; }
.photo-placeholder small { font-size: 9px; letter-spacing: .08em; margin-top: 16px; }
.family-card h3 { font-size: 18px; line-height: 1.25; margin: 13px 0 5px; }
.family-card p { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 0; }
.tree-root { display: flex; justify-content: center; padding-bottom: 42px; position: relative; }
.tree-root::after { content: ''; position: absolute; height: 42px; width: 1px; background: var(--tree-line); bottom: 0; left: 50%; }
.parent-couple { width: max-content; margin: auto; position: relative; padding-bottom: 48px; }
.couple { display: flex; gap: 24px; align-items: start; position: relative; }
.couple::before { content: ''; position: absolute; top: 106px; left: 50%; width: 24px; height: 1px; background: var(--tree-line); transform: translateX(-50%); }
.parent-couple::after { content: ''; position: absolute; height: 48px; width: 1px; background: var(--tree-line); bottom: 0; left: 50%; }
.children-row { display: grid; grid-template-columns: 1fr 1fr .7fr; align-items: start; }
.child-branch { display: flex; flex-direction: column; align-items: center; padding-top: 34px; position: relative; }
.child-branch::before { content: ''; position: absolute; top: 0; left: 0; right: 0; border-top: 1px solid var(--tree-line); }
.child-branch:first-child::before { left: 50%; }
.child-branch:last-child::before { right: 50%; }
.child-branch::after { content: ''; position: absolute; height: 34px; width: 1px; background: var(--tree-line); left: 50%; top: 0; }
.descendant { padding-top: 38px; position: relative; }
.descendant::before { content: ''; position: absolute; height: 38px; width: 1px; background: var(--tree-line); left: 50%; top: 0; }
.related-parent { margin-top: 32px; border-top: 1px dashed var(--tree-line); padding-top: 12px; }
.branch-caption { color: var(--muted); font-size: 10px; text-align: center; margin: 0 0 12px; }
.collateral-family { border-top: 1px solid var(--line); margin-top: 50px; padding-top: 28px; }
.collateral-grid { display: flex; gap: 28px; }
.witness-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 32px 22px; }
.witness-grid .family-card { width: 100%; max-width: 160px; }
@media (max-width: 1100px) and (min-width: 761px) {
 .family-archive { --card-width: 118px; }
 .couple { gap: 18px; }
 .couple::before { width: 18px; top: 85px; }
}
@media (max-width: 760px) {
 .family-archive { --card-width: 138px; }
 .children-row { display: flex; flex-direction: column; gap: 32px; border-left: 1px solid var(--tree-line); margin-left: 8px; padding-left: 20px; }
 .child-branch { padding-top: 22px; width: 100%; align-items: center; border-top: 1px solid var(--line); }
 .child-branch::before, .child-branch::after { display: none; }
 .parent-couple { padding-bottom: 36px; }
 .parent-couple::after { height: 36px; }
 .couple { gap: 16px; }
 .couple::before { width: 16px; top: 100px; }
 .child-branch > .family-card { align-self: center; }
 .collateral-grid { justify-content: center; gap: 20px; }
 .witness-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
 .witness-grid .family-card { max-width: none; }
}
@media (max-width: 380px) { .family-archive { --card-width: 114px; } .couple::before { top: 82px; } }

/* MAPPA A RAMI — coordinate dei ritratti definite con --x e --y nell’HTML. */
.tree-reading-note { font-size: 12px; color: var(--muted); margin: -8px 0 24px; }
.tree-scroll { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-color: #797061 var(--surface); scrollbar-width: thin; padding: 12px 0; }
.tree-scroll:focus-visible { outline: 1px solid var(--accent); outline-offset: 5px; }
.branch-map { width: 1380px; height: 1450px; position: relative; isolation: isolate; }
.branch-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: 0; }
.branch-lines path { fill: none; stroke: #95816a; stroke-width: 1.6; stroke-linecap: round; }
.branch-lines .sibling-line { stroke-dasharray: 4 6; stroke: #aa9e8b; }
.branch-lines .marriage-line { stroke: var(--accent); }
.branch-map .branch-person { position: absolute; left: var(--x); top: var(--y); width: 128px; }
.branch-person .photo-placeholder { background: linear-gradient(135deg, #32332c, #20231e); }
.branch-person h3 { font-size: 18px; }
.branch-person p { max-width: 128px; }
@media (min-width: 1200px) { .tree-scroll { overflow-x: visible; } }
@media (max-width: 760px) {
 .branch-map { height: 1450px; }
 .tree-reading-note::after { content: ' Puoi scorrere la mappa lateralmente.'; }
}
.site-main:has(.archive-workspace) {
    width: min(var(--content-width), calc(100% - 64px));
}
.archive-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 40px; align-items: start; }
.archive-workspace .family-archive { min-width: 0; }
.archive-workspace .tree-scroll { overflow-x: auto; }
.witnesses-sidebar { padding-left: 24px; border-left: 1px solid var(--line); }
.witnesses-sidebar .section-heading { display: block; }
.witnesses-sidebar .section-heading h2 { font-size: 24px; line-height: 1.25; margin-bottom: 10px; }
.witnesses-sidebar .witness-grid { display: grid; grid-template-columns: 1fr; gap: 30px; }
.witnesses-sidebar .family-card { width: 140px; max-width: 100%; margin-inline: auto; }
@media (max-width: 900px) {
 .site-main:has(.archive-workspace) { width: calc(100% - 36px); }
 .archive-workspace { grid-template-columns: minmax(0, 1fr); gap: 0; }
 .witnesses-sidebar { padding-left: 0; border-left: 0; }
 .witnesses-sidebar .witness-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}

/* ALBERO BOTANICO — rami e cartigli ispirati agli alberi genealogici antichi. */
.archive-workspace { display: block; }
.branch-map { width: 100% }
.branch-lines path { stroke: #a39471; stroke-width: 4; stroke-linejoin: round; opacity: .8; }
.branch-lines .marriage-line { stroke-width: 2; stroke: #b78d77; }
.branch-lines .sibling-line { stroke-width: 2; }
.branch-lines .twig { stroke-width: 1.4; }
.branch-lines .leaf { fill: #827e5d; stroke: #a39471; stroke-width: .8; opacity: .68; }
.branch-person .photo-placeholder { outline: 1px solid #6d6957; outline-offset: -6px; border: 1px solid #9a8c6c; border-radius: 48% 48% 3px 3px / 28% 28% 3px 3px; background: radial-gradient(ellipse at 50% 35%, #424336, #252a23 76%); box-shadow: 0 8px 22px #0003; }
.branch-person h3 { position: relative; padding: 8px 5px 5px; margin-top: -3px; background: #d0c3a4; color: #302d25; border: 1px solid #8a7f63; font-size: 16px; transform: rotate(-1deg); }
.branch-person:nth-of-type(even) h3 { transform: rotate(1deg); }
.branch-person p { font-size: 10px; margin-top: 7px; }
.independent-person .photo-placeholder { border-color: #62685b; outline-color: #454d40; }
.independent-person h3 { background: #b2b29a; border-color: #757b65; }
.family-archive { background: radial-gradient(ellipse at 35% 45%, #3b42301a, transparent 65%); }
@media (min-width: 1700px) { .site-main:has(.archive-workspace) { width: min(1600px, calc(100% - 64px)); } }

/* SFONDO ILLUSTRATO: immagine e schede condividono le proporzioni. */
/*
.illustrated-map {
    width: 100%;
    aspect-ratio: 4 / 3;

    background:
        url('./images/albero-vincenzi-transparent.png')
        center / 100% 100% no-repeat;

    border-radius: 0;
}
*/
.tree-scroll, .archive-workspace .tree-scroll { overflow: visible; padding: 0; }
.illustrated-map { width: 100%; height: auto; aspect-ratio: 4 / 3; background: #1a1f20 url('./images/albero-vincenzi.png') center / 100% 100% no-repeat; border-radius: 4px; }
.illustrated-map .branch-person { left: var(--left); top: var(--top); transform: translate(-50%, -50%); width: 8.2%; }
.illustrated-map .photo-placeholder { aspect-ratio: 2/3; border-radius: 2px; background: #222826ed; outline-color: #777261; border-color: #b2a68d; padding: 7px; box-shadow: 0 3px 12px #0008; }
.illustrated-map .photo-placeholder span { font-size: clamp(17px, 2vw, 29px); }
.illustrated-map .photo-placeholder small { font-size: clamp(6px, .65vw, 9px); margin-top: 6px; letter-spacing: 0; }
.illustrated-map .branch-person h3 { background: #1b2120f5; color: #e9e1d1; border: 0; border-bottom: 1px solid #81745b; transform: none; font-size: clamp(10px, 1.15vw, 15px); padding: 5px 2px; margin: 3px -8px 0; }
.illustrated-map .branch-person p { display: none; }
.illustrated-map .independent-person .photo-placeholder { border-color: #797c70; }
.mobile-families { display: none; }
.family-archive { background: none; }
@media (max-width: 760px) {
 .tree-scroll, .tree-reading-note { display: none; }
 .mobile-families { display: block; }
 .mobile-families section { margin-bottom: 32px; }
 .mobile-generation { font-family: var(--serif); font-size: 22px; margin: 24px 0 18px; }
 .mobile-person-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 24px 18px; }
 .mobile-person { width: 100%; }
 .mobile-person .photo-placeholder { background: #252c29; border-color: #827b68; border-radius: 2px; }
 .mobile-person h3 { font-size: 19px; }
 .mobile-person p { font-size: 12px; }
}

/* Fotografie di prova: conservano le proporzioni dei segnaposto. */
.portrait-photo { aspect-ratio: 2 / 3; overflow: hidden; border: 1px solid #a99b80; background: #252a26; box-shadow: 0 3px 12px #0008; padding: 3px; }
.portrait-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.independent-person .portrait-photo { border-color: #797c70; }
.mobile-person .portrait-photo { padding: 5px; }

/* SCHEDE PERSONAGGI */

.character-page {
    padding: 38px 0 60px;
}

.back-to-archive {
    color: var(--muted);
    font-size: 13px;
}

.character-heading {
    margin: 42px 0 34px;
}

.character-heading h1 {
    font-size: clamp(38px, 6vw, 76px);
    line-height: 1.1;
    margin: 0 0 16px;
    letter-spacing: -.025em;
}

.character-heading .eyebrow {
    margin-bottom: 14px;
}

.character-role {
    color: var(--muted);
    margin: 0;
}

/* CONTENUTO DEL RACCONTO */

.character-content {
    display: flow-root;
    width: 100%;
}

/* FOTO A SINISTRA CON TESTO ATTORNO */

.character-portrait {
    float: left;
    width: 280px;
    max-width: 32%;
    margin: 35px 42px 24px 0;
}

.character-portrait img {
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    padding: 5px;
}

/* TESTO DEL RACCONTO */

.story-access {
    min-width: 0;
}

.character-story {
    font-family: var(--serif);
    font-size: 19px;
    line-height: 1.85;
    text-align: justify;
    hyphens: auto;
    overflow-wrap: break-word;
}

.character-story > :first-child {
    margin-top: 0;
}

.character-story p {
    margin: 0 0 1.3em;
}

/* ELENCO PERSONAGGI */

.characters-summary {
    border-top: 1px solid var(--line);
    padding: 28px 0 48px;
}

.characters-summary h2 {
    font-size: 28px;
    margin: 0 0 22px;
}

.characters-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px 24px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
}

.characters-list a {
    text-decoration: none;
    border-bottom: 1px solid var(--accent);
}

.characters-list a:hover,
.characters-list a[aria-current="page"] {
    color: var(--text);
    border-bottom-width: 2px;
}

.characters-list span {
    color: var(--muted);
}

/* MOBILE */

@media (max-width: 700px) {

    .character-portrait {
        float: none;
        width: min(70%, 250px);
        max-width: none;
        margin: 20px auto 30px;
    }

    .character-story {
        font-size: 18px;
        text-align: left;
        hyphens: none;
    }

    .characters-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* LARGHEZZA PAGINE RACCONTI */

.site-main:has(.character-page) {
    width: min(1380px, calc(100% - 64px));
}

@media (max-width: 700px) {
    .site-main:has(.character-page) {
        width: calc(100% - 36px);
    }
}


/* LINK DELLE CARD */
.person-card-link { display: block; color: inherit; text-decoration: none; border-radius: 2px; }
.person-card-link:hover .portrait-photo, .person-card-link:hover .photo-placeholder { border-color: #dfc8a1; box-shadow: 0 0 0 1px #dfc8a155, 0 4px 18px #0006; }
.person-card-link:hover h3 { text-decoration: underline; text-underline-offset: 4px; }
.person-card-link:focus-visible { outline: 2px solid #dfc8a1; outline-offset: 5px; }

/* SBLOCCO CONDIVISO */
[hidden] { display: none !important; }
.story-access { min-width: 0; }
.story-status { color: var(--muted); font-size: 13px; margin-top: 0; }
.story-gate { border: 1px solid var(--line); padding: clamp(20px,4vw,36px); background: var(--surface); }
.story-gate h2 { font-size: 28px; line-height: 1.25; margin-top: 0; }
.story-gate p { color: var(--muted); }
.unlock-form { display: grid; gap: 14px; margin-top: 26px; }
.unlock-form label { font-size: 13px; }
.unlock-form input { width: 100%; min-width: 0; border: 1px solid #8b8779; background: var(--background); color: var(--text); padding: 13px; font: 17px var(--sans); }
.unlock-form button, .story-retry { background: #734c45; border: 1px solid #ac8073; color: #fff8ee; padding: 13px 18px; font: 14px var(--sans); cursor: pointer; }
.unlock-form button:disabled { opacity: .65; cursor: wait; }
.unlock-form :focus-visible, .story-retry:focus-visible { outline: 2px solid #dfc8a1; outline-offset: 4px; }
.unlock-message { min-height: 1.5em; font-size: 13px; margin: 0; }
.story-badge { display: block; color: #c6b69d; font-size: 10px; line-height: 1.4; margin-top: 6px; }
[data-unlocked="true"] .story-badge { color: #bacbb0; }
.characters-list .story-badge { font-size: 10px; }

/* PAGINA DEL PROGETTO */
.project-page { max-width: 900px; margin-inline: auto; padding: 38px 0 70px; }
.project-heading { margin: 44px 0; }
.project-heading h1 { font-size: clamp(42px, 6vw, 74px); line-height: 1.1; margin: 0 0 28px; }
.project-lead { color: var(--muted); font: 21px/1.65 var(--serif); max-width: 700px; }
.project-prose { max-width: 700px; }
.project-prose h2 { font-size: 29px; margin: 38px 0 14px; }
.project-prose p { font-size: 16px; line-height: 1.85; margin: 0 0 20px; }
.project-button { display: inline-flex; gap: 24px; align-items: center; margin-top: 10px; padding: 12px 18px; border: 1px solid var(--accent); text-decoration: none; }
.project-button:hover { background: var(--surface); }
.footer-brand-link { display: block; flex-shrink: 0; }


.footer-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.footer-brand-title {
    margin: 0;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

@media (max-width: 900px) {
    .site-main:has(.archive-workspace) {
        width: calc(100% - 36px);
    }
}


/* HEADER - fascia scura */

.site-header {
    background: rgba(12, 16, 15, 0.68);
    box-shadow: 0 0 0 100vmax rgba(12, 16, 15, 0.68);
    clip-path: inset(0 -100vmax);
    border-bottom: 1px solid rgba(185, 165, 133, 0.25);
}

/* ELENCO PERSONAGGI - sezione distinta */

.characters-summary {
    background: rgba(12, 16, 15, 0.46);
    box-shadow: 0 0 0 100vmax rgba(12, 16, 15, 0.46);
    clip-path: inset(0 -100vmax);
    border-top: 1px solid rgba(185, 165, 133, 0.25);
    border-bottom: 1px solid rgba(185, 165, 133, 0.25);
    padding: 35px 0 45px;
}

/* FOOTER - fascia scura */

.site-footer {
    background: rgba(12, 16, 15, 0.75);
    box-shadow: 0 0 0 100vmax rgba(12, 16, 15, 0.75);
    clip-path: inset(0 -100vmax);
    border-top: 1px solid rgba(185, 165, 133, 0.25);
    padding-block: 30px;
}


/* Cornici del PNG originale: le foto restano intere e separate dall'illustrazione. */
.intro-testimony { display: flow-root; }
.teresa-portrait { float: left; width: min(29%, 220px); margin: 0 28px 20px 0; }
.teresa-portrait .portrait-photo { aspect-ratio: auto; padding: 0; border: 0; }
.teresa-portrait img { display: block; width: 100%; height: auto; }
.teresa-portrait figcaption { font-size: 13px; margin-top: 10px; color: var(--muted); }
.rectangular-tree { position: relative; width: 100%; aspect-ratio: 1672 / 941; isolation: isolate; margin-bottom: 45px; }
.tree-art { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.rectangular-tree .tree-portrait { position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h); margin: 0; }
.tree-portrait .person-card-link { height: 100%; position: relative; }
.rectangular-tree .portrait-photo { width: 100%; height: 100%; aspect-ratio: auto; padding: 0; border: 0; outline: none; border-radius: 0; overflow: visible; background: transparent; box-shadow: none; }
.rectangular-tree .portrait-photo img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; border-radius: 0; }
.tree-portrait h3, .tree-portrait p { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); }
.tree-portrait .story-badge { position: absolute; top: 100%; left: -8%; width: 116%; background: #171d19ed; font-size: clamp(8px, .8vw, 12px); margin: 1px 0 0; padding: 2px; }
.rectangular-mobile { display: none; }
.tree-additional { margin: 36px 0; }
.tree-additional .mobile-person-grid { display: flex; gap: 28px; flex-wrap: wrap; }
.tree-additional .family-card { position: relative; inset: auto; transform: none; width: 148px; }
@media (max-width: 900px) {
 .rectangular-tree { display: none; }
 .rectangular-mobile { display: block; }
 .rectangular-mobile .mobile-person-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 28px 18px; }
 .rectangular-mobile .family-card { width: 100%; }
 .rectangular-mobile .portrait-photo { aspect-ratio: 2 / 3; padding: 0; }
 .rectangular-mobile .portrait-photo img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 0; }
 .teresa-portrait { width: min(32%, 180px); margin-right: 18px; }
}
@media (max-width: 420px) {
 .teresa-portrait { float: none; width: 160px; margin: 0 auto 24px; }
}

.character-story .story-signature { margin-top: 2em; text-align: right; font-style: italic; }

.rectangular-mobile .portrait-photo img { object-fit: contain; }
.tree-portrait .story-badge { top: auto; bottom: calc(100% + 5px); opacity: 0; pointer-events: none; }
.tree-portrait a:hover .story-badge, .tree-portrait a:focus-visible .story-badge { opacity: 1; }


/* Foto intere su rami e foglie: targhette HTML comprese nel collegamento. */
.leaf-tree { margin-bottom: 70px; }
.leaf-tree .portrait-photo { filter: drop-shadow(0 4px 5px #0008); }
.leaf-tree .tree-portrait h3 {
 position: absolute; top: calc(100% + 5px); left: -22%; width: 144%; height: auto;
 margin: 0; padding: 4px 3px; overflow: visible; clip-path: none;
 background: #ded0ac; color: #342d21; border: 0; border-radius: 1px;
 font: 500 clamp(9px, .95vw, 14px)/1.18 var(--serif); text-align: center;
 box-shadow: 0 2px 5px #0006; transform: none;
}
.leaf-tree .tree-portrait .person-card-link:hover h3,
.leaf-tree .tree-portrait .person-card-link:focus-visible h3 { background: #eee0bd; }
.rectangular-mobile .portrait-photo { border: 0; outline: 0; box-shadow: none; background: transparent; overflow: visible; }
.rectangular-mobile .portrait-photo img { filter: drop-shadow(0 4px 5px #0007); }
.rectangular-mobile h3 { background: #ded0ac; color: #342d21; padding: 6px 5px; margin: 9px 0 5px; font: 500 18px/1.25 var(--serif); }
.teresa-portrait .portrait-photo { box-shadow: none; background: transparent; }

/* Centra l’ingombro visivo dei rami, con foglie scure e desaturate. */
.leaf-tree .tree-art { left: -5.5%; filter: saturate(.28) brightness(.58) sepia(.2); }
.leaf-tree .tree-portrait { left: calc(var(--x) - 5.5%); }

/* Targhette in pergamena, con bordo bronzo e rilievo leggero. */
.leaf-tree .tree-portrait h3, .rectangular-mobile h3 {
 background: linear-gradient(180deg, #d6c9ac 0%, #c9b995 52%, #b9a581 100%);
 color: #352d22;
 border: 1px solid #7f6d50;
 border-radius: 3px;
 padding: 5px 6px;
 letter-spacing: .015em;
 font-weight: 500;
 box-shadow: inset 0 1px 0 #f4e8ce9c, inset 0 -1px 0 #67523545, 0 3px 5px #0006;
 text-shadow: 0 1px 0 #f4e8ce55;
}
.leaf-tree .tree-portrait .person-card-link:hover h3,
.leaf-tree .tree-portrait .person-card-link:focus-visible h3,
.rectangular-mobile .person-card-link:hover h3,
.rectangular-mobile .person-card-link:focus-visible h3 {
 background: linear-gradient(180deg, #e1d5b9, #c8b48f);
 border-color: #a58c60;
}

/* Teresa accompagna l'introduzione sul lato destro. */
.teresa-portrait { float: right; margin: 0 0 20px 28px; }
@media (max-width: 900px) { .teresa-portrait { margin: 0 0 20px 18px; } }
@media (max-width: 420px) { .teresa-portrait { float: none; margin: 0 auto 24px; } }

/* Ornamento della bambinaia separato dai rami genealogici. */
.leaf-tree .babysitter-foliage {
 left: -18.1%;
 clip-path: inset(73% 0% 0% 86%);
 pointer-events: none;
}

/* Didascalia e stato si spostano insieme senza cambiare l'impaginazione. */
.teresa-caption { display: flow-root; }
@media (min-width: 1200px) {
 .teresa-caption { text-align: right; transform: translate(calc(-100% - 16px), -100%); }
}

@media (min-width: 1200px) { .teresa-caption figcaption { justify-content: flex-end; padding-right: 0; } }

/* Teresa e l'albero sono due sezioni visivamente distinte. */
.archive-intro {
 background: rgba(12, 16, 15, .46);
 box-shadow: 0 0 0 100vmax rgba(12, 16, 15, .46);
 clip-path: inset(0 -100vmax);
}


/* La foto trovata: QR e inserimento manuale condividono lo stesso percorso. */
.found-photo { margin: 36px 0; padding: clamp(20px, 4vw, 32px); background: rgba(12,16,15,.46); border: 1px solid var(--line); }
.found-photo h2 { margin-top: 0; }
.found-photo-form { display: grid; gap: 12px; margin-top: 24px; }
.found-photo-form label { font-size: 13px; }
.found-photo-form input, .found-photo-form select { width: 100%; min-width: 0; border: 1px solid #8b8779; background: var(--background); color: var(--text); padding: 13px; font: 16px var(--sans); }
.found-photo-form button { background: #734c45; border: 1px solid #ac8073; color: #fff8ee; padding: 14px 18px; font: 15px var(--sans); cursor: pointer; }
.found-photo-form button:disabled { opacity: .65; cursor: wait; }
.found-photo-form :focus-visible { outline: 2px solid #dfc8a1; outline-offset: 4px; }
.found-photo-form .found-photo-message { min-height: 2em; margin: 0; font-size: 13px; line-height: 1.5; }

/* Testimonianza di chi ha trovato la fotografia. */
.story-comments { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid rgba(202,181,139,.35); }
.story-comments h2 { font-size: 1.6rem; }
.comment-code-form, .finder-comment-form { display: grid; gap: .8rem; }
.story-comments input, .story-comments textarea { box-sizing: border-box; width: 100%; min-width: 0; padding: .85rem; border: 1px solid #a88e61; border-radius: 4px; color: #eadcc1; background: #242621; font: inherit; }
.story-comments textarea { resize: vertical; line-height: 1.6; }
.story-comments textarea::placeholder { color: #c6bda9; opacity: 1; }
.story-comments button { justify-self: start; max-width: 100%; padding: .8rem 1.1rem; border: 1px solid #b39b70; border-radius: 4px; background: #d1bd91; color: #28251d; cursor: pointer; font: inherit; }
.story-comments button:disabled { opacity: .65; cursor: wait; }
.story-comments [hidden] { display: none !important; }
.story-comments #nota-commento { font-size: .9rem; opacity: .85; margin: 0 0 .5rem; }
.story-comments .comment-message { min-height: 1.5em; }
.finder-testimony { padding: 1rem 1.2rem; border-left: 2px solid #b39b70; background: rgba(219,200,158,.07); white-space: pre-wrap; overflow-wrap: anywhere; }
