/* Ex Carceri 1851 — intonaco, ferro e carta d'archivio. Caratteri ospitati sul sito (nessun servizio esterno). */
@font-face { font-family: "Bodoni Moda"; src: url(/assets/fonts/bodoni-moda-latin-wght-normal.woff2) format("woff2"); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Bodoni Moda"; src: url(/assets/fonts/bodoni-moda-latin-wght-italic.woff2) format("woff2"); font-weight: 400 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url(/assets/fonts/inter-latin-wght-normal.woff2) format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --carta: #f3eee4;
  --carta-2: #e9e1d2;
  --intonaco: #fbf9f4;
  --inchiostro: #1d1c1a;
  --grigio: #5d5a54;
  --muro: #4f5d56;        /* la fascia grigio-verde dipinta sui muri delle celle */
  --muro-chiaro: #8a9a90;
  --ruggine: #8a4b2a;     /* il «1851» del logo */
  --ruggine-2: #a85d36;
  --linea: #d6ccb9;
  --notte: #151614;
  --luce: #ffd88a;        /* i varchi nel tour */
  --serif: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 4px;
  --wrap: 1180px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--carta); color: var(--inchiostro); font: 400 17px/1.65 var(--sans); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ruggine); text-underline-offset: 3px; }
a:hover { color: var(--ruggine-2); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.3rem, 5.4vw, 4.2rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 22px; }
.muted { color: var(--grigio); }
.kicker { display: flex; align-items: center; gap: 10px; font: 600 .78rem/1.2 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--ruggine); margin: 0 0 14px; }
.kicker::before { content: ""; width: 26px; height: 2px; background: currentColor; }
.lead { font-size: 1.18rem; color: var(--grigio); max-width: 40em; }
section { padding: 72px 0; }
.skip { position: absolute; left: -999px; top: 0; background: var(--inchiostro); color: #fff; padding: 8px 14px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--ruggine-2); outline-offset: 2px; }
.anteprima { background: var(--ruggine); color: #fff; text-align: center; font: 600 .82rem/1 var(--sans); letter-spacing: .06em; padding: 8px 12px; }

/* Testata */
.site-header { position: sticky; top: 0; z-index: 30; background: rgba(243, 238, 228, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--linea); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 20px; }
.brand img { height: 46px; width: auto; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--inchiostro); text-decoration: none; font-weight: 500; font-size: .95rem; padding: 8px 12px; border-radius: var(--r); }
.nav a:hover { background: var(--carta-2); color: var(--inchiostro); }
.nav a[aria-current="page"] { color: var(--ruggine); box-shadow: inset 0 -2px 0 var(--ruggine); border-radius: 0; }
.menu-toggle { display: none; background: none; border: 0; padding: 8px; color: inherit; cursor: pointer; }
.menu-toggle svg { width: 26px; height: 26px; }
body.dark .site-header { background: rgba(21, 22, 20, .92); border-color: #2c2e2a; }
body.dark .nav a { color: #ece6da; }
body.dark .menu-toggle { color: #ece6da; }
body.dark .nav a:hover { background: #2a2c28; }
body.dark .nav a[aria-current="page"] { color: var(--luce); box-shadow: inset 0 -2px 0 var(--luce); }
body.dark { background: var(--notte); }

/* Bottoni */
.btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 13px 22px; border-radius: var(--r); font: 600 .98rem/1 var(--sans); text-decoration: none; border: 2px solid transparent; transition: background .15s, color .15s; }
.btn svg { width: 20px; height: 20px; }
.btn-main { background: var(--ruggine); color: #fff; }
.btn-main:hover { background: var(--ruggine-2); color: #fff; }
.btn-line { border-color: currentColor; color: var(--inchiostro); }
.btn-line:hover { background: var(--inchiostro); color: var(--carta); }

/* Home */
.hero { position: relative; min-height: min(86vh, 760px); display: flex; align-items: flex-end; color: #fff; padding: 120px 0 80px; overflow: hidden; background: var(--notte); }
.hero .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .62; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(21,22,20,.1) 30%, rgba(21,22,20,.86)); }
.hero .wrap { position: relative; z-index: 1; width: 100%; }
.hero h1 { color: #fff; max-width: 13em; }
.hero h1 em { font-weight: 400; color: var(--luce); }
.hero .lead { color: #e6e0d4; }
.hero .kicker { color: var(--luce); }
.hero .btn-line { color: #fff; }
.hero .btn-line:hover { background: #fff; color: var(--inchiostro); }
.band-wall { background: linear-gradient(180deg, var(--intonaco) 0 62%, #dfe4e0 62% 100%); border-top: 1px solid var(--linea); border-bottom: 6px solid var(--muro); }
.band-paper { background: var(--carta-2); }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 34px; }
.section-head p { margin-bottom: 0; max-width: 46em; }
.floors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.floor-card { position: relative; display: block; background: var(--carta); border: 1px solid var(--linea); border-radius: var(--r); overflow: hidden; text-decoration: none; color: var(--inchiostro); transition: transform .2s, box-shadow .2s; }
.floor-card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(29, 28, 26, .14); color: var(--inchiostro); }
.floor-card img { aspect-ratio: 1170 / 996; object-fit: cover; width: 100%; }
.floor-name { display: block; font: 600 1.3rem/1.1 var(--serif); padding: 14px 16px 2px; }
.floor-count { display: block; font-size: .86rem; color: var(--grigio); padding: 0 16px 16px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.split img { border-radius: var(--r); }
.mosaic { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mosaic img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border-radius: var(--r); }

/* Pagine interne */
.page-head { padding: 64px 0 46px; background: var(--intonaco); border-bottom: 6px solid var(--muro); }
.page-head .lead { margin-bottom: 0; }
.prose-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; padding-top: 56px; padding-bottom: 80px; }
.prose { max-width: 44em; }
.prose h2 { margin-top: 1.4em; font-size: 1.9rem; }
.prose h2:first-child { margin-top: 0; }
.prose figure { margin: 0 0 1.6em; }
.prose figure img { border-radius: var(--r); }
.prose blockquote { margin: 0 0 1.2em; padding: 6px 0 6px 22px; border-left: 3px solid var(--ruggine); font: italic 400 1.2rem/1.5 var(--serif); color: var(--grigio); }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 1.4em 0 1.8em; }
.duo img { aspect-ratio: 3 / 2; object-fit: cover; width: 100%; border-radius: var(--r); }
.side { display: flex; flex-direction: column; gap: 18px; }
.side-box { background: var(--intonaco); border: 1px solid var(--linea); border-radius: var(--r); padding: 20px 22px; }
.side-box h3 { font-size: 1.1rem; }
.side-box ul { list-style: none; margin: 0; padding: 0; }
.side-box li { padding: 7px 0; border-top: 1px solid var(--linea); font-size: .95rem; }
.side-box li:first-child { border-top: 0; }
.side-box a { text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.note { background: #fff4e0; border: 1px solid #e8cfa3; color: #6b4a1f; border-radius: var(--r); padding: 12px 16px; margin: 28px 0 0; }

/* Video al clic */
.video-fig { margin: 0 0 1.8em; }
.video { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--r); overflow: hidden; }
.video button { all: unset; cursor: pointer; position: absolute; inset: 0; display: block; }
.video button img { width: 100%; height: 100%; object-fit: cover; opacity: .7; transition: opacity .2s; }
.video button:hover img { opacity: .85; }
.big-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 74px; height: 74px; border-radius: 50%; background: var(--ruggine); color: #fff; display: grid; place-items: center; }
.big-play svg { width: 30px; height: 30px; margin-left: 4px; }
.video-title { position: absolute; left: 18px; right: 18px; bottom: 14px; color: #fff; font: 600 1.05rem/1.3 var(--sans); text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.video iframe { width: 100%; height: 100%; border: 0; }
.video-fig figcaption { font-size: .84rem; color: var(--grigio); margin-top: 8px; }

/* Galleria fotografica */
.gallery { columns: 3 260px; column-gap: 12px; }
.gallery a { display: block; margin-bottom: 12px; break-inside: avoid; }
.gallery img { width: 100%; border-radius: var(--r); transition: opacity .2s; }
.gallery a:hover img { opacity: .86; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 94vh; }
.lightbox::backdrop { background: rgba(10, 10, 10, .92); }
.lightbox img { max-width: 96vw; max-height: 90vh; width: auto; margin: 0 auto; }
.lightbox button { position: fixed; top: 14px; right: 18px; background: none; border: 0; color: #fff; font-size: 2.4rem; cursor: pointer; line-height: 1; }

/* Visita a 360°: piani, piantine, stanze */
.floor { border-top: 1px solid var(--linea); }
.floor:nth-of-type(even) { background: var(--intonaco); }
.plan-wrap { max-width: 820px; margin: 0 auto 34px; }
.plan { position: relative; border-radius: var(--r); overflow: hidden; box-shadow: 0 6px 24px rgba(29, 28, 26, .12); }
.plan img { width: 100%; }
.dot { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--ruggine); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); transition: transform .15s; }
.dot.is-new { background: var(--muro); }
.dot.is-current { background: var(--luce); border-color: var(--inchiostro); transform: scale(1.35); z-index: 2; }
.dot span { position: absolute; left: 50%; bottom: 150%; transform: translateX(-50%); white-space: nowrap; background: var(--inchiostro); color: #fff; font: 500 .78rem/1 var(--sans); padding: 6px 8px; border-radius: 3px; opacity: 0; pointer-events: none; transition: opacity .15s; }
.dot:hover, .dot:focus-visible { transform: scale(1.3); z-index: 3; }
.dot:hover span, .dot:focus-visible span { opacity: 1; }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.room { position: relative; display: block; text-decoration: none; color: var(--inchiostro); background: var(--carta); border: 1px solid var(--linea); border-radius: var(--r); overflow: hidden; }
.room img { aspect-ratio: 2 / 1; object-fit: cover; width: 100%; transition: transform .3s; }
.room:hover img { transform: scale(1.06); }
.room-name { display: block; padding: 10px 12px; font-weight: 500; font-size: .92rem; line-height: 1.3; }
.chip { display: inline-block; font: 600 .7rem/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; padding: 5px 7px; border-radius: 3px; background: var(--inchiostro); color: #fff; }
.chip.new { background: var(--muro); }
.room .chip { position: absolute; top: 8px; left: 8px; }

/* Il tour */
.tour { position: relative; height: calc(100svh - 73px); min-height: 420px; background: #000; }
.anteprima ~ main .tour { height: calc(100svh - 103px); }
.viewer { position: absolute; inset: 0; }
.tour-title { position: absolute; top: 18px; left: 18px; z-index: 5; max-width: calc(100% - 170px); pointer-events: none; background: rgba(21, 22, 20, .62); backdrop-filter: blur(6px); padding: 12px 16px 10px; border-radius: var(--r); color: #fff; }
.tour-title h1 { font-size: clamp(1.3rem, 2.6vw, 2rem); margin: 0; color: #fff; }
.tour-title .kicker { color: var(--luce); margin-bottom: 6px; font-size: .7rem; }
.tour-title .chip { margin-top: 8px; }
.plan-toggle { position: absolute; top: 18px; right: 18px; z-index: 6; display: inline-flex; align-items: center; gap: 8px; background: var(--carta); color: var(--inchiostro); border: 0; border-radius: var(--r); padding: 11px 16px; font: 600 .92rem/1 var(--sans); cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.plan-toggle svg { width: 20px; height: 20px; }
.plan-panel { position: absolute; top: 72px; right: 18px; z-index: 7; width: min(460px, calc(100% - 36px)); max-height: calc(100% - 150px); overflow: auto; background: var(--carta); border-radius: var(--r); box-shadow: 0 12px 40px rgba(0,0,0,.45); padding: 12px; }
.plan-panel[hidden] { display: none; }
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs button { background: none; border: 1px solid var(--linea); border-radius: 3px; padding: 7px 10px; font: 500 .82rem/1 var(--sans); cursor: pointer; color: var(--inchiostro); }
.tabs button[aria-selected="true"] { background: var(--inchiostro); color: #fff; border-color: var(--inchiostro); }
.plan-close { background: none; border: 0; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--inchiostro); padding: 0 6px; }
.plan-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tour-info { background: var(--notte); color: #d9d3c7; padding: 56px 0 64px; }
.tour-info h2 { color: #fff; font-size: 1.6rem; }
.tour-info .muted { color: #a59f93; }
.tour-info a { color: var(--luce); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; }
.room-list { columns: 2; padding-left: 18px; margin: 0; font-size: .95rem; }
.room-list li { break-inside: avoid; padding: 2px 0; }

/* Varchi e anteprime nel viewer (Photo Sphere Viewer) */
.varco { width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--luce); background: rgba(255, 216, 138, .18); box-shadow: 0 0 0 4px rgba(0,0,0,.25), 0 0 18px rgba(255, 216, 138, .7); cursor: pointer; transition: transform .2s, background .2s; animation: respiro 2.6s ease-in-out infinite; }
.varco:hover { transform: scale(1.18); background: rgba(255, 216, 138, .45); animation: none; }
@keyframes respiro { 50% { box-shadow: 0 0 0 4px rgba(0,0,0,.25), 0 0 30px rgba(255, 216, 138, 1); } }
@media (prefers-reduced-motion: reduce) { .varco { animation: none; } html { scroll-behavior: auto; } }
.psv-container { font-family: var(--sans); }
.psv-navbar { background: rgba(21, 22, 20, .75); }
.psv-virtual-tour-tooltip img { border-radius: 3px; }

/* Contatti */
.contact { display: grid; grid-template-columns: 1fr 1.1fr; gap: 48px; align-items: start; }
.contact-list { display: flex; flex-direction: column; gap: 22px; }
.contact-item { display: flex; gap: 16px; }
.contact-item svg { width: 26px; height: 26px; flex: none; color: var(--ruggine); margin-top: 4px; }
.contact-item h3 { font-size: 1.1rem; margin-bottom: 4px; }
.contact-item p { margin: 0; }
.form-card { background: var(--intonaco); border: 1px solid var(--linea); border-radius: var(--r); padding: 30px; }
.form-card h2 { font-size: 1.7rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
input, textarea { width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--linea); border-radius: var(--r); background: #fff; color: var(--inchiostro); }
textarea { min-height: 140px; resize: vertical; }
.form-error { color: #a32020; min-height: 1.2em; margin: 10px 0; font-size: .9rem; }
.form-note { font-size: .84rem; color: var(--grigio); margin-top: 14px; }
.tour-teaser { position: relative; display: block; border-radius: var(--r); overflow: hidden; }
.tour-teaser img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; }
.tour-teaser span { position: absolute; left: 16px; bottom: 16px; display: inline-flex; gap: 8px; align-items: center; background: var(--ruggine); color: #fff; padding: 10px 14px; border-radius: var(--r); font-weight: 600; }
.tour-teaser svg { width: 20px; height: 20px; }

/* Piè di pagina */
.site-footer { background: var(--notte); color: #bdb6a8; padding: 60px 0 28px; font-size: .92rem; border-top: 6px solid var(--muro); }
.site-footer .brand img { height: 50px; margin-bottom: 14px; }
.site-footer h3 { color: #fff; font-family: var(--sans); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 14px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { padding: 4px 0; }
.site-footer a { color: #e6dfd1; text-decoration: none; }
.site-footer a:hover { color: var(--luce); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr 1fr; gap: 36px; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 42px; padding-top: 20px; border-top: 1px solid #2c2e2a; font-size: .82rem; color: #8f897d; }

/* Telefono e tablet */
@media (max-width: 960px) {
  .floors { grid-template-columns: 1fr 1fr; }
  .split, .contact, .two-col { grid-template-columns: 1fr; gap: 36px; }
  .prose-wrap { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .menu-toggle { display: block; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; background: var(--carta); border-bottom: 1px solid var(--linea); padding: 10px 16px 16px; }
  .nav-wrap.open .nav { display: flex; }
  body.dark .nav { background: var(--notte); border-color: #2c2e2a; }
  .site-header .wrap { min-height: 64px; }
  .brand img { height: 40px; }
  .tour { height: calc(100svh - 65px); }
  .anteprima ~ main .tour { height: calc(100svh - 95px); }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  section { padding: 52px 0; }
  .floors { grid-template-columns: 1fr; }
  .duo, .mosaic { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .room-list { columns: 1; }
  .rooms { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tour-title { top: 10px; left: 10px; max-width: calc(100% - 140px); padding: 9px 12px 8px; }
  .plan-toggle { top: 10px; right: 10px; padding: 10px 12px; }
  .plan-panel { top: auto; bottom: 64px; left: 10px; right: 10px; width: auto; max-height: 62%; }
  .varco { width: 40px; height: 40px; }
  .hero { padding: 90px 0 56px; }
}
