/* Educational System (ProSync AI) — public website theme
   Colours come from school settings (set as CSS variables by site.js). */

:root {
  --primary: #123c69;
  --primary-dark: #0b2847;
  --accent: #e0a100;
  --ink: #1d2433;
  --muted: #5b6475;
  --line: #e3e7ee;
  --bg: #ffffff;
  --bg-soft: #f4f6fa;
  --radius: 10px;
  --max: 1160px;
  font-size: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; color: var(--primary-dark); }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── Top bar ─────────────────────────────────────────────────────────── */
.topbar { background: var(--primary-dark); color: #dfe6f1; font-size: .875rem; }
.topbar .wrap { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: space-between; padding-top: 6px; padding-bottom: 6px; }
.topbar a { color: #fff; text-decoration: none; }
.topbar .links { display: flex; gap: 16px; flex-wrap: wrap; }

/* ── Header + nav ────────────────────────────────────────────────────── */
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-top: 12px; padding-bottom: 8px; }
@media (min-width: 961px) { .main-nav { flex-basis: 100%; border-top: 1px solid var(--line); padding-top: 6px; } }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--primary-dark); }
.brand svg { width: 52px; height: 52px; flex: none; }
.brand-name { font-weight: 700; font-size: 1.15rem; line-height: 1.2; display: block; }
.brand-motto { font-size: .8rem; color: var(--muted); font-style: italic; display: block; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font: inherit; color: var(--primary-dark); }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; flex-wrap: wrap; }
.main-nav a { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .93rem; }
.main-nav a:hover, .main-nav a[aria-current="page"] { background: var(--bg-soft); color: var(--primary); }
.main-nav .cta a { background: var(--primary); color: #fff; }
.main-nav .cta a:hover { background: var(--primary-dark); color: #fff; }

@media (max-width: 960px) {
  .nav-toggle { display: inline-block; }
  .main-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-bottom: 1px solid var(--line); }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; padding: 8px 16px 16px; }
}

/* ── Hero ────────────────────────────────────────────────────────────── */
.hero {
  color: #fff; position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 85% 20%, rgba(224,161,0,.35), transparent 40%),
    linear-gradient(135deg, var(--primary-dark), var(--primary));
}
.hero .wrap { padding-top: 72px; padding-bottom: 72px; position: relative; }
.hero h1 { color: #fff; max-width: 18ch; }
.hero p.lead { font-size: 1.15rem; max-width: 52ch; color: #e7edf6; }
.hero .badge { display: inline-block; background: var(--accent); color: #1d1400; font-weight: 700; font-size: .8rem; padding: 4px 10px; border-radius: 999px; margin-bottom: 14px; letter-spacing: .02em; }
.btn { display: inline-block; padding: 12px 20px; border-radius: 8px; font-weight: 700; text-decoration: none; border: 2px solid transparent; cursor: pointer; font: inherit; font-weight: 700; }
.btn-accent { background: var(--accent); color: #1d1400; }
.btn-accent:hover { filter: brightness(1.05); color: #1d1400; }
.btn-ghost { border-color: rgba(255,255,255,.7); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

.page-hero { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; }
.page-hero .wrap { padding-top: 40px; padding-bottom: 40px; }
.page-hero h1 { color: #fff; margin: 0; }
.page-hero p { color: #e1e8f2; margin: 8px 0 0; max-width: 60ch; }
.crumbs { font-size: .85rem; color: #cfd9e8; margin-bottom: 6px; }
.crumbs a { color: #fff; }

/* ── Quick links ─────────────────────────────────────────────────────── */
.quick { background: var(--accent); }
.quick ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); }
.quick a { display: block; text-align: center; padding: 16px 8px; font-weight: 700; color: #1d1400; text-decoration: none; border-right: 1px solid rgba(0,0,0,.08); }
.quick li:last-child a { border-right: 0; }
.quick a:hover { background: rgba(255,255,255,.25); }
@media (max-width: 760px) { .quick ul { grid-template-columns: repeat(2, 1fr); } .quick a { border-bottom: 1px solid rgba(0,0,0,.08); } }

/* ── Sections and cards ──────────────────────────────────────────────── */
.section { padding: 56px 0; }
.section.soft { background: var(--bg-soft); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h3 { margin-bottom: 6px; }
.card .meta { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.card.link { text-decoration: none; color: inherit; display: block; transition: border-color .15s, transform .15s; }
.card.link:hover { border-color: var(--primary); transform: translateY(-2px); }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg-soft); color: var(--primary); }
.tag.featured { background: var(--accent); color: #1d1400; }
.tag.placeholder { background: #eceff3; color: var(--muted); }

.welcome { display: grid; grid-template-columns: 1fr 2fr; gap: 32px; align-items: center; }
.welcome .portrait { aspect-ratio: 4/5; border-radius: var(--radius); background: linear-gradient(160deg, #dfe6f0, #c3cfe0); display: grid; place-items: center; color: var(--primary); font-weight: 700; }
@media (max-width: 760px) { .welcome { grid-template-columns: 1fr; } .welcome .portrait { max-width: 260px; } }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; text-align: center; }
.stats .n { font-size: 2.2rem; font-weight: 800; color: var(--primary); line-height: 1; }
.stats .l { color: var(--muted); font-size: .9rem; }
@media (max-width: 620px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.event { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.event:last-child { border-bottom: 0; }
.date-chip { background: var(--primary); color: #fff; border-radius: 8px; text-align: center; padding: 6px 0; line-height: 1.1; }
.date-chip .d { font-size: 1.4rem; font-weight: 800; display: block; }
.date-chip .m { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }

table.data { width: 100%; border-collapse: collapse; background: #fff; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { background: var(--bg-soft); font-size: .9rem; }
.table-scroll { overflow-x: auto; }

.prose { max-width: 72ch; }
.notice { border-left: 4px solid var(--accent); background: #fff8e6; padding: 12px 16px; border-radius: 6px; }

/* ── Forms ───────────────────────────────────────────────────────────── */
form .field { margin-bottom: 14px; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #c9d1dd; border-radius: 8px; background: #fff; }
textarea { min-height: 100px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
.form-status { margin-top: 10px; font-weight: 600; }

/* ── Footer ──────────────────────────────────────────────────────────── */
.site-footer { background: var(--primary-dark); color: #d4dcea; margin-top: 0; }
.site-footer .wrap { padding-top: 40px; padding-bottom: 24px; }
.site-footer a { color: #fff; }
.site-footer h3 { color: #fff; font-size: 1rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-base { border-top: 1px solid rgba(255,255,255,.15); margin-top: 24px; padding-top: 16px; font-size: .85rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.demo-flag { background: #fff3cd; color: #5c4400; text-align: center; font-size: .85rem; padding: 6px 16px; }

/* ── Portal ──────────────────────────────────────────────────────────── */
.portal-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.btn-ghost-dark { border-color: var(--primary); color: var(--primary); background: #fff; }
.btn-ghost-dark:hover { background: var(--bg-soft); }
.btn-sm { padding: 6px 12px; font-size: .9rem; }
.portal-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin-bottom: 20px; }
.portal-tabs button { font: inherit; font-weight: 600; background: none; border: 0; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.portal-tabs button.active, .portal-tabs button:hover { color: var(--primary); border-bottom-color: var(--accent); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin-bottom: 10px; }
.toolbar label { font-weight: 600; font-size: .9rem; }
.toolbar select { width: auto; min-width: 180px; display: block; margin-top: 4px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .n { font-size: 1.45rem; font-weight: 800; color: var(--primary); line-height: 1.2; }
.kpi .l { color: var(--muted); font-size: .85rem; }
.barrow { display: grid; grid-template-columns: 40px 1fr 36px; gap: 8px; align-items: center; margin: 6px 0; }
.barrow .bar { background: var(--bg-soft); border-radius: 4px; height: 12px; overflow: hidden; }
.barrow .bar i { display: block; height: 100%; background: var(--primary); }
.up { color: #1b7a3a; } .down { color: #b3261e; }
.linkish { background: none; border: 0; color: var(--primary); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.tag.status-draft { background: #eceff3; color: #4b5565; }
.tag.status-approved { background: #fff3cd; color: #5c4400; }
.tag.status-published, .tag.status-applied { background: #dff3e5; color: #1b5e33; }
.tag.status-pending { background: #eceff3; color: #4b5565; }
.tag.decision-promote { background: #dff3e5; color: #1b5e33; }
.tag.decision-repeat { background: #fde2e1; color: #8a1c15; }
.tag.decision-complete { background: #e3ecf8; color: var(--primary); }
.demo-roles { display: grid; gap: 10px; }
.demo-role { text-align: left; font: inherit; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; }
.demo-role:hover { border-color: var(--primary); }
.demo-role span { color: var(--muted); font-size: .9rem; }
table.marks input { width: 90px; padding: 6px 8px; }
table.marks input.dirty { border-color: var(--accent); background: #fffbea; }
form.pay { display: flex; gap: 6px; flex-wrap: wrap; }
form.pay input { width: 130px; padding: 6px 8px; } form.pay select { width: auto; padding: 6px 8px; }
.child { margin-bottom: 16px; } .child h4 { margin: 12px 0 6px; color: var(--primary-dark); }
.replist { padding-left: 18px; margin: 0; }

/* Report card modal */
.modal { position: fixed; inset: 0; background: rgba(10, 20, 35, .55); z-index: 200; overflow-y: auto; padding: 24px 12px; }
.modal-card { background: #fff; max-width: 860px; margin: 0 auto; border-radius: var(--radius); padding: 28px; position: relative; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 8px; }
.watermark { position: absolute; top: 40%; left: 0; right: 0; text-align: center; font-size: 5rem; font-weight: 800; color: rgba(179, 38, 30, .12); transform: rotate(-18deg); pointer-events: none; }
.rc-head { display: flex; gap: 16px; align-items: center; border-bottom: 3px solid var(--primary); padding-bottom: 12px; }
.rc-head h2 { margin: 0; }
.rc-motto { font-style: italic; color: var(--muted); }
.rc-title { text-align: center; margin: 14px 0; text-transform: uppercase; letter-spacing: .04em; }
.rc-meta, .rc-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 16px; margin-bottom: 14px; }
.rc-summary { grid-template-columns: repeat(3, 1fr); margin-top: 14px; background: var(--bg-soft); padding: 12px; border-radius: 8px; }
.rc-meta span, .rc-summary span, .rc-comments span { display: block; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.rc-table td, .rc-table th { padding: 6px 8px; font-size: .92rem; }
.rc-comments p { border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.rc-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 36px; }
.rc-sign div { border-top: 1px solid var(--ink); padding-top: 4px; font-size: .85rem; color: var(--muted); }
.rc-foot { font-size: .78rem; margin-top: 16px; }
@media (max-width: 620px) { .rc-meta, .rc-summary { grid-template-columns: 1fr 1fr; } .modal-card { padding: 16px; } }

@media print {
  body.printing-report > *:not(.modal) { display: none !important; }
  body.printing-report .modal { position: static; background: none; padding: 0; overflow: visible; }
  body.printing-report .modal-card { box-shadow: none; max-width: none; padding: 0; }
  .no-print { display: none !important; }
}
