/* Design system: "Accessible & Ethical" (UI/UX Pro Max) — high-contrast navy, blue accent,
   Crimson Pro headings + Atkinson Hyperlegible body, Sindhi ajrak accent. */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --muted: #eef2f6;
  --fg: #0b1220;
  --fg-2: #334155;
  --fg-3: #475569;          /* 7.5:1 on white */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #0f2744;       /* navy */
  --primary-2: #16365c;
  --on-primary: #ffffff;
  --accent: #0369a1;        /* links, focus, active — 5.9:1 on white */
  --accent-soft: #e0f0fa;
  --ajrak: #9b1c1c;
  --gold: #c08a1e;
  --gold-on-dark: #f2cf7e;
  --boy: #1d4ed8;
  --girl: #be185d;
  --danger: #b91c1c;
  --ring: 0 0 0 3px var(--surface), 0 0 0 6px var(--accent);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .06);
  --serif: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  --sans: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #111a2b;
    --muted: #172238;
    --fg: #eef2f7;
    --fg-2: #c8d1de;
    --fg-3: #a3afc0;
    --border: #22304a;
    --border-strong: #31415f;
    --primary: #0f2744;
    --primary-2: #16365c;
    --accent: #5cb8f0;
    --accent-soft: #10304a;
    --ajrak: #e05a5a;
    --gold: #e0ac45;
    --boy: #7aa7ff;
    --girl: #f17ab3;
    --danger: #f87171;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 16px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
h1, h2, h3, .h3 { font-family: var(--serif); line-height: 1.15; margin: 0 0 .4em; font-weight: 600; color: var(--fg); text-wrap: balance; }
h1 { font-size: clamp(2.3rem, 6vw, 3.6rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); }
h3, .h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
abbr[title] { text-decoration: none; }
.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; }
.icon { flex: none; }
main:focus { outline: none; box-shadow: none; }

.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }

.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  background: var(--primary); color: #fff; padding: 12px 18px; border-radius: var(--radius-sm); font-weight: 700;
}
.skip-link:focus { top: 12px; }

/* Ajrak-inspired band */
.ajrak {
  height: 6px;
  background:
    radial-gradient(circle at 50% 50%, var(--gold) 0 1.6px, transparent 2px) 0 0 / 12px 6px,
    linear-gradient(90deg, #8f1d17 0 50%, #13294b 50% 100%) 0 0 / 24px 6px;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 72px; }
.site-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--fg); margin-right: auto; padding: 4px 0; }
.crest { width: 44px; height: 44px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; }
.brand-text small { color: var(--fg-3); font-size: .82rem; }
.nav { display: flex; gap: 4px; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  text-decoration: none; color: var(--fg-2); font-weight: 700; font-size: .98rem;
  padding: 0 16px; border-radius: 999px; transition: background-color .2s var(--ease), color .2s var(--ease);
}
.nav a:hover { background: var(--muted); color: var(--fg); }
.nav a[aria-current="page"] { background: var(--primary); color: var(--on-primary); }
@media (prefers-color-scheme: dark) { .nav a[aria-current="page"] { background: var(--accent); color: #04121d; } }
.menu-btn {
  display: none; background: none; border: 1px solid var(--border); color: var(--fg);
  width: 44px; height: 44px; border-radius: 10px; cursor: pointer; place-items: center;
}

@media (max-width: 760px) {
  .menu-btn { display: grid; }
  .nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 2px; padding: 8px 16px 16px;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { border-radius: 10px; }
  .brand-text strong { font-size: 1.15rem; }
}

/* Hero & page heads */
.hero, .page-head {
  position: relative; color: var(--on-primary); overflow: hidden;
  background:
    radial-gradient(900px 380px at 90% -20%, rgba(192, 138, 30, .22), transparent 60%),
    linear-gradient(165deg, var(--primary) 0%, #0a1c33 100%);
}
.hero::after, .page-head::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .07;
  background-image: radial-gradient(circle at 1px 1px, #fff 1px, transparent 0);
  background-size: 22px 22px;
}
.hero > *, .page-head > * { position: relative; z-index: 1; }
.hero { padding: 80px 0 112px; }
.hero h1, .page-head h1 { color: #fff; }
.hero .lead { font-size: 1.2rem; max-width: 640px; color: #dbe4ef; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.page-head { padding: 56px 0 64px; }
.page-head p { color: #dbe4ef; max-width: 660px; margin: 0; font-size: 1.08rem; }
.hero .eyebrow, .page-head .eyebrow { color: var(--gold-on-dark); }

.eyebrow {
  display: block; font-size: .8rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 8px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  padding: 0 22px; border-radius: 999px; font: 700 1rem var(--sans);
  text-decoration: none; border: 1.5px solid transparent; cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .15s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-light { background: #fff; color: var(--primary); }
.btn-light:hover { background: #e8eef6; }
.btn-ghost { border-color: rgba(255, 255, 255, .55); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }
.btn-outline { border-color: var(--border-strong); color: var(--fg); background: var(--surface); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* Sections */
section { padding: 72px 0; }
section.tight { padding-top: 0; }
.section-head { margin-bottom: 28px; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 24px; }
.section-head > div { max-width: 680px; }
.section-head p { color: var(--fg-3); margin: 0; }
.count { color: var(--fg-3); font-weight: 700; font-size: .95rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Stats */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--border); border-radius: var(--radius); overflow: hidden;
  margin-top: -64px; position: relative; z-index: 2; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.stat { background: var(--surface); padding: 22px 24px; display: flex; gap: 14px; align-items: center; }
.stat-ico, .info-ico {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent);
}
.stat b { display: block; font-family: var(--serif); font-size: 2.2rem; line-height: 1; color: var(--fg); }
.stat span { color: var(--fg-3); font-size: .95rem; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .stat { padding: 18px 16px; } .stat-ico { display: none; } }

/* Headmaster message */
.hm { display: grid; grid-template-columns: 240px 1fr; gap: 48px; padding: 44px; align-items: start; }
.hm-photo { text-align: center; position: sticky; top: 100px; }
.hm-photo h3 { margin: 16px 0 2px; }
.hm-photo small { color: var(--fg-3); display: block; font-size: .92rem; }
.hm-body { position: relative; border-left: 3px solid var(--ajrak); padding-left: 32px; }
.hm-body p { color: var(--fg-2); font-size: 1.08rem; line-height: 1.7; max-width: 68ch; }
.hm-body p:first-of-type { font-family: var(--serif); font-size: 1.55rem; line-height: 1.3; color: var(--fg); }
.hm-sign { font-family: var(--serif); font-style: italic; font-size: 1.2rem !important; color: var(--fg) !important; margin-top: 12px; }
@media (max-width: 760px) {
  .hm { grid-template-columns: 1fr; padding: 24px; gap: 20px; }
  .hm-photo { position: static; display: flex; gap: 16px; align-items: center; text-align: left; }
  .hm-photo h3 { margin: 0; }
  .hm-body { padding-left: 18px; }
}

.avatar {
  width: 56px; height: 56px; font-size: 1.25rem;
  display: grid; place-items: center; border-radius: 50%; flex: none; overflow: hidden;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--serif); font-weight: 700;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 76px; height: 76px; font-size: 1.7rem; }
.avatar-xl { width: 168px; height: 168px; font-size: 3.4rem; margin: 0 auto; box-shadow: 0 0 0 6px var(--surface), 0 0 0 8px var(--border); }
@media (max-width: 760px) { .avatar-xl { width: 88px; height: 88px; font-size: 1.9rem; margin: 0; } }

/* Quick links */
.links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.link-card {
  padding: 28px; text-decoration: none; color: var(--fg); display: flex; flex-direction: column; gap: 6px;
  transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.link-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.link-card .stat-ico { margin-bottom: 10px; }
.link-card h3 { margin: 0; }
.link-card p { color: var(--fg-3); margin: 0; }
.link-card .more { margin-top: 12px; color: var(--accent); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
@media (max-width: 860px) { .links { grid-template-columns: 1fr; } }

.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.info { padding: 20px; display: flex; gap: 14px; align-items: flex-start; }
.info dl { margin: 0; min-width: 0; }
.info dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-3); font-weight: 700; }
.info dd { margin: 4px 0 0; font-weight: 700; overflow-wrap: anywhere; }
@media (max-width: 860px) { .info-grid { grid-template-columns: 1fr; } }

/* Faculty */
.hm-strip { display: flex; gap: 20px; align-items: center; padding: 24px 28px; margin-bottom: 40px; border-left: 4px solid var(--ajrak); }
.hm-strip .eyebrow { margin-bottom: 2px; }
.hm-strip h2 { margin: 0; }
.hm-strip p { margin: 0; color: var(--fg-3); }
.hm-strip .btn { margin-left: auto; }
@media (max-width: 640px) { .hm-strip { flex-wrap: wrap; } .hm-strip .btn { margin-left: 0; width: 100%; } }

.faculty-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.teacher { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.teacher-top { display: flex; gap: 14px; align-items: center; }
.teacher-top h3 { margin: 0; }
.desig { color: var(--fg-3); font-size: .92rem; margin: 2px 0 0; }
.desig abbr { font-weight: 700; color: var(--fg-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; gap: 6px; align-items: center;
  font-size: .88rem; padding: 4px 12px; border-radius: 999px;
  background: var(--muted); color: var(--fg-3); border: 1px solid var(--border);
}
.chip b { color: var(--fg); font-weight: 700; }
.chip.chip-primary { background: var(--primary); color: #fff; border-color: transparent; font-weight: 700; }
@media (prefers-color-scheme: dark) { .chip.chip-primary { background: var(--accent); color: #04121d; } }
.teacher-foot {
  display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; gap: 8px;
  margin: auto 0 0; padding-top: 14px; border-top: 1px dashed var(--border-strong);
}
.teacher-foot dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-3); font-weight: 700; }
.teacher-foot dd { margin: 2px 0 0; font-weight: 700; font-size: .95rem; }

.support-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.support { padding: 18px 20px; display: flex; gap: 14px; align-items: center; }
.support .avatar { background: var(--muted); color: var(--fg-2); }
.support h3 { margin: 0; font-size: 1.2rem; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .97rem; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-2); white-space: nowrap; font-weight: 700; }
tbody th { font-weight: 700; }
tbody tr:hover > * { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
tfoot th, tfoot td { background: var(--muted); font-weight: 700; border-bottom: 0; }
tbody tr:last-child > * { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-3); }
.empty { text-align: center; color: var(--fg-3); padding: 32px; }

/* Students */
.bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--muted); min-width: 120px; margin-top: 6px; }
.bar .b { background: var(--boy); }
.bar .g { background: var(--girl); }
.legend { display: flex; gap: 18px; font-size: .9rem; color: var(--fg-3); margin-top: 12px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tab {
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1.5px solid var(--border-strong); background: var(--surface);
  color: var(--fg-2); font: 700 .95rem var(--sans); cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.tab:hover { border-color: var(--accent); color: var(--accent); }
.tab[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
@media (prefers-color-scheme: dark) { .tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #04121d; } }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .88rem; font-weight: 700; color: var(--fg-2); }
.field.grow { flex: 1; min-width: 220px; }
.input-wrap { position: relative; }
.input-wrap .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--fg-3); pointer-events: none; }
.toolbar input, .toolbar select {
  font: inherit; font-size: 1rem; min-height: 48px; padding: 0 14px; border-radius: 10px; width: 100%;
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--fg);
}
.toolbar input { padding-left: 42px; }
.toolbar input:focus-visible, .toolbar select:focus-visible { border-color: var(--accent); }
.toolbar select:disabled { opacity: .6; cursor: not-allowed; }
.class-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.status { font-size: .9rem; color: var(--fg-3); margin: 10px 0 0; }

.gender { font-size: .82rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.gender.M { background: color-mix(in srgb, var(--boy) 12%, transparent); color: var(--boy); }
.gender.F { background: color-mix(in srgb, var(--girl) 12%, transparent); color: var(--girl); }

/* Timetable */
.segmented { display: inline-flex; padding: 4px; background: var(--muted); border-radius: 999px; border: 1px solid var(--border); }
.segmented button {
  min-height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent;
  font: 700 .95rem var(--sans); color: var(--fg-2); cursor: pointer; transition: background-color .2s var(--ease), color .2s var(--ease);
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.tt-bar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.tt-title { font-size: 1.6rem; margin: 6px 0 14px; }

.tt { min-width: 900px; table-layout: fixed; }
.tt th, .tt td { text-align: center; padding: 10px 8px; border-right: 1px solid var(--border); vertical-align: middle; }
.tt th:last-child, .tt td:last-child { border-right: 0; }
.tt thead th small { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--fg-3); font-size: .8rem; margin-top: 2px; }
.tt tbody th { background: var(--muted); font-family: var(--serif); font-size: 1.1rem; width: 120px; text-align: left; padding-left: 16px; }
.tt tbody th em { display: block; font: 700 .7rem var(--sans); text-transform: uppercase; letter-spacing: .1em; font-style: normal; color: var(--accent); }
.tt .day-col { width: 120px; }
.tt .brk-col { width: 46px; }
.tt tbody tr:hover > * { background: inherit; }
.cell { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.cell b { font-size: .93rem; font-weight: 700; line-height: 1.25; color: var(--c, var(--fg)); }
.cell span { font-size: .8rem; color: var(--fg-3); line-height: 1.25; }
.brk {
  background: repeating-linear-gradient(135deg, var(--muted) 0 6px, transparent 6px 12px);
  writing-mode: vertical-rl; transform: rotate(180deg); font-size: .74rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--fg-3); font-weight: 700;
}
.off { background: var(--muted); color: var(--fg-3); font-style: italic; }
.free { color: var(--fg-3); font-size: .85rem; background: repeating-linear-gradient(135deg, transparent 0 8px, var(--muted) 8px 9px); }
.tt tr.today th { background: var(--primary); color: #fff; }
.tt tr.today th em { color: var(--gold-on-dark); }
.tt tr.today td { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.tt td[class^="s-"] { box-shadow: inset 0 3px 0 var(--c); }
.tt td.clash { outline: 2px solid var(--danger); outline-offset: -3px; }

.s-ENG { --c: #1d4ed8; } .s-URD { --c: #7e22ce; } .s-SND { --c: #b91c1c; } .s-MTH { --c: #047857; }
.s-SCI { --c: #a16207; } .s-SST { --c: #4d7c0f; } .s-ISL { --c: #0e7490; } .s-CMP { --c: #475569; }
.s-PHY { --c: #c2410c; } .s-CHE { --c: #a21caf; } .s-BIO { --c: #15803d; } .s-PKS { --c: #9a3412; } .s-PED { --c: #be123c; }
@media (prefers-color-scheme: dark) {
  .s-ENG { --c: #8ab4ff; } .s-URD { --c: #d0a5f5; } .s-SND { --c: #fb9b9b; } .s-MTH { --c: #5fd3a6; }
  .s-SCI { --c: #f2c25c; } .s-SST { --c: #b5d86a; } .s-ISL { --c: #6fd3e6; } .s-CMP { --c: #b8c3d3; }
  .s-PHY { --c: #fdab7d; } .s-CHE { --c: #ec9cf0; } .s-BIO { --c: #79dba0; } .s-PKS { --c: #f6ad84; } .s-PED { --c: #fb9ab0; }
}

.notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 20px; }
.note { padding: 16px 18px; font-size: .95rem; color: var(--fg-3); display: flex; gap: 12px; align-items: flex-start; }
.note .icon { color: var(--accent); margin-top: 2px; }
.note b { color: var(--fg); display: block; }
@media (max-width: 860px) { .notes { grid-template-columns: 1fr; } }
.scroll-hint { display: none; font-size: .88rem; color: var(--fg-3); margin: 0 0 8px; }
@media (max-width: 960px) { .scroll-hint { display: block; } }

.alert {
  padding: 14px 18px; border-radius: 10px; margin-bottom: 16px; font-weight: 700;
  background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}

/* Footer */
.site-footer { background: var(--primary); color: #c9d4e3; padding: 44px 0 36px; margin-top: 40px; }
.site-footer .wrap { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 28px; font-size: .95rem; }
.site-footer strong { color: #fff; font-family: var(--serif); font-size: 1.3rem; }
.site-footer p { margin: 2px 0; }
.site-footer a { color: #fff; }
.site-footer .crest path:first-child { fill: #fff; }
.site-footer .crest path:nth-child(3) { fill: var(--primary); }
.foot-brand { display: flex; gap: 14px; align-items: flex-start; }
.foot-list li { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.foot-list .icon { color: var(--gold-on-dark); }
@media (max-width: 860px) { .site-footer .wrap { grid-template-columns: 1fr; } }

@media print {
  .site-header, .site-footer, .tt-bar, .tabs, .no-print, .ajrak, .skip-link, .scroll-hint { display: none !important; }
  .page-head { background: none; color: #000; padding: 0 0 12px; }
  .page-head h1, .page-head p { color: #000; }
  .page-head::after { display: none; }
  body { background: #fff; }
  .table-wrap { box-shadow: none; overflow: visible; }
  .tt { min-width: 0; }
  section { padding: 12px 0; }
}

/* Empty state */
[hidden] { display: none !important; }
.empty-state { padding: 48px 32px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.empty-state .stat-ico { width: 56px; height: 56px; margin-bottom: 12px; }
.empty-state h2 { margin: 0; }
.empty-state p { color: var(--fg-3); margin: 0; max-width: 48ch; }

/* Headmaster label on a teacher card */
.role-badge { display: inline-block; margin: 6px 0 0; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; letter-spacing: .04em; color: var(--ajrak); border: 1px solid color-mix(in srgb, var(--ajrak) 40%, transparent); }

/* Staff service record */
.service td, .service th { white-space: nowrap; }
.service td .muted { font-size: .88rem; }
.service .role-badge { margin: 0 0 0 6px; vertical-align: 1px; }

/* ===== Design polish (UI/UX Pro Max pass 2) ===== */

/* Home hero: copy + live "Today at school" card */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 48px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 32px; } }
.today-card {
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 16px; padding: 24px; backdrop-filter: blur(6px); color: #fff;
}
.today-card:empty { display: none; }
.today-eyebrow { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-on-dark); }
.today-day { color: #fff; font-size: 2rem; margin: 0; }
.today-date { margin: 0 0 16px; color: #c9d4e3; }
.today-status { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .06); }
.today-status b { color: #fff; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.open { background: #4ade80; box-shadow: 0 0 0 4px rgba(74, 222, 128, .2); }
.dot.closed { background: #fbbf24; box-shadow: 0 0 0 4px rgba(251, 191, 36, .2); }
.today-hint { color: #c9d4e3; font-size: .95rem; margin: 12px 0 8px; }
.today-classes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.today-classes a {
  display: grid; place-items: center; min-height: 44px; border-radius: 10px; font-weight: 700;
  color: #fff; text-decoration: none; border: 1px solid rgba(255, 255, 255, .25);
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.today-classes a:hover { background: rgba(255, 255, 255, .14); border-color: #fff; }
.today-all { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--gold-on-dark); font-weight: 700; text-decoration: none; }
.today-all:hover { text-decoration: underline; }
.hero .today-card :focus-visible { box-shadow: 0 0 0 3px var(--primary), 0 0 0 6px var(--gold-on-dark); }

/* Students: KPI cards and direct labels */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr) 1.4fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 960px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .kpis { grid-template-columns: 1fr; } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--fg-3); display: flex; align-items: center; gap: 8px; }
.kpi b { font-family: var(--serif); font-size: 2.4rem; line-height: 1.05; }
.kpi-sub { font-size: .9rem; color: var(--fg-3); }
.key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.key.b { background: var(--boy); } .key.g { background: var(--girl); }
.kpi-split { justify-content: center; }
.bar-lg { height: 14px; margin: 10px 0 6px; }
.split-labels, .bar-labels { display: flex; justify-content: space-between; gap: 8px; }
.split-labels span:first-child, .bar-labels span:first-child { color: var(--boy); font-weight: 700; }
.split-labels span:last-child, .bar-labels span:last-child { color: var(--girl); font-weight: 700; }
.bar-labels { font-size: .78rem; margin-top: 4px; }

/* Faculty: search + subject filter chips (wrap, never clip) */
.fac-filter { align-items: flex-start; margin-bottom: 20px; }
.fac-filter .field:last-child { flex-basis: 100%; }
.field-label { font-size: .88rem; font-weight: 700; color: var(--fg-2); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fchip {
  min-height: 40px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--fg-2);
  font: 700 .9rem var(--sans); transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.fchip:hover { border-color: var(--accent); color: var(--accent); }
.fchip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
@media (prefers-color-scheme: dark) { .fchip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #04121d; } }
#fac-empty { text-align: center; padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
#fac-empty p { color: var(--fg-3); margin: 0 0 10px; }
.teacher[hidden] { display: none !important; }

/* Subtle scroll reveal (JS adds .reveal only when motion is allowed) */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .35s ease-out, transform .35s ease-out; }
.reveal.in { opacity: 1; transform: none; }
@media print { .reveal { opacity: 1 !important; transform: none !important; } .today-card { display: none; } }
@media (max-width: 760px) {
  .hm-photo { display: grid; grid-template-columns: auto 1fr; column-gap: 16px; align-items: center; }
  .hm-photo .avatar { grid-row: span 2; }
  .hm-photo h3 { align-self: end; }
  .hm-photo small { align-self: start; }
}

/* =========================================================
   Design pass 3 (UI/UX Pro Max): colour-coded subjects,
   richer page heads, livelier faculty and student pages.
   Subject colours live in SUBJECT_TONE (js/main.js).
   ========================================================= */

/* Page heads: warm glows on the navy, an ajrak band along the bottom, stat pills */
.page-head {
  padding: 64px 0 80px;
  background:
    radial-gradient(520px 300px at 92% 20%, rgba(242, 207, 126, .20), transparent 70%),
    radial-gradient(460px 280px at 70% 120%, rgba(190, 24, 93, .26), transparent 70%),
    radial-gradient(420px 260px at 105% 105%, rgba(13, 148, 136, .24), transparent 70%),
    linear-gradient(165deg, var(--primary) 0%, #0a1c33 100%);
}
.page-head::before {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; z-index: 1;
  background: repeating-linear-gradient(90deg, #9b1c1c 0 14px, #0f2744 14px 16px, #c08a1e 16px 22px, #0f2744 22px 24px);
  opacity: .9;
}
.page-head h1 { font-size: clamp(2.4rem, 5vw, 3.4rem); }
.head-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 0; padding: 0; }
.head-stats li {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px 8px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); color: #dbe4ef; font-size: .95rem;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.head-stats .icon { color: var(--gold-on-dark); }
.head-stats b { font-family: var(--serif); font-size: 1.3rem; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }

/* Subject chips take their subject's colour */
.chip-subj { background: color-mix(in srgb, var(--tone) 10%, var(--surface)); border-color: color-mix(in srgb, var(--tone) 30%, var(--border)); }
.chip-subj b { color: color-mix(in srgb, var(--tone) 72%, var(--fg)); }

/* Teacher cards: tinted top in the teacher's main subject colour, coloured initials, gentle lift on hover */
.teacher {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tone) 8%, var(--surface)) 0, var(--surface) 120px);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.teacher::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--tone), color-mix(in srgb, var(--tone) 30%, transparent)); }
.teacher:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--tone) 35%, var(--border)); box-shadow: 0 18px 34px -18px color-mix(in srgb, var(--tone) 55%, transparent); }
.avatar-tone { background: linear-gradient(135deg, var(--tone), color-mix(in srgb, var(--tone) 55%, #0b1220)); color: #fff; box-shadow: 0 8px 16px -8px var(--tone); }
.teacher-foot dd { font-variant-numeric: tabular-nums; }

/* Subject filter: a colour dot per subject; the chosen one fills with a darkened subject colour (white text stays above 4.5:1) */
.fchip { display: inline-flex; align-items: center; gap: 8px; }
.fdot { width: 9px; height: 9px; border-radius: 50%; background: var(--tone); flex: none; }
.fchip[data-code]:not([data-code=""]):hover { border-color: var(--tone); color: color-mix(in srgb, var(--tone) 75%, var(--fg)); }
.fchip[data-code]:not([data-code=""])[aria-pressed="true"] { background: color-mix(in srgb, var(--tone) 75%, #000); border-color: transparent; color: #fff; }
.fchip[aria-pressed="true"] .fdot { background: #fff; }

/* Headmaster strip: navy with a gold glow and an ajrak edge */
.hm-strip {
  position: relative; overflow: hidden; border: 0; color: #fff;
  background: radial-gradient(420px 220px at 100% 0, rgba(242, 207, 126, .22), transparent 70%), linear-gradient(135deg, var(--primary), #0a1c33);
}
.hm-strip::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 8px; background: repeating-linear-gradient(180deg, #9b1c1c 0 14px, #c08a1e 14px 20px); }
.hm-strip .eyebrow { color: var(--gold-on-dark); }
.hm-strip h2 { color: #fff; }
.hm-strip p { color: #dbe4ef; }
.hm-strip .avatar { background: linear-gradient(135deg, var(--gold-on-dark), var(--gold)); color: var(--primary); box-shadow: 0 0 0 5px rgba(255, 255, 255, .1); }
.hm-strip .btn-outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .45); }
.hm-strip .btn-outline:hover { background: rgba(255, 255, 255, .1); color: #fff; border-color: #fff; }

/* Support staff: same lift as teacher cards */
.support { transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.support:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -18px rgba(15, 23, 42, .35); }

/* Student KPI cards: a colour bar on top and an icon in the corner */
.kpi { position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--k, var(--accent)); }
.kpi-total { --k: var(--accent); }
.kpi-boys { --k: var(--boy); }
.kpi-girls { --k: var(--girl); }
.kpi-split { --k: var(--gold); }
.kpi-ico {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; color: var(--k); background: color-mix(in srgb, var(--k) 12%, var(--surface));
}
.kpi b { font-variant-numeric: tabular-nums; }

/* Class colour dots in the enrolment table (same colours as the home page class cards) */
.cdot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--cc); margin-right: 10px; vertical-align: 1px; }

@media (prefers-reduced-motion: reduce) {
  .teacher, .support { transition: none; }
  .teacher:hover, .support:hover { transform: none; }
}
@media print {
  .page-head::before, .head-stats { display: none; }
  .hm-strip { background: none; color: #000; }
  .hm-strip h2, .hm-strip p, .hm-strip .eyebrow { color: #000; }
}

/* Page-head art: teacher initials cloud (Faculty) and boys/girls ring (Students); decorative, hidden on narrow screens */
.page-head .wrap { position: relative; }
.head-art { position: absolute; right: 32px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 12px; }
@media (max-width: 1020px) { .head-art { display: none; } }
.avatar-cloud { display: flex; flex-wrap: wrap; justify-content: center; width: 290px; gap: 10px 8px; }
.ac {
  width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center;
  font: 700 1.15rem var(--serif); color: #fff;
  background: linear-gradient(135deg, var(--tone), color-mix(in srgb, var(--tone) 55%, #0b1220));
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .14), 0 12px 22px -12px var(--tone);
}
.ac:nth-child(even) { transform: translateY(12px); }
.head-ring { width: 200px; height: 200px; }
.ring-n { font: 700 38px var(--serif); fill: #fff; }
.ring-l { font: 13px var(--sans); fill: #dbe4ef; letter-spacing: .04em; }
.ring-key { display: flex; gap: 16px; color: #dbe4ef; font-size: .92rem; }
.ring-key span { display: inline-flex; align-items: center; gap: 6px; }
.ring-key i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
@media print { .head-art { display: none; } }
@media (prefers-color-scheme: dark) {
  .chip-subj b { color: color-mix(in srgb, var(--tone) 45%, var(--fg)); }
}
