:root {
    --pub-primary: #2563eb;
    --pub-primary-dark: #1d4ed8;
    --pub-dark: #0f172a;
    --pub-dark-2: #1e293b;
    --pub-muted: #64748b;
    --pub-border: #e2e8f0;
    --pub-bg: #f8fafc;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--pub-bg);
    color: #0f172a;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }
img { max-width: 100%; }

/* ---------- Navbar ---------- */
.pub-nav {
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--pub-border);
    box-shadow: 0 1px 0 rgba(15,23,42,.04);
    z-index: 103;
}
.pub-nav .navbar-brand { font-weight: 800; color: #0f172a; }
.pub-nav .brand-logo {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-size: 17px; flex-shrink: 0; overflow: hidden;
}
.pub-nav .brand-logo img { width: 100%; height: 100%; object-fit: cover; }

/* Desktop navigation: inline pill links instead of plain text.
   Scoped to xl+ so the mobile off-canvas drawer stays a vertical stack. */
@media (min-width: 1200px) {
    .pub-nav .navbar-brand { margin-right: auto; }
    .pub-nav .navbar-nav {
        flex-direction: row;
        align-items: center;
        gap: .25rem;
        flex-wrap: nowrap;
    }
    .pub-nav .navbar-nav .nav-item { display: flex; }
    .pub-nav .nav-link {
        font-weight: 600; color: #334155; font-size: 13px; white-space: nowrap;
        padding: .45rem .7rem; border-radius: 999px; transition: background .15s ease, color .15s ease;
    }
    .pub-nav .nav-link:hover { background: #eff6ff; color: var(--pub-primary); }
    .pub-nav .nav-link.active { background: var(--pub-primary); color: #fff !important; }
    .pub-nav .dropdown-menu {
        border: 1px solid var(--pub-border); border-radius: 12px;
        box-shadow: 0 8px 24px rgba(15,23,42,.08); padding: .35rem; margin-top: .35rem;
    }
    .pub-nav .dropdown-item { font-size: 13.5px; padding: 8px 16px; color: #334155; border-radius: 8px; }
    .pub-nav .dropdown-item:hover { background: #eff6ff; color: var(--pub-primary); }
    .pub-nav .dropdown-item.active { color: var(--pub-primary); font-weight: 600; background: #eff6ff; }
}

/* Off-canvas (mobile) opens from the left — Bootstrap's offcanvas-xl handles the
   responsive show/hide; these are only cosmetic enhancements. */
.pub-nav .navbar-toggler { border: 1px solid var(--pub-border); padding: .25rem .5rem; }
.pub-offcanvas { width: 280px; }
.pub-offcanvas .offcanvas-body { padding: 1rem; }
.pub-offcanvas .navbar-nav { gap: .25rem; }
.pub-offcanvas .nav-item { width: 100%; }
.pub-offcanvas .nav-link { border-radius: 10px; padding: .65rem .85rem; }
.pub-offcanvas .dropdown-menu {
    position: static !important; transform: none !important; box-shadow: none;
    border: none; padding-left: .5rem; margin-top: 0; background: #f8fafc;
}

/* ---------- Hero ---------- */
.pub-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #7c3aed 100%);
    color: #fff; padding: 90px 24px 130px; position: relative; overflow: hidden;
}
.pub-hero::after {
    content: ""; position: absolute; inset: 0; background:
        radial-gradient(circle at 20% 80%, rgba(255,255,255,.12), transparent 45%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,.1), transparent 40%);
    pointer-events: none;
}
.pub-hero .hero-badge {
    display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.25); padding: 7px 16px; border-radius: 50px;
    font-size: 13px; font-weight: 600; letter-spacing: .3px;
}
.pub-hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 900; letter-spacing: -.5px; }
.pub-hero .motto { font-size: 1.15rem; opacity: .92; font-style: italic; }

/* ---------- Buttons ---------- */
.btn-hero-primary { background: #fff; color: #1d4ed8; border: none; font-weight: 700; padding: 12px 26px; border-radius: 10px; }
.btn-hero-primary:hover { background: #eef2ff; color: #1e3a8a; }
.btn-hero-outline { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.6); font-weight: 700; padding: 12px 26px; border-radius: 10px; }
.btn-hero-outline:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ---------- Stats ---------- */
.pub-stats { margin-top: -70px; position: relative; z-index: 2; }
.pub-stat-card {
    background: #fff; border: 1px solid var(--pub-border); border-radius: 16px; padding: 24px;
    box-shadow: 0 18px 50px rgba(15,23,42,.08); height: 100%;
}
.pub-stat-card .num { font-size: 34px; font-weight: 900; line-height: 1; }
.pub-stat-card .lbl { color: var(--pub-muted); font-size: 13px; font-weight: 600; margin-top: 6px; }

/* ---------- Sections ---------- */
.pub-section { padding: 72px 24px; }
.pub-section-alt { background: #fff; }
.section-title { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -.3px; }
.section-sub { color: var(--pub-muted); max-width: 640px; }
.section-eyebrow { color: var(--pub-primary); font-weight: 700; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }

/* ---------- Cards ---------- */
.pub-card {
    background: #fff; border: 1px solid var(--pub-border); border-radius: 16px; padding: 26px;
    height: 100%; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.pub-card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(15,23,42,.08); border-color: #c7d2fe; }
.pub-card .pub-icon {
    width: 52px; height: 52px; border-radius: 13px; display: flex; align-items: center;
    justify-content: center; font-size: 22px; margin-bottom: 16px;
}
.pub-card h5 { font-weight: 700; }
.pub-card p { color: var(--pub-muted); }

/* ---------- Page header (inner pages) ---------- */
.pub-page-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #7c3aed 100%);
    color: #fff; padding: 70px 24px; position: relative; overflow: hidden;
}
.pub-page-hero h1 { font-weight: 900; font-size: clamp(1.9rem, 4vw, 2.8rem); letter-spacing: -.4px; }
.pub-page-hero .breadcrumb { margin: 0; padding: 0; background: none; font-size: 13px; }
.pub-page-hero .breadcrumb a { color: rgba(255,255,255,.85); }
.pub-page-hero .breadcrumb-item.active { color: #fff; }

/* ---------- Lists / timeline ---------- */
.pub-list-item { display: flex; align-items: flex-start; gap: 14px; padding: 16px; border: 1px solid var(--pub-border); border-radius: 14px; margin-bottom: 12px; background: #fff; }
.pub-list-item .icon { width: 44px; height: 44px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }

/* ---------- News ---------- */
.news-card { background: #fff; border: 1px solid var(--pub-border); border-radius: 16px; overflow: hidden; height: 100%; transition: transform .18s ease, box-shadow .18s ease; }
.news-card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(15,23,42,.08); }
.news-card .news-img { height: 190px; background: linear-gradient(135deg, #dbeafe, #ede9fe); display: flex; align-items: center; justify-content: center; font-size: 44px; color: var(--pub-primary); }
.news-card .news-img img { width: 100%; height: 100%; object-fit: cover; }
.news-card .news-body { padding: 20px; }

/* ---------- Gallery ---------- */
.gallery-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery-item { position: relative; border-radius: 14px; overflow: hidden; cursor: pointer; height: 220px; background: #e2e8f0; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.gallery-item:hover img { transform: scale(1.06); }
.gallery-item .overlay {
    position: absolute; inset: 0; background: linear-gradient(to top, rgba(15,23,42,.75), transparent 60%);
    display: flex; align-items: flex-end; padding: 16px; color: #fff; opacity: 0; transition: opacity .25s ease;
}
.gallery-item:hover .overlay,
.gallery-item:focus-visible .overlay { opacity: 1; }
.gallery-item:focus-visible { outline: 2px solid var(--pub-primary); outline-offset: 2px; }
.pub-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.pub-gallery-section { scroll-margin-top: calc(var(--pub-nav-height) + 16px); }

/* Gallery lightbox modal (click a photo to zoom/read more) */
.gallery-modal { background: transparent; border: none; }
.gallery-modal .gallery-modal-close {
    position: absolute; top: 12px; right: 12px; z-index: 2;
    background: #fff; color: #0f172a; opacity: 1; width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.gallery-modal-img { width: 100%; max-height: 70vh; object-fit: contain; background: #0f172a; border-radius: 14px 14px 0 0; }
.gallery-modal-body { background: #fff; border-radius: 0 0 14px 14px; padding: 16px 20px; }

/* ---------- Leadership ---------- */
.leader-card { background: #fff; border: 1px solid var(--pub-border); border-radius: 16px; padding: 28px 22px; text-align: center; height: 100%; }
.leader-avatar {
    width: 86px; height: 86px; border-radius: 50%; margin: 0 auto 16px;
    background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 800;
}
.leader-card .role { color: var(--pub-primary); font-weight: 600; font-size: 13px; }

/* ---------- Timeline ---------- */
.pub-timeline { position: relative; padding-left: 28px; }
.pub-timeline::before { content: ""; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: #c7d2fe; }
.pub-timeline .tl-item { position: relative; margin-bottom: 22px; }
.pub-timeline .tl-item::before {
    content: ""; position: absolute; left: -25px; top: 5px; width: 14px; height: 14px;
    border-radius: 50%; background: var(--pub-primary); border: 3px solid #fff; box-shadow: 0 0 0 3px #c7d2fe;
}

/* ---------- Tables ---------- */
.pub-table { background: #fff; border-radius: 14px; overflow: hidden; border: 1px solid var(--pub-border); }
.pub-table th { background: #f1f5f9; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; }

/* ---------- Forms ---------- */
.pub-form .form-control, .pub-form .form-select { border-radius: 10px; padding: 10px 14px; border-color: var(--pub-border); }
.pub-form .form-label { font-weight: 600; font-size: 13px; }

/* ---------- Footer ---------- */
.pub-footer { background: #0f172a; color: #94a3b8; padding: 56px 24px 24px; }
.pub-footer h6 { color: #fff; font-weight: 700; margin-bottom: 16px; }
.pub-footer a { color: #cbd5e1; font-size: 13.5px; }
.pub-footer a:hover { color: #fff; }
.pub-footer .footer-bottom { border-top: 1px solid #1e293b; padding-top: 20px; margin-top: 40px; font-size: 13px; }

/* ---------- Map card (contact page) ---------- */
.pub-map-card {
    height: auto;
    padding: 0;
    overflow: hidden;
    contain: layout paint;
}
.pub-map-card:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--pub-border);
}
.pub-map-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 240px;
    overflow: hidden;
    background: #e2e8f0;
}
.pub-map-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* ---------- Utility ---------- */
.pub-tag {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; border: 1px solid var(--pub-border); border-radius: 999px;
    padding: 8px 16px; font-size: 13.5px; font-weight: 600; color: var(--pub-muted);
    transition: border-color .15s ease, color .15s ease;
}
.pub-tag:hover { border-color: #c7d2fe; color: var(--pub-primary); }
.text-gradient { background: linear-gradient(135deg, #2563eb, #7c3aed); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.bg-soft-primary { background: #dbeafe; color: #2563eb; }
.bg-soft-success { background: #dcfce7; color: #16a34a; }
.bg-soft-warning { background: #fef3c7; color: #d97706; }
.bg-soft-danger  { background: #fee2e2; color: #dc2626; }
.bg-soft-info    { background: #cffafe; color: #0891b2; }
.bg-soft-purple  { background: #ede9fe; color: #7c3aed; }

/* ---------- Event date badge (Upcoming Events) ---------- */
.event-date-badge {
    width: 58px; height: 58px; border-radius: 14px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    line-height: 1;
}
.event-date-badge .day { font-size: 20px; font-weight: 800; }
.event-date-badge .mon { font-size: 12px; font-weight: 700; text-transform: uppercase; opacity: .85; }

/* ---------- Calendar grid (School Calendar) ---------- */
.pub-calendar { width: 100%; }
.pub-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}
.pub-cal-head .pub-cal-cell {
    background: none; border: none; min-height: auto; font-size: 12px; text-align: center;
}
.pub-cal-cell {
    background: var(--pub-bg);
    border: 1px solid var(--pub-border);
    border-radius: 12px;
    min-height: 84px;
    padding: 8px 10px;
    display: flex; flex-direction: column; gap: 6px;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.pub-cal-cell.empty { background: transparent; border: none; }
.pub-cal-cell.today { border-color: var(--pub-primary); box-shadow: 0 0 0 2px rgba(37,99,235,.18); }
.pub-cal-cell.has-event { background: #eff6ff; cursor: pointer; }
.pub-cal-cell.has-event:hover { transform: translateY(-2px); border-color: #c7d2fe; box-shadow: 0 8px 20px rgba(15,23,42,.08); }
.pub-cal-day { font-weight: 700; font-size: 14px; color: #0f172a; }
.pub-cal-cell.today .pub-cal-day { color: var(--pub-primary); }
.pub-cal-dots { display: flex; flex-wrap: wrap; gap: 4px; }
.pub-cal-dot {
    width: 7px; height: 7px; border-radius: 50%; background: var(--pub-primary); display: inline-block;
}

@media (max-width: 575px) {
    .pub-cal-cell { min-height: 56px; padding: 5px 6px; border-radius: 9px; }
    .pub-cal-day { font-size: 12px; }
    .pub-cal-grid { gap: 5px; }
}

@media (max-width: 991px) {
    .pub-hero { padding: 60px 20px 120px; }
    .pub-section { padding: 48px 20px; }
}

/* ---------- Sticky navbar offset ----------
   The navbar uses .sticky-top; without scroll-padding the in-page anchors
   (e.g. #calendar, #events, #announcements) land hidden behind the navbar. */
html { scroll-behavior: smooth; }
:root { --pub-nav-height: 64px; }
@media (min-width: 1200px) { :root { --pub-nav-height: 68px; } }
body { scroll-padding-top: calc(var(--pub-nav-height) + 16px); }
/* Inner page heroes already have top padding; nudge their anchors a touch more. */
.pub-page-hero { scroll-margin-top: calc(var(--pub-nav-height) + 16px); }

/* ---------- Announcement card ---------- */
.announce-card {
    background: #fff;
    border: 1px solid var(--pub-border);
    border-radius: 16px;
    padding: 22px;
    height: 100%;
    display: flex;
    gap: 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.announce-card:hover { border-color: #c7d2fe; box-shadow: 0 10px 26px rgba(15,23,42,.07); }
.announce-icon {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: #dbeafe; color: #2563eb; font-size: 18px;
}
.announce-body { min-width: 0; }

/* ---------- Horizontal slider (Events & Announcements) ---------- */
.pub-slider {
    position: relative;
    overflow: hidden;
}
.pub-slider-track {
    display: flex;
    align-items: stretch;
    gap: 16px;
    transition: transform .45s cubic-bezier(.22,.61,.36,1);
    will-change: transform;
}
/* Each slide shares the row width so exactly one card is visible per "step". */
.pub-slider .pub-slide {
    flex: 0 0 100%;
    max-width: 100%;
    min-width: 0;
}
/* Within a slide, the event card should fill its own height. */
.pub-slider .pub-slide > .pub-card { height: 100%; }

/* On wider screens the Events column can show a bit more context, but keep
   one card per step for clarity. The track transform handles stepping. */
@media (min-width: 992px) {
    #evSlide .pub-slide { flex-basis: 100%; max-width: 100%; }
}

/* Slider navigation buttons */
.pub-slider ~ .slide-nav,
.slide-nav { margin-bottom: 0; }
.slide-nav .btn { border-radius: 999px; width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.slide-nav .btn:disabled { opacity: .4; cursor: default; }

/* Dots */
.pub-slider-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}
.pub-slider-dots .dot {
    width: 9px; height: 9px; border-radius: 999px;
    border: none; padding: 0; cursor: pointer;
    background: #cbd5e1; transition: width .2s ease, background .2s ease;
}
.pub-slider-dots .dot.active { width: 22px; background: var(--pub-primary); }

/* Touch / reduced-motion fallbacks */
@media (prefers-reduced-motion: reduce) {
    .pub-slider-track { transition: none; }
    html { scroll-behavior: auto; }
}
/* If JS is unavailable the slides should still be usable: stack them. */
.no-js .pub-slider-track { flex-direction: column; gap: 14px; }
.no-js .pub-slider { overflow: visible; }

/* ---------- Themed containers: differentiate Announcements vs Events ---------- */
#annSlide {
    background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #dbeafe;
    border-radius: 18px;
    padding: 18px;
}
#evSlide {
    background: linear-gradient(180deg, #f0fdf4 0%, #f8fafc 100%);
    border: 1px solid #bbf7d0;
    border-radius: 18px;
    padding: 18px;
}
/* Match the active dot colour to each container's theme. */
.pub-slider-dots[data-for="annSlide"] .dot.active { background: var(--pub-primary); }
.pub-slider-dots[data-for="evSlide"] .dot.active { background: #16a34a; }
/* Tint the card accent border to match its container. */
#annSlide .announce-card { border-color: #dbeafe; }
#evSlide .pub-card { border-color: #bbf7d0; }
/* Colour the per-container nav buttons to match their theme. */
.slide-nav .btn[data-target="annSlide"]:hover { background: var(--pub-primary); border-color: var(--pub-primary); color: #fff; }
.slide-nav .btn[data-target="evSlide"]:hover { background: #16a34a; border-color: #16a34a; color: #fff; }
