/*
Theme Name: Romagna Podismo
Description: Tema su misura per Romagna Podismo: archivio di gare, locandine, classifiche e foto, ottimizzato per la SEO e Google Discover.
Author: Romagna Podismo
Version: 1.0.0
Requires PHP: 8.1
Text Domain: romagnapodismo
*/

/* ---------- Caratteri ---------- */

@font-face { font-family: "Outfit"; src: url("assets/fonts/outfit.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("assets/fonts/manrope.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

/* ---------- Variabili ---------- */

:root {
  --ink: #0d1f4f;          /* blu notte, dal blu del vecchio logo */
  --ink-2: #26365f;
  --brand: #1d4ed8;
  --brand-dark: #1638a6;
  --sky: #a9dcf7;          /* azzurro del vecchio favicon */
  --sky-soft: #eaf6fd;
  --accent: #ff6a2b;       /* arancio pettorale */
  --accent-dark: #e2541a;
  --bg: #f6f8fb;
  --card: #fff;
  --line: #e1e7f0;
  --text: #1c2539;
  --muted: #5d6a83;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(13, 31, 79, .06), 0 6px 20px rgba(13, 31, 79, .06);
  --shadow-hover: 0 2px 4px rgba(13, 31, 79, .08), 0 14px 34px rgba(13, 31, 79, .12);
  --font-head: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 1200px;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--font-body); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--ink); line-height: 1.2; letter-spacing: -.01em; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Intestazione ---------- */

.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .94); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.site-header__inner { display: flex; align-items: center; gap: 20px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand__icon { width: 40px; height: 40px; }
.brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.brand__name { font: 600 1.32rem/1 var(--font-head); letter-spacing: -.02em; }
.brand__name b { font-weight: 800; color: var(--brand); }
.brand__tag { font-size: .72rem; color: var(--muted); margin-top: 3px; letter-spacing: .02em; }
.brand--light { color: #fff; }
.brand--light .brand__name b { color: var(--sky); }

.nav { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.nav__list { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav__list > li { position: relative; }
.nav__list a { display: block; padding: 8px 11px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .93rem; white-space: nowrap; }
.nav__list a:hover, .nav__list .current-menu-item > a { background: var(--sky-soft); color: var(--brand-dark); }
.nav__list .sub-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 210px; list-style: none; margin: 0; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-hover); }
.nav__list li:hover > .sub-menu, .nav__list li:focus-within > .sub-menu { display: block; }
.nav__search { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 14px; }
.nav__search input { border: 0; background: transparent; font: inherit; font-size: .9rem; width: 180px; padding: 6px 0; outline: none; }
.nav__search button { border: 0; background: none; color: var(--muted); padding: 6px; cursor: pointer; border-radius: 50%; }
.nav-toggle { display: none; margin-left: auto; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 12px; font: 600 .9rem var(--font-body); color: var(--ink); cursor: pointer; }

@media (max-width: 1080px) {
  .nav-toggle { display: inline-flex; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 20px 20px; background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--shadow-hover); max-height: calc(100vh - 68px); overflow: auto; }
  .nav.is-open { display: flex; }
  .nav__list { flex-direction: column; }
  .nav__list a { padding: 11px 12px; font-size: 1rem; }
  .nav__list .sub-menu { display: block; position: static; box-shadow: none; border: 0; padding: 0 0 0 14px; }
  .nav__search input { width: 100%; }
}
@media (max-width: 520px) { .brand__tag { display: none; } .brand__name { font-size: 1.15rem; } }

/* ---------- Home ---------- */

.hero { background: radial-gradient(1200px 500px at 85% -10%, rgba(169, 220, 247, .35), transparent 60%), linear-gradient(160deg, var(--ink) 0%, #12307a 60%, var(--brand) 120%); color: #fff; padding: 56px 0 60px; overflow: hidden; }
.hero__inner { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.hero__title { color: #fff; font-size: clamp(2.1rem, 4.6vw, 3.4rem); font-weight: 700; margin: .25em 0 .35em; letter-spacing: -.025em; }
.hero__title span { color: var(--sky); }
.hero__lead { font-size: 1.1rem; color: rgba(255, 255, 255, .86); max-width: 34em; margin: 0 0 26px; }
.hero__search { display: flex; gap: 8px; background: #fff; border-radius: 999px; padding: 6px; max-width: 520px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.hero__search input { flex: 1; min-width: 0; border: 0; font: inherit; padding: 10px 16px; outline: none; border-radius: 999px; color: var(--text); }
.hero__search button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--accent); color: #fff; font: 700 .95rem var(--font-body); padding: 10px 20px; border-radius: 999px; cursor: pointer; }
.hero__search button:hover { background: var(--accent-dark); }
.hero__search--inline { margin-top: 18px; border: 1px solid var(--line); box-shadow: none; }
.kicker { margin: 0; font: 700 .78rem/1.3 var(--font-body); text-transform: uppercase; letter-spacing: .09em; color: var(--accent-dark); }
.kicker a { color: inherit; text-decoration: none; }
.kicker--light { color: var(--sky); }

.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; height: 100%; padding: 16px; border-radius: var(--radius); background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); color: #fff; text-decoration: none; transition: background .2s, transform .2s; }
.tile:hover { background: rgba(255, 255, 255, .16); color: #fff; transform: translateY(-2px); }
.tile .icon { grid-row: span 2; width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--accent); color: #fff; }
.tile__label { font: 700 1.02rem var(--font-head); }
.tile__desc { font-size: .8rem; color: rgba(255, 255, 255, .75); line-height: 1.35; }
.tiles--light .tile { background: #fff; border-color: var(--line); color: var(--ink); grid-template-columns: 1fr; box-shadow: var(--shadow); }
.tiles--light .tile__desc { color: var(--muted); }
.tiles--light { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

@media (max-width: 900px) {
  .hero { padding: 36px 0 40px; }
  .hero__inner { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 420px) { .tiles { grid-template-columns: 1fr; } }

.band { padding: 52px 0; }
.band--tint { background: var(--sky-soft); }
.band--dark { background: var(--ink); }
.band--dark .band__head h2 { color: #fff; }
.band--dark .more { color: var(--sky); }
.band__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.band__head h2 { margin: 0; font-size: clamp(1.45rem, 2.6vw, 1.9rem); font-weight: 700; }
.more { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .92rem; text-decoration: none; white-space: nowrap; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* ---------- Griglie e schede ---------- */

.grid { display: grid; gap: 20px; }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.grid--posters { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid--news { grid-template-columns: 2fr 1fr 1fr; grid-auto-rows: auto; }
.grid--news .card--lead { grid-row: span 2; }
.grid--news .card--lead .card__media { aspect-ratio: 16 / 10; }
.grid--news .card--lead .card__title { font-size: 1.4rem; }
@media (max-width: 960px) { .grid--news { grid-template-columns: 1fr 1fr; } .grid--news .card--lead { grid-column: span 2; grid-row: auto; } }
@media (max-width: 560px) { .grid--news { grid-template-columns: 1fr; } .grid--news .card--lead { grid-column: auto; } }

.card { display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s; position: relative; }
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card__media { display: block; aspect-ratio: 3 / 2; background: var(--sky-soft); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card--poster .card__media { aspect-ratio: 3 / 4; background: #fff; }
.card--poster .card__media img { object-fit: contain; padding: 8px; }
.card__placeholder { display: grid; place-items: center; height: 100%; color: var(--brand); }
.card__placeholder .icon { width: 48px; height: 48px; opacity: .55; }
.card__body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card__kicker { margin: 0; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-dark); }
.card__title { margin: 0; font: 600 1.05rem/1.3 var(--font-head); color: var(--ink); }
.card__title a { color: inherit; text-decoration: none; }
.card__title a::after { content: ""; position: absolute; inset: 0; }
.card__meta { margin: auto 0 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .82rem; color: var(--muted); }

.rows { list-style: none; margin: 0; padding: 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto auto; column-gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); position: relative; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--sky-soft); }
.row__date { grid-row: span 2; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 10px; background: var(--sky-soft); color: var(--brand-dark); font-size: .68rem; font-weight: 700; text-transform: uppercase; line-height: 1.1; padding: 6px 4px; }
.row__date span { font: 700 1.35rem/1 var(--font-head); color: var(--ink); }
.row__title { font-weight: 700; color: var(--ink); text-decoration: none; line-height: 1.35; }
.row__title::after { content: ""; position: absolute; inset: 0; }
.row__place { font-size: .84rem; color: var(--muted); }

/* ---------- Contenuti ---------- */

.entry__head { background: #fff; border-bottom: 1px solid var(--line); padding: 22px 0 28px; }
.entry__title { font-size: clamp(1.7rem, 3.6vw, 2.6rem); font-weight: 700; margin: .25em 0 .3em; max-width: 30em; }
.entry__lead { font-size: 1.1rem; color: var(--muted); max-width: 46em; margin: 0; }
.entry__meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.entry__meta span { display: inline-flex; align-items: center; gap: 6px; }
.entry__meta .icon { color: var(--brand); }
.entry__layout { padding-top: 32px; padding-bottom: 48px; }
.entry__main { max-width: 800px; }
.entry__main--wide { max-width: none; }
.entry__hero { margin: 0 0 28px; border-radius: var(--radius); overflow: hidden; }
.entry__hero img { display: block; width: 100%; }
/* Vignette video o locandina della stessa gara al posto di una foto perduta : inquadrata nel formato originale */
.prose img.rp-sost { object-fit: cover; object-position: top; border-radius: 4px; }

.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0 0 12px; padding: 0; font-size: .84rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 6px; color: #9aa6bd; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand); text-decoration: underline; }

.prose { font-size: 1.05rem; line-height: 1.75; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.6rem; margin: 1.6em 0 .5em; }
.prose h3 { font-size: 1.25rem; margin: 1.4em 0 .4em; }
.prose img { border-radius: var(--radius-sm); }
.prose figure { margin: 1.6em 0; }
.prose figcaption { font-size: .88rem; color: var(--muted); margin-top: 6px; }
.prose blockquote { margin: 1.4em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--accent); color: var(--ink-2); font-style: italic; }
.prose iframe { max-width: 100%; border: 0; border-radius: var(--radius-sm); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose--center { max-width: 820px; text-align: center; }
.table-scroll { overflow-x: auto; margin: 1.4em 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.prose table { border-collapse: collapse; width: 100%; font-size: .92rem; line-height: 1.45; }
.prose th, .prose td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { background: var(--sky-soft); color: var(--ink); font-weight: 700; position: sticky; top: 0; }
.prose tr:hover td { background: #fafcff; }

.note { background: var(--sky-soft); border-left: 4px solid var(--brand); border-radius: var(--radius-sm); padding: 12px 16px; color: var(--ink-2); font-size: .95rem; }
.badge { display: inline-block; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; }
.section-title { font: 700 1.3rem/1.2 var(--font-head); color: var(--ink); margin: 0 0 16px; }
.latest { padding-top: 32px; }

.docs { list-style: none; margin: 18px 0; padding: 0; display: grid; gap: 10px; }
.doc { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-weight: 600; transition: border-color .2s, box-shadow .2s; }
.doc:hover { border-color: var(--brand); box-shadow: var(--shadow); color: var(--brand-dark); }
.doc .icon { color: var(--accent); width: 26px; height: 26px; }
.doc__label { flex: 1; }
.doc__ext { font-size: .72rem; font-weight: 800; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }

.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 28px; }
.panel__title { display: flex; align-items: center; gap: 8px; margin: 0; font: 700 1.1rem var(--font-head); color: var(--ink); }
.panel__title .icon { color: var(--accent); }

/* Locandina */
.poster { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 36px; padding-top: 32px; padding-bottom: 48px; align-items: start; }
.poster__image { margin: 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.poster__image img { display: block; margin: 0 auto; border-radius: 6px; }
.poster__info { position: sticky; top: 90px; }
.poster__text { grid-column: 1 / -1; max-width: 800px; }
.facts { margin: 0 0 8px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 20px; }
.facts div { display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts div:last-child { border-bottom: 0; }
.facts dt { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding-top: 2px; }
.facts dd { margin: 0; font-weight: 600; color: var(--ink); }
@media (max-width: 860px) { .poster { grid-template-columns: 1fr; } .poster__info { position: static; } }

/* Galleria */
.gallery__count { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--muted); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 12px; }
.gallery__item { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px; background: var(--sky-soft); scroll-margin-top: 100px; }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.gallery__item:hover img { transform: scale(1.04); }
.gallery__item.is-target { outline: 4px solid var(--accent); outline-offset: 2px; }
@media (max-width: 520px) { .gallery { grid-template-columns: repeat(2, 1fr); gap: 4px; } }

.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: rgba(5, 12, 30, .92); }
.lightbox figure { margin: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 50px 60px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 120px); border-radius: 6px; }
.lightbox figcaption { color: #cfd8ea; margin-top: 10px; font-size: .9rem; }
.lightbox button { position: absolute; border: 0; background: rgba(255, 255, 255, .12); color: #fff; width: 46px; height: 46px; border-radius: 50%; font-size: 1.8rem; line-height: 1; cursor: pointer; }
.lightbox button:hover { background: rgba(255, 255, 255, .25); }
.lightbox__close { top: 14px; right: 14px; }
.lightbox__prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 12px; top: 50%; transform: translateY(-50%); }
.lightbox--single .lightbox__prev, .lightbox--single .lightbox__next { display: none; }

/* Forum */
.thread { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 14px; }
.thread__msg { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; }
.thread__msg:first-child { border-left: 4px solid var(--accent); }
.thread__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 8px; font-size: .88rem; color: var(--muted); }
.thread__author { font-weight: 800; color: var(--ink); font-size: .95rem; }
.thread__text { font-size: 1rem; }

/* Autore */
.author-box { display: flex; gap: 16px; align-items: flex-start; margin-top: 36px; padding: 20px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.author-box__img { border-radius: 50%; }
.author-box__name { margin: 0; font: 700 1.05rem var(--font-head); color: var(--ink); }
.author-box__bio { margin: 4px 0 0; color: var(--muted); font-size: .94rem; }

.related { background: var(--sky-soft); padding: 40px 0 48px; }
.related .grid + .section-title { margin-top: 32px; }

.listing { padding-top: 32px; padding-bottom: 56px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 36px; }
.pagination .page-numbers { padding: 8px 14px; border-radius: 10px; background: #fff; border: 1px solid var(--line); text-decoration: none; font-weight: 700; }
.pagination .current { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Contact Form 7 */
.wpcf7 label { display: block; font-weight: 600; margin-bottom: 14px; }
.wpcf7 input[type="text"], .wpcf7 input[type="email"], .wpcf7 input[type="tel"], .wpcf7 textarea { width: 100%; margin-top: 6px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: #fff; }
.wpcf7 input[type="submit"] { background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 12px 28px; font: 700 1rem var(--font-body); cursor: pointer; }

/* ---------- Piè di pagina ---------- */

.site-footer { background: var(--ink); color: rgba(255, 255, 255, .78); padding: 48px 0 0; font-size: .93rem; }
.site-footer__grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 36px; }
.site-footer__about p { max-width: 30em; }
.site-footer__title { font: 700 .82rem var(--font-body); text-transform: uppercase; letter-spacing: .09em; color: var(--sky); margin: 4px 0 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { color: var(--sky); text-decoration: underline; }
.site-footer__bottom { display: flex; justify-content: space-between; gap: 16px; margin-top: 36px; padding-top: 18px; padding-bottom: 22px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .84rem; }
.site-footer__bottom p { margin: 0; }
@media (max-width: 760px) { .site-footer__grid { grid-template-columns: 1fr 1fr; } .site-footer__about { grid-column: 1 / -1; } }
