/* ── Reset & base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --orange:      #E8762A; /* buttons, decorative, large text — 3:1 on white OK for large */
  --orange-text: #B5510E; /* text links on white — 4.75:1 on white, passes WCAG AA */
  --blue:        #4AB8D4;
  --gold:        #F5C540;
  --light-blue:  #EBF7FC;
  --dark:        #2C3E50;
  --gray:        #F5F5F5;
  --text:        #444;
  --radius:      10px;
  --shadow:      0 4px 18px rgba(0,0,0,0.10);
  --transition:  0.22s ease;
}

html { scroll-behavior: smooth; }

/* Offset anchor targets so sticky header doesn't obscure them (WCAG 2.4.12) */
section, main, [id] { scroll-margin-top: 80px; }

/* Visually hidden utility — readable by screen readers, invisible on screen */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Focus indicators (WCAG 2.4.11) ──────────────────────
   Global rule: 3px solid outline, offset so it sits outside
   the element border, 3:1 contrast against adjacent colours. */
:focus-visible {
  outline: 3px solid var(--orange-text);
  outline-offset: 3px;
}

/* Skip-to-content (accessibility) */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--dark);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 var(--radius) var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 9999;
  transition: top 0.2s;
}
.skip-link:focus-visible {
  top: 0;
  text-decoration: none;
  color: #fff;
  outline: 3px solid #fff;
  outline-offset: 3px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
}

img { max-width: 100%; display: block; }
a  { color: var(--orange-text); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: var(--dark);
  margin-bottom: 0.5rem;
}

h3 { font-size: 1.2rem; color: var(--dark); margin-bottom: 0.5rem; }

section { padding: 70px 0; }

/* ── Buttons ──────────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  background: #be5620;
  color: #fff;
  padding: 14px 32px;
  border-radius: 40px;
  font-weight: 600;
  font-size: 1rem;
  min-height: 44px;
  transition: background var(--transition), transform var(--transition);
}
.btn-primary:hover { background: #9e4a0c; transform: translateY(-2px); text-decoration: none; }
.btn-primary:focus-visible {
  outline: 3px solid var(--dark);
  outline-offset: 3px;
}
#hero .btn-primary:focus-visible { outline-color: #fff; }

.btn-secondary {
  display: inline-block;
  border: 2px solid var(--orange-text);
  color: var(--orange-text);
  padding: 10px 24px;
  border-radius: 40px;
  font-weight: 600;
  font-size: 0.9rem;
  min-height: 44px;
  margin-top: 12px;
  transition: background var(--transition), color var(--transition);
}
.btn-secondary:hover { background: var(--orange-text); color: #fff; text-decoration: none; }

/* ── Header ───────────────────────────────────────────── */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  padding: 10px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}

.logo-img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--orange-text);
}

.logo-sub {
  font-size: 0.72rem;
  color: #555;
  font-weight: 600;
  letter-spacing: 0.03em;
}

#main-nav {
  flex: 1;
}

#main-nav ul {
  display: flex;
  gap: 28px;
  justify-content: center;
}

#main-nav a {
  color: var(--dark);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color var(--transition);
  padding: 8px 4px;
  border-radius: 4px;
}
#main-nav a:hover { color: var(--orange-text); text-decoration: none; }

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

.lang-toggle {
  background: #1678a0;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  min-height: 36px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition);
}
.lang-toggle:hover { background: #0e5e80; }
.lang-toggle:focus-visible {
  outline: 3px solid var(--orange-text);
  outline-offset: 3px;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--dark);
  min-width: 44px;
  min-height: 44px;
  border-radius: 4px;
}

/* ── Hero ─────────────────────────────────────────────── */
#hero {
  padding: 0;
  min-height: 560px;
  display: flex;
  align-items: center;
  background-image: url('assets/hero-bg.jpg');
  background-size: cover;
  background-position: center;
  background-color: #1a7a99;
}

.hero-overlay {
  width: 100%;
  min-height: 560px;
  background: linear-gradient(135deg, rgba(26,122,153,0.82) 0%, rgba(176,80,24,0.82) 100%);
  display: flex;
  align-items: center;
}

.hero-content {
  color: #fff;
  text-align: center;
  padding: 60px 20px;
}

.hero-content h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 18px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.hero-content p {
  font-size: clamp(1rem, 2vw, 1.25rem);
  margin-bottom: 32px;
  opacity: 0.95;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ── About ────────────────────────────────────────────── */
#about { background: var(--light-blue); }

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  align-items: center;
}

.about-text .tagline {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 16px;
}

.about-text p + p { margin-top: 14px; }

.stats-row {
  display: flex;
  gap: 28px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-num {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--orange-text);
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: #555;
  margin-top: 4px;
  max-width: 80px;
  text-align: center;
}

.about-image img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  height: 380px;
  object-fit: cover;
}

.about-image--placeholder {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  height: 380px;
  background: linear-gradient(135deg, #d4e8f7 0%, #b8d4eb 100%);
}

/* ── Courses ──────────────────────────────────────────── */
#courses { background: #fff; }
#courses h2 { text-align: center; margin-bottom: 40px; }

.courses-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.course-card {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition);
  display: flex;
  flex-direction: column;
}
.course-card:hover { transform: translateY(-4px); }

.course-header {
  height: 6px;
  flex-shrink: 0;
}
.course-header--zh  { background: var(--red); }
.course-header--pl  { background: #c8102e; }
.course-header--en  { background: #003087; }
.course-header--mat { background: var(--blue); }

.course-lang {
  display: none;
}

.course-body {
  padding: 22px 24px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.course-body ul {
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.course-body li {
  font-size: 0.88rem;
  color: #555;
  padding-left: 16px;
  position: relative;
}
.course-body li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--orange-text);
  font-weight: 700;
}

.course-body .btn-secondary {
  margin-top: auto;
  align-self: flex-start;
}

/* ── Divisions ────────────────────────────────────────── */
#divisions {
  background: var(--gray);
}

#divisions h2 { text-align: center; }

.divisions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.division-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform var(--transition);
  overflow: hidden;
}
.division-card:hover { transform: translateY(-4px); }

.division-img {
  height: 190px;
  overflow: hidden;
}
.division-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.division-card:hover .division-img img { transform: scale(1.06); }
.division-img img[src*="camp-1"] { object-position: center 30%; }

.division-body {
  padding: 22px 26px 28px;
  border-top: 3px solid var(--gold);
}

.division-num {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--orange-text);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.division-card h3 {
  font-size: 1.15rem;
  margin-bottom: 12px;
  color: var(--dark);
}

.division-card p {
  font-size: 0.92rem;
  color: #555;
  line-height: 1.65;
}

/* ── Events ───────────────────────────────────────────── */
#events {
  background: #fff;
}

#events h2 { text-align: center; }

.section-sub {
  text-align: center;
  color: #666;
  margin-bottom: 36px;
  font-size: 1rem;
}

.events-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.event-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}
.event-card:hover { transform: translateY(-4px); }

.event-img {
  height: 180px;
  overflow: hidden;
}
.event-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.event-card:hover .event-img img { transform: scale(1.06); }

.event-body { padding: 16px 18px 20px; }

.event-tag {
  display: inline-block;
  background: var(--gold);
  color: var(--dark);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.event-body h3 {
  font-size: 1rem;
  color: var(--dark);
  margin-bottom: 6px;
}

.event-body p { font-size: 0.88rem; color: #666; }

.events-cta {
  text-align: center;
  margin-top: 30px;
  font-size: 0.95rem;
  color: #555;
}

/* ── Contact ──────────────────────────────────────────── */
#contact { background: var(--dark); color: #e0e0e0; }
#contact h2 { color: #fff; margin-bottom: 12px; }
#contact .contact-info p { margin-bottom: 24px; color: #aaa; }

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  align-items: center;
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contact-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.contact-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  background-color: var(--gold);
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}
.contact-icon--email {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z'/%3E%3C/svg%3E");
}
.contact-icon--location {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E");
}
.contact-icon--chat {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2z'/%3E%3C/svg%3E");
}
.contact-icon--fb {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z'/%3E%3C/svg%3E");
}

.contact-list a {
  color: var(--gold);
}
.contact-list a:hover { color: var(--orange); }

.contact-map iframe {
  border-radius: var(--radius);
  display: block;
}

/* ── Footer ───────────────────────────────────────────── */
footer {
  background: #1a252f;
  color: #999;
  padding: 20px 0;
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-legal {
  font-size: 0.78rem;
  color: #999;
  margin-top: 3px;
  font-style: italic;
}

/* Footer links — meet 24×24 minimum target size (WCAG 2.5.8) */
footer a, footer button {
  display: inline-block;
  padding: 4px 0;
  min-height: 24px;
}
footer a { color: var(--gold); }

/* ── Map placeholder ──────────────────────────────────── */
.map-placeholder {
  background: #e8e8e8;
  border-radius: var(--radius);
  height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 20px;
  color: #666;
  font-size: 0.9rem;
}

#map-frame iframe { border-radius: var(--radius); display: block; }

/* ── Cookie banner ────────────────────────────────────── */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: var(--dark);
  color: #ddd;
  padding: 16px 20px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.25);
}

.cookie-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.cookie-inner p {
  margin: 0;
  font-size: 0.88rem;
  color: #ccc;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.cookie-inner a { color: var(--gold); font-size: 0.88rem; }

.cookie-buttons {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.cookie-decline {
  background: transparent;
  border: 1px solid #999;
  color: #d0d0d0;
  padding: 10px 22px;
  border-radius: 40px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.cookie-decline:hover { border-color: #ccc; color: #fff; }
.cookie-decline:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* ── Consent-gated lazy images ───────────────────────── */
.lazy-img {
  background: #e8e8e8;
}

/* Footer cookie-preferences button — matches anchor style */
.footer-consent-btn {
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  font: inherit;
  font-size: inherit;
  padding: 0;
  text-decoration: none;
}
.footer-consent-btn:hover { text-decoration: underline; }
.footer-consent-btn:focus-visible {
  outline: 3px solid var(--orange-text);
  outline-offset: 2px;
  border-radius: 2px;
}

/* On dark backgrounds (#2C3E50, #1a252f) orange-text outline is only 2.17:1 —
   override to white which gives 10.98:1 (WCAG 2.4.11 requires 3:1) */
#contact a:focus-visible,
#contact button:focus-visible,
.cookie-banner a:focus-visible,
.cookie-banner button:focus-visible,
footer a:focus-visible,
footer button:focus-visible {
  outline-color: #fff;
}

.btn-secondary:focus-visible {
  outline: 3px solid var(--orange-text);
  outline-offset: 3px;
}

/* ── About image ─────────────────────────────────────── */
.about-photo {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  height: 380px;
  object-fit: cover;
  display: block;
}

/* ── Gallery ──────────────────────────────────────────── */
#gallery { background: var(--gray); }
#gallery h2 { text-align: center; margin-bottom: 12px; }

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 24px 0 36px;
}

.gallery-filter {
  background: #fff;
  border: 2px solid #ddd;
  color: var(--dark);
  padding: 8px 20px;
  border-radius: 40px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.gallery-filter:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.gallery-filter.active {
  background: var(--orange-text);
  border-color: var(--orange-text);
  color: #fff;
}
.gallery-filter:focus-visible {
  outline: 3px solid var(--orange-text);
  outline-offset: 3px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.gallery-item {
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.14);
}
.gallery-item[hidden] { display: none; }

.gallery-slot {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #e8edf0;
}
.gallery-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.gallery-item:hover .gallery-slot img { transform: scale(1.04); }

/* Shown only when the img fails to load (onerror adds this class) */
.gallery-slot--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #d4e8f7 0%, #b8d4eb 100%);
}
.gallery-slot--empty img { display: none; }
.gallery-slot-label {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  text-align: center;
  font-size: 0.78rem;
  color: #5a7a8a;
  font-weight: 600;
}
.gallery-slot--empty .gallery-slot-label { display: flex; }

.gallery-item figcaption {
  padding: 10px 14px 12px;
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 600;
}

/* ── Mobile ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .courses-grid   { grid-template-columns: 1fr 1fr; }
  .divisions-grid { grid-template-columns: 1fr; }
  .events-grid    { grid-template-columns: 1fr 1fr; }
  .about-grid     { grid-template-columns: 1fr; }
  .about-image    { order: -1; }
  .about-photo    { height: 260px; }
  .contact-grid   { grid-template-columns: 1fr; }
  .gallery-grid   { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  #main-nav {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 16px 20px;
  }
  #main-nav.open { display: block; }
  #main-nav ul   { flex-direction: column; gap: 16px; justify-content: flex-start; }
  #site-header   { position: sticky; }
  .header-inner  { position: relative; }
  .nav-toggle    { display: block; }

  .courses-grid  { grid-template-columns: 1fr; }
  .events-grid   { grid-template-columns: 1fr; }
  .gallery-grid  { grid-template-columns: 1fr; }
  .stats-row     { gap: 20px; }
  .footer-inner  { flex-direction: column; text-align: center; }
  section        { padding: 48px 0; }
}

/* ── Reduced motion (WCAG 2.3.3 / prefers-reduced-motion) ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .course-card:hover,
  .division-card:hover,
  .event-card:hover,
  .btn-primary:hover { transform: none; }
}
