/* CHRYSOPRASE BASE STYLESHEET (reconciled, v6 - Production Polished)
   Load first, then css/pages.css.

   Approved palette:
   apple #78B83A | soft mint #E8F5ED | mint highlight #C8E7D4
   ivory #F6F8F5 | evergreen #174734 | charcoal #25342D

   Verified text pairs (WCAG AA & AAA):
   Light:
   charcoal on apple 5.4:1 | charcoal on ivory 12.2:1 | evergreen on white 10.6:1
   muted #55645D on ivory 5.8:1 | white on evergreen 10.6:1
   Dark:
   primary #F5F7F3 on #111B18 15.5:1 | primary #F5F7F3 on #1C3027 12.3:1
   secondary #B8C7BD on #111B18 9.2:1 | secondary #B8C7BD on #1C3027 7.3:1
   charcoal #111B18 on apple #78B83A 7.5:1
*/

:root {
  /* Brand Constants */
  --apple: #78B83A;
  --apple-hover: #8CC652;
  --evergreen: #174734;
  --evergreen-deep: #123A2B;
  --charcoal: #25342D;
  --mint-soft: #E8F5ED;
  --mint-hl: #C8E7D4;
  --ivory: #F6F8F5;
  --white: #FFFFFF;

  /* Theme Tokens — Light Theme Default */
  --bg-page: var(--ivory);
  --bg-card: var(--white);
  --bg-alt: var(--mint-soft);
  --bg-header: rgba(255, 255, 255, 0.97);
  --bg-footer: var(--charcoal);
  --bg-notice: #FFF4D6;
  --text-notice: #5C4300;

  --text-main: var(--charcoal);
  --text-lead: #55645D;
  --text-head: var(--evergreen);
  --text-foot: #D6E3DC;
  --text-foot-link: #E8F5ED;
  --link-color: var(--evergreen);

  --eyebrow-bg: var(--white);
  --eyebrow-border: var(--mint-hl);
  --eyebrow-text: var(--evergreen);

  --btn-sec-bg: var(--white);
  --btn-sec-text: var(--evergreen);
  --btn-sec-border: var(--evergreen);
  --btn-sec-hover-bg: var(--evergreen);
  --btn-sec-hover-text: var(--white);

  --portal-btn-bg: var(--evergreen);
  --portal-btn-text: var(--white);
  --portal-btn-border: var(--evergreen);

  /* Lines & UI accents */
  --muted: #55645D;
  --line: #D6E6DC;
  --line-strong: #9AB3A6;
  --error: #A12C1C;

  /* Layout, Shadows & Focus */
  --radius: 10px;
  --radius-lg: 16px;
  --max: 1200px;
  --space: clamp(56px, 7vw, 92px);
  --shadow-sm: 0 1px 3px rgba(23, 71, 52, 0.07), 0 2px 8px rgba(23, 71, 52, 0.05);
  --shadow-md: 0 6px 22px rgba(23, 71, 52, 0.10);
  --focus-ring: 3px solid #174734;

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: Georgia, "Times New Roman", serif;
}

[data-theme="dark"] {
  /* Theme Tokens — Dark Theme */
  --bg-page: #111B18;
  --bg-card: #1C3027;
  --bg-alt: #17241E;
  --bg-header: rgba(17, 27, 24, 0.97);
  --bg-footer: #0C1411;
  --bg-notice: #2A2511;
  --text-notice: #FBE288;

  --text-main: #F5F7F3;
  --text-lead: #B8C7BD;
  --text-head: #C5E9A5;
  --text-foot: #B8C7BD;
  --text-foot-link: #C5E9A5;
  --link-color: #8CC652;

  --eyebrow-bg: #17241E;
  --eyebrow-border: #284436;
  --eyebrow-text: #C5E9A5;

  --btn-sec-bg: #1C3027;
  --btn-sec-text: #F5F7F3;
  --btn-sec-border: #78B83A;
  --btn-sec-hover-bg: #78B83A;
  --btn-sec-hover-text: #111B18;

  --portal-btn-bg: #1C382C;
  --portal-btn-text: #FFFFFF;
  --portal-btn-border: #78B83A;

  --muted: #B8C7BD;
  --line: #264234;
  --line-strong: #335946;
  --error: #FF7B6B;

  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 26px rgba(0, 0, 0, 0.45);
  --focus-ring: 3px solid #78B83A;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-main);
  background: var(--bg-page);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .25s ease, color .25s ease;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link-color); }
:focus-visible { outline: var(--focus-ring); outline-offset: 3px; }
h1, h2, h3, p, label { overflow-wrap: break-word; }

/* Safe, centered container with guaranteed horizontal gutters */
.container {
  width: 100%;
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(20px, 4vw, 36px);
  padding-right: clamp(20px, 4vw, 36px);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link {
  position: absolute; left: 16px; top: -60px; background: var(--evergreen); color: var(--white);
  padding: 8px 14px; border-radius: var(--radius); z-index: 100; font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* Demo banner */
.demo-banner {
  background: var(--bg-notice); color: var(--text-notice); text-align: center;
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em; padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg-header);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: background-color .25s ease, border-color .25s ease;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 76px; gap: clamp(12px, 2vw, 32px); position: relative;
}

/* Brand */
.brand {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text-head);
  flex-shrink: 0;
}
.brand img {
  width: auto; height: 48px; flex-shrink: 0; border-radius: 6px;
}
.brand-name {
  font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; line-height: 1.2;
  color: var(--text-head); white-space: nowrap;
}

/* Header utility actions */
.header-actions {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}

/* Desktop Navigation */
.site-nav {
  display: none;
}
.site-nav ul {
  list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; align-items: center;
}
.site-nav li {
  margin: 0; padding: 0; white-space: nowrap; overflow-wrap: normal; word-break: normal; flex-shrink: 0;
}
.site-nav a {
  display: inline-block; text-decoration: none; color: var(--text-main); font-weight: 500; font-size: 15px;
  padding: 8px 13px; border-radius: 999px; white-space: nowrap; word-break: normal; overflow-wrap: normal;
  transition: background-color .2s, color .2s;
}
.site-nav a:hover { background: var(--bg-alt); color: var(--apple); }

@media (min-width: 880px) {
  .site-nav { display: block; flex: 0 1 auto; }
  .brand img { height: 54px; }
  .header-inner { min-height: 80px; }
  /* Ensure duplicate portal link is NEVER visible in desktop nav */
  .nav-portal-item { display: none !important; }
}

@media (min-width: 880px) and (max-width: 1140px) {
  .header-inner { gap: 12px; }
  .site-nav ul { gap: 2px; }
  .site-nav a { padding: 6px 9px; font-size: 14px; }
  .brand-name { font-size: 1.05rem; }
  .btn-portal { padding: 8px 12px; font-size: 13px; }
}

@media (min-width: 1141px) {
  .site-nav ul { gap: 6px; }
  .site-nav a { padding: 8px 14px; font-size: 15px; }
}

/* Mobile: clean header & accessible dropdown drawer */
.nav-toggle {
  display: none; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  width: 44px; height: 44px; cursor: pointer; position: relative; box-shadow: var(--shadow-sm); flex-shrink: 0;
  transition: background-color .25s ease, border-color .25s ease;
  align-items: center; justify-content: center;
}
.nav-toggle .bars, .nav-toggle .bars::before, .nav-toggle .bars::after {
  display: block; width: 20px; height: 2px; background: var(--text-head); margin: auto; position: relative; border-radius: 2px;
  transition: transform .2s, background-color .2s;
}
.nav-toggle .bars::before, .nav-toggle .bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle .bars::before { top: -6px; }
.nav-toggle .bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { top: 0; transform: rotate(-45deg); }

@media (max-width: 879px) {
  .nav-toggle { display: inline-flex; }
  .brand img { height: 42px; }
  .brand-name { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; max-width: calc(100vw - 165px); }
  .site-nav {
    display: none; position: absolute; top: calc(100% + 8px); right: 16px; left: auto;
    width: min(320px, calc(100vw - 32px));
    background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md); padding: 12px 8px; z-index: 100;
    transition: background-color .25s ease, border-color .25s ease;
  }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; gap: 4px; }
  .site-nav li { width: 100%; }
  .site-nav a { display: block; padding: 12px 16px; min-height: 44px; border-radius: var(--radius); }
  .nav-portal-item { display: block !important; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
  .nav-portal-item .btn-portal { width: 100%; min-height: 46px; }
  body { padding-bottom: 72px; }
}

/* ---------- Theme Toggle Button ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text-head);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color .25s ease, border-color .25s ease, color .25s ease, transform .15s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--bg-alt);
  border-color: var(--apple);
  color: var(--apple);
}
.theme-toggle:active {
  transform: translateY(1px);
}
.theme-toggle svg {
  display: block;
  pointer-events: none;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 50px;
  padding: 12px 26px; border-radius: var(--radius); font: inherit; font-weight: 600; font-size: 16px;
  text-decoration: none; cursor: pointer; border: 2px solid transparent; white-space: nowrap;
  transition: background-color .2s, color .2s, border-color .2s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--apple); color: #111B18; font-weight: 700; }
.btn-primary:hover { background: var(--apple-hover); color: #111B18; }
.btn-secondary { background: var(--btn-sec-bg); color: var(--btn-sec-text); border-color: var(--btn-sec-border); }
.btn-secondary:hover { background: var(--btn-sec-hover-bg); color: var(--btn-sec-hover-text); border-color: var(--btn-sec-hover-bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background:
    radial-gradient(circle at 88% 18%, rgba(120, 184, 58, 0.14), transparent 42%),
    linear-gradient(165deg, var(--mint-soft) 0%, var(--ivory) 62%);
  padding: clamp(48px, 6vw, 84px) 0 clamp(52px, 6vw, 84px);
  border-bottom: 1px solid var(--line);
  transition: background .25s ease, border-color .25s ease;
}
[data-theme="dark"] .hero {
  background:
    radial-gradient(circle at 88% 18%, rgba(120, 184, 58, 0.18), transparent 45%),
    linear-gradient(165deg, #17241E 0%, #111B18 65%);
}
.eyebrow {
  display: inline-flex; align-items: center; color: var(--eyebrow-text); font-weight: 600; font-size: 14px;
  letter-spacing: 0.04em; text-transform: uppercase; margin: 0 0 16px; padding: 6px 14px; border-radius: 999px;
  background: var(--eyebrow-bg); border: 1px solid var(--eyebrow-border); white-space: nowrap;
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}
.hero-title {
  font-family: var(--font-head); color: var(--text-head);
  font-size: clamp(2.1rem, 5vw, 3.6rem); line-height: 1.15; margin: 0 0 18px; letter-spacing: -0.01em;
}
.hero-sub {
  font-size: clamp(1.05rem, 1.8vw, 1.25rem); color: var(--text-lead); margin: 0 0 32px; max-width: 58ch;
  line-height: 1.6;
}
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
@media (max-width: 479px) {
  .cta-row { flex-direction: column; align-items: stretch; }
  .cta-row .btn { width: 100%; }
}

/* ---------- Sections ---------- */
.section { padding: var(--space) 0; background: var(--bg-page); transition: background-color .25s ease; }
.section-mint { background: var(--bg-alt); }
.section-white { background: var(--bg-card); }

h1, h2, h3 { color: var(--text-head); }
h2 {
  font-family: var(--font-head);
  font-size: clamp(1.8rem, 3.2vw, 2.4rem); margin: 0 0 18px; line-height: 1.2;
}
h2::after {
  content: ""; display: block; width: 56px; height: 4px; border-radius: 2px;
  background: var(--apple); margin-top: 14px;
}
h3 { font-size: 1.1rem; margin: 0 0 8px; }
.lead { font-size: 1.1rem; color: var(--text-lead); max-width: 64ch; }
.split { display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 880px) { .split { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); } }

/* Educational promise, shown as a quoted panel */
.promise {
  margin: 0; background: var(--bg-card); border: 1px solid var(--line); border-left: 5px solid var(--apple);
  border-radius: var(--radius-lg); padding: clamp(24px, 4vw, 36px); box-shadow: var(--shadow-sm);
  transition: background-color .25s ease, border-color .25s ease;
}
.promise p { margin: 0; font-family: var(--font-head); font-size: clamp(1.1rem, 2.2vw, 1.35rem); line-height: 1.6; color: var(--text-head); }

/* ---------- Panels and lists ---------- */
.panel {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-sm);
  transition: background-color .25s ease, border-color .25s ease;
}
.values {
  list-style: none; padding: 0; margin: 36px 0 0; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 720px) { .values { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.values li {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px; border-top: 4px solid var(--apple); box-shadow: var(--shadow-sm); min-width: 0;
  transition: background-color .25s ease, border-color .25s ease;
}
.values strong { color: var(--text-head); display: block; font-size: 1.05rem; margin-bottom: 6px; }

.levels {
  list-style: none; padding: 0; margin: 36px 0 0; display: grid; gap: 16px;
  grid-template-columns: minmax(0, 1fr); counter-reset: lvl;
}
@media (min-width: 720px) { .levels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.levels li {
  background: var(--bg-card); border-radius: var(--radius-lg); padding: 22px 22px 22px 72px;
  border: 1px solid var(--line); position: relative; box-shadow: var(--shadow-sm); min-width: 0;
  transition: background-color .25s ease, border-color .25s ease;
}
.levels li::before {
  counter-increment: lvl; content: counter(lvl); position: absolute; left: 20px; top: 20px;
  width: 36px; height: 36px; border-radius: 50%; background: var(--evergreen); color: var(--white);
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
[data-theme="dark"] .levels li::before {
  background: var(--apple); color: #111B18;
}
.levels strong { display: block; color: var(--text-head); font-size: 1.05rem; margin-bottom: 2px; }

/* Gallery base (photographs retain original natural colors — no dark filter applied) */
.gallery { display: grid; gap: 16px; margin-top: 36px; }
.gallery figure { margin: 0; min-width: 0; }
.gallery img, .photo-pending {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-lg);
  background: var(--bg-alt); box-shadow: var(--shadow-sm);
}
.photo-pending {
  display: grid; place-items: center; color: var(--muted); font-size: 14px;
  border: 1px dashed var(--line-strong); text-align: center; padding: 12px;
}

/* Notices */
.notice {
  background: var(--bg-notice); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; font-size: 14px; color: var(--text-notice);
}

/* ---------- Forms ---------- */
.form {
  background: var(--bg-card); border-radius: var(--radius-lg); padding: 28px; border: 1px solid var(--line);
  display: grid; gap: 18px; box-shadow: var(--shadow-md); color: var(--text-main); min-width: 0;
  transition: background-color .25s ease, border-color .25s ease;
}
.field label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--text-main); font-size: 15px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 50px; padding: 10px 14px; font: inherit; color: var(--text-main);
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg-card);
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--apple); outline: none; box-shadow: 0 0 0 4px rgba(120, 184, 58, 0.35);
}
.field .error { color: var(--error); font-size: 14px; margin: 6px 0 0; min-height: 0; }
.form .btn-primary { width: 100%; }
.form-status { margin: 0; font-weight: 600; color: var(--apple); }

/* ---------- Contact cards ---------- */
.contact-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.contact-card {
  background: var(--bg-card); border: 1px solid var(--line); border-left: 3px solid var(--apple);
  border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-sm); min-width: 0;
  transition: background-color .25s ease, border-color .25s ease;
}
.contact-card .k {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.contact-card .v { margin: 4px 0 0; color: var(--text-main); font-size: 15px; font-weight: 500; line-height: 1.4; }
.contact-card .v a { color: var(--link-color); text-decoration: underline; text-underline-offset: 2px; }
.contact-card .v a:hover { color: var(--apple); }

.tag-demo {
  display: inline-block; background: var(--bg-notice); color: var(--text-notice);
  border-radius: 999px; font-size: 11px; line-height: 1; padding: 4px 8px; letter-spacing: .03em;
}

/* ---------- Footer base ---------- */
.site-footer {
  background: var(--bg-footer); color: var(--text-foot); border-top: 3px solid var(--apple);
  transition: background-color .25s ease;
}

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