/* ==========================================================================
   Jamia Darussalam Arabic College — Design System
   Mobile-first. Scholarly identity: deep green, warm parchment, restrained brass.
   Display: Spectral (serif)  ·  Body/UI: Karla (sans)
   ========================================================================== */

:root {
  /* Palette */
  --ink:        #12211C;
  --green-900:  #0E3B33;
  --green-800:  #14463C;
  --green-700:  #1B5A4D;
  --green-tint: #EAF1ED;
  --brass:      #B5882F;
  --brass-soft: #D9B675;
  --parchment:  #F6F2E9;
  --paper:      #FFFFFF;
  --muted:      #5E6B65;
  --line:       #E5DFD2;
  --danger:     #B23B2E;
  --ok:         #2E7D5B;

  /* Type */
  --display: "Spectral", Georgia, "Times New Roman", serif;
  --body: "Karla", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  /* Scale & rhythm */
  --maxw: 1140px;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(18,33,28,.06), 0 8px 24px rgba(18,33,28,.06);
  --shadow-lg: 0 12px 40px rgba(18,33,28,.14);
  --header-h: 64px;
}

/* Reset ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.15; color: var(--ink); margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 6vw, 3.1rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.25rem; }
li { margin: .25rem 0; }

/* Layout helpers --------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 56px 0; }
.section--tint { background: var(--parchment); }
.section--green { background: var(--green-900); color: #EAF0EC; }
.section--green h2, .section--green h3 { color: #fff; }
.eyebrow {
  font-family: var(--body);
  font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--brass); margin: 0 0 .6rem; display: inline-flex; align-items: center; gap: .5rem;
}
.eyebrow svg { width: 16px; height: 16px; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }

/* Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--body); font-weight: 700; font-size: .95rem;
  padding: .72rem 1.25rem; border-radius: var(--radius);
  border: 1.5px solid transparent; cursor: pointer; transition: .18s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--brass); color: #1c1407; border-color: var(--brass); }
.btn--primary:hover { background: var(--brass-soft); }
.btn--ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn--ghost:hover { border-color: #fff; background: rgba(255,255,255,.08); }
.btn--dark { background: var(--green-800); color: #fff; border-color: var(--green-800); }
.btn--dark:hover { background: var(--green-700); }
.btn--block { width: 100%; }

/* ==========================================================================
   Header
   ========================================================================== */
.topbar {
  background: var(--ink); color: #cdd6d1; font-size: .82rem;
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 36px; gap: 12px; flex-wrap: wrap; }
.topbar a { color: #e8ede9; }
.topbar .marquee { overflow: hidden; white-space: nowrap; flex: 1 1 auto; }
.topbar .marquee span { display: inline-block; padding-left: 100%; animation: marquee 22s linear infinite; color: #ff0000; }
@keyframes marquee { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
  .topbar .marquee span { animation: none; padding-left: 0; }
}
.topbar .util { display: flex; gap: 16px; flex: 0 0 auto; }

.site-header { position: sticky; top: 0; z-index: 50; background: var(--green-900); color: #fff; }
.identity { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.identity .crest { flex: 0 0 auto; width: 530px; height: auto; }
.identity .crest img { width: 100%; height: auto; object-fit: contain; }
.identity .crest img { width: 100%; height: 100%; object-fit: contain; }
.identity .crest svg { width: 100%; height: 100%; }
.identity .name { line-height: 1.1; }
.identity .name b { font-family: var(--display); font-weight: 600; font-size: 2rem; color: #fff; display: block; }
.identity .name small { display: block; color: var(--brass-soft); font-size: .72rem; letter-spacing: .04em; margin-top: 2px; }
.identity .name small.addr { color: #b8c6bf; }

.identity .header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu-toggle {
  margin-left: auto; background: transparent; border: 1.5px solid rgba(255,255,255,.35);
  color: #fff; border-radius: var(--radius); padding: 8px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.menu-toggle svg { width: 22px; height: 22px; }

/* Primary nav (mobile-first = collapsible) */
.primary-nav { border-top: 1px solid rgba(255,255,255,.1); display: none; }
.primary-nav.open { display: block; }
.primary-nav ul { list-style: none; margin: 0; padding: 0; }
.primary-nav > .wrap > ul > li { border-bottom: 1px solid rgba(255,255,255,.08); }
.primary-nav a { color: #eaf0ec; display: block; padding: 13px 20px; font-weight: 600; }
.primary-nav a:hover { text-decoration: none; background: rgba(255,255,255,.06); }
/* has-sub: label link + chevron button share a row; submenu wraps to next line */
.has-sub { display: flex; flex-wrap: wrap; align-items: center; }
.has-sub > .nav-link { flex: 1 1 auto; }
.has-sub > .sub-toggle {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: #eaf0ec; cursor: pointer; padding: 13px 18px;
}
.has-sub > .sub-toggle .chev { width: 20px; height: 20px; transition: transform .2s ease; }
.has-sub.open > .sub-toggle .chev { transform: rotate(180deg); }
.submenu { flex-basis: 100%; display: none; background: rgba(0,0,0,.16); }
.has-sub.open > .submenu { display: block; }
.submenu a { padding-left: 36px; font-weight: 500; font-size: .95rem; color: #cfdbd5; }
.nav-login { display: flex; gap: 10px; padding: 16px 20px; }
.nav-login .btn { flex: 1; }

/* ==========================================================================
   Hero — modern split layout with crossfade slideshow
   ========================================================================== */
.hero {
  position: relative;
  background: var(--green-900);
  color: #fff;
  overflow: hidden;
}

/* Subtle star tile across the whole hero */
.hero .star-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  opacity: .07;
  background-image: url('/assets/img/star-01.svg');
  background-repeat: repeat;
  background-size: 90px 90px;
}

/* ── Inner: full-width flex row ── */
.hero-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  max-width: 100%;
}

/* ── Text side ── */
.hero-text {
  padding: 56px 24px 48px;
  max-width: 620px;
  margin: 0 auto;
  width: 100%;
}
.hero h1 {
  color: #fff;
  margin: 12px 0 20px;
  line-height: 1.08;
}
.hero .affil {
  display: inline-block;
  color: var(--brass-soft);
  font-family: var(--body);
  font-size: .8rem;
  font-weight: 700;
  letter-width: .12em;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.6;
  border-left: 3px solid var(--brass);
  padding-left: 10px;
  margin-bottom: 20px;
}
.hero .sub {
  color: #c8ddd5;
  font-size: 1.08rem;
  line-height: 1.65;
  max-width: 48ch;
  margin-bottom: 0;
}
.hero .cta-row {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: 28px;
}

/* Facts — pill cards instead of a border-top line */
.hero .facts {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: 40px;
}
.hero .facts div {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  padding: 14px 20px;
  min-width: 110px;
}
.hero .facts div b {
  font-family: var(--display);
  font-size: 1.4rem;
  color: var(--brass-soft);
  display: block;
  line-height: 1;
  margin-bottom: 4px;
}
.hero .facts div span {
  font-size: .72rem;
  color: #9ab0a6;
  letter-spacing: .07em;
  text-transform: uppercase;
}

/* ── Slideshow side ── */
.hero-slide-wrap {
  position: relative;
  width: 100%;
  height: 280px;
  overflow: hidden;
  flex-shrink: 0;
}
.hero-slides {
  position: relative; width: 100%; height: 100%;
}
.hero-slide {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 55%;
  opacity: 0; transition: opacity 1s ease;
}
.hero-slide.active { opacity: 1; }

/* Gradient overlay on image — blends into green on left edge (desktop) */
.hero-slide-wrap::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to right, var(--green-900) 0%, transparent 18%);
  pointer-events: none; z-index: 1;
}

/* Dot indicators */
.hero-dots {
  position: absolute; bottom: 16px; right: 20px;
  display: flex; gap: 7px; z-index: 2;
}
.hero-dot {
  width: 8px; height: 8px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.55);
  background: transparent; cursor: pointer; padding: 0;
  transition: background .25s, border-color .25s;
}
.hero-dot.active { background: #fff; border-color: #fff; }

/* ── Desktop: true side-by-side ── */
@media (min-width: 960px) {
  .hero-inner {
    flex-direction: row;
    min-height: 580px;
    align-items: stretch;
  }
  .hero-text {
    flex: 0 0 50%;
    max-width: 50%;
    margin: 0;
    padding: 72px 48px 72px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  /* Respect the site max-width: left panel text shouldn't exceed half of 1140px */
  @supports (padding-left: max(1px, 1px)) {
    .hero-text {
      padding-left: max(40px, calc((100vw - var(--maxw)) / 2 + 40px));
    }
  }
  .hero-slide-wrap {
    flex: 0 0 50%;
    height: auto;
    min-height: 580px;
  }
  /* On desktop the gradient goes left (text→image blend) */
  .hero-slide-wrap::after {
    background: linear-gradient(to right, var(--green-900) 0%, transparent 22%);
  }
}

/* ==========================================================================
   Cards / grids
   ========================================================================== */
.grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); transition: .18s ease;
}
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; border-color: var(--brass-soft); }
.card .num { font-family: var(--display); color: var(--brass); font-size: .9rem; font-weight: 600; }
.card h3 { margin-bottom: .35rem; }
.card p { color: var(--muted); margin: 0; font-size: .96rem; }
.card .more { color: var(--brass); font-weight: 700; font-size: .9rem; margin-top: 12px; display: inline-block; }

.dept-grid a {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--green-tint); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; color: var(--ink);
}
.dept-grid a:hover { background: #fff; border-color: var(--brass-soft); text-decoration: none; box-shadow: var(--shadow); }
.dept-grid b { font-family: var(--display); font-size: 1.1rem; }
.dept-grid span { color: var(--muted); font-size: .85rem; }

/* Notices */
.notices { list-style: none; padding: 0; margin: 0; }
.notices li { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px dashed rgba(255,255,255,.2); }
.notices time { flex: 0 0 auto; font-size: .8rem; color: var(--brass-soft); font-weight: 700; min-width: 86px; }
.notices a { color: #eaf0ec; }

/* ==========================================================================
   Interior page layout
   ========================================================================== */
.page-head { background: var(--green-800); color: #fff; padding: 34px 0; }
.page-head .breadcrumb { font-size: .82rem; color: #bcd0c8; margin-bottom: 8px; }
.page-head .breadcrumb a { color: #bcd0c8; }
.page-head h1 { color: #fff; font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 0; }

.page-body { padding: 44px 0; }
.layout { display: grid; gap: 32px; grid-template-columns: 1fr; }
.prose { max-width: 70ch; }
.prose h2 { margin-top: 1.6em; }
.prose img { border-radius: var(--radius); margin: 1rem 0; }
.editor-note {
  border-left: 3px solid var(--brass); background: var(--parchment);
  padding: 14px 16px; font-size: .92rem; color: #6a5a36; border-radius: 0 var(--radius) var(--radius) 0; margin: 0 0 24px;
}
.sidenav { background: var(--parchment); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; height: fit-content; }
.sidenav h4 { font-family: var(--body); text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; color: var(--muted); padding: 12px 14px 6px; margin: 0; }
.sidenav ul { list-style: none; margin: 0; padding: 0; }
.sidenav a { display: block; padding: 10px 14px; border-radius: var(--radius); color: var(--ink); font-size: .95rem; }
.sidenav a:hover { background: #fff; text-decoration: none; }
.sidenav a.active { background: var(--green-900); color: #fff; font-weight: 700; }

.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.doc-list a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--ink); }
.doc-list a:hover { background: var(--parchment); text-decoration: none; }
.doc-list .pdf-ic { flex: 0 0 auto; width: 22px; height: 22px; color: var(--danger); }

/* ==========================================================================
   Auth (login + portal)
   ========================================================================== */
.auth-wrap { min-height: calc(100vh - var(--header-h)); display: grid; place-items: center; padding: 40px 20px; background: var(--parchment); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 32px; }
.auth-card .crest { width: 52px; height: 52px; margin: 0 auto 14px; }
.auth-card h1 { font-size: 1.5rem; text-align: center; margin-bottom: 4px; }
.auth-card .role { text-align: center; color: var(--brass); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .76rem; margin-bottom: 22px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .85rem; font-weight: 700; margin-bottom: 6px; }
.field input {
  width: 100%; padding: .7rem .8rem; font: inherit; border: 1.5px solid var(--line);
  border-radius: var(--radius); background: #fff; color: var(--ink);
}
.field input:focus { outline: 2px solid var(--brass-soft); outline-offset: 1px; border-color: var(--brass); }
.auth-msg { font-size: .9rem; padding: 10px 12px; border-radius: var(--radius); margin-bottom: 14px; display: none; }
.auth-msg.show { display: block; }
.auth-msg.err { background: #fbecea; color: var(--danger); border: 1px solid #eccac5; }
.auth-msg.ok { background: #e9f5ef; color: var(--ok); border: 1px solid #c2e3d4; }
.auth-foot { text-align: center; font-size: .9rem; margin-top: 18px; color: var(--muted); }
.auth-foot a { font-weight: 700; }
.forgot { text-align: right; font-size: .85rem; margin: -6px 0 16px; }

.portal-shell { display: grid; gap: 24px; grid-template-columns: 1fr; padding: 32px 0; }
.portal-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.portal-welcome { background: var(--green-900); color: #fff; border-radius: var(--radius); padding: 26px; }
.portal-welcome h1 { color: #fff; }
.portal-welcome .muted { color: #b8c6bf; }
.stat-row { display: flex; flex-wrap: wrap; gap: 16px; }
.stat { flex: 1 1 140px; background: var(--green-tint); border-radius: var(--radius); padding: 16px; }
.stat b { font-family: var(--display); font-size: 1.6rem; display: block; }
.stat span { font-size: .82rem; color: var(--muted); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { background: var(--ink); color: #b9c4be; padding: 48px 0 24px; font-size: .95rem; }
.site-footer h4 { color: #fff; font-family: var(--body); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 14px; }
.footer-grid { display: grid; gap: 30px; grid-template-columns: 1fr; }
.site-footer a { color: #cdd6d1; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 7px 0; }
.footer-map { width: 100%; border: 0; border-radius: var(--radius); min-height: 180px; filter: grayscale(.2); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 32px; padding-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; font-size: .85rem; color: #8b978f; }

/* Skip link */
.skip { position: absolute; left: -9999px; top: 0; background: #fff; color: var(--ink); padding: 10px 14px; z-index: 100; }
.skip:focus { left: 10px; top: 10px; }

/* ==========================================================================
   Responsive — tablet & up
   ========================================================================== */
@media (min-width: 760px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .dept-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
  .portal-shell { grid-template-columns: 1.6fr 1fr; }
}

@media (min-width: 960px) {
  .menu-toggle { display: none; }
  .primary-nav { display: block; border-top: 1px solid rgba(255,255,255,.12); }
  .primary-nav > .wrap > ul { display: flex; flex-wrap: wrap; }
  .primary-nav > .wrap > ul > li { border-bottom: 0; position: relative; }
  .has-sub { flex-wrap: nowrap; }
  .has-sub > .nav-link { flex: 0 0 auto; padding-right: 4px; }
  .primary-nav > .wrap > ul > li > a { padding: 14px 8px; font-size: .84rem; }
  .has-sub > .nav-link { padding: 14px 2px 14px 14px; }
  .has-sub > .sub-toggle { padding: 14px 12px 14px 2px; }
  .has-sub > .sub-toggle .chev { width: 14px; height: 14px; }
  .submenu {
    display: block; flex-basis: auto; position: absolute; top: 100%; left: 0; min-width: 230px;
    background: var(--green-800); box-shadow: var(--shadow-lg); border-radius: 0 0 var(--radius) var(--radius);
    opacity: 0; visibility: hidden; transform: translateY(6px); transition: .16s ease; z-index: 60;
  }
  .has-sub:hover > .submenu, .has-sub:focus-within > .submenu { opacity: 1; visibility: visible; transform: translateY(0); }
  .submenu a { padding: 11px 16px; }
  .nav-login { display: none; } /* shown as header buttons on desktop */
  .layout--sidebar { grid-template-columns: 250px 1fr; }
  .grid--3.grid--lg-3 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 959px) {
  .identity .header-actions .btn { display: none; } /* logins live in the mobile menu */
}