/* ==========================================================================
   REEC — Rural Education Experts Cambodia
   Hand-written CSS. No framework. "Warm Roots" direction.
   Latin text uses system fonts (0 bytes downloaded).
   ========================================================================== */

/* ---- Design tokens ---- */
:root {
  --bg: #FBF7F1;
  --surface: #FFFFFF;
  --sand: #F1E8D8;
  --ink: #241F1B;
  --muted: #6E655B;
  --brand: #15695A;
  --brand-dark: #0E4A40;
  --accent: #D9772E;
  --accent-dark: #BC6121;
  --line: #E6DAC6;
  --maxw: 68rem;
  --measure: 44rem;   /* readable text column on interior pages */
  --media: 58rem;     /* images, figures & card grids on interior pages */
  --radius: 14px;
  --shadow: 0 1px 2px rgba(36,31,27,.05), 0 6px 20px rgba(36,31,27,.06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; color: var(--ink); margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 6vw, 3.2rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.5rem, 3.6vw, 2.2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

/* ---- Layout helpers ---- */
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: 1.25rem; }
.center { text-align: center; }
.lede { font-size: 1.18rem; color: var(--muted); }
.eyebrow {
  font-family: var(--sans); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; font-size: .78rem; color: var(--brand); margin: 0 0 .4rem;
}
.eyebrow-light { color: #ffd9a8; }
section { padding-block: clamp(2.6rem, 7vw, 4.2rem); }
.tint { background: var(--sand); }
.section-head { max-width: 60ch; margin-inline: auto; margin-bottom: .5rem; }
.center-cta { margin-top: 1.6rem; }

/* ---- Accessibility ---- */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.skip-link {
  position: absolute; left: .5rem; top: .5rem; z-index: 100;
  transform: translateY(calc(-100% - 1rem));
  background: var(--brand); color: #fff; padding: .6rem 1rem; border-radius: 8px;
  text-decoration: none; transition: transform .15s;
}
.skip-link:focus { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---- Buttons ---- */
.btn {
  display: inline-block; font-weight: 700; text-decoration: none; cursor: pointer;
  border-radius: 999px; padding: .68rem 1.35rem; font-size: 1rem;
  border: 2px solid transparent; transition: background .15s, color .15s;
}
.btn-donate { background: var(--accent); color: #fff; }
.btn-donate:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-ghost:hover { background: var(--brand); color: #fff; }
.btn-ghost-light { background: transparent; color: #fff; border-color: #fff; }
.btn-ghost-light:hover { background: #fff; color: var(--brand-dark); }

/* ---- Header ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251,247,241,.94); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .nav { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; padding-block: .6rem; }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--brand); margin-right: auto; }
.brand-logo { width: 46px; height: 46px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--serif); font-size: 1.2rem; color: var(--brand); }
.brand-text small { font-family: var(--sans); font-weight: 600; font-size: .64rem; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: .55rem; }

.mainnav { order: 3; flex-basis: 100%; }
.mainnav ul { display: flex; gap: .1rem; list-style: none; margin: 0; padding: 0; overflow-x: auto; }
.mainnav a { display: block; padding: .4rem .6rem; white-space: nowrap; text-decoration: none; color: var(--ink); font-weight: 600; border-radius: 8px; }
.mainnav a:hover { color: var(--brand); }
.mainnav a[aria-current="page"] { color: var(--brand); background: var(--sand); }

@media (min-width: 880px) {
  .mainnav { order: 0; flex-basis: auto; margin-left: .5rem; }
  .header-actions { order: 1; }
  .mainnav ul { overflow: visible; gap: 1rem; }
  .mainnav a:hover { background: none; }
}

/* ---- Hero ---- */
.hero { position: relative; color: #fff; overflow: hidden; isolation: isolate; }
.hero .hero-img, .hero picture { position: absolute; inset: 0; z-index: -2; }
.hero .hero-img { width: 100%; height: 100%; object-fit: cover; object-position: center 42%; }
.hero .scrim { position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(14,74,64,.32), rgba(14,74,64,.80)); }
.hero-inner { padding-block: clamp(3.5rem, 12vw, 7rem); }
.hero h1 { color: #fff; max-width: 26ch; text-wrap: balance; }
.hero-text { color: #f4ede1; font-size: 1.2rem; max-width: 46ch; }
.cta-row { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.4rem; }

/* ---- Impact strip (dark green) ---- */
.impact { background: var(--brand); color: #fff; }
.impact-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.6rem 1rem; padding-block: 2.4rem; text-align: center; }
.impact .num { font-family: var(--serif); font-size: 2.4rem; line-height: 1; display: block; }
.impact .lbl { font-size: .9rem; color: #cfe7df; display: block; margin-top: .3rem; }
@media (min-width: 760px) { .impact-grid { grid-template-columns: repeat(4, 1fr); } }

/* ---- Stat strip (light, interior pages) ---- */
.stat-strip { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.4rem 1rem; text-align: center; background: var(--sand); border-radius: var(--radius); padding: 2rem 1rem; margin: 1.5rem 0; }
.stat-strip .num { font-family: var(--serif); font-size: 2.2rem; color: var(--brand); line-height: 1; display: block; }
.stat-strip .lbl { font-size: .9rem; color: var(--muted); display: block; margin-top: .3rem; }
@media (min-width: 720px) { .stat-strip { grid-template-columns: repeat(4, 1fr); } }

/* ---- Prose section (home welcome) ---- */
.prose-section .prose { max-width: 60ch; margin-inline: auto; }
.prose-section .prose :where(h2) { margin-bottom: .3em; }

/* ---- Cards ---- */
.cards { display: grid; grid-template-columns: 1fr; gap: 1.2rem; margin-top: 2rem; }
@media (min-width: 680px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.card .card-img, .card picture { width: 100%; }
.card .card-img { height: 180px; object-fit: cover; }
.card-body { padding: 1.1rem 1.2rem 1.3rem; }
.card-body h3 { margin-bottom: .3rem; }
.card-body p { font-size: .96rem; color: var(--muted); margin: 0; }

/* ---- Quote band ---- */
.quote { background: var(--ink); color: #fff; text-align: center; }
.quote blockquote { font-family: var(--serif); font-size: clamp(1.4rem, 3.5vw, 2rem); max-width: 28ch; margin: 0 auto; line-height: 1.3; }
.quote-src { color: #c9beae; font-size: .95rem; margin-top: 1rem; font-family: var(--sans); }

/* ---- Donate band ---- */
.donate-band { background: var(--accent); color: #fff; text-align: center; }
.donate-band h2 { color: #fff; }
.donate-band p { max-width: 50ch; margin-inline: auto; }

/* ---- Page header (interior) ---- */
.page-header { background: var(--sand); padding-block: clamp(2.2rem, 6vw, 3.4rem); border-bottom: 1px solid var(--line); }
.page-header .wrap > * { max-width: var(--measure); margin-inline: auto; }

/* ---- Page body (markdown prose) ----
   Text sits in a centred readable column; images and card grids span the full
   content width so everything shares the same centre line (no lopsided left edge). */
.page-body { padding-block: clamp(2.2rem, 6vw, 3.6rem); }
/* All body content sits in ONE centred column (consistent left edge for every
   heading, paragraph, list and panel)... */
.page-body > .wrap > * { max-width: var(--measure); margin-inline: auto; }
/* ...except images, figures and card grids, which sit in a wider media column
   (--media) — wider than the text for presence, but pulled in from the full
   page width so the step from text to image stays gentle, not jarring. */
.page-body > .wrap > :where(p:has(picture), figure, .cards, .team-grid, .value-grid, .stat-strip, .stories) { max-width: var(--media); }
.page-body > .wrap > p > picture { display: block; }
.page-body > .wrap > p > picture > img { width: 100%; }
.page-body h2 { margin-top: 1.8em; }
.page-body h2:first-child { margin-top: 0; }
.page-body img, .page-body picture { border-radius: var(--radius); margin: 1.5rem 0; box-shadow: var(--shadow); }
.page-body figure { margin: 1.5rem 0; }
.page-body figcaption { font-size: .85rem; color: var(--muted); margin-top: .5rem; }
.page-body ul, .page-body ol { padding-left: 1.2rem; }
.page-body li { margin-bottom: .4rem; }
.page-body blockquote { border-left: 4px solid var(--accent); margin-inline: auto; padding: .2rem 0 .2rem 1.2rem; color: var(--ink); font-style: italic; }

/* ---- Values grid ---- */
.value-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 1.5rem 0; }
@media (min-width: 720px) { .value-grid { grid-template-columns: repeat(3, 1fr); } }
.value { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); }
.value h3 { margin-bottom: .3rem; }
.value p { margin: 0; color: var(--muted); font-size: .96rem; }

/* ---- Team grid (photo cards) ---- */
.team-grid { display: grid; grid-template-columns: 1fr; gap: 1.2rem; margin: 1.5rem 0; }
@media (min-width: 620px) { .team-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .team-grid { grid-template-columns: repeat(3, 1fr); } }
.person { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.person .person-photo, .person picture { width: 100%; }
.person .person-photo { height: 230px; object-fit: cover; object-position: center 25%; }
.avatar { height: 230px; background: var(--brand); color: #fff; display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 2.6rem; }
.person-info { min-width: 0; padding: 1rem 1.2rem 1.3rem; }
.person-name { margin: 0; font-size: 1.1rem; }
.person-role { margin: .1rem 0 .5rem; color: var(--brand); font-weight: 600; font-size: .9rem; }
.person-bio { margin: 0; font-size: .92rem; color: var(--muted); }

/* ---- Our Stories (blog-style; one Markdown file per story) ---- */
.stories { display: grid; gap: clamp(2.2rem, 6vw, 3.6rem); margin: 2rem 0; }
.story { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 760px) {
  .story { grid-template-columns: 46% 1fr; gap: 1.8rem; }
  /* Alternate the photo side for a gentle blog rhythm */
  .story:nth-child(even) .story-media { order: 2; }
}
.story-media { margin: 0; }
.story-media picture { display: block; width: 100%; margin: 0; box-shadow: none; border-radius: 0; }
.story-media img, .story .story-img { display: block; width: 100%; }
.story .story-img { border-radius: var(--radius); box-shadow: var(--shadow); margin: 0; }
@media (min-width: 760px) { .story .story-img { height: 100%; max-height: 22rem; object-fit: cover; } }
.story-title { margin: 0 0 .6rem; font-size: 1.5rem; }
.story-text > p { color: var(--ink); }
.story-text > p:last-child { margin-bottom: 0; }

/* ---- Centre a lone trailing card in the last 3-up row (e.g. 7 items: 3/3/1) ---- */
@media (min-width: 980px) {
  .cards > .card:last-child:nth-child(3n+1),
  .team-grid > .person:last-child:nth-child(3n+1) { grid-column: 2; }
}

/* ---- Panels (donate / generic) ---- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem 1.5rem; margin: 1.5rem 0; max-width: 34rem; }
.panel-title { display: block; font-size: 1.05rem; margin-bottom: .6rem; }
.panel dl { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: 0; }
.panel dt { color: var(--muted); font-size: .9rem; }
.panel dd { margin: 0; font-weight: 600; }
.bank-panel { scroll-margin-top: 6rem; }
.panel-note { font-size: .85rem; color: var(--muted); margin: .9rem 0 0; }

/* QR payment code */
.page-body .qr-code {
  display: block; width: 240px; max-width: 100%; height: auto;
  margin: 1.2rem auto; padding: .6rem; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}

/* "New" badge (e.g. updated address) */
.badge-new {
  display: inline-block; background: var(--accent); color: #fff;
  font-family: var(--sans); font-weight: 700; font-size: .66rem; letter-spacing: .04em;
  text-transform: uppercase; padding: .1rem .4rem; border-radius: 5px;
  margin-left: .4rem; vertical-align: middle;
}

/* ---- Placeholder marker (clearly shows owner what to fill) ---- */
.placeholder { background: #fff4d6; border-bottom: 1px dashed var(--accent); color: #7a4a12; padding: 0 .25rem; border-radius: 3px; font-weight: 600; }

/* ---- Portrait photo (e.g. founder), modest + centred ---- */
.page-body .figure-portrait { display: block; width: auto; max-width: 360px; margin: 1.5rem auto; }

/* ---- Footer ---- */
.site-footer { background: var(--brand-dark); color: #dcefe6; padding-block: 2.6rem 1.6rem; font-size: .95rem; margin-top: 0; }
.site-footer a { color: #fff; }
.footer-cols { display: grid; grid-template-columns: 1fr; gap: 1.6rem; }
@media (min-width: 760px) { .footer-cols { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer .brand { color: #fff; margin-bottom: .6rem; }
.site-footer .brand-logo { background: #fff; border-radius: 50%; }
.site-footer .brand-text strong { color: #fff; }
.footer-brand p { color: #bfe3d7; max-width: 38ch; }
.site-footer h2 { color: #fff; font-family: var(--sans); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 .7rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.footer-contact .placeholder { background: rgba(255,255,255,.12); border-bottom-color: rgba(255,255,255,.5); color: #fff; }
.footer-fine { border-top: 1px solid rgba(255,255,255,.15); margin-top: 1.8rem; padding-top: 1.2rem; color: #a9cfc3; font-size: .85rem; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; }
/* Builder credit: own centred row; "sleeper" link — reads as plain text, reveals on hover/focus. */
.footer-credit { flex-basis: 100%; text-align: center; }
.footer-credit a { color: inherit; text-decoration: none; }
.footer-credit a:hover, .footer-credit a:focus-visible { color: #fff; text-decoration: underline; }
