/*
Theme Name: FamilyTimeline
Description: Tema leggero e multilingua (EN, IT, FR, DE, ES) per il sito di FamilyTimeline. Richiede il plugin Polylang.
Version: 1.0.5
Author: FamilyTimeline
Text Domain: familytimeline
*/

:root {
    --bg: #fbf7f2;
    --surface: #ffffff;
    --text: #2a2623;
    --muted: #6b635c;
    --line: #e9e1d8;
    --brand: #1f6f78;
    --brand-dark: #165259;
    --accent: #e07a3f;
    --radius: 18px;
    --shadow: 0 6px 24px rgba(42, 38, 35, .08);
    --maxw: 1080px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #171514;
        --surface: #221f1d;
        --text: #f1ebe4;
        --muted: #b3a89d;
        --line: #36312d;
        --brand: #4fb3be;
        --brand-dark: #7cc9d2;
        --shadow: 0 6px 24px rgba(0, 0, 0, .35);
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 64px 0; }
.section.alt { background: var(--surface); border-block: 1px solid var(--line); }
.center { text-align: center; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; }
.center .lead { margin-inline: auto; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 100; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; white-space: nowrap; font-weight: 800; font-size: 1.2rem; line-height: 1; text-decoration: none; color: var(--text); margin-right: auto; }
.logo img { display: block; width: 36px; height: 36px; border-radius: 9px; }
.logo b { font-weight: 800; }
.logo span { color: var(--accent); }
.nav ul { list-style: none; display: flex; gap: 22px; margin: 0; padding: 0; }
.nav a { text-decoration: none; color: var(--text); font-weight: 500; }
.nav a:hover, .nav .current-menu-item > a, .nav .current_page_item > a { color: var(--brand); }
/* Selettore lingua a tendina */
.langsw { position: relative; flex-shrink: 0; }
.langsw summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 600; font-size: .9rem; user-select: none; }
.langsw summary::-webkit-details-marker { display: none; }
.langsw summary::after { content: "▾"; font-size: .75rem; color: var(--muted); }
.langsw[open] summary::after { content: "▴"; }
.langsw img { display: block; width: 22px; height: 15px; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px var(--line); }
.langsw ul { position: absolute; left: 0; top: calc(100% + 6px); z-index: 60; min-width: 100%; list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.langsw a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; font-size: .9rem; font-weight: 600; text-decoration: none; color: var(--text); }
.langsw a:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.burger { display: none; background: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; color: var(--text); font: inherit; cursor: pointer; }

@media (max-width: 820px) {
    .burger { display: block; }
    .nav { display: none; position: absolute; left: 0; right: 0; top: 64px; background: var(--bg); border-bottom: 1px solid var(--line); padding: 12px 20px 20px; }
    .nav.open { display: block; }
    .nav ul { flex-direction: column; gap: 12px; }
    .bar { flex-wrap: wrap; }
}

/* Pulsanti e moduli */
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 14px 28px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .15s, filter .15s; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn.alt { background: var(--brand); }
.badge { display: inline-block; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 700; font-size: .85rem; padding: 6px 14px; border-radius: 999px; margin-bottom: 18px; }

.form { display: grid; gap: 12px; max-width: 520px; }
.center .form { margin-inline: auto; text-align: left; }
.form label.f { font-weight: 600; font-size: .95rem; }
.form input[type=email], .form input[type=text], .form textarea { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; }
.form input:focus, .form textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.form .consent { display: flex; gap: 10px; font-size: .88rem; color: var(--muted); align-items: flex-start; }
.form .consent input { margin-top: 4px; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.notice { padding: 12px 16px; border-radius: 12px; font-weight: 600; max-width: 520px; }
.center .notice { margin-inline: auto; }
.notice.ok { background: #e3f4e8; color: #1c5a30; }
.notice.err { background: #fbe4e1; color: #8a2a1f; }

/* Hero */
.hero { padding: 72px 0 56px; text-align: center; background: radial-gradient(900px 400px at 50% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent); }
.hero .lead { margin: 0 auto 28px; }

/* Griglie e card */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 32px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: .35em; }
.card p { color: var(--muted); margin: 0; }
.ico-img { display: block; width: 56px; height: 56px; border-radius: 14px; margin-bottom: 14px; }
.center .card .ico-img { margin-inline: auto; }
.hero-icon { display: block; width: 168px; height: 168px; margin: 0 auto 26px; border-radius: 38px; box-shadow: 0 14px 40px rgba(224, 122, 63, .35); }
.ico { width: 44px; height: 44px; border-radius: 12px; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); display: grid; place-items: center; font-weight: 800; margin-bottom: 14px; }

/* Prezzi */
.toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin: 20px 0 8px; }
.toggle button { border: 0; background: none; color: var(--text); font: inherit; font-weight: 600; padding: 9px 22px; border-radius: 999px; cursor: pointer; }
.toggle button[aria-pressed=true] { background: var(--brand); color: #fff; }
.plans { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 28px; text-align: left; }
.plan { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; box-shadow: var(--shadow); }
.plan.pop { border: 2px solid var(--accent); }
.plan .tag { position: absolute; top: -13px; left: 24px; background: var(--accent); color: #fff; font-size: .78rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; }
.plan h3 { margin-bottom: 4px; }
.plan .desc { color: var(--muted); font-size: .95rem; min-height: 3em; }
.price { font-size: 2.4rem; font-weight: 800; letter-spacing: -.02em; margin: 10px 0 0; }
.price small { font-size: 1rem; font-weight: 500; color: var(--muted); }
.save { color: var(--accent); font-weight: 700; font-size: .9rem; min-height: 1.4em; margin: 0 0 12px; }
.plan ul { list-style: none; padding: 0; margin: 12px 0 22px; flex: 1; }
.plan li { padding: 6px 0 6px 26px; position: relative; font-size: .95rem; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--brand); font-weight: 800; }
.plan .btn { text-align: center; }
.plans[data-period=month] .p-year, .plans[data-period=year] .p-month { display: none; }
.note { color: var(--muted); font-size: .88rem; max-width: 720px; margin: 28px auto 0; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 8px 0 0; }
.social { margin-top: 18px; }
.social a { margin: 0 10px; font-weight: 600; }

/* Blog */
.blog-head { margin-bottom: 36px; }
.blog-head .lead { margin: 0 auto 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { display: inline-block; padding: 5px 14px; border-radius: 999px; font-size: .85rem; font-weight: 600; text-decoration: none; color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); border: 1px solid transparent; }
.chip:hover { border-color: var(--brand); }
.chip.on { background: var(--brand); color: #fff; }

.posts { display: grid; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.post-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s; }
.post-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(42, 38, 35, .14); }
.post-card .media { display: block; aspect-ratio: 16 / 9; background: var(--line); overflow: hidden; }
.post-card .media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-card .ph { display: grid; place-items: center; width: 100%; height: 100%; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--surface)), color-mix(in srgb, var(--brand) 22%, var(--surface))); }
.post-card .ph img { width: 72px; height: 72px; border-radius: 18px; box-shadow: var(--shadow); }
.post-card .body { padding: 22px; display: flex; flex-direction: column; flex: 1; }
.post-card .title { font-size: 1.2rem; margin: 6px 0 8px; }
.post-card .title a { color: var(--text); text-decoration: none; }
.post-card .title a:hover { color: var(--brand); }
.post-card .excerpt { color: var(--muted); font-size: .96rem; margin: 0 0 14px; }
.post-card .more { margin-top: auto; font-weight: 600; text-decoration: none; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; }
.meta .chip { padding: 2px 10px; font-size: .78rem; }

.post-card.is-featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.15fr 1fr; }
.post-card.is-featured .media { aspect-ratio: auto; min-height: 280px; height: 100%; }
.post-card.is-featured .body { padding: 34px; justify-content: center; }
.post-card.is-featured .title { font-size: clamp(1.5rem, 3vw, 2rem); }
.post-card.is-featured .excerpt { font-size: 1.05rem; }
@media (max-width: 760px) { .post-card.is-featured { grid-template-columns: 1fr; } .post-card.is-featured .media { aspect-ratio: 16 / 9; min-height: 0; } .post-card.is-featured .body { padding: 22px; } }

.empty { text-align: center; padding: 48px 0; color: var(--muted); }
.empty img { border-radius: 22px; margin-bottom: 14px; box-shadow: var(--shadow); }

.pagination { margin-top: 36px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pagination .page-numbers { min-width: 40px; text-align: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; background: var(--surface); color: var(--text); }
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Articolo */
.article { max-width: 740px; margin: 0 auto; }
.article .back { font-size: .92rem; margin-bottom: 24px; }
.post-head h1 { font-size: clamp(1.9rem, 4.5vw, 2.7rem); margin: 12px 0 22px; }
.post-cover { margin: 0 0 30px; }
.post-cover img { width: 100%; height: auto; border-radius: var(--radius); display: block; }
.entry { font-size: 1.08rem; line-height: 1.75; }
.entry > * + * { margin-top: 1.1em; }
.entry h2 { margin-top: 1.8em; }
.entry [id] { scroll-margin-top: 88px; } /* i link del sommario non finiscono sotto la barra fissa */
.entry h3 { margin-top: 1.5em; }
.entry img { border-radius: 14px; }
.entry figure { margin-inline: 0; }
.entry figcaption { color: var(--muted); font-size: .88rem; text-align: center; margin-top: 8px; }
.entry blockquote { margin-inline: 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--accent); color: var(--muted); font-style: italic; }
.entry ol, .entry ul { padding-left: 1.3em; }
.entry table { width: 100%; border-collapse: collapse; font-size: .93rem; display: block; overflow-x: auto; }
.entry th, .entry td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.entry th { background: var(--surface); }
.share { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 40px 0 0; padding-top: 22px; border-top: 1px solid var(--line); }
.share a { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); text-decoration: none; font-weight: 600; font-size: .9rem; }
.share a:hover { border-color: var(--brand); }
.post-nav { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; margin-top: 28px; }
.post-nav a { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; color: var(--text); }
.post-nav a:hover { border-color: var(--brand); }
.post-nav small { display: block; color: var(--muted); margin-bottom: 4px; }
.post-nav span { font-weight: 700; }
.post-nav .next { text-align: right; grid-column: 2; }
@media (max-width: 600px) { .post-nav { grid-template-columns: 1fr; } .post-nav .next { grid-column: auto; } }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0; color: var(--muted); font-size: .92rem; }
.foot { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
.site-footer a { color: var(--muted); margin-right: 16px; }
.site-footer .small { font-size: .8rem; margin-top: 20px; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .btn { transition: none; } }
