/* villa-page.css — shared stylesheet for standalone villa detail pages.
   Generated pages live at /properties/{slug}/ (FR) and /en/properties/{slug}/ (EN).
   This file is cached by browsers after the first villa visit. */

:root{
  --bg:#F4EFE8;
  --bg-soft:#FFFFFF;
  --ink:#2A2722;
  --ink-2:#5A5247;
  --muted:#998F82;
  --line:#DCD3C2;
  --line-soft:#EAE2D2;
  --accent:#A8896C;
  --accent-deep:#806447;
  --brand-coral:#EB5942;
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background:var(--bg);
  color:var(--ink);
  font-family:'Lato',system-ui,sans-serif;
  font-weight:300;
  font-size:15px;
  line-height:1.7;
  letter-spacing:.01em;
  -webkit-font-smoothing:antialiased;
}
a{color:inherit;text-decoration:none;}
a:hover{color:var(--accent-deep);}
img{display:block;max-width:100%;height:auto;}

.serif{font-family:'Cormorant Garamond',serif;font-weight:400;}
.display{font-family:'Cormorant Garamond',serif;font-weight:300;letter-spacing:-0.005em;line-height:1.04;}

/* ---------- Header ---------- */
.villa-header{
  padding:22px 40px;
  background:var(--bg);
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  flex-wrap:nowrap;
}
.villa-header .logo-block{
  display:flex;
  flex-direction:column;
  gap:4px;
  text-decoration:none;
  min-width:0;
  flex:0 1 auto;
}
.villa-header .brand-strip{
  font-size:11px;
  letter-spacing:.28em;
  text-transform:uppercase;
  color:var(--ink-2);
  white-space:nowrap;
}
.villa-header .logo img{width:200px;height:auto;}
.villa-header .right-nav{
  display:flex;
  align-items:center;
  gap:28px;
  flex:0 0 auto;
}
.villa-header .back-link{
  font-size:11px;
  letter-spacing:.28em;
  text-transform:uppercase;
  color:var(--ink-2);
  transition:color .25s ease;
  white-space:nowrap;
}
.villa-header .back-link:hover{color:var(--accent-deep);}
/* Save-as-PDF entry point in the header right-nav. Visually mirrors the
   back-link (same font, color, hover treatment) plus a small download icon. */
.villa-header .header-pdf{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:11px;
  letter-spacing:.28em;
  text-transform:uppercase;
  color:var(--ink-2);
  transition:color .25s ease;
  white-space:nowrap;
}
.villa-header .header-pdf:hover{color:var(--accent-deep);}
.villa-header .header-pdf svg{flex-shrink:0;}
.lang-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:12px;
  letter-spacing:.14em;
}
.lang-pill a{
  color:var(--ink-2);
  padding:4px 0;
  border-bottom:1px solid transparent;
  text-transform:uppercase;
}
.lang-pill a.active{color:var(--ink);border-bottom-color:var(--ink);}
.lang-pill .sep{color:var(--muted);}
@media (max-width:1023px){
  .villa-header{padding:18px 22px;gap:12px;}
  .villa-header .brand-strip{font-size:8px;letter-spacing:.2em;}
  .villa-header .logo img{width:150px;}
  .villa-header .right-nav{gap:18px;}
  .villa-header .back-link,
  .villa-header .header-pdf{font-size:9px;letter-spacing:.2em;}
  .villa-header .header-pdf svg{width:9px;height:9px;}
}
@media (max-width:480px){
  .villa-header{padding:14px 16px;gap:10px;}
  .villa-header .brand-strip{font-size:7px;letter-spacing:.16em;}
  .villa-header .logo img{width:120px;}
  .villa-header .right-nav{gap:12px;}
  .villa-header .back-link,
  .villa-header .header-pdf{font-size:8.5px;letter-spacing:.14em;}
  .villa-header .header-pdf svg{width:9px;height:9px;}
  /* Hide the redundant PDF label on tight phone widths; the icon + aria-label
     still convey the action. Saves ~30px of horizontal room next to FR / EN. */
  .villa-header .header-pdf > span{display:none;}
  .lang-pill{font-size:10px;}
}

/* ---------- Hero ---------- */
.villa-hero{
  position:relative;
  width:100%;
  height:clamp(360px,60vh,640px);
  overflow:hidden;
  background:var(--ink);
}
.villa-hero img{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  z-index:0;
}
.villa-hero::after{
  content:'';
  position:absolute;
  inset:0;
  background:linear-gradient(180deg,transparent 25%,rgba(0,0,0,.55) 95%);
  z-index:1;
}
.villa-hero-text{
  position:absolute;
  z-index:2;
  left:0;right:0;bottom:0;
  padding:40px;
  color:#fff;
}
.villa-hero-text .crumb{
  font-size:11px;
  letter-spacing:.32em;
  text-transform:uppercase;
  opacity:.92;
  margin-bottom:14px;
}
.villa-hero-text h1{
  font-family:'Cormorant Garamond',serif;
  font-weight:300;
  font-size:clamp(36px,6vw,86px);
  line-height:1.05;
  margin:0;
  letter-spacing:-0.01em;
  text-shadow:0 4px 22px rgba(0,0,0,.45);
}

/* ---------- Spec strip ---------- */
.spec-strip{
  display:flex;
  flex-wrap:wrap;
  gap:14px 48px;
  align-items:center;
  justify-content:center;
  padding:22px 40px;
  font-family:'Lato',sans-serif;
  font-size:12px;
  letter-spacing:.18em;
  text-transform:uppercase;
  color:var(--ink-2);
  border-bottom:1px solid var(--line);
  font-weight:300;
}
.spec-strip .item{display:inline-flex;align-items:center;gap:10px;}
.spec-strip svg{width:18px;height:18px;stroke-width:1.2;color:var(--accent);flex-shrink:0;}

/* ---------- Read-more (collapses the long structured description) ---------- */
details.read-more{margin:18px 0 36px;}
details.read-more > summary{
  list-style:none;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:14px;
  font-family:'Lato',sans-serif;
  font-size:11px;
  letter-spacing:.3em;
  text-transform:uppercase;
  font-weight:400;
  color:var(--ink);
  padding-bottom:6px;
  border-bottom:1px solid var(--ink);
  transition:color .25s, border-color .25s;
}
details.read-more > summary::-webkit-details-marker{display:none;}
details.read-more > summary:hover{color:var(--accent);border-color:var(--accent);}
details.read-more > summary .arr{display:inline-block;transition:transform .35s ease;}
details.read-more > summary:hover .arr{transform:translateX(4px);}
details.read-more[open] > summary{margin-bottom:20px;}
details.read-more[open] > summary .arr{transform:rotate(90deg);}

/* ---------- Main grid ---------- */
.villa-main{
  max-width:1280px;
  margin:60px auto;
  padding:0 40px;
  display:grid;
  grid-template-columns:1fr 400px;
  gap:64px;
  align-items:flex-start;
}
.villa-body{min-width:0;}

/* ---------- Body typography ---------- */
.desc-short{
  font-family:'Cormorant Garamond',serif;
  font-weight:300;
  font-size:clamp(22px,2.4vw,28px);
  line-height:1.5;
  color:var(--ink-2);
  margin:0 0 32px;
}
.desc-long{color:var(--ink-2);}
.desc-long h4{
  font-family:'Cormorant Garamond',serif;
  font-weight:400;
  font-style:italic;
  font-size:22px;
  margin:32px 0 10px;
  color:var(--ink);
}
.desc-long p{margin:0 0 14px;font-size:16px;line-height:1.75;font-weight:300;}
.desc-long ul{columns:2;column-gap:32px;padding:0;margin:12px 0 18px;list-style:none;}
.desc-long ul li{font-size:14px;padding:4px 0;break-inside:avoid;}
.desc-long ul li::before{content:'— ';color:var(--muted);}

/* ---------- Features stack ---------- */
.features-stack{
  margin-top:48px;
  padding-top:32px;
  border-top:1px solid var(--line);
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:24px 48px;
}
.features-stack .eyebrow{
  font-size:11px;
  letter-spacing:.24em;
  text-transform:uppercase;
  color:var(--ink-2);
  margin-bottom:6px;
}
.features-stack .value{font-size:14px;color:var(--ink);line-height:1.55;font-weight:300;}

/* ---------- Section titles ---------- */
.section-title{
  font-family:'Cormorant Garamond',serif;
  font-weight:400;
  font-size:30px;
  margin:60px 0 22px;
  letter-spacing:0.005em;
  color:var(--ink);
}

/* ---------- Gallery ---------- */
.photo-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}
.photo-grid img{
  width:100%;
  aspect-ratio:4/3;
  object-fit:cover;
}

/* ---------- Inquiry card ---------- */
.villa-side{position:sticky;top:32px;}
.inquiry-card{
  background:var(--bg-soft);
  border:1px solid var(--line);
  padding:32px;
}
.inquiry-card .kicker{
  font-size:11px;
  letter-spacing:.28em;
  text-transform:uppercase;
  color:var(--accent-deep);
  margin-bottom:12px;
}
.inquiry-card h3{
  font-family:'Cormorant Garamond',serif;
  font-weight:300;
  font-size:26px;
  line-height:1.2;
  margin:0 0 8px;
  color:var(--ink);
}
.inquiry-card .price-tag{
  font-family:'Cormorant Garamond',serif;
  font-style:italic;
  color:var(--accent-deep);
  font-size:16px;
  margin-bottom:24px;
}
.inquiry-card label{
  font-size:11px;
  letter-spacing:.24em;
  text-transform:uppercase;
  color:var(--ink-2);
  display:block;
  margin:0 0 6px;
}
.inquiry-input{
  width:100%;
  padding:10px 14px;
  border:1px solid var(--line);
  background:transparent;
  font-family:'Lato',sans-serif;
  font-size:14px;
  color:var(--ink);
  margin-bottom:14px;
  font-weight:300;
}
.inquiry-input:focus{outline:1px solid var(--accent-deep);border-color:var(--accent-deep);}
.row-dates{display:flex;gap:10px;}
.row-dates .inquiry-input{flex:1;}
.btn-primary{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:100%;
  padding:14px 24px;
  background:var(--ink);
  color:#fff;
  border:1px solid var(--ink);
  font-family:'Lato',sans-serif;
  font-size:12px;
  letter-spacing:.28em;
  text-transform:uppercase;
  cursor:pointer;
  transition:background .25s,color .25s,border-color .25s;
}
.btn-primary:hover{background:var(--accent-deep);border-color:var(--accent-deep);}
.btn-primary:disabled{opacity:.6;cursor:not-allowed;}
.form-status{
  display:none;
  text-align:center;
  font-family:'Cormorant Garamond',serif;
  font-style:italic;
  font-size:17px;
  color:var(--accent-deep);
  margin-top:18px;
  line-height:1.5;
}
.inquiry-whatsapp{
  margin-top:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  font-size:11px;
  letter-spacing:.18em;
  text-transform:uppercase;
  color:var(--ink-2);
}
.inquiry-whatsapp:hover{color:var(--accent-deep);}

/* ---------- Related ---------- */
.related-section{
  max-width:1280px;
  margin:80px auto;
  padding:60px 40px 0;
  border-top:1px solid var(--line);
}
.related-section .section-title{margin-top:0;}
.related-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:32px;
}
.related-card{display:block;transition:transform .35s ease;}
.related-card:hover{transform:translateY(-3px);}
.related-card .card-img{
  width:100%;
  aspect-ratio:4/3;
  object-fit:cover;
  margin-bottom:16px;
}
.related-card .card-loc{
  font-size:11px;
  letter-spacing:.24em;
  text-transform:uppercase;
  color:var(--accent-deep);
  margin-bottom:8px;
}
.related-card h4{
  font-family:'Cormorant Garamond',serif;
  font-weight:400;
  font-size:22px;
  margin:0;
  color:var(--ink);
}

/* ---------- Footer ---------- */
.villa-footer{
  background:#1a1612;
  color:#bdb4a3;
  padding:80px 40px 40px;
  margin-top:100px;
  font-size:13px;
  font-weight:300;
}
.villa-footer .footer-grid{
  max-width:1280px;
  margin:0 auto;
  display:grid;
  grid-template-columns:1.5fr 1fr 1fr;
  gap:56px;
}
.villa-footer .footer-brand{
  color:#fff;
  font-family:'Cormorant Garamond',serif;
  font-size:22px;
  letter-spacing:.12em;
  text-transform:uppercase;
  margin-bottom:16px;
}
.villa-footer p{line-height:1.7;color:#bdb4a3;margin:0;}
.villa-footer h4{
  color:#fff;
  font-family:'Lato',sans-serif;
  font-size:12px;
  letter-spacing:.28em;
  text-transform:uppercase;
  margin:0 0 18px;
  font-weight:400;
}
.villa-footer ul{list-style:none;padding:0;margin:0;}
.villa-footer ul li{margin-bottom:10px;}
.villa-footer a{color:#bdb4a3;}
.villa-footer a:hover{color:#fff;}
.villa-footer .legal-strip{
  max-width:1280px;
  margin:60px auto 0;
  padding-top:24px;
  border-top:1px solid #3a3026;
  display:flex;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:16px;
  font-size:11px;
  letter-spacing:.08em;
  color:#7a6e5b;
}
.villa-footer .legal-strip a{color:#7a6e5b;}
.villa-footer .legal-strip a:hover{color:#fff;}
.villa-footer .footer-socials{
  display:flex;
  gap:14px;
  margin-top:28px;
}
.villa-footer .social-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:42px;
  height:42px;
  border-radius:10px;
  text-decoration:none;
  transition:transform .25s;
}
.villa-footer .social-pill:hover{transform:scale(1.08);}
.villa-footer .social-ig{background:#fff;}
.villa-footer .social-wa{background:#25D366;}
.villa-footer .anubis-credit{
  display:inline-flex;
  align-items:center;
  gap:8px;
  white-space:nowrap;
}
.villa-footer .anubis-credit svg{vertical-align:middle;}

/* ---------- Mobile ---------- */
@media (max-width:900px){
  .villa-header{padding:18px 22px;}
  .villa-header .logo img{width:170px;}
  .villa-hero{height:50vh;min-height:340px;}
  .villa-hero-text{padding:24px;}
  .spec-strip{padding:16px 22px;gap:10px 22px;font-size:11px;}
  .villa-main{grid-template-columns:1fr;gap:48px;margin:36px auto;padding:0 22px;}
  .villa-side{position:static;}
  .features-stack{grid-template-columns:1fr;gap:18px;}
  .photo-grid{grid-template-columns:1fr;}
  .related-grid{grid-template-columns:1fr;gap:24px;}
  .related-section{padding:40px 22px 0;margin:56px auto;}
  .villa-footer{padding:60px 22px 28px;}
  .villa-footer .footer-grid{grid-template-columns:1fr;gap:36px;}
  .desc-long ul{columns:1;}
}

/* ---------- Save-as-PDF link ---------- */
/* Visible on screen, below the features-stack. Triggers window.print(),
   whose dialog includes a "Save as PDF" destination on every modern browser. */
.pdf-link-row{margin:32px 0 0;}
.pdf-link{
  display:inline-flex;
  align-items:center;
  gap:14px;
  font-family:'Lato',sans-serif;
  font-size:11px;
  letter-spacing:.3em;
  text-transform:uppercase;
  font-weight:400;
  color:var(--ink);
  padding-bottom:6px;
  border-bottom:1px solid var(--ink);
  text-decoration:none;
  transition:color .25s, border-color .25s;
}
.pdf-link:hover{color:var(--accent);border-color:var(--accent);}
.pdf-link .arr{display:inline-block;transition:transform .35s ease;}
.pdf-link:hover .arr{transform:translateX(4px);}

/* ---------- Print ---------- */
@media print{
  /* Force backgrounds and overlays to actually render in the PDF — without
     this, Edge / Chrome treat coloured backgrounds and the dark hero overlay
     as "optional" and skip them, which made the white H1 title invisible
     against the photo background. */
  *{-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important;}
  .villa-header,.villa-footer,.inquiry-card,.related-section,.pdf-link-row{display:none!important;}
  body{background:#fff;color:#000;}
  /* Hero: keep the same overlay layout as on screen so the title sits over
     the photo with the dark gradient for legibility. Position:absolute + the
     gradient must render — see print-color-adjust above. */
  .villa-hero{height:11cm;position:relative;overflow:hidden;}
  .villa-hero img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;}
  .villa-hero::after{
    content:'';display:block!important;position:absolute;inset:0;
    background:linear-gradient(180deg,transparent 35%,rgba(0,0,0,0.65) 100%)!important;
  }
  .villa-hero-text{position:absolute;left:0;right:0;bottom:0;padding:16pt 20pt;color:#fff!important;}
  .villa-hero-text h1{color:#fff!important;text-shadow:0 2px 6px rgba(0,0,0,0.5);font-size:26pt;margin:0;line-height:1.05;font-weight:300;}
  .villa-hero-text .crumb{color:#fff!important;opacity:0.92;font-size:9pt;letter-spacing:0.28em;margin-bottom:8pt;}
  .villa-main{grid-template-columns:1fr;margin:0;padding:14pt 0 0;gap:0;}
  .photo-grid img{aspect-ratio:auto;}
  /* The brochure includes EVERY gallery photo. (We used to cap at 8 because the
     old static build embedded full-res images and blew Pages' 25 MiB per-file
     limit; the PDF is now generated on demand and cached in R2, which has no such
     limit, so all photos go in.) */
  /* Force the Read-more details open and hide its toggle button — so a
     direct Ctrl+P (without clicking the PDF link first) still prints the
     full long description, not just the short blurb. */
  details.read-more > .desc-long{display:block!important;}
  details.read-more > summary{display:none!important;}
  @page{size:A4;margin:1.6cm;}
}

/* ---------- PDF generation (html2pdf.js capture state) ----------
   When the user clicks "Save as PDF", window.printVilla() sets the
   .pdf-generating class on <body>, calls html2pdf().from(document.body),
   then removes the class once the download starts. These rules hide every
   piece of chrome that doesn't belong in a property brochure (header,
   footer, inquiry card, related-section, read-more toggle, the PDF link
   itself) and reflow .villa-main to a single column so the photo grid
   sits below the description rather than next to a now-hidden side card.
   The browser print dialog is bypassed entirely, so there's no URL / date /
   page-number footer injected at the bottom of each page. */
body.pdf-generating .villa-header,
body.pdf-generating .villa-footer,
body.pdf-generating .inquiry-card,
body.pdf-generating .villa-side,
body.pdf-generating .related-section,
body.pdf-generating .pdf-link-row{display:none!important;}
body.pdf-generating details.read-more > summary{display:none!important;}
body.pdf-generating details.read-more > .desc-long{display:block!important;}
/* CRITICAL: lock body to a known width so html2canvas captures at exactly the
   PDF page width. Without this, the body keeps its natural (viewport-wide)
   layout — 1200–1920px on desktop — which then gets clipped against the A4
   page boundary instead of scaled to fit, cropping the left edge of every
   row. 794px = A4 portrait at 96dpi, so the canvas-to-PDF mapping is 1:1. */
body.pdf-generating{
  width:794px!important;
  min-width:794px!important;
  max-width:794px!important;
  margin:0 auto!important;
  background:#fff!important;
  color:#000!important;
}
body.pdf-generating .villa-hero{height:340px;}
body.pdf-generating .villa-main{max-width:none;width:100%;grid-template-columns:1fr;margin:0;padding:20px 28px 28px;gap:0;}
body.pdf-generating .photo-grid{grid-template-columns:1fr 1fr;}
body.pdf-generating .photo-grid img,
body.pdf-generating .features-stack,
body.pdf-generating .desc-short,
body.pdf-generating .villa-hero{break-inside:avoid;page-break-inside:avoid;}
