/* Krisna.House, Siem Reap
   Layout: calm editorial pages. Split heroes with an arched "temple doorway" photo,
   wide warm-white space, soft sage bands, charcoal footer. */

:root {
  --warm-white: #faf7f1;
  --paper: #f3efe6;
  --sage-mist: #e6ebe1;
  --sage: #9aae94;
  --sage-deep: #5d7458;
  --charcoal: #2a2b29;
  --ink-soft: #5b5d58;
  --line: #ddd8cc;

  --font-display: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --font-body: "Manrope", "Helvetica Neue", Arial, sans-serif;

  --step-hero: clamp(2.9rem, 6.4vw, 5.6rem);
  --step-h2: clamp(2.1rem, 3.8vw, 3.2rem);
  --step-h3: 1.6rem;
  --step-body: 1.0625rem;

  --max: 1180px;
  --radius-arch: 999px 999px 18px 18px;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

body {
  margin: 0;
  background: var(--warm-white);
  color: var(--charcoal);
  font-family: var(--font-body);
  font-size: var(--step-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: var(--step-hero); font-weight: 700; }
h2 { font-size: var(--step-h2); }
h3 { font-size: var(--step-h3); line-height: 1.15; }
p { margin: 0; max-width: 34em; color: var(--ink-soft); }

.wrap {
  width: 100%;
  max-width: calc(var(--max) + 2 * 32px);
  margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
@media (min-width: 720px) { .wrap { padding-left: 32px; padding-right: 32px; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  padding: .95em 1.8em;
  border-radius: 999px;
  background: var(--charcoal);
  color: var(--warm-white);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: 1.5px solid var(--charcoal);
  cursor: pointer;
  transition: background .25s, color .25s, border-color .25s, transform .25s;
}
.btn:hover { background: var(--sage-deep); border-color: var(--sage-deep); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--charcoal); }
.btn--ghost:hover { background: var(--charcoal); color: var(--warm-white); border-color: var(--charcoal); }
.btn--sage { background: var(--sage-deep); border-color: var(--sage-deep); }
.btn--sage:hover { background: var(--charcoal); border-color: var(--charcoal); }
.btn--light { background: var(--warm-white); color: var(--charcoal); border-color: var(--warm-white); }
.btn--light:hover { background: var(--sage); border-color: var(--sage); color: var(--charcoal); }

a:focus-visible, button:focus-visible, input:focus-visible, label:focus-visible {
  outline: 2px solid var(--sage-deep);
  outline-offset: 3px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--warm-white) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand img { width: 44px; height: auto; }
.brand-name {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.brand-name strong {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: #1b2e54;
}
.brand-name span {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: #b8541e;
  margin-top: 5px;
}

.nav { display: flex; align-items: center; gap: 30px; }
.nav a {
  text-decoration: none;
  font-size: .95rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--charcoal); }
.nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--sage); text-underline-offset: 8px; text-decoration-thickness: 2px; }
.nav .btn { color: var(--warm-white); padding: .7em 1.4em; }
.nav .btn:hover { color: var(--warm-white); }

.nav-toggle { display: none; }
.nav-toggle-label { display: none; }

@media (max-width: 1100px) {
  .nav-toggle-label {
    display: inline-flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px 6px;
    cursor: pointer;
  }
  .nav-toggle-label span { width: 24px; height: 2px; background: var(--charcoal); border-radius: 2px; }
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--warm-white);
    border-bottom: 1px solid var(--line);
    padding: 8px max(20px, env(safe-area-inset-right, 0px)) 24px max(20px, env(safe-area-inset-left, 0px));
  }
  .nav a { padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
  .nav a[aria-current="page"] { text-decoration: none; color: var(--sage-deep); }
  .nav .btn { margin-top: 18px; border-bottom: 0; padding: .95em 1.4em; }
  .nav-toggle:checked ~ .nav { display: flex; }
}

/* ---------- Hero ---------- */
.hero { padding-block: clamp(48px, 8vw, 104px) clamp(56px, 8vw, 112px); }
.hero .wrap {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  align-items: center;
  gap: clamp(32px, 6vw, 88px);
}
.hero-text { display: grid; gap: 26px; justify-items: start; min-width: 0; }
.hero-text p { font-size: 1.2rem; max-width: 26em; }
.arch {
  border-radius: var(--radius-arch);
  overflow: hidden;
  background: var(--sage-mist);
  aspect-ratio: 4 / 5;
  max-width: 100%;
}
.arch img { width: 100%; height: 100%; object-fit: cover; }
.hero .arch { justify-self: end; width: min(100%, 460px); }

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero .arch { justify-self: center; width: min(100%, 300px); order: -1; }
}

/* ---------- Sections ---------- */
.section { padding-block: clamp(64px, 9vw, 120px); }
.section--sage { background: var(--sage-mist); }
.section--paper { background: var(--paper); }
.section-head { display: grid; gap: 14px; margin-bottom: clamp(36px, 5vw, 56px); max-width: 40em; }
.section-head--center { margin-inline: auto; text-align: center; justify-items: center; }

/* Offerings: three items on home */
.offerings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(24px, 3vw, 40px);
}
.offering {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 14px;
  text-decoration: none;
  min-width: 0;
}
.offering .photo {
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: var(--sage-mist);
  margin-bottom: 8px;
}
.offering .photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.offering:hover .photo img { transform: scale(1.03); }
.offering .more {
  font-weight: 600;
  font-size: .95rem;
  color: var(--sage-deep);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1.5px;
}
@media (max-width: 860px) { .offerings { grid-template-columns: 1fr; } }

/* Split: image + text */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 7vw, 104px);
  align-items: center;
}
.split > * { min-width: 0; }
.split .text { display: grid; gap: 20px; justify-items: start; }
.split .arch { width: min(100%, 440px); }
.split--reverse .arch { order: 2; justify-self: end; }
.split .frame {
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--sage-mist);
}
.split .frame img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .split--reverse .arch { order: 0; justify-self: start; }
}

/* Key numbers */
.numbers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
}
.number {
  padding: 32px 24px 8px 0;
  display: grid;
  gap: 6px;
}
.number + .number { padding-left: 24px; border-left: 1px solid var(--line); }
.number strong {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 5vw, 4.2rem);
  font-weight: 600;
  line-height: 1;
  color: var(--charcoal);
  font-variant-numeric: lining-nums tabular-nums;
}
.number span { color: var(--ink-soft); font-size: .98rem; }
@media (max-width: 860px) {
  .numbers { grid-template-columns: 1fr 1fr; }
  .number:nth-child(3) { padding-left: 0; border-left: 0; }
  .number:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* Schedule list (programs page) */
.schedule { display: grid; border-top: 1px solid var(--line); }
.schedule-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.schedule-row .when { font-weight: 600; color: var(--sage-deep); }
.schedule-row .what { display: grid; gap: 6px; }
@media (max-width: 640px) { .schedule-row { grid-template-columns: 1fr; gap: 8px; } }

/* Gift amounts (Food for Life) */
.gifts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.gift {
  display: grid;
  gap: 10px;
  padding: 32px 28px;
  border-radius: 16px;
  background: var(--warm-white);
  border: 1px solid var(--line);
}
.gift strong {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 600;
  line-height: 1;
}
@media (max-width: 760px) { .gifts { grid-template-columns: 1fr; } }

/* Donate methods */
.methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}
.method {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 36px 30px;
  border-radius: 18px;
  background: var(--warm-white);
  border: 1px solid var(--line);
  min-width: 0;
}
.method .btn { justify-self: start; }
.method .qr {
  width: 100%;
  max-width: 220px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.details { margin: 0; display: grid; gap: 10px; }
.details div { display: grid; gap: 2px; }
.details dt { font-size: .85rem; color: var(--ink-soft); }
.details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 900px) { .methods { grid-template-columns: 1fr; } }

/* ---------- Subscribe band ---------- */
.subscribe { background: var(--charcoal); color: var(--warm-white); }
.subscribe .wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  padding-block: clamp(64px, 8vw, 104px);
}
.subscribe h2 { color: var(--warm-white); }
.subscribe p { color: #c9cbc4; margin-top: 14px; }
.subscribe-form { display: flex; gap: 12px; flex-wrap: wrap; }
.subscribe-form input {
  flex: 1 1 240px;
  min-width: 0;
  padding: 1em 1.3em;
  border-radius: 999px;
  border: 1.5px solid #55574f;
  background: transparent;
  color: var(--warm-white);
  font: inherit;
}
.subscribe-form input::placeholder { color: #9c9e96; }
@media (max-width: 860px) { .subscribe .wrap { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.contact-item {
  display: grid;
  gap: 8px;
  padding: 30px 28px;
  border-radius: 16px;
  background: var(--warm-white);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: border-color .25s, transform .25s;
  min-width: 0;
}
a.contact-item:hover { border-color: var(--sage); transform: translateY(-2px); }
.contact-item span { font-size: .9rem; color: var(--ink-soft); }
.contact-item strong { font-size: 1.15rem; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }

/* ---------- Closing call to action ---------- */
.closing { text-align: center; }
.closing .wrap { display: grid; justify-items: center; gap: 22px; }
.closing p { text-align: center; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding-block: 48px;
  font-size: .95rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 48px;
  justify-content: space-between;
  align-items: center;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.footer-links a { text-decoration: none; color: var(--ink-soft); }
.footer-links a:hover { color: var(--charcoal); }
.site-footer small { color: var(--ink-soft); font-size: .88rem; }

/* ---------- Home banner: full-width, full-size photo banner (rotates when there are several photos) ---------- */
.banner {
  position: relative;
  overflow: hidden;
  background: #1d1e1b;
  color: var(--warm-white);
  min-height: min(88vh, 820px);
  display: flex;
  align-items: flex-end;
}
.banner-slides { position: absolute; inset: 0; }
.banner-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.banner-photo.is-active { opacity: 1; }
.banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(20, 21, 19, .78) 0%, rgba(20, 21, 19, .35) 55%, rgba(20, 21, 19, .1) 100%),
    linear-gradient(to top, rgba(20, 21, 19, .7) 0%, transparent 45%);
  pointer-events: none;
}
.banner .wrap { position: relative; z-index: 1; padding-block: clamp(96px, 14vw, 160px) clamp(56px, 8vw, 96px); }
.banner-text { display: grid; gap: 26px; justify-items: start; max-width: 640px; }
.banner h1 { color: var(--warm-white); text-shadow: 0 2px 24px rgba(0, 0, 0, .25); }
.banner p { color: #e4e5df; font-size: 1.2rem; max-width: 24em; }

@media (max-width: 760px) {
  .banner { min-height: min(86vh, 680px); }
  .banner::after { background: linear-gradient(to top, rgba(20, 21, 19, .85) 0%, rgba(20, 21, 19, .35) 60%, rgba(20, 21, 19, .15) 100%); }
  .banner .wrap { padding-bottom: 48px; }
}

/* ---------- Language switcher ---------- */
.lang { position: relative; flex: none; }
.lang summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: .5em .9em;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--charcoal);
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary::after {
  content: "";
  width: 6px; height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}
.lang[open] summary { border-color: var(--sage); }
.lang ul {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 170px;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(42, 43, 41, .12);
  z-index: 30;
}
.lang a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: .95rem;
}
.lang a:hover { background: var(--sage-mist); color: var(--charcoal); }
.lang a[aria-current="true"] { color: var(--sage-deep); font-weight: 600; }
.site-header .nav { margin-left: auto; }
@media (max-width: 1100px) {
  .site-header .lang { margin-left: auto; order: 2; }
  .site-header .nav-toggle-label { order: 3; }
}

/* The logo wordmark always stays in the Latin logo face */
.brand-name strong { font-family: "Cormorant Garamond", Garamond, serif; }

/* ---------- Khmer ---------- */
:root:lang(km) {
  --font-display: "Noto Serif Khmer", "Khmer OS", serif;
  --font-body: "Kantumruy Pro", "Noto Sans Khmer", "Khmer OS", sans-serif;
  --step-hero: clamp(2.2rem, 4.6vw, 4rem);
  --step-h2: clamp(1.7rem, 3vw, 2.5rem);
  --step-h3: 1.3rem;
}
:lang(km) h1, :lang(km) h2, :lang(km) h3 { line-height: 1.5; letter-spacing: 0; font-weight: 600; }
:lang(km) body, body:lang(km) { line-height: 1.8; }

/* ---------- Chinese ---------- */
:root:lang(zh) {
  --font-display: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --step-hero: clamp(2.4rem, 5vw, 4.4rem);
  --step-h2: clamp(1.8rem, 3.2vw, 2.6rem);
  --step-h3: 1.35rem;
}
:lang(zh) h1, :lang(zh) h2, :lang(zh) h3 { line-height: 1.3; letter-spacing: .02em; }
:lang(zh) p { max-width: 30em; }

/* ---------- Russian: long words need a slightly smaller headline ---------- */
:root:lang(ru) { --step-hero: clamp(2.5rem, 5.6vw, 5rem); }

/* Key numbers: let long labels wrap instead of widening the page */
.number { min-width: 0; }
.number span { overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .number strong { font-size: clamp(2.2rem, 9vw, 2.8rem); }
}

/* ---------- Books page ---------- */
.split .frame--tall { aspect-ratio: 4 / 5; max-width: 440px; }
.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 1.6vw, 18px);
}
.gallery img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 14px;
  background: var(--sage-mist);
}
.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.help-grid .btn { justify-self: start; }
@media (max-width: 760px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .help-grid { grid-template-columns: 1fr; }
}
/* Seven menu items: tighten spacing on mid-size screens */
@media (min-width: 1101px) and (max-width: 1280px) {
  .nav { gap: 18px; }
  .nav a { font-size: .9rem; }
}

.nav a { white-space: nowrap; }

/* Gallery with one large first photo (fills the grid evenly with 5, 8 or 11 photos) */
.gallery--feature img:first-child { grid-row: span 2; aspect-ratio: auto; height: 100%; }

/* Home cards: most photos are portrait, so show them taller and keep people in frame */
.offering .photo { aspect-ratio: 4 / 5; }
.offering .photo img { object-position: center 35%; }
@media (max-width: 860px) { .offering .photo { aspect-ratio: 1 / 1; } }

/* "Get directions" link inside the Find us card */
.contact-item .more { font-weight: 600; font-size: .95rem; color: var(--sage-deep); text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1.5px; }

/* KHQR card: real QR, no extra frame */
.method .qr { border: 0; border-radius: 16px; max-width: 240px; }

/* Donate options: fill the row whether there are 2 or 3 */
.methods { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* Food gallery with 7 photos: first two photos are tall, so 3 columns fill evenly */
.gallery--two-tall img:nth-child(2) { grid-row: span 2; aspect-ratio: auto; height: 100%; }
@media (max-width: 760px) { .gallery--two-tall img:nth-child(2) { grid-row: auto; aspect-ratio: 3 / 4; height: auto; } }
@media (max-width: 760px) { .gallery--flat-mobile img:first-child { grid-row: auto; aspect-ratio: 3 / 4; height: auto; } }
