/*
Theme Name: Redazione
Description: Tema in stile app Apple per il blog. Su computer e Safari e un sito pulito e leggibile; installato sulla Home dell'iPhone diventa un'app: barra traslucida con titolo grande, liste a righe, barra a schede in basso, tasto Indietro, modalita scura.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: redazione
*/

/* ---------- colori e misure (come le app di sistema) ---------- */
:root {
  --bg: #f2f2f7;
  --paper: #ffffff;
  --card: #ffffff;
  --label: #000000;
  --label2: rgba(60, 60, 67, .68);
  --label3: rgba(60, 60, 67, .3);
  --sep: rgba(60, 60, 67, .22);
  --tint: #007aff;
  --fill: rgba(120, 120, 128, .12);
  --bar: rgba(249, 249, 249, .86);
  --brand1: #0b3d91;
  --brand2: #1565c0;
  --radius: 12px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
  --bar-h: 44px;
  --tab-h: 49px;
  --col: 720px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --paper: #000000;
    --card: #1c1c1e;
    --label: #ffffff;
    --label2: rgba(235, 235, 245, .62);
    --label3: rgba(235, 235, 245, .3);
    --sep: rgba(84, 84, 88, .65);
    --tint: #0a84ff;
    --fill: rgba(120, 120, 128, .24);
    --bar: rgba(29, 29, 31, .82);
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--label); font: 17px/1.47 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-wrap: break-word; min-height: 100vh; }
body.single, body.page, body.error404 { background: var(--paper); }
html:has(body.single), html:has(body.page) { background: var(--paper); }
a { color: var(--tint); text-decoration: none; }
img, svg, video, iframe { max-width: 100%; }
img, video { height: auto; }
button { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; border-radius: 6px; }
svg.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- barra in alto ---------- */
.bar { position: sticky; top: 0; z-index: 50; padding-top: var(--safe-t); background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: .5px solid var(--sep); view-transition-name: bar; }
.bar__in { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 960px; margin: 0 auto; min-height: var(--bar-h); padding: 0 max(16px, var(--safe-r)) 0 max(16px, var(--safe-l)); }
.bar__l, .bar__r { display: flex; align-items: center; gap: 4px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--label); font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand svg { width: 28px; height: 28px; border-radius: 7px; }
.bar__nav { display: flex; gap: 2px; }
.bar__nav a { padding: 6px 12px; border-radius: 999px; color: var(--label); font-size: 15px; font-weight: 500; }
.bar__nav a:hover { background: var(--fill); }
.bar__nav a[aria-current="page"] { background: var(--fill); color: var(--tint); }
.bar__btn { display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-width: 44px; min-height: 44px; padding: 0 6px; border: 0; background: none; color: var(--tint); cursor: pointer; -webkit-user-select: none; user-select: none; }
.bar__btn:active { opacity: .45; }
.bar__back { display: none; padding-left: 0; margin-left: -6px; font-size: 17px; }
.bar__back .i { width: 22px; height: 22px; stroke-width: 2.4; }
.bar__title, .bar__share { display: none; }
@media (max-width: 640px) {
  .bar__in { flex-wrap: wrap; padding-top: 4px; padding-bottom: 0; row-gap: 0; }
  .bar__nav { order: 3; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 2px 0 8px; margin: 0 -4px; }
  .bar__nav::-webkit-scrollbar { display: none; }
  .bar__nav a { white-space: nowrap; }
  .bar__r { display: contents; }
  .bar__search, .bar__share { order: 2; }
  .bar__search { margin-left: auto; }
}

/* ---------- schermata ---------- */
.screen { max-width: var(--col); margin: 0 auto; padding: 8px max(16px, var(--safe-r)) 56px max(16px, var(--safe-l)); }
.large-title { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .37px; margin: 8px 0 2px; }
.large-sub { margin: 0 0 14px; color: var(--label2); font-size: 15px; }
.empty { text-align: center; padding: 56px 16px; color: var(--label2); }
.empty h2 { color: var(--label); font-size: 22px; margin: 12px 0 6px; }
.empty .i { width: 48px; height: 48px; color: var(--label3); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border: 0; border-radius: 12px; background: var(--fill); color: var(--tint); font: 600 17px/1 var(--font); cursor: pointer; }
.btn:active { opacity: .6; }
.btn--primary { background: var(--tint); color: #fff; }

/* ---------- in evidenza ---------- */
.hero { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 188px; margin: 8px 0 0; padding: 20px; border-radius: 20px; overflow: hidden; color: #fff; background: radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 55%), linear-gradient(145deg, var(--brand1), var(--brand2)); transition: transform .18s ease; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.hero:active { transform: scale(.985); }
.hero__et { font-size: 12px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; opacity: .85; }
.hero__title { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; margin: 6px 0 8px; font-size: 24px; line-height: 29px; font-weight: 700; letter-spacing: .2px; color: #fff; }
.hero__meta { font-size: 13px; opacity: .85; }

/* ---------- liste a righe ---------- */
.sec { display: flex; align-items: baseline; justify-content: space-between; margin: 30px 0 8px; }
.sec h2 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: .35px; }
.sec a { font-size: 15px; }
.list { margin: 0; padding: 0; list-style: none; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.row { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: inherit; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; transition: background-color .12s ease; }
.list li + li .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.row:active { background: var(--fill); }
.row__body { flex: 1; min-width: 0; }
.row__cat { display: block; font-size: 12px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--tint); }
.row__title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 1px 0 3px; font-size: 17px; line-height: 22px; font-weight: 500; color: var(--label); }
.row__meta { display: block; font-size: 13px; color: var(--label2); }
.row__chev { flex: none; width: 8px; height: 14px; color: var(--label3); }
.pagination { display: flex; justify-content: center; gap: 8px; margin: 22px 0 0; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--card); color: var(--tint); font-weight: 600; padding: 0 14px; }
.pagination .current { background: var(--tint); color: #fff; }

/* ---------- articolo e pagine ---------- */
.post__cat { display: inline-block; margin: 6px 0 2px; font-size: 13px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--tint); }
.post__title { margin: 4px 0 8px; font-size: 30px; line-height: 36px; font-weight: 700; letter-spacing: .3px; }
.post__meta { margin: 0 0 22px; font-size: 14px; color: var(--label2); }
.entry { font-size: 17px; line-height: 1.6; }
.entry > :first-child { margin-top: 0; }
.entry p { margin: 0 0 1.05em; }
.entry h2 { margin: 1.7em 0 .5em; font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: .3px; }
.entry h3 { margin: 1.5em 0 .4em; font-size: 19px; line-height: 25px; font-weight: 600; }
.entry ul, .entry ol { margin: 0 0 1.05em; padding-left: 1.35em; }
.entry li { margin: .35em 0; }
.entry a { text-decoration: underline; text-decoration-thickness: .5px; text-underline-offset: 3px; }
.entry strong { font-weight: 600; }
.entry blockquote { margin: 1.2em 0; padding: .15em 0 .15em 1em; border-left: 3px solid var(--tint); color: var(--label2); }
.entry img { border-radius: 10px; }
.fonte { margin: 30px 0 6px; padding: 14px 16px; border-radius: var(--radius); background: var(--bg); font-size: 14px; line-height: 1.45; color: var(--label2); }
body.single .fonte, body.page .fonte { background: var(--fill); }
.fonte__et { display: block; margin-bottom: 2px; font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--label); }
.fonte p { margin: 0; }
.post__actions { display: flex; gap: 10px; margin: 22px 0 0; }
.seg { display: flex; margin: 6px 0 18px; padding: 2px; border-radius: 9px; background: var(--fill); }
.seg a { flex: 1; padding: 6px 8px; border-radius: 7px; text-align: center; font-size: 13px; font-weight: 600; color: var(--label); }
.seg a[aria-current="page"] { background: var(--card); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); }
body.page .seg a[aria-current="page"] { background: var(--paper); }

/* ---------- cerca ---------- */
.searchbox { position: relative; margin: 6px 0 4px; }
.searchbox .i { position: absolute; left: 10px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--label2); pointer-events: none; }
.searchbox input[type=search] { width: 100%; height: 40px; padding: 0 12px 0 34px; border: 0; border-radius: 10px; background: var(--fill); color: var(--label); font: 17px/1 var(--font); -webkit-appearance: none; appearance: none; }
.searchbox input::placeholder { color: var(--label2); }
.searchbox input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ---------- commenti ---------- */
.comments { margin-top: 36px; }
.comments h2, .comment-reply-title { font-size: 22px; line-height: 28px; font-weight: 700; margin: 0 0 10px; }
.comment-list { margin: 0 0 24px; padding: 0; list-style: none; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.comment-list .comment-body { padding: 12px 16px; border-top: .5px solid var(--sep); }
.comment-list > li:first-child > .comment-body { border-top: 0; }
.comment-list .children { margin: 0; padding-left: 16px; list-style: none; }
.comment-author { font-weight: 600; font-size: 15px; }
.comment-author .avatar { display: none; }
.comment-metadata, .comment-metadata a { font-size: 12px; color: var(--label2); }
.comment-content { margin-top: 4px; font-size: 16px; }
.comment-content p { margin: 0 0 .6em; }
.reply a { font-size: 14px; font-weight: 600; }
.comment-form { display: grid; gap: 10px; }
.comment-form p { margin: 0; }
.comment-form label { display: block; margin: 0 0 4px; font-size: 13px; color: var(--label2); }
.comment-form input[type=text], .comment-form input[type=email], .comment-form input[type=url], .comment-form textarea { width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: var(--fill); color: var(--label); font: 16px/1.4 var(--font); -webkit-appearance: none; appearance: none; }
.comment-form .note, .comment-notes { font-size: 13px; color: var(--label2); }
.comment-form-cookies-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--label2); }
.comment-form-cookies-consent input { margin-top: 3px; }
.comment-form .submit { width: 100%; }

/* ---------- piede (sito) ---------- */
.foot { max-width: var(--col); margin: 12px auto 0; padding: 0 max(16px, var(--safe-r)) calc(28px + var(--safe-b)) max(16px, var(--safe-l)); color: var(--label2); font-size: 13px; line-height: 1.5; }
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 10px; }
.foot p { margin: 0 0 6px; }

/* ---------- barra a schede in basso (solo nell'app) ---------- */
.tabs { display: none; }
.is-app .tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding-bottom: var(--safe-b); background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid var(--sep); view-transition-name: tabs; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--tab-h); padding: 6px 0 4px; color: var(--label2); font-size: 10px; font-weight: 500; letter-spacing: .1px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.tab .i { width: 25px; height: 25px; }
.tab:active { opacity: .55; }
.tab[aria-current="page"] { color: var(--tint); }
.tab[aria-current="page"] .i { stroke-width: 2.2; }

/* ---------- modalita app (schermo intero) ---------- */
.is-app body { -webkit-user-select: none; user-select: none; }
.is-app .entry, .is-app .comments, .is-app .post__title, .is-app .post__meta, .is-app input, .is-app textarea { -webkit-user-select: text; user-select: text; }
.is-app #wpadminbar { display: none !important; }
html.is-app { margin-top: 0 !important; }
.is-app .brand, .is-app .bar__nav, .is-app .bar__search, .is-app .foot { display: none; }
.is-app .bar { background: transparent; border-bottom-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; transition: background-color .2s ease, border-color .2s ease; }
.is-app .bar--solid { background: var(--bar); border-bottom-color: var(--sep); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.is-app .bar__in { display: grid; grid-template-columns: minmax(64px, 1fr) auto minmax(64px, 1fr); flex-wrap: nowrap; padding-top: 0; padding-bottom: 0; }
.is-app .bar__l { justify-self: start; }
.is-app .bar__r { display: flex; justify-self: end; margin-left: 0; }
.is-app .bar__title { display: block; max-width: calc(100vw - 150px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 600; opacity: 0; transition: opacity .18s ease; }
.is-app .bar--solid .bar__title { opacity: 1; }
.is-app.has-back .bar__back { display: inline-flex; }
.is-app .bar__share { display: inline-flex; }
.is-app .bar--solid .bar__back span { display: none; }
.is-app .bar--solid .bar__back { padding-right: 0; }
.is-app .screen { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 28px); }
.is-app .seg { margin-top: 2px; }

/* ---------- tira per aggiornare (solo app) ---------- */
.ptr { position: fixed; top: calc(var(--safe-t) + 6px); left: 50%; z-index: 70; width: 30px; height: 30px; margin-left: -15px; border-radius: 50%; background: var(--card); box-shadow: 0 2px 10px rgba(0, 0, 0, .18); display: flex; align-items: center; justify-content: center; color: var(--tint); opacity: 0; pointer-events: none; transform: translateY(0); }
.ptr svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.ptr--on { opacity: 1 !important; transform: translateY(46px) !important; transition: transform .2s ease; }
.ptr--on svg { animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ---------- transizioni leggere tra le pagine ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- computer: colonna centrale piu ampia ---------- */
@media (min-width: 900px) {
  :root { --col: 760px; }
  .large-title { font-size: 40px; line-height: 48px; }
  .post__title { font-size: 38px; line-height: 44px; }
}
