/* =========================================================
   School website – main stylesheet
   Colours come from --primary / --accent (set in admin).
   Uses logical properties so Dhivehi (RTL) mirrors cleanly.
   ========================================================= */

/* Optional: drop faruma.woff2 into assets/fonts/ to use Faruma for Dhivehi */
@font-face {
  font-family: "Faruma";
  src: url("../fonts/faruma.woff2") format("woff2"), url("../fonts/faruma.ttf") format("truetype");
  font-display: swap;
}

:root {
  --primary: #0b2e6f;
  --accent: #f2b705;
  --primary-ink: color-mix(in srgb, var(--primary) 82%, black);
  --ink: #16213a;
  --muted: #5d6679;
  --line: #e3e7ef;
  --bg: #ffffff;
  --bg-soft: #f3f6fb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 33, 72, .06), 0 6px 18px rgba(16, 33, 72, .07);
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-brand: "Source Serif 4", Georgia, serif;
  --wrap: 1200px;
}
.lang-dv {
  --font: "Faruma", "MV Faseyha", "Noto Sans Thaana", "Figtree", sans-serif;
  --font-brand: "Faruma", "Noto Sans Thaana", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body.lang-dv { font-size: 1.06rem; line-height: 1.9; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { width: min(var(--wrap), 100% - 2.5rem); margin-inline: auto; }
.ic { width: 1.15em; height: 1.15em; flex: none; }
[dir="rtl"] .ic-dir { transform: scaleX(-1); }
.muted { color: var(--muted); }

.skip {
  position: absolute; inset-inline-start: 1rem; top: -60px; z-index: 100;
  background: var(--accent); color: var(--ink); padding: .5rem 1rem; border-radius: var(--radius-sm);
}
.skip:focus { top: 1rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .85rem 1.35rem; border-radius: var(--radius-sm);
  font-weight: 700; font-size: .92rem; border: 2px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.lang-en .btn { letter-spacing: .02em; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-ink); }
.btn-outline { border-color: var(--primary); color: var(--primary); background: #fff; }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-accent { background: var(--accent); color: var(--ink); }
.btn-accent:hover { background: color-mix(in srgb, var(--accent) 85%, black); }
.btn-ghost { border: 1px solid var(--primary); color: var(--primary); }
.btn-ghost:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: .6rem 1.2rem; }
.btn-xs { padding: .35rem .7rem; font-size: .78rem; font-weight: 600; border-radius: 6px; }

/* ---------- Top bar ---------- */
.topbar { background: var(--primary-ink); color: #dfe6f5; font-size: .82rem; }
.topbar-in { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 38px; }
.topbar a { display: inline-flex; align-items: center; gap: .4rem; }
.topbar a:hover { color: #fff; }
.topbar-contact, .topbar-links { display: flex; gap: 1.25rem; align-items: center; }
.topbar-links a + a { border-inline-start: 1px solid rgba(255,255,255,.25); padding-inline-start: 1.25rem; }
.lang-switch { font-weight: 700; color: var(--accent) !important; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
body.nav-open .site-header { z-index: 80; }
.header-in { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 76px; }
.brand { display: flex; align-items: center; gap: .75rem; }
.brand-badge { width: 56px; height: 56px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name {
  font-family: var(--font-brand); font-weight: 700; color: var(--primary);
  font-size: 1.55rem; letter-spacing: .01em; white-space: nowrap;
}
.lang-en .brand-name { text-transform: uppercase; }
.brand-tag { font-family: var(--font-brand); font-size: .8rem; color: var(--primary); opacity: .8; margin-top: .2rem; }
.lang-dv .brand-name { font-size: 1.45rem; line-height: 1.5; }
.lang-dv .brand-tag { margin-top: 0; }

.main-nav ul { display: flex; gap: .25rem; }
.main-nav a {
  display: block; padding: .55rem .7rem; font-weight: 600; font-size: .95rem;
  color: var(--ink); position: relative; border-radius: 6px; white-space: nowrap;
}
.main-nav a:hover { color: var(--primary); background: var(--bg-soft); }
.main-nav a[aria-current="page"] { color: var(--primary); }
.main-nav a[aria-current="page"]::after {
  content: ""; position: absolute; inset-inline: .8rem; bottom: .15rem;
  height: 3px; border-radius: 3px; background: var(--accent);
}
.nav-extra { display: none; }

.header-actions { display: flex; align-items: center; gap: .5rem; }
.lang-pill {
  display: none; padding: .35rem .8rem; border-radius: 999px;
  border: 1px solid var(--line); font-weight: 700; font-size: .85rem; color: var(--primary);
}
.menu-btn {
  display: none; background: none; border: 0; padding: .5rem; border-radius: 8px;
  color: var(--primary);
}
.menu-btn .ic { width: 28px; height: 28px; }
.menu-btn .ic-close { display: none; }
.menu-btn[aria-expanded="true"] .ic-open { display: none; }
.menu-btn[aria-expanded="true"] .ic-close { display: block; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; background: #fff; }
.hero-media {
  position: absolute; inset-block: 0; inset-inline-end: 0; width: 60%;
  background-size: cover; background-position: center 30%;
}
.hero-media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to right, #fff 0%, rgba(255,255,255,.85) 18%, rgba(255,255,255,0) 50%);
}
[dir="rtl"] .hero-media::after {
  background: linear-gradient(to left, #fff 0%, rgba(255,255,255,.85) 18%, rgba(255,255,255,0) 50%);
}
.hero-in { position: relative; padding-block: 3.5rem 6.5rem; }
.hero-copy { max-width: 560px; }
.hero-pill {
  display: inline-block; background: var(--primary); color: #fff;
  padding: .3rem 1rem; border-radius: 999px; font-weight: 700; font-size: .85rem;
}
.lang-en .hero-pill { text-transform: uppercase; letter-spacing: .04em; }
.hero-title {
  margin-top: 1rem; color: var(--primary);
  font-size: clamp(2.3rem, 5.2vw, 3.9rem); font-weight: 800; letter-spacing: -.01em; line-height: 1.02;
}
.lang-en .hero-title { text-transform: uppercase; }
.lang-dv .hero-title { line-height: 1.5; font-weight: 700; }
.hero-title span { color: var(--accent); }
.hero-sub { margin-top: 1rem; font-size: clamp(1.1rem, 2vw, 1.4rem); font-weight: 700; color: var(--primary); }
.hero-text { margin-top: .9rem; color: #3b4458; max-width: 46ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }

/* ---------- Quick links ---------- */
.quick {
  position: relative; z-index: 2; margin-top: -3.25rem;
  display: grid; grid-template-columns: repeat(8, 1fr);
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.quick-item {
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
  padding: 1.35rem .5rem 1.2rem; text-align: center;
  font-size: .85rem; font-weight: 600; color: var(--primary);
}
.quick-item + .quick-item { border-inline-start: 1px solid var(--line); }
.quick-ic { width: 38px; height: 38px; color: var(--c); stroke-width: 1.6; transition: transform .15s; }
.quick-item:hover .quick-ic { transform: translateY(-3px); }
.quick-item:hover { background: var(--bg-soft); }

/* ---------- Cards / 3-column band ---------- */
.trio { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.25rem; margin-top: 1.75rem; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.35rem; box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.card-title { font-size: 1.05rem; font-weight: 800; color: var(--primary); margin-bottom: 1rem; }
.lang-en .card-title { text-transform: uppercase; letter-spacing: .02em; }
.view-all { font-size: .82rem; font-weight: 700; color: var(--primary); white-space: nowrap; }
.view-all:hover { text-decoration: underline; }

/* Principal */
.principal { background: var(--primary); color: #fff; border-color: transparent; }
.principal .card-title { color: #fff; }
.principal-body { display: grid; grid-template-columns: 42% 1fr; gap: 1rem; }
.principal-fig { margin: 0; }
.principal-fig img { aspect-ratio: 4/5; width: 100%; object-fit: cover; border-radius: var(--radius-sm); background: rgba(255,255,255,.1); }
.principal-fig figcaption { margin-top: .6rem; font-size: .85rem; display: flex; flex-direction: column; }
.principal-fig figcaption span { opacity: .75; }
.principal-text { font-size: .88rem; color: #e6ebf7; display: flex; flex-direction: column; gap: .75rem; align-items: flex-start; }
.signature { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 1.5rem; color: #fff; line-height: 1; }
.lang-dv .signature { font-family: var(--font); font-size: 1.1rem; }

/* News */
.news-list li + li { border-top: 1px solid var(--line); }
.news-item { display: flex; gap: .9rem; padding-block: .7rem; }
.news-item img { width: 96px; height: 76px; object-fit: cover; border-radius: var(--radius-sm); flex: none; }
.news-item > span { display: flex; flex-direction: column; font-size: .84rem; min-width: 0; }
.news-item time { color: var(--muted); font-size: .76rem; }
.news-item strong { color: var(--primary); font-size: .92rem; }
.news-item:hover strong { text-decoration: underline; }

/* Events */
.event { display: flex; align-items: center; gap: .9rem; padding-block: .75rem; }
.event + .event { border-top: 1px solid var(--line); }
.event-date {
  width: 58px; flex: none; text-align: center; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding-block: .35rem; color: var(--primary);
}
.event-date b { display: block; font-size: 1.5rem; line-height: 1.1; }
.event-date span { font-size: .72rem; font-weight: 700; }
.event-info { display: flex; flex-direction: column; flex: 1; font-size: .82rem; min-width: 0; }
.event-info strong { color: var(--primary); font-size: .92rem; }

/* ---------- Stats ---------- */
.stats {
  display: grid; grid-template-columns: repeat(6, 1fr); margin-top: 1.5rem;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.stats li { display: flex; align-items: center; justify-content: center; gap: .75rem; padding: 1.2rem .75rem; }
.stats li + li { border-inline-start: 1px solid var(--line); }
.stat-ic { width: 40px; height: 40px; color: var(--primary); }
.stats li:nth-child(4) .stat-ic, .stats li:nth-child(5) .stat-ic { color: var(--accent); }
.stats li:nth-child(6) .stat-ic { color: #1e9e57; }
.stats b { display: block; font-size: 1.6rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.stats small { font-size: .8rem; color: var(--muted); }

/* ---------- Programs ---------- */
.programs-wrap { margin-top: 1.5rem; background: var(--bg-soft); border-radius: var(--radius); padding: 1.75rem; }
.section-title { text-align: center; color: var(--primary); font-size: 1.45rem; font-weight: 800; margin-bottom: 1.4rem; }
.lang-en .section-title { text-transform: uppercase; letter-spacing: .02em; }
.programs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.program {
  display: flex; gap: .9rem; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem;
}
.program-ic {
  width: 56px; height: 56px; flex: none; border-radius: 14px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 12%, white); color: var(--c);
}
.program-ic .ic { width: 30px; height: 30px; }
.program h3 { font-size: 1rem; color: var(--primary); }
.program p { font-size: .84rem; color: var(--muted); margin-top: .35rem; }
.link { display: inline-flex; align-items: center; gap: .35rem; margin-top: .6rem; font-weight: 700; font-size: .84rem; color: var(--primary); }
.link:hover { text-decoration: underline; }

/* ---------- Gallery / testimonials / video ---------- */
.trio-media { grid-template-columns: 1.25fr 1fr 1.25fr; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; }
.gallery-item { padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: var(--bg-soft); }
.gallery-item img { width: 100%; aspect-ratio: 16/10; object-fit: cover; transition: transform .25s; }
.gallery-item:hover img { transform: scale(1.06); }

.slider { background: var(--bg-soft); border-radius: var(--radius-sm); padding: 1.1rem; display: grid; }
.testimonial { grid-area: 1 / 1; margin: 0; opacity: 0; visibility: hidden; transition: opacity .35s; }
.testimonial.is-active { opacity: 1; visibility: visible; }
.quote-ic { width: 30px; height: 30px; color: var(--primary); }
[dir="rtl"] .quote-ic { transform: scaleX(-1); }
.testimonial p { margin-top: .4rem; font-size: .9rem; color: #3b4458; }
.testimonial footer { display: flex; align-items: center; gap: .6rem; margin-top: .9rem; }
.testimonial footer span:last-child { display: flex; flex-direction: column; line-height: 1.3; }
.testimonial strong { color: var(--primary); font-size: .88rem; }
.testimonial small { color: var(--muted); font-size: .76rem; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: #fff; font-weight: 700;
}
.dots { display: flex; justify-content: center; gap: .4rem; margin-top: 1rem; grid-row: 2; }
.dots button { width: 9px; height: 9px; border-radius: 50%; border: 0; padding: 0; background: #c6cede; }
.dots button[aria-selected="true"] { background: var(--primary); width: 22px; border-radius: 6px; }

.video { position: relative; width: 100%; padding: 0; border: 0; border-radius: var(--radius-sm); overflow: hidden; display: block; }
.video img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.play {
  position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%;
  background: rgba(11, 25, 60, .7); color: #fff; display: grid; place-items: center;
  border: 3px solid #fff; transition: transform .15s;
}
.play .ic { width: 28px; height: 28px; margin-inline-start: 4px; }
.video:not([disabled]):hover .play { transform: scale(1.08); }
.video[disabled] { cursor: default; }
.video[disabled] .play { display: none; }
.video-soon {
  position: absolute; inset-inline: 0; bottom: .6rem; text-align: center;
  color: #fff; font-size: .8rem; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.6);
}

/* ---------- Admissions banner ---------- */
#admissions { margin-top: 1.5rem; margin-bottom: 2.5rem; }
.admit {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  background: var(--primary); color: #fff; border-radius: var(--radius); padding: 1.4rem 2rem;
}
.admit-ic { width: 48px; height: 48px; color: #fff; stroke-width: 1.4; }
.admit > div { flex: 1; min-width: 220px; }
.admit h2 { font-size: 1.3rem; font-weight: 800; }
.lang-en .admit h2 { text-transform: uppercase; }
.admit p { opacity: .85; margin-top: .2rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--primary); color: #d5ddef; font-size: .88rem; }
.footer-grid {
  display: grid; grid-template-columns: 1.6fr repeat(4, 1fr) 1.4fr; gap: 2rem;
  padding-block: 2.75rem 2rem;
}
.brand-light .brand-name, .brand-light .brand-tag { color: #fff; }
.brand-light .brand-name { font-size: 1.3rem; }
.footer-brand p { margin-top: 1rem; max-width: 34ch; }
.social { display: flex; gap: .5rem; margin-top: 1rem; }
.social a {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: rgba(255,255,255,.12);
}
.social-facebook:hover { background: #1877f2; }
.social-instagram:hover { background: #d6249f; }
.social-youtube:hover { background: #ff0000; }
.social-whatsapp:hover { background: #25d366; }
.footer-col h3 { color: #fff; font-size: .95rem; margin-bottom: .9rem; }
.lang-en .footer-col h3 { text-transform: uppercase; letter-spacing: .03em; }
.footer-col li + li { margin-top: .4rem; }
.footer-col a:hover { color: #fff; text-decoration: underline; }
.footer-contact li { display: flex; gap: .6rem; align-items: flex-start; }
.footer-contact .ic { margin-top: .2em; color: var(--accent); }
.footer-bottom { background: var(--primary-ink); font-size: .82rem; }
.footer-bottom-in { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: .9rem; }
.footer-bottom nav { display: flex; gap: 1.25rem; }
.footer-bottom a:hover { color: #fff; }

/* ---------- Modal ---------- */
.modal {
  border: 0; padding: 0; background: transparent; width: min(960px, 94vw); max-height: 90vh; overflow: visible;
}
.modal::backdrop { background: rgba(8, 18, 45, .85); }
.modal-body img { width: 100%; max-height: 85vh; object-fit: contain; border-radius: var(--radius-sm); }
.modal-body iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: var(--radius-sm); background: #000; }
.modal-close {
  position: absolute; top: -44px; inset-inline-end: 0; background: none; border: 0; color: #fff; padding: .3rem;
}
.modal-close .ic { width: 30px; height: 30px; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1240px) {
  .menu-btn, .lang-pill { display: inline-flex; }
  .main-nav {
    position: fixed; inset-block: 0; inset-inline-end: 0; top: 0; z-index: 60;
    width: min(320px, 86vw); background: #fff; padding: 5rem 1.25rem 2rem;
    box-shadow: -10px 0 30px rgba(10,25,60,.2);
    transform: translateX(105%); transition: transform .25s ease; overflow-y: auto;
  }
  [dir="rtl"] .main-nav { transform: translateX(-105%); }
  .main-nav.is-open { transform: none; }
  .main-nav ul { flex-direction: column; gap: 0; }
  .main-nav a { padding: .85rem .75rem; border-bottom: 1px solid var(--line); border-radius: 0; font-size: 1.02rem; }
  .main-nav a[aria-current="page"]::after { inset-inline: auto; inset-inline-start: 0; top: .7rem; bottom: .7rem; width: 3px; height: auto; }
  .nav-extra { display: flex; flex-direction: column; gap: .5rem; margin-top: 1.5rem; }
  .nav-extra a { padding: .7rem .9rem; background: var(--bg-soft); border-radius: var(--radius-sm); font-weight: 600; color: var(--primary); }
  .menu-btn { position: relative; z-index: 70; }
  body.nav-open::after {
    content: ""; position: fixed; inset: 0; background: rgba(8, 18, 45, .45); z-index: 55;
  }
  .footer-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 1024px) {
  .trio, .trio-media { grid-template-columns: 1fr 1fr; }
  .principal, .trio-media > :first-child { grid-column: 1 / -1; }
  .quick { grid-template-columns: repeat(4, 1fr); }
  .quick-item:nth-child(5) { border-inline-start: 0; }
  .quick-item:nth-child(n+5) { border-top: 1px solid var(--line); }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stats li:nth-child(4) { border-inline-start: 0; }
  .stats li:nth-child(n+4) { border-top: 1px solid var(--line); }
  .programs { grid-template-columns: 1fr 1fr; }
  .topbar-links a:not(.lang-switch) { display: none; }
  .topbar-links a + a { border: 0; padding: 0; }
}

@media (max-width: 720px) {
  .topbar-contact a:nth-child(2) { display: none; }
  .lang-pill { display: none; }
  .header-in { min-height: 66px; }
  .brand-badge { width: 44px; height: 44px; }
  .brand-name { font-size: 1.15rem; }
  .lang-dv .brand-name { font-size: 1.15rem; }
  .brand-tag { font-size: .7rem; }

  .hero-media { position: relative; width: 100%; height: 230px; }
  .hero-media::after, [dir="rtl"] .hero-media::after {
    background: linear-gradient(to top, #fff 0%, rgba(255,255,255,0) 45%);
  }
  .hero-in { padding-block: .5rem 5rem; }
  .hero-cta .btn { flex: 1; justify-content: center; }

  .quick { grid-template-columns: repeat(4, 1fr); }
  .quick-item { padding: .9rem .25rem; font-size: .72rem; gap: .4rem; }
  .quick-ic { width: 28px; height: 28px; }

  .trio, .trio-media { grid-template-columns: 1fr; }
  .principal-body { grid-template-columns: 38% 1fr; }

  .stats { grid-template-columns: 1fr 1fr; }
  .stats li:nth-child(odd) { border-inline-start: 0; }
  .stats li:nth-child(4) { border-inline-start: 1px solid var(--line); }
  .stats li:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stats li { justify-content: flex-start; padding-inline: 1rem; }

  .programs-wrap { padding: 1.25rem; }
  .programs { grid-template-columns: 1fr; }

  .admit { padding: 1.4rem; text-align: start; }
  .admit .btn { width: 100%; justify-content: center; }

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.75rem 1.25rem; }
  .footer-contact { grid-column: 1 / -1; }
  .footer-bottom-in { flex-direction: column; align-items: center; text-align: center; }
}

@media (max-width: 380px) {
  .principal-body { grid-template-columns: 1fr; }
  .principal-fig img { max-width: 160px; }
}

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