/* SchoolCloud public portal: shared by index.php, login.php and logout.php
   Theme colours (--primary, --primary-light, --secondary, --dark, --light) are injected by PHP from school_themes. */

:root {
  --primary: #1e3a5f; --primary-light: #2d5b8a; --secondary: #ff9f43; --dark: #0f1f38; --light: #f0f4f8;
  --white: #fff; --text: #2b3544; --gray: #566275; --line: rgba(15, 31, 56, .12);
  --shadow: 0 1px 2px rgba(15, 31, 56, .06), 0 12px 32px rgba(15, 31, 56, .1);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  --font-ar: 'Noto Naskh Arabic', 'Amiri', 'Traditional Arabic', serif;
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='black' stroke-width='1.2'%3E%3Crect x='16' y='16' width='40' height='40'/%3E%3Crect x='16' y='16' width='40' height='40' transform='rotate(45 36 36)'/%3E%3C/g%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; font: 400 1rem/1.65 var(--font-body); color: var(--text); background: var(--white); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: var(--primary); }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--dark); line-height: 1.12; letter-spacing: -.015em; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }
.ar { font-family: var(--font-ar); font-weight: 500; letter-spacing: 0; line-height: 1.6; }
.wrap { width: 100%; max-width: 1160px; margin-inline: auto; padding-inline: clamp(18px, 4vw, 32px); }
.i { width: 1.25em; height: 1.25em; flex: none; }
:focus-visible { outline: 3px solid var(--secondary); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: 12px; top: -64px; z-index: 2000; background: var(--secondary); color: var(--dark); padding: 10px 16px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }

/* Geometric star lattice (decorative). Colour via --pat, strength via --pat-o */
.pattern { position: relative; isolation: isolate; }
.pattern::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: var(--pat, var(--primary)); opacity: var(--pat-o, .07); -webkit-mask: var(--star) 0 0 / 72px 72px repeat; mask: var(--star) 0 0 / 72px 72px repeat; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 1000; background: var(--primary); color: #fff; transition: box-shadow .2s; }
.site-header.scrolled { box-shadow: 0 6px 24px rgba(0, 0, 0, .2); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.brand img { height: 46px; width: 46px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; }
.brand span { font: 700 1.05rem/1.2 var(--font-head); }
.nav { display: flex; align-items: center; gap: 28px; }
.nav a:not(.btn) { color: rgba(255, 255, 255, .88); text-decoration: none; font-weight: 500; font-size: .95rem; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a:not(.btn):hover { color: #fff; border-color: var(--secondary); }
.nav-toggle { display: none; background: none; border: 0; color: #fff; padding: 8px; cursor: pointer; border-radius: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 600; padding: 8px 14px; border: 1.5px solid rgba(255, 255, 255, .4); border-radius: 10px; }
.back-link:hover { background: rgba(255, 255, 255, .12); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 26px; border: 2px solid transparent; border-radius: 12px; font: 700 .98rem var(--font-body); text-decoration: none; cursor: pointer; transition: transform .15s var(--ease), background .15s, color .15s, filter .15s; }
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 42px; padding: 0 20px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--dark); }
.btn-accent { background: var(--secondary); color: var(--dark); }
.btn-accent:hover { filter: brightness(1.07); }
.btn-ghost { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-ghost:hover { background: var(--primary); color: #fff; }
.btn-light { border-color: rgba(255, 255, 255, .55); color: #fff; }
.btn-light:hover { background: rgba(255, 255, 255, .12); }
.btn[disabled] { opacity: .75; cursor: progress; }

/* Hero */
.hero { background: var(--light); --pat: var(--primary); }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(32px, 6vw, 80px); align-items: center; padding-block: clamp(48px, 8vw, 104px); }
.hero h1 { font-size: clamp(2.4rem, 5.2vw, 4.1rem); font-weight: 800; letter-spacing: -.03em; margin-bottom: .45em; text-wrap: balance; }
.hero h1 span { color: var(--primary); }
.hero-lead { font-size: 1.12rem; color: var(--gray); max-width: 54ch; margin-bottom: 2rem; }
.hero-lead b { display: block; font: 500 1.3rem/1.8 var(--font-ar); color: var(--dark); unicode-bidi: plaintext; text-align: left; margin-bottom: .35rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.arch-wrap { position: relative; width: 100%; max-width: 400px; margin-inline: auto; padding: 12px; border: 2px solid var(--secondary); border-radius: 999px 999px 30px 30px; }
.arch { aspect-ratio: 4 / 5; border-radius: 999px 999px 20px 20px; overflow: hidden; background: var(--primary); animation: reveal 1s var(--ease) both; }
.arch img { width: 100%; height: 100%; object-fit: cover; }
.motto { position: absolute; left: 50%; bottom: -20px; transform: translateX(-50%); width: max-content; max-width: 92%; text-align: center; background: var(--dark); color: #fff; padding: 10px 22px; border-radius: 999px; font: 600 .92rem/1.3 var(--font-head); box-shadow: var(--shadow); }
@keyframes reveal { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0); } }

/* Statistics (only rendered when the API returns data) */
.stats { background: var(--white); border-bottom: 1px solid var(--line); }
.stats-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stats-list li { padding: 28px 24px; border-inline-start: 1px solid var(--line); }
.stats-list li:first-child { border-inline-start: 0; padding-inline-start: 0; }
.stat-n { display: block; font: 800 2.4rem/1 var(--font-head); letter-spacing: -.03em; color: var(--primary); }
.stat-l { display: block; margin-top: 6px; color: var(--gray); font-size: .92rem; }
.stat-l .ar { display: block; color: var(--dark); font-size: 1.05rem; }

/* Sections */
.section { padding-block: clamp(56px, 9vw, 104px); }
.section-head { max-width: 640px; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head h2 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); margin-bottom: .2em; }
.section-head .ar { font-size: 1.4rem; color: var(--primary); margin: 0 0 .5rem; }
.section-head p:last-child { color: var(--gray); margin: 0; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: clamp(28px, 4vw, 56px); }
.role { border-top: 3px solid var(--primary); padding-top: 22px; }
.role > .i { width: 30px; height: 30px; color: var(--primary); margin-bottom: 14px; }
.role h3 { font-size: 1.35rem; margin-bottom: 0; }
.role .ar { color: var(--gray); margin-bottom: 14px; }
.role ul { display: grid; gap: 10px; }
.role li { display: flex; gap: 10px; }
.role li .i { width: 18px; height: 18px; margin-top: 4px; color: var(--primary); }
.about { background: var(--light); }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 72px); align-items: center; }
.about-img { border-radius: 20px; overflow: hidden; aspect-ratio: 4 / 3; box-shadow: var(--shadow); }
.about-img img { width: 100%; height: 100%; object-fit: cover; }
.about-text { max-width: 60ch; color: var(--gray); }
.mv { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 40px 0; }
.mv-item { padding-inline: clamp(20px, 3vw, 40px); border-inline-start: 1px solid var(--line); }
.mv-item:first-child { padding-inline-start: 0; border-inline-start: 0; }
.mv-item .ar { display: block; font-size: 2.3rem; line-height: 1.4; color: var(--primary); }
.mv-item h3 { font-size: 1.3rem; }
.mv-item p { color: var(--gray); margin: 0; }
.cta { background: var(--dark); color: #fff; --pat: #fff; --pat-o: .08; }
.cta .wrap { display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.cta h2 { color: #fff; font-size: clamp(1.7rem, 3.2vw, 2.4rem); margin-bottom: .3em; }
.cta p { margin: 0; max-width: 56ch; color: rgba(255, 255, 255, .8); }

/* Footer */
.site-footer { background: var(--dark); color: rgba(255, 255, 255, .8); padding-block: 56px 28px; font-size: .95rem; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--secondary); text-decoration: underline; }
.foot-grid { display: grid; grid-template-columns: 1.5fr 1fr 1.3fr 1fr; gap: 40px; padding-bottom: 40px; }
.foot-h { font: 700 1rem var(--font-head); color: #fff; margin-bottom: 14px; }
.foot-list { display: grid; gap: 10px; }
.foot-list li { display: flex; gap: 10px; align-items: flex-start; }
.foot-list .i { margin-top: 4px; color: var(--secondary); }
.foot-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, .14); font-size: .88rem; }
.site-footer.compact { padding-block: 24px; }
.site-footer.compact .foot-bar { border: 0; padding: 0; }

/* Sign-in */
.auth { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: clamp(32px, 6vw, 72px) clamp(18px, 4vw, 48px); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 2.1rem; font-weight: 800; }
.auth-card > p { color: var(--gray); margin-bottom: 28px; }
.auth-panel { background: var(--primary); color: #fff; --pat: #fff; --pat-o: .1; display: flex; align-items: center; justify-content: center; padding: clamp(40px, 6vw, 80px); }
.auth-panel-inner { max-width: 400px; }
.auth-panel img { height: 84px; width: 84px; object-fit: contain; background: #fff; border-radius: 18px; padding: 6px; margin-bottom: 24px; }
.auth-panel h2 { color: #fff; font-size: 1.9rem; }
.auth-panel p { color: rgba(255, 255, 255, .85); }
.auth-panel ul { display: grid; gap: 14px; margin-top: 28px; }
.auth-panel li { display: flex; gap: 12px; align-items: flex-start; }
.auth-panel li .i { margin-top: 3px; color: var(--secondary); }
.field { margin-bottom: 20px; }
.field label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; font-weight: 600; font-size: .95rem; color: var(--dark); }
.field label .ar { font-size: 1rem; color: var(--gray); }
.control { position: relative; }
.control input { width: 100%; height: 52px; padding: 0 52px 0 16px; border: 1.5px solid rgba(15, 31, 56, .28); border-radius: 12px; background: #fff; color: var(--dark); font: inherit; transition: border-color .15s, box-shadow .15s; }
.control input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
.control .toggle { position: absolute; right: 6px; top: 6px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--gray); cursor: pointer; }
.control .toggle:hover { color: var(--primary); }
.hint { margin: 6px 0 0; font-size: .85rem; color: #8a5a00; }
.opts { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; font-size: .95rem; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--primary); text-decoration: underline; cursor: pointer; }
.help { margin: -8px 0 20px; padding: 12px 14px; background: var(--light); border-radius: 12px; font-size: .92rem; color: var(--text); }
.alert { padding: 12px 14px; margin-bottom: 20px; border: 1px solid; border-radius: 12px; font-size: .95rem; }
.alert-error { background: #fdecec; border-color: #f2b8b5; color: #8a1f17; }
.alert-success { background: #e8f6ee; border-color: #a9dcbd; color: #14532d; }
.alert-info { background: #e8f1fb; border-color: #b6d2f0; color: #123c69; }
.auth-foot { margin-top: 24px; font-size: .92rem; color: var(--gray); text-align: center; }

/* Signed-out */
.bye { flex: 1; display: grid; place-items: center; padding: 32px 18px; background: var(--light); --pat: var(--primary); }
.bye-card { width: 100%; max-width: 440px; padding: 40px 32px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.bye-card img { height: 72px; width: 72px; object-fit: contain; margin: 0 auto 14px; }
.bye-card .school { font: 700 1.05rem var(--font-head); color: var(--gray); margin-bottom: 22px; }
.bye-card h1 { font-size: 1.8rem; }
.bye-card p { color: var(--gray); }
.progress { height: 4px; margin: 24px 0 10px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress i { display: block; width: 0; height: 100%; background: var(--primary); animation: fill 5s linear forwards; }
@keyframes fill { to { width: 100%; } }
.bye-note { margin-top: 24px; padding: 14px; background: var(--light); border-radius: 12px; font-size: .88rem; color: var(--gray); text-align: left; }

/* Responsive */
@media (max-width: 960px) {
  .hero-grid, .about-grid { grid-template-columns: 1fr; }
  .arch-wrap { max-width: 300px; margin-bottom: 24px; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-panel { display: none; }
}
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; padding: 8px clamp(18px, 4vw, 32px) 20px; background: var(--primary); box-shadow: 0 16px 24px rgba(0, 0, 0, .2); }
  .nav.open { display: flex; }
  .nav a:not(.btn) { padding: 14px 0; border-bottom: 1px solid rgba(255, 255, 255, .14); }
  .nav .btn { margin-top: 16px; }
  .stats-list li:nth-child(odd) { border-inline-start: 0; padding-inline-start: 0; }
  .mv-item { border-inline-start: 0; padding-inline: 0; }
  .foot-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}