/* Dew Drops Nature Villa — main.css
   Mobile-first. Tokens live in tokens.css. One hero entrance only. */

:root {
  --header-h: 4rem;
  /* Hero floor: the art-directed 4:5 frame plus the copy/CTA stack. Sized so the
     tallest translated hero fits without the hero growing after the font swap,
     which otherwise shifts every section below it. */
  --hero-min-h: 176vw;
  /* The source spec authored an 11px white badge on rgb(20 40 36 / .5). Over
     pale image areas that composite falls below 4.5:1, so the scrim is raised
  to .88, which holds >= 4.5:1 across the whole authored palette. */
  --label-scrim: rgb(20 40 36 / .88);
}

a, button, [tabindex] { scroll-margin-block: calc(var(--header-h) + var(--s-2)) calc(var(--sticky-cta-h) + var(--s-2)); }

html { scroll-padding-top: calc(var(--header-h) + var(--s-4)); }

*, *::before, *::after { box-sizing: border-box; }

/* A component that sets display would otherwise defeat the hidden attribute. */
[hidden] { display: none !important; }

.wrap {
  width: min(calc(100% - var(--gutter) * 2), var(--max-w));
  margin-inline: auto;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip-link { display: inline-flex; align-items: center; min-height: 44px; }

.section { padding-block: var(--s-12); }.section-intro { margin-block-end: var(--s-8); }
.section-intro p, .gallery-heading p { color: var(--c-muted); max-width: 46rem; margin: var(--s-3) 0 0; }

/* ---------- controls ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--control-h); padding: 0 var(--s-6);
  background: var(--c-accent); color: var(--c-accent-ink);
  border: 0; border-radius: var(--r-md);
  font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; text-align: center;
  cursor: pointer;
}
.button:hover { background: var(--accent-hover); }
.button svg { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.button.secondary { background: transparent; color: var(--c-accent); box-shadow: inset 0 0 0 1.5px var(--c-accent); }
.button.secondary:hover { background: var(--c-tint); color: var(--c-accent); }
.secondary-link {
  display: inline-flex; align-items: center; min-height: var(--control-h);
  padding-inline: var(--s-3); color: #fff; background: rgb(20 40 36 / .72);
  border-radius: var(--r-sm); font-weight: 600; text-underline-offset: 6px;
}
.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0;
  background: transparent; color: inherit; border: 0; border-radius: var(--r-sm); cursor: pointer;
}
.icon-button svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- header ---------- */
.site-header {
  position: fixed; inset-inline: 0; top: 0; z-index: 30;
  height: var(--header-h);
  background: transparent;
}
.site-header[data-scrolled="true"] { background: var(--c-bg); }
.header-inner {
  display: flex; align-items: center; gap: var(--s-3);
  height: 100%;
}
.wordmark {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; line-height: 1.1;
  color: var(--c-ink); text-decoration: none; white-space: nowrap;
}
.desktop-nav { display: none; }
@media (min-width: 1024px) {
  .desktop-nav a { display: inline-flex; align-items: center; min-height: 44px; }
}
.header-cta { display: none; }
.lang-switch { display: flex; align-items: center; gap: var(--s-3); margin-inline-start: auto; }
.lang-switch a {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--c-muted); text-decoration: none; font-size: var(--fs-0); white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.lang-switch a:hover { color: var(--c-ink); }
.lang-switch a[aria-current="true"] { color: var(--c-ink); border-bottom-color: var(--c-accent); }
.menu-toggle { margin-inline-start: var(--s-2); }

/* ---------- drawer ---------- */
.drawer {
  inset: 0 0 0 auto; margin: 0; padding: var(--s-4);
  width: min(100%, 22rem); height: 100dvh; max-height: none;
  border: 0; background: var(--c-surface); color: var(--c-ink);
  overscroll-behavior: contain;
}
.drawer::backdrop { background: rgb(20 40 36 / .5); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-block-end: var(--s-6); }
.drawer-nav { display: grid; gap: var(--s-1); margin-block-end: var(--s-6); }
.drawer-nav a {
  display: flex; align-items: center; min-height: 48px; padding: var(--s-3) 0; color: var(--c-ink); text-decoration: none;
  font-family: var(--font-display); font-size: var(--fs-2); border-bottom: 1px solid var(--c-line);
}
.drawer .lang-switch { margin: 0 0 var(--s-6); }
.drawer .button { width: 100%; }

/* ---------- hero ---------- */
.hero {
  position: relative; display: grid; isolation: isolate; overflow: clip;
  min-height: var(--hero-min-h);
}
.hero-figure { position: absolute; inset: 0; z-index: 0; margin: 0; }
.hero-figure picture, .hero-figure img { display: block; width: 100%; height: 100%; }
.hero-figure img { object-fit: cover; object-position: center top; }
.hero-inner {
  position: relative; z-index: 2;
  display: grid; grid-template-rows: 1fr auto; gap: var(--s-6);
  min-height: inherit;
  padding-block: calc(var(--header-h) + var(--s-6)) var(--s-12);
}
.hero-copy { max-width: 34rem; }
.kicker {
  margin: 0 0 var(--s-3); font-family: var(--font-body); font-style: italic; font-weight: 500;
  font-size: var(--fs-0); letter-spacing: .02em; color: var(--c-muted);
}
.hero-copy h1 { color: var(--c-ink); }
.hero-lower { display: grid; gap: var(--s-4); justify-items: start; }
.hero-subline {
  margin: 0; max-width: 34rem; padding: var(--s-2) var(--s-3);
  color: #fff; background: rgb(20 40 36 / .72); border-radius: var(--r-sm);
  font-size: var(--fs-1);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-6); align-items: center; }
.fact-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.fact-chips li {
  background: var(--c-tint); color: var(--c-ink);
  border-radius: var(--r-md); padding: var(--s-2) var(--s-4);
  font-size: var(--fs-0); font-weight: 500;
}
/* Reserve the measured Sinhala wrapping before its native font arrives.
   These are minimums, so narrow screens and enlarged text can still grow. */
@media (max-width: 479px) {
  html[data-lang="si"] .hero-copy h1 { min-block-size: 3lh; }
  html[data-lang="si"] .hero-subline { min-block-size: calc(4lh + 2 * var(--s-2)); }
  html[data-lang="si"] .fact-chips {
    min-block-size: calc(2 * (var(--fs-0) * var(--lh-body) + 2 * var(--s-2)) + var(--s-2));
    align-content: start;
    align-items: start;
  }
  html[data-lang="si"] .about-head h2 { min-block-size: 2lh; }
}
/* SIGNATURE 1/2 — the hero mist fade: image dissolves into --c-bg over its lower 28% */
.hero-mist {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, transparent var(--mist-fade-start), var(--c-bg) 100%);
  animation: mist-in var(--t-entrance) var(--ease) both;
}
.hero-copy h1 { animation: copy-in var(--t-entrance) var(--ease) both; }
.image-note {
  position: absolute; inset-block-end: 0; inset-inline-start: 0; margin: var(--s-3);
  padding: 2px var(--s-2); border-radius: var(--r-sm);
  background: var(--label-scrim); color: #fff; font-size: 11px; line-height: 1.6;
}

/* ---------- about ---------- */
.about-section { padding-block-start: var(--s-8); }
.about-head { position: relative; margin-block-end: var(--s-6); }
/* SIGNATURE 2/2 — the same fog wash, 96px, opacity .65, behind the about heading only */
.fog-band {
  position: absolute; inset-inline: 0; top: 50%; translate: 0 -50%;
  height: var(--fog-band-h);
  background: var(--c-tint); opacity: var(--fog-band-opacity);
  pointer-events: none;
}
.about-head h2 { position: relative; }
.about-grid { display: grid; gap: var(--s-8); }
.prose p { margin: 0 0 var(--s-4); }
.prose p:last-child { margin-block-end: 0; }
.about-figure { position: relative; margin: 0; }
.about-figure picture, .about-figure img { display: block; width: 100%; height: auto; }
.about-figure img { border-radius: var(--r-md); }
.about-figure .image-note { position: absolute; inset-block-end: auto; inset-block-start: 0; }
.highlights { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-4); margin: var(--s-8) 0 0; }
.highlights div { border-top: 1px solid var(--c-line); padding-block-start: var(--s-3); }
.highlights dt { color: var(--c-muted); font-size: var(--fs-0); }
.highlights dd { margin: var(--s-1) 0 0; font-weight: 500; }

/* ---------- services ---------- */
.services-section { background: var(--c-surface); }
.service-list { display: grid; gap: var(--s-6); margin: 0; padding: 0; list-style: none; }
.service-list li { display: grid; grid-template-columns: auto 1fr; gap: var(--s-4); align-items: start; }
.service-icon { width: 28px; height: 28px; fill: none; stroke: var(--c-accent); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.service-list h3 { margin: 0 0 var(--s-1); }
.service-list p { margin: 0; color: var(--c-muted); }
.services-note { margin: var(--s-8) 0 0; color: var(--c-muted); font-size: var(--fs-0); }

/* ---------- gallery ---------- */
.gallery-heading { margin-block-end: var(--s-8); }
/* Mixed gallery: natural source ratios. JS packs columns from measured
   intrinsic heights; without it the grid still keeps every tile's ratio. */
.gallery-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4); margin: 0; padding: 0; list-style: none; align-items: start;
}
.gallery-grid[data-masonry="true"] { grid-auto-rows: 1px; row-gap: 0; }
.gallery-grid[data-masonry="true"] > li { padding-block-end: var(--s-4); }
.gallery-link {
  position: relative; display: block; overflow: clip;
  aspect-ratio: var(--tile-ratio); border-radius: var(--r-sm);
  background: var(--c-tint);
}
.gallery-link picture, .gallery-link img { display: block; width: 100%; height: 100%; }
.gallery-link img { object-fit: cover; }
.sample-badge {
  position: absolute; inset-block-end: 0; inset-inline-start: 0; margin: var(--s-2);
  padding: 2px var(--s-2); border-radius: var(--r-sm);
  background: var(--label-scrim); color: #fff; font-size: 11px; font-weight: 600; line-height: 1.7;
}

/* ---------- trust ---------- */
.trust-section { background: var(--c-surface); text-align: center; }
.trust-list { display: grid; gap: var(--s-8); justify-content: center; margin: var(--s-8) 0 0; padding: 0; list-style: none; }
.trust-source { margin: 0; color: var(--c-muted); font-size: var(--fs-0); font-weight: 600; }
.trust-score { margin: var(--s-1) 0 0; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-4); line-height: 1; color: var(--c-accent); font-variant-numeric: lining-nums tabular-nums; }
.trust-detail { margin: var(--s-2) 0 0; color: var(--c-muted); font-size: var(--fs-0); }
.trust-disclaimer { margin: var(--s-8) auto 0; max-width: 42rem; color: var(--c-muted); font-size: var(--fs-0); }

/* ---------- contact ---------- */
.contact-grid { display: grid; gap: var(--s-12); }
.contact-intro { color: var(--c-muted); margin: var(--s-3) 0 var(--s-6); max-width: 34rem; }
.contact-details { display: grid; gap: var(--s-4); margin: 0 0 var(--s-8); }
.contact-details dt { color: var(--c-muted); font-size: var(--fs-0); }
.contact-details dd { margin: var(--s-1) 0 0; }
.contact-details a { display: inline-flex; align-items: center; min-height: 44px; }
.hours-heading { margin: 0 0 var(--s-3); font-size: var(--fs-2); }
.hours { display: grid; gap: var(--s-2); margin: 0; }
.hours div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2) var(--s-4); border-bottom: 1px solid var(--c-line); padding-block-end: var(--s-2); }
.hours dt { color: var(--c-muted); }
.hours dd { margin: 0; font-weight: 500; }
.hours-note, .contact-languages { color: var(--c-muted); font-size: var(--fs-0); }
.hours-note { margin: var(--s-3) 0 var(--s-6); }
.contact-languages { margin: 0; }
.map-column h3 { margin: 0 0 var(--s-3); font-size: var(--fs-2); }
.map-card { background: var(--c-tint); border-radius: var(--r-md); overflow: clip; }
.map-placeholder { display: grid; gap: var(--s-3); justify-items: start; padding: var(--s-6); }
.map-placeholder p { margin: 0; color: var(--c-ink); }
.map-pin { width: 32px; height: 32px; fill: none; stroke: var(--c-accent); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.map-card iframe { display: block; width: 100%; height: 300px; border: 0; }
.maps-link { display: inline-flex; align-items: center; gap: var(--s-2); margin-block-start: var(--s-4); min-height: 44px; font-weight: 500; }

/* ---------- dialogs ---------- */
dialog { border: 0; box-shadow: var(--shadow-1); overscroll-behavior: contain; }
dialog::backdrop { background: rgb(20 40 36 / .65); }
.lightbox {
  width: min(1050px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  margin: auto; padding: var(--s-3); background: var(--c-surface); color: var(--c-ink);
}
.viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.viewer-toolbar > span { font-size: 11px; color: var(--c-muted); }
.viewer-image { display: grid; place-items: center; min-height: 40vh; margin-block: var(--s-3); }
.viewer-image picture, .viewer-image img { display: block; max-width: 100%; max-height: min(70dvh, 640px); width: auto; height: auto; }
.viewer-image img { object-fit: contain; }
.viewer-loading { color: var(--c-muted); }
.viewer-bottom { display: grid; gap: var(--s-3); }
.viewer-bottom p { margin: 0; color: var(--c-muted); font-size: var(--fs-0); }
.viewer-controls { display: flex; align-items: center; gap: var(--s-4); }
.viewer-count { margin-inline-start: auto; color: var(--c-muted); font-size: var(--fs-0); }

/* ---------- footer ---------- */
.site-footer { background: var(--c-surface); padding-block: var(--s-12) calc(var(--s-12) + var(--sticky-cta-h)); }
.footer-top { display: flex; align-items: start; justify-content: space-between; gap: var(--s-6); flex-wrap: wrap; }
.footer-top p { margin: var(--s-2) 0 0; color: var(--c-muted); }
.back-top { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; font-weight: 500; }
.footer-bottom { display: grid; gap: var(--s-2); margin-block-start: var(--s-8); color: var(--c-muted); font-size: var(--fs-0); }
.footer-bottom p { margin: 0; }
.preview-notice { margin-block-start: var(--s-8); border-top: 1px solid var(--c-line); padding-block-start: var(--s-6); }
.preview-notice p { margin: 0; color: var(--c-muted); font-size: var(--fs-0); max-width: 48rem; }
.offer-link { display: inline-flex; align-items: center; min-height: 44px; margin-block-start: var(--s-3); font-weight: 600; }

/* ---------- sticky CTA ---------- */
.sticky-cta {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 25;
  padding: var(--s-2) var(--gutter) calc(var(--s-2) + env(safe-area-inset-bottom, 0px));
  background: var(--c-bg);
}
.sticky-cta .button { width: 100%; }

/* ---------- image failure ---------- */
.image-unavailable { position: relative; min-height: 120px; background: var(--c-tint); }
.image-unavailable img { visibility: hidden; }
.image-unavailable::after {
  content: attr(data-fallback-label);
  position: absolute; inset: 0; display: grid; place-items: center;
  padding: var(--s-3); text-align: center; font-size: var(--fs-0); color: var(--c-muted);
}

/* ---------- one hero entrance ---------- */
@keyframes mist-in { from { opacity: .4; } to { opacity: 1; } }
@keyframes copy-in { from { transform: translateY(-8px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .hero-mist, .hero-copy h1 { animation: none; }
}

/* ---------- breakpoints ---------- */
@media (min-width: 600px) {
  .highlights { grid-template-columns: repeat(4, 1fr); }
  .service-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trust-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  :root { --hero-min-h: max(80vh, 56.25vw); }
  .hero-inner { padding-block-start: calc(var(--header-h) + var(--s-8)); }
  /* docs/03-design-spec.md §6 expects the SI/TA headline to stay one or two
     lines at --fs-4 x .9, but the frozen dictionaries carry longer headlines
     than the ones quoted there, so at .9 the copy ran to 0.457 of the hero and
     left the upper-40% mist reservation. The cap keeps the whole copy block on
     the mist at every reviewed width; measure with qa/checks.cjs layout. */
  html[data-lang="si"] .hero-copy h1,
  html[data-lang="ta"] .hero-copy h1 { font-size: min(calc(var(--fs-4) * 0.78), 2.5rem); }
}

@media (min-width: 1024px) {
  .desktop-nav { display: flex; gap: var(--s-6); margin-inline-start: var(--s-8); }
  .desktop-nav a { color: var(--c-ink); text-decoration: none; font-size: var(--fs-0); }
  .desktop-nav a:hover { text-decoration: underline; text-underline-offset: 6px; }
  .header-cta { display: inline-flex; margin-inline-start: auto; }
  .menu-toggle { display: none; }
  .lang-switch { margin-inline-start: var(--s-6); }
  .sticky-cta { display: none; }
  .about-grid { grid-template-columns: 7fr 5fr; align-items: start; gap: var(--s-12); }
  .about-figure { margin-block-start: var(--s-2); }
  .service-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-8); }
  .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .contact-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .section { padding-block: var(--s-16); }
  .site-footer { padding-block-end: var(--s-12); }
}

@media (min-width: 1200px) {
  .hero-inner { padding-block-end: var(--s-16); }
}

@media (max-width: 359px) {
  .wordmark { font-size: 1.2rem; }
  .lang-switch { gap: var(--s-2); }
  .fact-chips li { padding-inline: var(--s-3); }
}
