/* ==========================================================================
   Bacezza e le Saline — "Custodia" (warm & traditional)
   Green & blue soft pastel · mobile-first · Cormorant Garamond + Mulish
   ========================================================================== */

:root{
  --cream:#F6F3EC; --paper:#FCFBF7; --ink:#2A352F; --muted:#6C7A70;
  --green:#4C6B54; --green-deep:#3C5744; --green-soft:#DCE6D8;
  --blue:#3E607E; --blue-soft:#D9E4EE;
  --line:#E6E3D8; --shadow:0 18px 44px -26px rgba(42,53,47,.55);
  --serif:'Cormorant Garamond',Georgia,serif;
  --sans:'Mulish',system-ui,-apple-system,Segoe UI,sans-serif;
  --mono:ui-monospace,SFMono-Regular,Menlo,monospace;
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0; background:var(--cream); color:var(--ink);
  font-family:var(--sans); font-size:16px; line-height:1.6;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4{font-family:var(--serif); font-weight:700; line-height:1.12; color:var(--ink); margin:0}
p{margin:0 0 1em}
a{color:var(--green); text-decoration:none}
a:hover{color:var(--blue); text-decoration:underline}
img{max-width:100%; display:block}
button{font-family:inherit}

.wrap{width:100%; max-width:1080px; margin:0 auto; padding:0 20px}
.skip-link{position:absolute; left:-999px; top:0; background:var(--green); color:#fff; padding:10px 16px; z-index:200}
.skip-link:focus{left:8px; top:8px}

/* Section rhythm */
.section{padding:44px 0}
.section-head{display:flex; align-items:baseline; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:22px}
.section-head h2{font-size:clamp(26px,4vw,34px)}
.eyebrow{font-family:var(--mono); font-size:11px; letter-spacing:.16em; text-transform:uppercase; color:var(--green); font-weight:700}
.muted{color:var(--muted)}

/* ---- Header / brand ------------------------------------------------------ */
.site-header{background:var(--paper); border-bottom:1px solid var(--line); position:sticky; top:0; z-index:100}
.header-inner{display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:68px}
.brand{display:flex; align-items:center; gap:12px; color:var(--ink)}
.brand:hover{text-decoration:none}
.brand-mark{width:42px; height:42px; border-radius:50%; background:var(--green); color:#fff;
  display:flex; align-items:center; justify-content:center; font-family:var(--serif); font-size:23px; font-weight:700; flex:none}
.brand-text{display:flex; flex-direction:column; line-height:1.05}
.brand-name{font-family:var(--serif); font-size:21px; font-weight:700}
.brand-sub{font-family:var(--mono); font-size:9.5px; letter-spacing:.13em; text-transform:uppercase; color:var(--muted); margin-top:3px}

/* Hamburger */
.nav-toggle{display:inline-flex; flex-direction:column; justify-content:center; gap:5px;
  width:46px; height:46px; border:1px solid var(--line); border-radius:10px; background:var(--paper); cursor:pointer; padding:0 12px}
.nav-toggle span{height:2px; background:var(--ink); border-radius:2px; transition:transform .25s, opacity .2s}
.nav-toggle[aria-expanded="true"] span:nth-child(1){transform:translateY(7px) rotate(45deg)}
.nav-toggle[aria-expanded="true"] span:nth-child(2){opacity:0}
.nav-toggle[aria-expanded="true"] span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}

/* ---- Navigation: mobile drawer (default) --------------------------------- */
.primary-nav{display:none; position:absolute; left:0; right:0; top:100%; background:var(--paper);
  border-bottom:1px solid var(--line); box-shadow:var(--shadow); max-height:calc(100vh - 68px); overflow-y:auto}
.primary-nav.open{display:block}
.nav-list{list-style:none; margin:0; padding:8px 20px 20px; display:flex; flex-direction:column; gap:2px; max-width:1080px; margin:0 auto}
.nav-link{display:block; width:100%; text-align:left; background:none; border:0; cursor:pointer;
  font-family:var(--sans); font-size:16px; font-weight:700; color:var(--ink); padding:12px 6px}
.nav-link:hover{color:var(--green); text-decoration:none}
.has-sub .caret{float:right; transition:transform .2s; color:var(--muted)}
.has-sub.open .caret{transform:rotate(180deg)}
.subnav{list-style:none; margin:0 0 6px; padding:0 0 0 6px; display:none; border-left:2px solid var(--green-soft)}
.has-sub.open .subnav{display:block}
.subnav a{display:block; padding:9px 12px; font-size:14.5px; color:var(--muted); font-weight:600}
.subnav a:hover{color:var(--green); text-decoration:none}
.is-active > .nav-link, li.is-active > a{color:var(--green)}

/* ---- Buttons / pills ----------------------------------------------------- */
.btn{display:inline-flex; align-items:center; gap:8px; border-radius:9px; padding:12px 20px;
  font-weight:700; font-size:14.5px; cursor:pointer; border:1px solid transparent; transition:transform .15s, background .2s}
.btn:hover{text-decoration:none; transform:translateY(-1px)}
.btn-primary{background:var(--green); color:#fff}
.btn-primary:hover{background:var(--green-deep); color:#fff}
.btn-ghost{background:transparent; border-color:var(--line); color:var(--ink)}
.btn-ghost:hover{border-color:var(--green); color:var(--green)}
.btn-block{width:100%; justify-content:center}

.seg{display:inline-flex; gap:3px; background:var(--green-soft); border-radius:22px; padding:4px}
.seg a, .seg button{border:0; background:none; cursor:pointer; font-family:var(--sans); font-weight:700;
  font-size:12.5px; color:var(--green-deep); padding:6px 15px; border-radius:18px}
.seg a:hover{text-decoration:none}
.seg .on{background:var(--paper); color:var(--green); box-shadow:0 1px 2px rgba(0,0,0,.06)}

/* ---- Hero ---------------------------------------------------------------- */
.hero{position:relative; color:var(--cream); border-radius:0}
.hero .ph, .hero .hero-img{position:absolute; inset:0; width:100%; height:100%; object-fit:cover}
.hero-shade{position:absolute; inset:0; background:linear-gradient(180deg,rgba(38,50,44,.18),rgba(38,50,44,.74))}
.hero-inner{position:relative; padding:56px 0 42px; min-height:300px; display:flex; flex-direction:column; justify-content:flex-end}
.hero-kicker{font-family:var(--mono); font-size:11px; letter-spacing:.2em; text-transform:uppercase; opacity:.9; margin-bottom:12px}
.hero h1{color:#fff; font-size:clamp(34px,7vw,52px); font-weight:600; max-width:640px}
.hero p{color:rgba(255,255,255,.9); max-width:520px; margin-top:14px}

/* ---- Cards --------------------------------------------------------------- */
.grid{display:grid; gap:20px}
.grid-3{grid-template-columns:1fr}
.card{background:var(--paper); border:1px solid var(--line); border-radius:12px; overflow:hidden; color:var(--ink); display:block; transition:transform .16s, box-shadow .2s}
a.card:hover{text-decoration:none; transform:translateY(-3px); box-shadow:var(--shadow)}
.card-img{height:120px}
.card-body{padding:20px 22px 22px}
.card .eyebrow{margin-bottom:6px}
.card h3{font-size:23px; margin-bottom:7px}
.card p{font-size:14px; color:var(--muted); margin-bottom:14px}
.card-cta{font-size:13.5px; font-weight:700; color:var(--green)}

/* ---- Schedule + contacts ------------------------------------------------- */
.two-col{display:grid; gap:20px; grid-template-columns:1fr}
.two-col-eq{grid-template-columns:1fr}
.panel{border-radius:12px; padding:26px 26px}
.panel-green{background:var(--green); color:#EFF3EA}
.panel-green h3{color:#fff}
.panel-line{border-top:1px solid rgba(255,255,255,.2); margin-top:16px; padding-top:14px; font-size:13px; line-height:1.7; opacity:.92}
.panel-paper{background:var(--paper); border:1px solid var(--line)}
.kv{display:grid; grid-template-columns:auto 1fr; gap:9px 18px; font-size:15px}
.kv .k{opacity:.85}
.kv .v{font-weight:700; color:#fff}

/* Full schedule table (orario page) */
.table-wrap{overflow-x:auto; border:1px solid var(--line); border-radius:12px; background:var(--paper)}
table.schedule{border-collapse:collapse; width:100%; min-width:560px; font-size:15px}
table.schedule th, table.schedule td{padding:14px 16px; text-align:left; border-bottom:1px solid var(--line); vertical-align:top}
table.schedule thead th{background:var(--green-soft); font-family:var(--serif); font-size:19px; font-weight:700; color:var(--green-deep)}
table.schedule tbody th{font-weight:700; color:var(--ink); background:#fbfaf5; white-space:nowrap}
table.schedule td{color:var(--ink)}
table.schedule td.empty{color:#b9bfb4}
table.schedule th:first-child{position:sticky; left:0; z-index:1; border-right:1px solid var(--line)}

/* ---- Entry lists (libretto / news / preghiere) --------------------------- */
.feature{background:var(--paper); border:1px solid var(--line); border-radius:14px; overflow:hidden; box-shadow:var(--shadow)}
.feature-head{padding:22px 24px 0}
.feature-head .eyebrow{color:var(--blue)}
.feature-head h2{font-size:28px; margin:6px 0 4px}
.feature-body{padding:18px 24px 24px}
.pdf-frame{width:100%; height:min(78vh,860px); border:1px solid var(--line); border-radius:10px; background:#f0eee6}
.pdf-canvas-wrap{border:1px solid var(--line); border-radius:10px; background:#f0eee6; max-height:min(78vh,860px); overflow:auto; padding:14px; text-align:center}
.pdf-canvas-wrap canvas{margin:0 auto 12px; box-shadow:0 6px 18px -10px rgba(0,0,0,.4); max-width:100%; height:auto}
.pdf-fallback{margin-top:14px; display:flex; gap:12px; flex-wrap:wrap; align-items:center; font-size:14px; color:var(--muted)}

.entry-list{list-style:none; margin:0; padding:0}
.entry-list li{border-bottom:1px solid var(--line)}
.entry-list li:last-child{border-bottom:0}
.entry{display:flex; align-items:baseline; gap:12px; padding:13px 4px; color:var(--ink)}
.entry:hover{text-decoration:none; color:var(--green)}
.entry .ico{flex:none; color:var(--green); font-size:13px; margin-top:2px}
.entry .t{flex:1; font-weight:600}
.entry .d{font-family:var(--mono); font-size:12px; color:var(--muted); white-space:nowrap}
.entry.textonly{cursor:default}
.entry.textonly:hover{color:var(--ink)}
.entry.textonly .ico{color:var(--blue)}

.badge{display:inline-block; font-family:var(--mono); font-size:10px; letter-spacing:.08em; text-transform:uppercase;
  padding:3px 8px; border-radius:20px; background:var(--blue-soft); color:var(--blue); font-weight:700; margin-left:8px}

/* Archive accordion */
.archive{margin-top:26px}
.archive > summary{cursor:pointer; list-style:none; display:inline-flex; align-items:center; gap:8px;
  font-weight:700; color:var(--green); padding:10px 0}
.archive > summary::-webkit-details-marker{display:none}
.archive > summary .caret{transition:transform .2s}
.archive[open] > summary .caret{transform:rotate(180deg)}
.year-group{margin-top:14px}
.year-group > summary{cursor:pointer; list-style:none; font-family:var(--serif); font-size:22px; font-weight:700;
  color:var(--ink); padding:10px 0; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between}
.year-group > summary::-webkit-details-marker{display:none}
.year-group .count{font-family:var(--sans); font-size:12px; color:var(--muted); font-weight:600}

/* ---- Forms (admin) ------------------------------------------------------- */
.auth-wrap{max-width:420px; margin:56px auto; padding:0 20px}
.form-card{background:var(--paper); border:1px solid var(--line); border-radius:14px; padding:30px 28px; box-shadow:var(--shadow)}
.field{margin-bottom:18px}
.field label{display:block; font-weight:700; font-size:14px; margin-bottom:6px}
.field .hint{font-size:12.5px; color:var(--muted); margin-top:5px}
.field input, .field select, .field textarea{width:100%; font-family:inherit; font-size:15px; color:var(--ink);
  background:#fff; border:1px solid var(--line); border-radius:9px; padding:11px 13px}
.field input:focus, .field select:focus, .field textarea:focus{outline:2px solid var(--green-soft); border-color:var(--green)}
.field textarea{min-height:84px; resize:vertical}
.flash{border-radius:10px; padding:13px 16px; margin-bottom:20px; font-size:14.5px; font-weight:600}
.flash-ok{background:var(--green-soft); color:var(--green-deep)}
.flash-err{background:#F6DED9; color:#8f3b2c}
.admin-bar{display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:8px}
.admin-bar .logout{font-size:13.5px; font-weight:700}

/* ---- Upload progress ---- */
progress{width:100%; height:10px; border:0; border-radius:6px; accent-color:var(--green)}
progress::-webkit-progress-bar{background:var(--line); border-radius:6px}
progress::-webkit-progress-value{background:var(--green); border-radius:6px}
progress::-moz-progress-bar{background:var(--green); border-radius:6px}
.dest-summary{margin-top:14px; display:grid; gap:10px; grid-template-columns:1fr}
.dest-chip{border:1px solid var(--line); border-radius:10px; padding:14px 16px; background:var(--paper)}
.dest-chip .n{font-family:var(--serif); font-size:26px; font-weight:700; color:var(--green)}
.dest-chip .l{font-size:13px; color:var(--muted)}

/* ---- Delete lists (admin) ---- */
.btn-danger{background:#9c3b28; color:#fff}
.btn-danger:hover{background:#82301f; color:#fff}
/* Stays red while inactive: a flat grey pill stops reading as "the destructive
   button", which is the one thing it must always look like. */
.btn-danger:disabled{background:#9c3b28; color:#fff; opacity:.42; cursor:not-allowed; transform:none}
.btn-danger:disabled:hover{background:#9c3b28; transform:none}
.del-block{margin-top:26px; border:1px solid var(--line); border-radius:12px; padding:18px 20px; background:var(--paper)}
.del-block h3{font-size:19px; display:flex; align-items:baseline; justify-content:space-between; gap:12px;
  padding-bottom:10px; border-bottom:1px solid var(--line); margin-bottom:6px}
.del-block .count{font-family:var(--sans); font-size:12px; color:var(--muted); font-weight:600}
.del-block .archive{margin-top:6px}
.del-block .btn-danger{margin-top:16px}
.entry-admin{display:flex; align-items:center; gap:10px; padding:9px 4px; border-bottom:1px solid var(--line); cursor:pointer}
.entry-admin:last-of-type{border-bottom:0}
.entry-admin input{flex:none; width:17px; height:17px; accent-color:#9c3b28}
.entry-admin .t{flex:1; font-size:14.5px; font-weight:600; min-width:0; overflow-wrap:anywhere}
.entry-admin .d{font-family:var(--mono); font-size:12px; color:var(--muted); white-space:nowrap}
.entry-admin:has(input:checked){background:#F6DED9; border-radius:6px}

/* Selectable thumbnails in the gallery admin */
.photo-pick{position:relative; display:block}
.photo-pick .photo-thumb{cursor:pointer}
.photo-pick input{position:absolute; top:7px; left:7px; width:20px; height:20px; accent-color:#9c3b28; z-index:2}
.photo-pick:has(input:checked) .photo-thumb{outline:3px solid #9c3b28; outline-offset:-3px}
.photo-pick .cover-tag{position:absolute; bottom:6px; left:6px; font-family:var(--mono); font-size:9.5px;
  letter-spacing:.06em; text-transform:uppercase; background:rgba(20,22,20,.72); color:#fff; padding:3px 7px; border-radius:20px}
.album-row{display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:11px 4px; border-bottom:1px solid var(--line)}
.album-row:last-of-type{border-bottom:0}

/* ---- Photo gallery ---- */
.photo-grid{display:grid; gap:8px; grid-template-columns:repeat(2,1fr)}
.photo-thumb{display:block; aspect-ratio:1; border-radius:8px; background-size:cover; background-position:center; background-color:var(--line); cursor:pointer; transition:transform .15s}
.photo-thumb:hover{transform:scale(1.03)}

.lightbox{position:fixed; inset:0; background:rgba(20,22,20,.92); display:none; align-items:center; justify-content:center; z-index:200; padding:20px}
.lightbox.is-open{display:flex}
.lightbox-img{max-width:92vw; max-height:88vh; border-radius:6px; box-shadow:0 10px 40px rgba(0,0,0,.4)}
.lightbox-close{position:absolute; top:18px; right:22px; background:none; border:0; color:#fff; font-size:26px; cursor:pointer; line-height:1; padding:6px}
.lightbox-prev, .lightbox-next{position:absolute; top:50%; transform:translateY(-50%); background:rgba(255,255,255,.14); border:0; color:#fff; font-size:28px; width:44px; height:44px; border-radius:50%; cursor:pointer; line-height:1}
.lightbox-prev{left:12px}
.lightbox-next{right:12px}

/* ---- Placeholders (drop real photos here later) -------------------------- */
.ph{display:flex; align-items:center; justify-content:center; text-align:center; padding:10px;
  font-family:var(--mono); font-size:11px; letter-spacing:.07em; text-transform:uppercase; color:#8a9a86;
  background:#E4E8DD; background-image:repeating-linear-gradient(135deg,#dbe1d2 0 14px,#e4e8dd 14px 28px)}
.ph-blue{color:#8497a8; background:#DEE7EF; background-image:repeating-linear-gradient(135deg,#d3dfe9 0 14px,#dee7ef 14px 28px)}

/* ---- Footer -------------------------------------------------------------- */
.site-footer{background:var(--ink); color:#C6D0C4; margin-top:40px}
.footer-inner{padding:30px 20px; text-align:center}
.footer-name{font-family:var(--serif); font-size:21px; color:#fff}
.footer-meta{font-size:13px; margin-top:8px; opacity:.85}
.footer-meta a{color:#C6D0C4; text-decoration:underline}
.footer-meta .dot{opacity:.5; margin:0 4px}
.footer-links{margin-top:16px; display:flex; gap:18px; justify-content:center; flex-wrap:wrap; font-size:13px}
.footer-links a{color:#fff; opacity:.9}

/* ==========================================================================
   Responsive — tablet / desktop
   ========================================================================== */
@media (min-width:620px){
  .grid-3{grid-template-columns:repeat(3,1fr)}
  .two-col{grid-template-columns:1.15fr .85fr}
  .two-col-eq{grid-template-columns:1fr 1fr}
  .dest-summary{grid-template-columns:repeat(3,1fr)}
  .hero-inner{min-height:340px; padding:64px 0 46px}
  .photo-grid{grid-template-columns:repeat(4,1fr)}
}

@media (min-width:880px){
  .nav-toggle{display:none}
  .primary-nav{display:block; position:static; background:none; border:0; box-shadow:none; overflow:visible; max-height:none}
  .nav-list{flex-direction:row; align-items:center; gap:4px; padding:0}
  .nav-link{padding:10px 12px; font-size:14.5px; white-space:nowrap}
  .has-sub{position:relative}
  .has-sub .caret{float:none; margin-left:4px; font-size:12px}
  .subnav{position:absolute; top:100%; left:0; min-width:230px; background:var(--paper); border:1px solid var(--line);
    border-radius:10px; box-shadow:var(--shadow); padding:8px; display:none; border-left:1px solid var(--line); z-index:120}
  .has-sub:hover .subnav, .has-sub:focus-within .subnav, .has-sub.open .subnav{display:block}
  .subnav a{border-radius:7px; padding:9px 12px}
  .subnav a:hover{background:var(--green-soft)}
  .has-sub.open .caret{transform:none}
  .photo-grid{grid-template-columns:repeat(5,1fr)}
}
