/**
 * COSYlanguages: modern, cosy layer
 * Loaded last. Part 1 is global (every page that includes it); part 2 is the home page.
 *
 * Design idea: a table where a conversation happens.
 *  - Warm linen surfaces, forest ink, one lamp-yellow glow used sparingly.
 *  - Fraunces (soft) for anything that speaks; Commissioner for everything that explains.
 *  - Few boxes. Sections are separated by space and one tinted band, not by ornaments.
 *  - Motion: a single sequence in the hero. Everything else answers a click.
 */

/* ═══════════════════════════════════════════════════════════════════
   1. GLOBAL
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* Flatter, softer elevation than the old stacked "raised" shadow. */
  --cosy-shadow-raised: 0 1px 2px rgba(35, 56, 39, 0.14), 0 8px 18px -10px rgba(35, 56, 39, 0.35);
  --cosy-shadow-pressed: 0 1px 2px rgba(35, 56, 39, 0.18);
  --btn-primary-shadow: var(--cosy-shadow-raised);
  --btn-primary-hover-shadow: 0 1px 2px rgba(35, 56, 39, 0.16), 0 12px 22px -10px rgba(35, 56, 39, 0.45);
  --btn-secondary-shadow: none;
  --btn-secondary-hover-shadow: none;
  --btn-soft-shadow: none;
  --btn-soft-hover-shadow: none;
  --btn-weight: 700;
  --btn-height: 46px;

  --measure: 62ch;
  --page-gutter: clamp(1.1rem, 4vw, 2rem);
}

html { scroll-padding-top: 5rem; }

body {
  font-family: var(--font-sans);
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 560;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
p, li { text-wrap: pretty; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Keyboard focus: always visible, never only a colour change. */
:where(a, button, summary, input, select, textarea, [role="button"], [tabindex]):focus-visible {
  outline: 3px solid var(--lamp, #F3C969);
  outline-offset: 3px;
  border-radius: 8px;
  box-shadow: 0 0 0 5px var(--sage, #416B49);
}

/* Touch target sizing for mobile navigation accessibility */
.mobile-nav-item {
  min-height: 48px;
  min-width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Buttons: one family, calmer than before. */
.btn-primary, .btn-secondary, .btn-soft {
  min-height: var(--btn-height);
  letter-spacing: 0;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .12s ease;
}
.btn-primary:active, .btn-secondary:active, .btn-soft:active { transform: translateY(1px); }

/* WhatsApp button never hides behind the mobile bottom bar. */
.wa-fab {
  width: 52px; height: 52px;
  font-size: 1.4rem;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.45);
}
@media (max-width: 768px) {
  .wa-fab { bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important; right: 14px; }
}

/* Footer: quieter, better spaced. */
footer .footer-inner { gap: clamp(1.5rem, 4vw, 3rem); }
footer .footer-links-col h2 {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
footer .footer-links-col a { line-height: 1.9; }

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


/* Footer links always stack */
.footer-links-col a { display: block; }

/* ===== Language pages: calm the legacy ornaments ===== */
.sec-milestone-divider, .sec-tag { display: none !important; }
.course-card.dark, .courses-grid .course-card {
  background: var(--cosy-surface, #fffdf8) !important;
  color: var(--ink, #2b2b26) !important;
  border: 1px solid var(--border, rgba(74,107,80,.18)) !important;
  border-left: 4px solid var(--cosy-color-primary, #3f6b4b) !important;
  border-radius: 14px; box-shadow: none; text-align: left;
}
.course-card.dark .cc-title, .courses-grid .cc-title { color: inherit !important; font-family: var(--cosy-font-serif); }
.course-card.dark .cc-desc, .courses-grid .cc-desc { color: var(--ink-muted, #5a5a50) !important; }
.courses-grid.summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.btn-card-on-dark { background: var(--cosy-color-primary, #3f6b4b) !important; color: var(--cosy-on-brand) !important; border-radius: 999px; }
html[data-theme="dark"] .course-card.dark, html[data-theme="dark"] .courses-grid .course-card {
  background: #1f2a23 !important; color: #f1ecdf !important; border-color: rgba(255,255,255,.12) !important;
}
html[data-theme="dark"] .course-card.dark .cc-desc { color: #c9c4b5 !important; }

/* Dark mode: legacy inline-coloured headings/links placed directly on the page background */
html[data-theme="dark"] main > h1[style],
html[data-theme="dark"] main > h2[style],
html[data-theme="dark"] main > h3[style]{color:#eef4ef !important}
html[data-theme="dark"] main > p[style*="color"]{color:#b9c6bd !important}
html[data-theme="dark"] main > p > a[style*="color"]{color:#9fd3aa !important}

/* Dark mode: language hub sticky sub-header */
html[data-theme="dark"] .sd-sticky-header{background:#141c16 !important;border-color:rgba(255,255,255,.1) !important}
html[data-theme="dark"] .sd-breadcrumbs a,
html[data-theme="dark"] .sd-jump-link{color:#b9d4bf !important}
html[data-theme="dark"] .sd-breadcrumbs .current{color:#eef4ef !important}
html[data-theme="dark"] .sd-breadcrumbs .sep{color:#6b7f70 !important}
html[data-theme="dark"] .sd-jump-link:hover,html[data-theme="dark"] .sd-jump-link:focus-visible{background:rgba(159,211,170,.16);color:var(--cosy-on-brand) !important}

/* Dark mode: tokens that pages reference with light fallbacks (so cards no longer stay cream under light text) */
html[data-theme="dark"], body.theme-dark {
  --surface: var(--cosy-color-surface);
  --surface-color: var(--cosy-color-surface);
  --card-bg: var(--cosy-color-surface);
}
html[data-theme="dark"] .hero-jump-menu a { background: var(--cosy-color-surface); color: #cfe3d2; border-color: rgba(255,255,255,.14); }
html[data-theme="dark"] .hero-jump-menu a:hover { background: #2c3a2e; color: var(--cosy-on-brand); }

/* Dark mode: page-level "paper" boxes that were hard-coded white/pastel while their text turns light */
html[data-theme="dark"] .course-section,
html[data-theme="dark"] .student-portal-box,
html[data-theme="dark"] .value-card,
html[data-theme="dark"] .contact-card,
html[data-theme="dark"] .contact-cta-box,
html[data-theme="dark"] .cta-section {
  background: var(--cosy-color-surface) !important;
  color: var(--cosy-color-ink);
  border-color: rgba(255,255,255,.12) !important;
}
html[data-theme="dark"] .sd-jump-link { background: transparent !important; }
html[data-theme="dark"] .course-section h2, html[data-theme="dark"] .course-section h3,
html[data-theme="dark"] .cta-section h2, html[data-theme="dark"] .cta-section h3 { color: #eef4ef !important; }
html[data-theme="dark"] .course-section p, html[data-theme="dark"] .course-section li,
html[data-theme="dark"] .cta-section p { color: #cfdcd1 !important; }
/* Dark mode: --sage-dark is a light text token, so it cannot back a section that carries white text */
html[data-theme="dark"] body:not(.page-home) header.hero:not([data-letter]) {
  background:
    radial-gradient(ellipse at 80% 20%, rgba(143,177,147,.22) 0%, transparent 55%),
    radial-gradient(ellipse at 15% 80%, rgba(232,168,56,.12) 0%, transparent 50%),
    linear-gradient(160deg, #1c2e22 0%, #2d4a37 100%);
}
/* Small contrast lifts */
.footer-bottom { color: inherit; opacity: .8; }
html[data-theme="dark"] .about-breadcrumb a, html[data-theme="dark"] .breadcrumb a, html[data-theme="dark"] .course-breadcrumb a { color: #9fd3aa; }
html[data-theme="dark"] .about-section h3, html[data-theme="dark"] .value-card h3, html[data-theme="dark"] .contact-card h3 { color: #b6dcbe; }

/* Accessibility preferences are booted by shared/js/cosy-theme.js, which
   every page loads before first paint. modern.css is the global layer every
   page also loads, including the language hubs that skip base.css. */
html[data-text-scale="1.15"] {
    font-size: 115%;
}

html[data-text-scale="1.25"] {
    font-size: 125%;
}

html[data-text-scale="1.40"] {
    font-size: 140%;
}

html[data-reduced-motion="true"] *,
html[data-reduced-motion="true"] *::before,
html[data-reduced-motion="true"] *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

