/* Hansika Guest Inn — tokens from docs/03-design-spec.md §2. Soft radius family.
   Kumbuk green on bleached paddy; serif reading body for a house spoken in Sinhala first. */

:root {
  color-scheme: light;
  /* colour — from project.json.design.palette */
  --c-bg: #EFE6D0;
  --c-surface: #FBF6E6;
  --c-ink: #1C2418;
  --c-muted: #5A5340;
  --c-accent: #2E5A4C;
  --c-accent-ink: #F7F3E8;
  --c-line: #D4C9A8;
  --c-tint: #E4DCC0;
  /* primary button hover: the authored accent darkened by 8% */
  --c-accent-strong: #2A5346;

  /* type - EN families from project.json.design.fonts. Each carries a
     metric-matched local face (defined below) directly after the authored
     family, so the display=swap load does not re-wrap the page. */
  --font-display: "Libre Franklin", "Latin display loading fallback", Georgia, serif;
  --font-body: "Source Serif 4", "Latin body loading fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* SI/TA families from project.json.design.fonts. Keep these separate so
     native switcher labels remain readable while another language is active.
     Each stack carries a metric-matched local face (defined below) directly
     after the authored family, so the display=swap load does not re-wrap text. */
  --font-si-body: "Noto Sans Sinhala", "Sinhala loading fallback", system-ui, sans-serif;
  --font-si-display: "Noto Serif Sinhala", "Noto Sans Sinhala", "Sinhala display loading fallback", serif;
  --font-ta-body: "Noto Sans Tamil", "Tamil loading fallback", system-ui, sans-serif;
  --font-ta-display: "Noto Serif Tamil", "Noto Sans Tamil", "Tamil display loading fallback", serif;

  --fs-0: clamp(0.875rem, 0.85rem + 0.2vw, 0.95rem);
  --fs-1: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  --fs-2: clamp(1.25rem, 1.1rem + 0.8vw, 1.5rem);
  --fs-3: clamp(1.6rem, 1.3rem + 1.6vw, 2.25rem);
  /* h1 capped at 3.0rem for this client's Sinhala-first headline. */
  --fs-4: clamp(2.2rem, 1.6rem + 3.2vw, 3rem);
  --lh-body: 1.55;
  --lh-heading: 1.08;
  --scale-heading: 1;

  /* space (4-pt) */
  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-6: 1.5rem; --s-8: 2rem;
  --s-12: 3rem; --s-16: 4rem; --s-24: 6rem;

  /* shape + depth — soft, one radius family; no shadows on cards */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px;
  --shadow-1: 0 8px 24px rgb(28 36 24 / .12);
  --shadow-2: none;

  /* motion — one hero entrance only (map pin drops, tank-bund path draws) */
  --t-fast: 150ms; --t-base: 240ms; --t-hero: 520ms; --ease: cubic-bezier(.2, .7, .2, 1);

  /* layout */
  --max-w: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --header-h: 3.5rem;
  --sticky-cta-h: 4rem;
}

/* Loading fallbacks for the authored web families.
   The families arrive from Google Fonts with display=swap, so the first paint
   uses a local face. Unadjusted, that face re-wraps the hero when the webfont
   lands: at 412px the Sinhala subline gained a line, the fact chips gained two
   and .hero-map jumped 150px (CLS 0.14699 in the harness, 0.136 in Lighthouse
   mobile); English moved the same element by 43px (CLS 0.136 in Lighthouse).
   size-adjust below is the measured ratio of the authored family's advance
   widths to this local face over the page's own strings (BUILD-LOG.md), which
   holds the line breaks steady through the swap. Sources are local() only, so
   where the face is absent the stack falls through unchanged.
   unicode-range keeps each face on the script it stands in for. The SI/TA
   subsets are requested per character, so the authored face only ever supplies
   that script plus its Latin; without a range the face would also take the Latin
   and digit runs and wrap the fact chips differently until it loads. */
@font-face {
  font-family: "Latin body loading fallback";
  src: local("Segoe UI"), local("Arial");
  size-adjust: 107.5%;
  unicode-range: U+0000-024F, U+2000-206F;
}
@font-face {
  font-family: "Latin display loading fallback";
  src: local("Georgia"), local("Times New Roman");
  size-adjust: 105.6%;
  unicode-range: U+0000-024F, U+2000-206F;
}
@font-face {
  font-family: "Sinhala loading fallback";
  src: local("Nirmala UI"), local("Iskoola Pota");
  size-adjust: 110.9%;
  unicode-range: U+0D80-0DFF, U+200D;
}
@font-face {
  font-family: "Sinhala display loading fallback";
  src: local("Nirmala UI"), local("Iskoola Pota");
  size-adjust: 101.9%;
  unicode-range: U+0D80-0DFF, U+200D;
}
@font-face {
  font-family: "Tamil loading fallback";
  src: local("Nirmala UI"), local("Latha");
  size-adjust: 98.8%;
  unicode-range: U+0B80-0BFF, U+200D;
}
@font-face {
  font-family: "Tamil display loading fallback";
  src: local("Nirmala UI"), local("Latha");
  size-adjust: 104.8%;
  unicode-range: U+0B80-0BFF, U+200D;
}

/* Sinhala / Tamil overrides - docs/I18N.md §4 */
html[data-lang="si"] {
  --font-body: var(--font-si-body);
  --font-display: var(--font-si-display);
}
html[data-lang="ta"] {
  --font-body: var(--font-ta-body);
  --font-display: var(--font-ta-display);
}
html[data-lang="si"],
html[data-lang="ta"] {
  --lh-body: 1.75;
  --lh-heading: 1.25;
  --scale-heading: 0.9;
  letter-spacing: 0;
}
/* The shared boot requests the SI/TA display families at 500;600, so headings use the
   loaded 600 face instead of a synthesised 700 that was never requested. */
html[data-lang="si"] h1, html[data-lang="si"] h2, html[data-lang="si"] h3,
html[data-lang="ta"] h1, html[data-lang="ta"] h2, html[data-lang="ta"] h3 {
  font-weight: 600;
}

/* Base */
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 0.5rem);
  scroll-padding-bottom: calc(var(--sticky-cta-h) + 0.5rem);
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--c-bg); color: var(--c-ink);
  font-family: var(--font-body); font-size: var(--fs-1); font-weight: 400; line-height: var(--lh-body);
  -webkit-text-size-adjust: 100%; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 {
  font-family: var(--font-display); font-weight: 700; line-height: var(--lh-heading);
  text-wrap: balance; margin: 0;
}
h1 { font-size: calc(var(--fs-4) * var(--scale-heading)); }
h2 { font-size: calc(var(--fs-3) * var(--scale-heading)); }
h3 { font-size: calc(var(--fs-2) * var(--scale-heading)); }
img, picture, video { max-width: 100%; height: auto; display: block; }
figure { margin: 0; }
a { color: var(--c-accent); }
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 3px; border-radius: var(--r-sm); }
[translate="no"] { font-variant-numeric: tabular-nums; }
address { font-style: normal; overflow-wrap: anywhere; }
[data-lang-switch="si"] { font-family: var(--font-si-body); }
[data-lang-switch="ta"] { font-family: var(--font-ta-body); }
.skip-link {
  position: absolute; inset-inline-start: var(--s-4); top: -100%;
  background: var(--c-accent); color: var(--c-accent-ink);
  padding: var(--s-2) var(--s-4); border-radius: var(--r-sm); z-index: 80;
  min-height: 44px; display: inline-flex; align-items: center;
}
.skip-link:focus { top: calc(var(--header-h) + 0.25rem); }
