/* Guida di Sfoglia (ADR-151). Usa i colori di style.css (tema scuro e chiaro). */

.guide .langs { display: none; } /* la lingua della guida si sceglie con il suo menu (8 lingue) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.g-page .wrap { max-width: 1320px; padding-top: 74px; }
.g-page { --g-accent: var(--lav); --g-dim: rgba(6, 9, 18, .55); --g-card: var(--box); --g-card-line: var(--line-2); }
:root[data-theme="light"] .g-page { --g-dim: rgba(22, 19, 48, .38); }

/* ---------- Barra: ricerca, telefono/computer, lingua ---------- */
.g-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 4px 0 26px; }
.g-search { position: relative; flex: 1 1 320px; max-width: 560px; }
.g-search > .i { position: absolute; left: 16px; top: 50%; width: 19px; height: 19px; margin-top: -9.5px; color: var(--muted); pointer-events: none; }
.g-search input {
  width: 100%; height: 46px; padding: 0 16px 0 46px;
  border: 1px solid var(--g-card-line); border-radius: 23px;
  background: var(--g-card); color: var(--text); font: inherit; font-size: 15.5px;
}
.g-search input::placeholder { color: var(--muted); }
.g-search input:focus { outline: 2px solid var(--g-accent); outline-offset: 1px; }
.g-results {
  position: absolute; left: 0; right: 0; top: 52px; z-index: 40;
  max-height: 70vh; overflow: auto; padding: 6px;
  border: 1px solid var(--g-card-line); border-radius: 18px;
  background: var(--bg); box-shadow: var(--shadow);
}
.g-results a { display: block; padding: 10px 12px; border-radius: 12px; color: var(--text-3); text-decoration: none; }
.g-results a:hover, .g-results a.on { background: var(--chip-hover); }
.g-results b { display: block; color: var(--text); font-weight: 650; }
.g-results span { display: inline-block; margin-top: 2px; color: var(--g-accent); font-size: 13px; }
.g-results small { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.g-none { margin: 0; padding: 12px; color: var(--muted); }

.g-devices { display: inline-flex; padding: 4px; border: 1px solid var(--g-card-line); border-radius: 23px; background: var(--g-card); }
.g-devices button {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
  border: 0; border-radius: 18px; background: transparent; color: var(--text-3); font: inherit; font-size: 14.5px; cursor: pointer;
}
.g-devices button .i { width: 17px; height: 17px; }
.g-devices button[aria-pressed="true"] { background: var(--pill); color: var(--pill-text); font-weight: 600; }

.g-langs { position: relative; margin: 0; padding: 0; border: 0; background: none; }
.g-langs summary {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px;
  border: 1px solid var(--g-card-line); border-radius: 23px; background: var(--g-card);
  color: var(--text); font-weight: 500; list-style: none;
}
.g-langs summary::-webkit-details-marker { display: none; }
.g-langs summary .i { width: 18px; height: 18px; color: var(--g-accent); }
.g-langs-list {
  position: absolute; right: 0; top: 52px; z-index: 40; display: grid; min-width: 180px; padding: 6px;
  border: 1px solid var(--g-card-line); border-radius: 16px; background: var(--bg); box-shadow: var(--shadow);
}
.g-langs-list a { padding: 8px 12px; border-radius: 10px; color: var(--text-3); text-decoration: none; }
.g-langs-list a:hover { background: var(--chip-hover); color: var(--text); }
.g-langs-list a[aria-current] { color: var(--g-accent); font-weight: 650; }

/* ---------- Indice a sinistra e testo ---------- */
.g-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 40px; align-items: start; }
.g-nav-box { position: sticky; top: 20px; margin: 0; padding: 0; border: 0; background: none; }
.g-nav-box summary { display: none; }
.g-nav { display: flex; flex-direction: column; gap: 2px; }
.g-nav a { padding: 8px 14px; border-radius: 12px; color: var(--text-3); font-size: 15px; text-decoration: none; }
.g-nav a:hover { background: var(--chip-hover); color: var(--text); }
.g-nav a[aria-current="page"] { background: var(--pill); color: var(--pill-text); font-weight: 600; }

.g-doc { max-width: none; }
.g-doc h2, .g-doc h3 { position: relative; scroll-margin-top: 20px; }
.g-anchor { position: absolute; left: -22px; color: var(--muted); text-decoration: none; opacity: 0; transition: opacity .15s; }
.g-doc h2:hover .g-anchor, .g-doc h3:hover .g-anchor { opacity: 1; }
.g-doc h2 .g-anchor { top: 28px; }
.g-doc code { padding: 1px 6px; border-radius: 6px; background: var(--chip); color: var(--text-2); font-size: .92em; }
.g-doc > p, .g-doc > ul, .g-doc > ol, .g-doc > .g-note, .g-doc > .g-steps, .g-doc > .lead { max-width: 780px; }

.g-toc { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 8px; padding: 14px 16px; border: 1px solid var(--g-card-line); border-radius: 16px; background: var(--g-card); font-size: 14.5px; }
.g-toc b { width: 100%; color: var(--text); font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.g-toc a { padding: 3px 10px; border-radius: 999px; background: var(--chip); color: var(--text-3); text-decoration: none; }
.g-toc a:hover { background: var(--chip-hover); color: var(--text); }
.g-toc .g-toc-3 { font-size: 13.5px; opacity: .85; }

.g-note { margin: 16px 0; padding: 12px 16px; border-left: 4px solid var(--g-accent); border-radius: 10px; background: var(--g-card); }
.g-note b { color: var(--text); }
.g-warn { border-left-color: #f2a65a; }
.g-pro { border-left-color: #ff8f7a; }
.g-pro b::before { content: "PRO"; margin-right: 8px; padding: 1px 7px; border-radius: 999px; background: #ff8f7a; color: #24121a; font-size: 11.5px; letter-spacing: .06em; }

.g-steps { margin: 18px 0; padding: 18px 22px; border: 1px solid var(--g-card-line); border-radius: 18px; background: var(--g-card); }
.g-steps h4 { margin: 0 0 6px; color: var(--text); font-size: 17px; }
.g-steps ol { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.g-steps li { position: relative; margin: 10px 0; padding-left: 42px; counter-increment: step; }
.g-steps li::before {
  content: counter(step); position: absolute; left: 0; top: -1px;
  width: 28px; height: 28px; border-radius: 50%; background: var(--pill); color: var(--pill-text);
  font-weight: 700; font-size: 14px; line-height: 28px; text-align: center;
}

/* ---------- Foto con i punti ---------- */
.g-scene { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 28px; align-items: start; margin: 22px 0 34px; }
.g-page[data-device="desktop"] .g-scene { grid-template-columns: minmax(0, 1fr); }
.g-figure { position: sticky; top: 16px; min-width: 0; }
.g-page[data-device="desktop"] .g-scene .g-figure { position: static; }
.g-shot { display: none; }
.g-page:not([data-device]) .g-phone, .g-page[data-device="phone"] .g-phone, .g-page[data-device="desktop"] .g-desktop { display: block; }
.g-screen { position: relative; overflow: hidden; line-height: 0; background: #f5f1ea; box-shadow: var(--shadow); }
.g-phone .g-screen { width: 300px; max-width: 100%; border: 9px solid #16171c; border-radius: 34px; }
.g-desktop .g-screen { width: 100%; max-width: 980px; border: 1px solid var(--g-card-line); border-top: 26px solid #262a36; border-radius: 12px; }
.g-desktop .g-screen::before {
  content: ""; position: absolute; top: -17px; left: 12px; width: 44px; height: 9px;
  background: radial-gradient(circle at 4.5px 4.5px, #ff6159 4px, transparent 4.5px), radial-gradient(circle at 21.5px 4.5px, #ffbd2e 4px, transparent 4.5px), radial-gradient(circle at 38.5px 4.5px, #28c941 4px, transparent 4.5px);
}
.g-screen img { width: 100%; height: auto; }

.g-pin {
  position: absolute; z-index: 3; width: 24px; height: 24px; margin: -10px 0 0 -14px; padding: 0;
  border: 2px solid #fff; border-radius: 50%; background: #6b4cd1; color: #fff;
  font: 700 12px/20px "Figtree", system-ui, sans-serif; text-align: center; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35); transition: transform .18s, background-color .18s;
}
.g-pin.in { margin: 0; }
.g-desktop .g-pin { width: 22px; height: 22px; line-height: 18px; font-size: 11px; }
.g-pin:hover, .g-pin.on { transform: scale(1.25); background: #ff6f5b; }
.g-pin::after { content: ""; position: absolute; inset: -6px; border: 2px solid #6b4cd1; border-radius: 50%; opacity: 0; animation: g-ping 2.8s ease-out infinite; }
.g-scene:hover .g-pin::after, .g-pin.on::after { animation: none; }
@keyframes g-ping { 0% { transform: scale(.6); opacity: .9; } 70%, 100% { transform: scale(1.5); opacity: 0; } }

.g-hl {
  position: absolute; z-index: 2; border: 2px solid #ff6f5b; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 9999px var(--g-dim); opacity: 0;
  transition: left .35s cubic-bezier(.2, .8, .2, 1), top .35s cubic-bezier(.2, .8, .2, 1), width .35s cubic-bezier(.2, .8, .2, 1), height .35s cubic-bezier(.2, .8, .2, 1), opacity .2s;
}
.g-hl.on { opacity: 1; }

.g-spots { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.g-page[data-device="desktop"] .g-spots { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.g-spots > li {
  display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; margin: 0; padding: 14px 16px;
  border: 1px solid var(--g-card-line); border-radius: 16px; background: var(--g-card); cursor: default;
  transition: border-color .2s, background-color .2s, opacity .2s; scroll-margin-top: 20px;
}
.g-spots > li.on { border-color: #ff6f5b; }
.g-spots > li.flash { animation: g-flash 2.2s ease-out; }
@keyframes g-flash { 0%, 40% { background: var(--pill); } 100% { background: var(--g-card); } }
.g-spots > li.g-off { opacity: .5; }
.g-spots h4 { margin: 0 0 4px; color: var(--text); font-size: 16px; line-height: 1.35; }
.g-spots p { margin: 6px 0 0; font-size: 15px; line-height: 1.55; }
.g-spots ul, .g-spots ol { margin: 6px 0 0; padding-left: 20px; font-size: 15px; }
.g-spots .g-note { margin: 8px 0 0; font-size: 14.5px; }
.g-num { width: 28px; height: 28px; border-radius: 50%; background: #6b4cd1; color: #fff; font-weight: 700; font-size: 13px; line-height: 28px; text-align: center; }
.g-spots > li.on .g-num { background: #ff6f5b; }
.g-tag { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); font-size: 12px; font-weight: 600; vertical-align: 2px; }
.g-ref { padding: 10px 14px !important; }
.g-ref h4 { font-size: 15px; }
.g-ref p { margin-top: 2px; color: var(--muted); font-size: 14px; }

/* ---------- Percorsi animati ---------- */
.g-tour { margin: 26px 0 34px; padding: 20px; border: 1px solid var(--g-card-line); border-radius: 22px; background: linear-gradient(135deg, var(--g-card), var(--bg)); }
.g-tour header { margin-bottom: 14px; }
.g-tour-kicker { color: var(--g-accent); font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.g-tour h3 { margin: 2px 0 0; }
.g-tour-body { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 26px; align-items: start; }
.g-page[data-device="desktop"] .g-tour-body { grid-template-columns: minmax(0, 1fr); }
.g-tour .g-figure { position: static; }
.g-frames img { position: absolute; inset: 0; opacity: 0; transition: opacity .45s ease; }
.g-frames img[data-step="0"] { position: relative; }
.g-frames img.on { opacity: 1; z-index: 1; }
.g-cursor {
  position: absolute; z-index: 4; border: 3px solid #ff6f5b; border-radius: 12px; opacity: 0; pointer-events: none;
  transition: left .7s cubic-bezier(.3, .7, .2, 1), top .7s cubic-bezier(.3, .7, .2, 1), width .7s cubic-bezier(.3, .7, .2, 1), height .7s cubic-bezier(.3, .7, .2, 1), opacity .3s;
}
.g-cursor.on { opacity: 1; }
.g-cursor::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px;
  border-radius: 50%; background: rgba(255, 111, 91, .55); transform: scale(0); opacity: 0;
}
.g-cursor.tap::after { animation: g-tap .7s ease-out; }
@keyframes g-tap { 0% { transform: scale(.2); opacity: 1; } 100% { transform: scale(2.6); opacity: 0; } }
.g-captions { margin: 0; padding: 0; list-style: none; counter-reset: cap; display: grid; gap: 8px; }
.g-captions li {
  position: relative; padding: 10px 14px 10px 46px; border-radius: 14px; color: var(--text-3); cursor: pointer;
  counter-increment: cap; transition: background-color .2s, color .2s;
}
.g-captions li::before {
  content: counter(cap); position: absolute; left: 12px; top: 10px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--chip); color: var(--text-3); font-weight: 700; font-size: 13px; line-height: 24px; text-align: center;
}
.g-captions li.on { background: var(--pill); color: var(--pill-text); }
.g-captions li.on::before { background: #ff6f5b; color: #fff; }
.g-tour-ctl { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.g-btn { height: 40px; padding: 0 18px; border: 1px solid var(--g-card-line); border-radius: 20px; background: var(--g-card); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.g-btn:hover { background: var(--chip-hover); }
.g-btn.g-primary { border-color: transparent; background: var(--btn); color: var(--btn-text); }
.g-btn.g-primary:hover { background: var(--btn-hover); }

/* ---------- Fondo pagina ---------- */
.g-help { margin-top: 40px; padding: 16px 18px; border-radius: 16px; background: var(--g-card); }
.g-pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.g-pager a { display: flex; flex-direction: column; gap: 2px; max-width: 48%; padding: 12px 16px; border: 1px solid var(--g-card-line); border-radius: 16px; color: var(--text); font-weight: 600; text-decoration: none; }
.g-pager a span { color: var(--muted); font-size: 13px; font-weight: 500; }
.g-pager a:hover { background: var(--chip-hover); }
.g-pager .g-next { margin-left: auto; text-align: right; }
.g-updated { color: var(--muted); font-size: 13.5px; }
.g-root-langs { display: grid; gap: 8px; padding: 0; list-style: none; }
.g-root-langs a { display: block; padding: 12px 16px; border: 1px solid var(--g-card-line); border-radius: 14px; text-decoration: none; }

/* ---------- Schermi stretti ---------- */
@media (max-width: 1100px) {
  .g-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .g-nav-box { position: static; padding: 12px 16px; border: 1px solid var(--g-card-line); border-radius: 16px; background: var(--g-card); }
  .g-nav-box summary { display: list-item; color: var(--text); font-weight: 600; cursor: pointer; }
  .g-nav { margin-top: 8px; }
}
@media (max-width: 760px) {
  .g-page .wrap { padding-top: 84px; }
  .g-scene, .g-tour-body { grid-template-columns: minmax(0, 1fr); }
  .g-figure { position: static; display: flex; justify-content: center; }
  .g-desktop .g-screen { border-top-width: 18px; }
  .g-desktop .g-screen::before { top: -13px; transform: scale(.75); transform-origin: left center; }
  .g-anchor { display: none; }
  .g-langs-list { left: 0; right: auto; }
  .g-tour { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .g-pin::after { animation: none; }
  .g-hl, .g-cursor, .g-frames img { transition: none; }
}
