/*
Theme Name: Finanziamenti&Bandi
Description: Tema leggero per finanziamentiebandi.it: pagine pubbliche e guide. Nessun font o script di terze parti.
Version: 0.1.0
Requires at least: 6.5
Requires PHP: 8.1
Text Domain: fb-theme
*/

:root { --fb-wide: 1140px; --fb-gutter: clamp(16px, 4vw, 32px); --fb-radius: 12px; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
img, svg { max-width: 100%; height: auto; }
a { text-underline-offset: 2px; }
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 100; clip: auto; width: auto; height: auto; padding: 10px 14px; background: #fff; color: #1e3a8a; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.fb-wrap { max-width: var(--fb-wide); margin: 0 auto; padding: 0 var(--fb-gutter); }

/* Intestazione */
.fb-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.97); border-bottom: 1px solid #e2e8f0; }
.fb-header__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.fb-logo { display: inline-flex; align-items: center; gap: 10px; color: #0f172a; text-decoration: none; font-weight: 700; font-size: 1.125rem; }
.fb-logo svg { width: 32px; height: 32px; flex: none; }
.fb-logo .amp { color: #047857; }
.fb-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 22px; }
.fb-nav a { color: #334155; text-decoration: none; font-weight: 500; font-size: .95rem; }
.fb-nav a:hover, .fb-nav .current-menu-item > a, .fb-nav a[aria-current="page"] { color: #1e3a8a; }
.fb-cta { display: flex; gap: 10px; align-items: center; }
.fb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 8px; font-weight: 600; font-size: .95rem; text-decoration: none; border: 1px solid transparent; line-height: 1.2; }
.fb-btn--primary { background: #1e3a8a; color: #fff; }
.fb-btn--primary:hover { background: #172554; color: #fff; }
.fb-btn--ghost { color: #1e3a8a; border-color: #cbd5e1; background: #fff; }
.fb-btn--ghost:hover { border-color: #1e3a8a; }
.fb-menu-toggle { display: none; }
@media (max-width: 900px) {
  .fb-nav, .fb-cta { display: none; }
  .fb-menu-toggle { display: inline-flex; padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; font-weight: 600; color: #0f172a; }
  .fb-header.is-open .fb-nav, .fb-header.is-open .fb-cta { display: flex; }
  .fb-header.is-open .fb-header__bar { flex-wrap: wrap; padding-bottom: 14px; }
  .fb-header.is-open .fb-nav { order: 3; width: 100%; }
  .fb-header.is-open .fb-nav ul { flex-direction: column; gap: 4px; width: 100%; }
  .fb-header.is-open .fb-nav a { display: block; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
  .fb-header.is-open .fb-cta { order: 4; width: 100%; }
  .fb-header.is-open .fb-cta .fb-btn { flex: 1; }
}

/* Contenuti */
.fb-main { min-height: 50vh; }
.fb-page-header { background: #f1f5f9; border-bottom: 1px solid #e2e8f0; padding: clamp(32px, 6vw, 56px) 0; }
.fb-page-header h1 { margin: 0; font-size: clamp(1.75rem, 4vw, 2.5rem); }
.fb-page-header p { margin: 10px 0 0; color: #475569; max-width: 62ch; }
.fb-content { padding-top: clamp(28px, 5vw, 48px); padding-bottom: clamp(40px, 7vw, 72px); }
.fb-content > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.fb-content > .alignwide, .fb-content > .fb-section { max-width: var(--fb-wide); }
.fb-content > .alignfull { max-width: none; }
.fb-content h2 { margin-top: 2em; font-size: clamp(1.4rem, 3vw, 1.85rem); }
.fb-content h3 { font-size: 1.15rem; margin-bottom: .4em; }
.fb-content table { width: 100%; border-collapse: collapse; font-size: .95rem; display: block; overflow-x: auto; }
.fb-content th, .fb-content td { border: 1px solid #e2e8f0; padding: 8px 10px; text-align: left; vertical-align: top; }
.fb-content th { background: #f8fafc; }
.fb-notice { background: #fffbeb; border: 1px solid #fcd34d; color: #78350f; border-radius: 8px; padding: 12px 16px; font-size: .95rem; }

/* Sezioni della home (blocchi con classi del tema) */
.fb-section { padding: clamp(40px, 7vw, 80px) var(--fb-gutter) !important; margin: 0 auto !important; }
/* Tutti gli elementi partono dal bordo sinistro del contenitore largo; ognuno ha la sua larghezza di lettura. */
.fb-section > *, .fb-section.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
  max-width: var(--fb-wide); margin-left: max(0px, calc((100% - var(--fb-wide)) / 2)) !important; margin-right: auto !important;
}
.fb-section > p, .fb-section > ul, .fb-section > ol { max-width: min(70ch, var(--fb-wide)); }
.fb-section .wp-block-columns p, .fb-section .wp-block-columns li { max-width: none; }
.fb-hero { background: linear-gradient(180deg, #eff6ff 0%, #fff 100%); }
.fb-hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.15; margin-top: 0; margin-bottom: 18px; text-wrap: balance; }
.fb-hero .fb-lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: #334155; }
.fb-hero > h1 { max-width: min(18ch, var(--fb-wide)); }
@media (min-width: 900px) { .fb-hero > h1 { max-width: 24ch; } }
.fb-eyebrow { color: #047857; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; margin-bottom: 8px; }
.fb-soft { background: #f8fafc; border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; }
.fb-cards { gap: 20px !important; }
.fb-card { background: #fff; border: 1px solid #e2e8f0; border-radius: var(--fb-radius); padding: 22px !important; }
.fb-card h3 { margin-top: 0; }
.fb-card--accent { border-color: #1e3a8a; box-shadow: 0 6px 24px rgba(30,58,138,.08); }
.fb-steps { counter-reset: fbstep; list-style: none; padding-left: 0; }
.fb-steps > li { counter-increment: fbstep; position: relative; padding: 4px 0 18px 52px; }
.fb-steps > li::before { content: counter(fbstep); position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%; background: #dbeafe; color: #1e3a8a; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.fb-checks { list-style: none; padding-left: 0; }
.fb-checks > li { padding-left: 28px; position: relative; margin-bottom: 8px; }
.fb-checks > li::before { content: "✓"; position: absolute; left: 0; color: #047857; font-weight: 700; }
.wp-block-details { border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px 18px; margin: 0 auto 12px; background: #fff; }
.wp-block-details summary { cursor: pointer; font-weight: 600; }
.wp-block-details[open] summary { margin-bottom: 8px; }
.fb-callout { border-left: 4px solid #1e3a8a; background: #eff6ff; padding: 14px 18px !important; border-radius: 0 8px 8px 0; }
.wp-block-button__link { padding: 12px 20px; }
.is-style-outline > .wp-block-button__link { background: #fff; color: #1e3a8a; border: 1px solid #94a3b8; }

/* Blog */
.fb-posts { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); max-width: var(--fb-wide) !important; }
.fb-post-card { border: 1px solid #e2e8f0; border-radius: var(--fb-radius); padding: 20px; }
.fb-post-card h2 { font-size: 1.15rem; margin: 0 0 8px; }
.fb-post-card h2 a { color: #0f172a; text-decoration: none; }
.fb-meta { color: #64748b; font-size: .875rem; }
.fb-updated { background: #f1f5f9; border-radius: 8px; padding: 10px 14px; font-size: .9rem; color: #334155; }

/* Modulo di contatto */
.fb-form { display: grid; gap: 16px; max-width: 640px; }
.fb-form .fb-row { display: grid; gap: 16px; }
@media (min-width: 640px) { .fb-form .fb-row { grid-template-columns: 1fr 1fr; } }
.fb-field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
.fb-field .req { color: #b91c1c; }
.fb-field input, .fb-field select, .fb-field textarea { width: 100%; padding: 10px 12px; border: 1px solid #94a3b8; border-radius: 8px; font: inherit; background: #fff; color: #0f172a; }
.fb-field textarea { min-height: 150px; resize: vertical; }
.fb-field [aria-invalid="true"] { border-color: #b91c1c; }
.fb-field .fb-error { color: #b91c1c; font-size: .875rem; margin-top: 4px; }
.fb-field .fb-hint { color: #64748b; font-size: .85rem; margin-top: 4px; }
.fb-check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.fb-check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.fb-hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.fb-alert { border-radius: 8px; padding: 12px 16px; }
.fb-alert--ok { background: #ecfdf5; border: 1px solid #6ee7b7; color: #065f46; }
.fb-alert--err { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.fb-small { font-size: .85rem; color: #475569; }

/* Piè di pagina */
.fb-footer { background: #0f172a; color: #cbd5e1; padding: 44px 0 28px; margin-top: 0; font-size: .95rem; }
.fb-footer a { color: #e2e8f0; }
.fb-footer__grid { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .fb-footer__grid { grid-template-columns: 2fr 1fr 1fr; } }
.fb-footer h2 { color: #fff; font-size: 1rem; margin: 0 0 10px; }
.fb-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.fb-footer__legal { border-top: 1px solid #1e293b; margin-top: 28px; padding-top: 18px; font-size: .85rem; color: #94a3b8; }
.fb-footer .fb-logo { color: #fff; }
