/* Shared Skoolyst design system — keep this file aligned across every module. */
:root {
  --skoolyst-navy: #0A0E2A;
  --skoolyst-blue: #0F4077;
  --skoolyst-cyan: #00D9FF;
  --skoolyst-gold: #F4B942;
  --white: #FFFFFF;
  --text: #172033;
  --muted: #64748B;
  --border: #E2E8F0;
  --surface: #F8FAFC;
  --radius: 10px;
  --shadow: 0 4px 20px rgba(10,14,42,.08);
  --container: 1200px;
}
* { box-sizing: border-box; }
body { margin:0; font-family: Inter, system-ui, -apple-system, sans-serif; color:var(--text); background:var(--surface); }
img { max-width:100%; height:auto; }
.container { width:min(100% - 32px, var(--container)); margin-inline:auto; }
.btn { display:inline-flex; align-items:center; justify-content:center; border:0; border-radius:var(--radius); padding:.65rem 1rem; cursor:pointer; }
.card { background:var(--white); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); }
.table-wrap { overflow-x:auto; }
.table { width:100%; border-collapse:collapse; background:var(--white); }
.table th,.table td { padding:.75rem; border-bottom:1px solid var(--border); text-align:left; word-break:break-word; }
.form-control { width:100%; padding:.7rem .8rem; border:1px solid var(--border); border-radius:var(--radius); }
@media (max-width:768px) {
  .container { width:min(100% - 20px, var(--container)); }
  .hero h1 { font-size:1.5rem; }
}

/* ---- Buttons ---- */
.btn { font-size:.95rem; font-weight:600; text-decoration:none; transition:opacity .15s, transform .05s; gap:.4rem; }
.btn:active { transform:translateY(1px); }
.btn-sm { padding:.4rem .8rem; font-size:.85rem; }
.btn-primary { background:var(--skoolyst-blue); color:var(--white); }
.btn-secondary { background:var(--skoolyst-gold); color:var(--skoolyst-navy); }
.btn-outline { background:transparent; border:1px solid var(--skoolyst-blue); color:var(--skoolyst-blue); }
.btn-ghost { background:transparent; color:var(--skoolyst-blue); }
.btn-danger { background:#DC2626; color:var(--white); }
.btn:hover { opacity:.9; }

/* ---- Navbar ---- */
.site-navbar { background:var(--skoolyst-navy); position:sticky; top:0; z-index:40; }
.navbar-inner { display:flex; align-items:center; justify-content:space-between; height:64px; }
.navbar-brand { display:flex; flex-direction:row; align-items:center; gap:-0.5rem; color:var(--white); font-weight:800; font-size:1.2rem; text-decoration:none; }
.navbar-brand .brand-logo-img { height:30px; width:auto; transform:translateY(-9%); }
.navbar-brand .brand-logo-word { color:var(--skoolyst-cyan); font-size:.85rem; letter-spacing:.02em; }
.navbar-links { display:flex; align-items:center; gap:1.5rem; }
.navbar-links a { color:#CBD5E1; text-decoration:none; font-weight:500; }
.navbar-links a.is-active, .navbar-links a:hover { color:var(--white); }
.navbar-user { color:var(--white); font-weight:600; font-size:.9rem; }
.navbar-toggle { display:none; flex-direction:column; gap:4px; background:none; border:0; cursor:pointer; padding:6px; }
.navbar-toggle span { width:22px; height:2px; background:var(--white); display:block; }
@media (max-width:768px) {
  .navbar-toggle { display:flex; }
  .navbar-links { position:absolute; top:64px; left:0; right:0; background:var(--skoolyst-navy); flex-direction:column; align-items:flex-start; padding:1rem; display:none; gap:1rem; }
  .navbar-links.is-open { display:flex; }
}

/* ---- Footer ---- */
.site-footer { background:var(--skoolyst-navy); color:#CBD5E1; margin-top:3rem; }
.footer-inner { display:flex; justify-content:space-between; flex-wrap:wrap; gap:1.5rem; padding:2.5rem 0; }
.footer-logo { display:flex; flex-direction:row; align-items:center; gap:-0.5rem; color:var(--white); font-weight:800; font-size:1.1rem; margin:0; }
.footer-logo .brand-logo-img { height:28px; width:auto; transform:translateY(-9%); }
.footer-logo .brand-logo-word { color:var(--skoolyst-cyan); }
.footer-tagline { max-width:320px; color:#94A3B8; }
.footer-links { display:flex; gap:1.25rem; flex-wrap:wrap; }
.footer-links a { color:#CBD5E1; text-decoration:none; }
.footer-links a:hover { color:var(--white); }
.footer-bottom { border-top:1px solid rgba(255,255,255,.1); padding:1rem 0; text-align:center; color:#64748B; font-size:.85rem; }

/* ---- Layout sections ---- */
.site-main { min-height:60vh; }
.hero { text-align:center; padding:4rem 0 2rem; }
.hero h1 { font-size:2rem; max-width:640px; margin-inline:auto; }
.hero > p { max-width:640px; margin-inline:auto; color:var(--muted); line-height:1.6; }
.hero-search { display:flex; flex-wrap:wrap; gap:.5rem; max-width:480px; margin:1.5rem auto 0; }
.hero-search .form-control { flex:1; }
.post-grid, .stat-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(220px, 1fr)); gap:1.25rem; margin:1.5rem 0; }
.about-section { margin:3.5rem auto; }
.about-section h2 { font-size:1.5rem; margin:0 0 1rem; }
.about-section > p { max-width:720px; margin-inline:auto; line-height:1.7; color:var(--text); }
.about-section > p + p { margin-top:1rem; }
.about-card-icon { font-size:1.9rem; margin:0 0 .5rem; line-height:1; }
.about-cta { max-width:640px; text-align:center; margin:4rem auto; padding:3rem 2rem; background:var(--skoolyst-navy); border-radius:var(--radius); color:var(--white); }
.about-cta h2 { color:var(--white); }
.about-cta p { color:#CBD5E1; margin-bottom:1.5rem; }

/* ---- Legal pages (Terms, Privacy, etc.) ---- */
.legal-page { max-width:760px; margin-inline:auto; padding:1rem 0 4rem; }
.legal-callout { background:var(--surface); border-left:4px solid var(--skoolyst-blue); border-radius:var(--radius); padding:1.25rem 1.5rem; margin-bottom:2.5rem; }
.legal-callout p { margin:0; line-height:1.6; }
.legal-section { margin-bottom:2.5rem; }
.legal-section h2 { font-size:1.2rem; margin:0 0 .75rem; }
.legal-section p { line-height:1.7; color:var(--text); margin:0 0 .75rem; }
.legal-section ul { margin:0 0 .75rem; padding-left:1.25rem; line-height:1.8; color:var(--text); }
.legal-section ul li { margin-bottom:.25rem; }
.legal-updated { color:var(--muted); font-size:.85rem; border-top:1px solid var(--border); padding-top:1.5rem; }
.post-card-image { margin:-1.25rem -1.25rem 1rem; aspect-ratio:16/9; overflow:hidden; border-radius:var(--radius) var(--radius) 0 0; background:var(--surface); }
.post-card-image img { width:100%; height:100%; object-fit:cover; display:block; }
.post-card-meta { display:flex; gap:.75rem; flex-wrap:wrap; color:var(--muted); font-size:.8rem; margin-top:.5rem; }
.post-card-meta span { display:inline-flex; align-items:center; gap:.3rem; }
.newsletter { max-width:520px; margin-inline:auto; text-align:center; padding:2rem 0; }
.newsletter form { display:flex; flex-wrap:wrap; align-items:stretch; gap:.5rem; }
.newsletter form .form-group { flex:1; min-width:180px; margin-bottom:0; text-align:left; }
.newsletter form .form-control { height:100%; }
.newsletter .btn { flex-shrink:0; }
.stat-value { font-size:1.75rem; font-weight:800; color:var(--skoolyst-blue); margin:0; }
.stat-label { color:var(--muted); margin:.25rem 0 0; }

/* ---- Card ---- */
.card-header, .card-body, .card-footer { padding:1.25rem; }
.card-header { border-bottom:1px solid var(--border); }
.card-footer { border-top:1px solid var(--border); }
.card-header h3 { margin:0; font-size:1.05rem; }

/* ---- Forms ---- */
.form-group { margin-bottom:1rem; text-align:left; }
.form-group label { display:block; font-weight:600; margin-bottom:.35rem; font-size:.9rem; }
.form-group .required { color:#DC2626; }
.field-help {
  display:inline-flex; align-items:center; justify-content:center;
  width:15px; height:15px; border-radius:50%;
  background:var(--border); color:var(--white);
  font-size:.68rem; font-weight:700; font-style:italic; line-height:1;
  cursor:help; margin-left:.3rem; position:relative; vertical-align:middle;
}
.field-help:hover, .field-help:focus-visible { background:var(--skoolyst-blue); outline:none; }
.field-help::after {
  content:attr(data-tooltip);
  position:absolute; bottom:calc(100% + 8px); left:50%; transform:translateX(-50%);
  background:var(--skoolyst-navy); color:var(--white);
  padding:.5rem .7rem; border-radius:6px; font-size:.78rem; font-weight:400; font-style:normal;
  white-space:normal; width:max-content; max-width:220px; text-align:left; line-height:1.4;
  box-shadow:var(--shadow);
  opacity:0; visibility:hidden; pointer-events:none; transition:opacity .15s;
  z-index:60;
}
.field-help:hover::after, .field-help:focus-visible::after { opacity:1; visibility:visible; }
.form-control:focus { outline:2px solid var(--skoolyst-cyan); outline-offset:1px; border-color:var(--skoolyst-blue); }
textarea.form-control { min-height:120px; resize:vertical; }
.form-error { color:#DC2626; font-size:.82rem; margin:.35rem 0 0; }
.form-static { margin:0; padding:.7rem 0; color:var(--muted); }
.has-error .form-control { border-color:#DC2626; }

/* ---- Alerts ---- */
.alert { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.85rem 1rem; border-radius:var(--radius); margin:1rem 0; border:1px solid transparent; }
.alert-success { background:#ECFDF5; border-color:#A7F3D0; color:#065F46; }
.alert-error { background:#FEF2F2; border-color:#FECACA; color:#991B1B; }
.alert-warning { background:#FFFBEB; border-color:#FDE68A; color:#92400E; }
.alert-info { background:#EFF6FF; border-color:#BFDBFE; color:#1E40AF; }
.alert-close { background:none; border:0; font-size:1.1rem; line-height:1; cursor:pointer; color:inherit; }

/* ---- Badges ---- */
.badge { display:inline-block; padding:.2rem .6rem; border-radius:999px; font-size:.75rem; font-weight:700; text-transform:uppercase; letter-spacing:.03em; }
.badge-default { background:var(--surface); color:var(--muted); }
.badge-success { background:#ECFDF5; color:#065F46; }
.badge-warning { background:#FFFBEB; color:#92400E; }
.badge-danger { background:#FEF2F2; color:#991B1B; }
.badge-info { background:#EFF6FF; color:#1E40AF; }

/* ---- Modal ---- */
.modal[hidden] { display:none; }
.modal { position:fixed; inset:0; z-index:100; display:flex; align-items:center; justify-content:center; }
.modal-backdrop { position:absolute; inset:0; background:rgba(10,14,42,.6); }
.modal-dialog { position:relative; background:var(--white); border-radius:var(--radius); max-width:480px; width:min(90%, 480px); box-shadow:var(--shadow); }
.modal-header, .modal-body, .modal-footer { padding:1.25rem; }
.modal-header { display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--border); }
.modal-close { background:none; border:0; font-size:1.3rem; cursor:pointer; }
.modal-footer { border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:.5rem; }

/* ---- Pagination ---- */
.pagination { display:flex; gap:.4rem; justify-content:center; margin:1.5rem 0; flex-wrap:wrap; }
.pagination-item { padding:.5rem .85rem; border-radius:var(--radius); border:1px solid var(--border); text-decoration:none; color:var(--text); }
.pagination-item.is-active { background:var(--skoolyst-blue); border-color:var(--skoolyst-blue); color:var(--white); }
.pagination-item.is-disabled { opacity:.4; pointer-events:none; }

/* ---- Empty state ---- */
.empty-state { text-align:center; padding:3rem 1rem; color:var(--muted); }
.empty-state-title { font-weight:700; color:var(--text); font-size:1.1rem; margin:0 0 .5rem; }

/* ---- Auth layout ---- */
.auth-body { background:var(--skoolyst-navy); min-height:100vh; }
.auth-layout { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:2rem; }
.auth-card { background:var(--white); border-radius:var(--radius); padding:2.5rem; width:min(100%, 400px); box-shadow:var(--shadow); text-align:center; }
.auth-back { display:inline-flex; align-items:center; gap:.35rem; font-size:.85rem; color:var(--muted); text-decoration:none; margin-bottom:1rem; }
.auth-back:hover { color:var(--skoolyst-blue); }
.auth-brand { display:flex; flex-direction:row; align-items:center; justify-content:center; gap:.5rem; font-weight:800; font-size:1.2rem; margin-bottom:1.5rem; }
.auth-brand .brand-logo-img { height:36px; width:auto; transform:translateY(-9%); }
.auth-brand .brand-logo-word { color:var(--skoolyst-blue); }
.auth-card form { text-align:left; }
.auth-switch { margin-top:1rem; font-size:.9rem; color:var(--muted); }
.btn-sso { width:100%; gap:.6rem; margin-top:.5rem; }
.btn-sso img { border-radius:4px; }
.auth-divider { display:flex; align-items:center; gap:.75rem; margin:1.25rem 0; color:var(--muted); font-size:.85rem; }
.auth-divider::before, .auth-divider::after { content:""; flex:1; height:1px; background:var(--border, #e5e7eb); }

/* ---- Phase 6 additions ---- */
.archive-filters { display:flex; gap:.75rem; flex-wrap:wrap; margin:1.5rem 0; }
.archive-filters .form-control { flex:1; min-width:160px; }
.post-detail { max-width:760px; margin-inline:auto; padding:2rem 0; }
.post-meta { color:var(--muted); font-size:.9rem; }
.post-cover { width:100%; border-radius:var(--radius); margin:1rem 0; }
.post-body { line-height:1.7; margin:1.5rem 0; overflow-wrap:break-word; }
.post-body img { max-width:100%; height:auto; }
.post-body table { width:100%; border-collapse:collapse; margin:1.25rem 0; }
.post-body th, .post-body td { border:1px solid var(--border); padding:.6rem .75rem; text-align:left; word-break:break-word; }
.post-body th { background:var(--surface); font-weight:600; }
.post-body pre { max-width:100%; overflow-x:auto; }
.post-tags .badge { margin-right:.4rem; }
.comments { margin-top:2.5rem; border-top:1px solid var(--border); padding-top:1.5rem; }
.comment { padding:1rem 0; border-bottom:1px solid var(--border); }
.comment-author { font-weight:700; margin:0 0 .25rem; }

/* ---- Breadcrumb ---- */
.breadcrumb { margin:1rem 0 .5rem; }
.breadcrumb-list { display:flex; flex-wrap:wrap; align-items:center; gap:.25rem; list-style:none; margin:0; padding:0; font-size:.85rem; color:var(--muted); }
.breadcrumb-item + .breadcrumb-item::before { content:'›'; margin-right:.25rem; color:var(--border); }
.breadcrumb-item a { color:var(--muted); text-decoration:none; }
.breadcrumb-item a:hover { color:var(--skoolyst-blue); text-decoration:underline; }
.breadcrumb-item.is-current span { color:var(--text); font-weight:500; }
@media (max-width:768px) { .breadcrumb-list { font-size:.8rem; } }

/* ---- Ad slot ---- */
.ad-slot { position:relative; background:var(--white); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; margin:1.5rem 0; }
.ad-slot-label { position:absolute; top:.6rem; right:.6rem; background:rgba(10,14,42,.65); color:var(--white); font-size:.7rem; font-weight:600; letter-spacing:.03em; text-transform:uppercase; padding:.2rem .5rem; border-radius:999px; z-index:1; }
.ad-slot-card { display:flex; gap:1rem; align-items:center; padding:1rem; text-decoration:none; color:inherit; }
.ad-slot-card img { width:120px; height:80px; object-fit:cover; border-radius:calc(var(--radius) - 4px); flex-shrink:0; }
.ad-slot-body h3 { margin:0 0 .35rem; font-size:1rem; color:var(--text); }
.ad-slot-body p { margin:0 0 .6rem; color:var(--muted); font-size:.9rem; }
@media (max-width:520px) {
  .ad-slot-card { flex-direction:column; align-items:flex-start; }
  .ad-slot-card img { width:100%; height:140px; }
}

/* ===== Other Skoolyst Apps (cards above the footer) ===== */
.skoolyst-apps {
    --sk-primary: #0A2D52; --sk-primary-soft: #eef3f8; --sk-text: #1c2b3a; --sk-muted: #63758a;
    --sk-border: #e4e9f0; --sk-radius: 12px;
    --sk-shadow: 0 6px 24px rgba(10, 45, 82, 0.08); --sk-shadow-hover: 0 12px 32px rgba(10, 45, 82, 0.14);
    background: #fff; border-top: 1px solid var(--sk-border); padding: 48px 0; margin-top: 40px;
    font-family: 'Poppins', 'Segoe UI', sans-serif; line-height: 1.6;
}
.skoolyst-apps *, .skoolyst-apps *::before, .skoolyst-apps *::after { box-sizing: border-box; }
.skoolyst-apps-inner { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.skoolyst-apps-title { text-align: center; font-size: 24px; font-weight: 700; color: var(--sk-primary); margin: 0 0 28px; }
.skoolyst-apps-grid { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; }
.skoolyst-apps-grid li { flex: 0 1 calc((100% - 36px) / 3); margin: 0; padding: 0; }
.skoolyst-apps-grid li::before, .skoolyst-apps-grid li::marker { content: none; }
.skoolyst-app-card {
    display: flex; flex-direction: column; height: 100%; padding: 22px; background: #fff; text-decoration: none;
    border: 1px solid var(--sk-border); border-radius: var(--sk-radius); box-shadow: var(--sk-shadow); transition: .25s;
}
.skoolyst-app-card:hover, .skoolyst-app-card:focus-visible {
    box-shadow: var(--sk-shadow-hover); transform: translateY(-4px); border-color: var(--sk-primary); outline: none; text-decoration: none;
}
.skoolyst-app-icon {
    width: 44px; height: 44px; border-radius: 10px; background: var(--sk-primary-soft); color: var(--sk-primary);
    display: inline-flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 700; margin-bottom: 14px;
}
.skoolyst-app-name { font-weight: 600; font-size: 17px; color: var(--sk-text); margin-bottom: 4px; }
.skoolyst-app-desc { color: var(--sk-muted); font-size: 13.5px; line-height: 1.55; }
@media (max-width: 860px) { .skoolyst-apps-grid li { flex-basis: calc((100% - 18px) / 2); } }
@media (max-width: 560px) {
    .skoolyst-apps { padding: 36px 0; }
    .skoolyst-apps-inner { padding: 0 16px; }
    .skoolyst-apps-title { font-size: 21px; }
    .skoolyst-apps-grid { gap: 14px; }
    .skoolyst-apps-grid li { flex-basis: 100%; }
}
.skoolyst-apps + .site-footer { margin-top: 0; }

/* ===== Password show/hide toggle (components/input.php) ===== */
.password-field { position:relative; }
.password-field .form-control { padding-right:2.75rem; }
.password-toggle { position:absolute; top:50%; right:.35rem; transform:translateY(-50%); width:2.25rem; height:2.25rem; display:inline-flex; align-items:center; justify-content:center; border:0; border-radius:var(--radius); background:transparent; color:var(--muted); cursor:pointer; padding:0; }
.password-toggle:hover, .password-toggle:focus-visible { color:var(--skoolyst-blue); }
.password-toggle:focus-visible { outline:2px solid var(--skoolyst-blue); outline-offset:1px; }
.password-toggle .icon-eye-off, .password-toggle[aria-pressed="true"] .icon-eye { display:none; }
.password-toggle[aria-pressed="true"] .icon-eye-off { display:inline; }
/* Hide Edge/IE's own reveal button so there aren't two eyes. */
.password-field input::-ms-reveal, .password-field input::-ms-clear { display:none; }

/* Inline SVG icons (replaces Font Awesome, which was never loaded) */
.icon { width:1em; height:1em; flex-shrink:0; vertical-align:-.125em; }
.post-meta .icon { margin-inline-end:.15rem; }
.post-cover { height:auto; aspect-ratio:1200/630; object-fit:cover; }
.pagination-item.is-disabled { opacity:.5; pointer-events:none; }
.post-body[dir="rtl"] { text-align:right; line-height:2; }

/* Archive pages: exactly 4 cards per row (12 per page = 3 full rows) */
.post-grid--4 { grid-template-columns:repeat(4, minmax(0, 1fr)); }
@media (max-width:1024px) { .post-grid--4 { grid-template-columns:repeat(2, minmax(0, 1fr)); } }
@media (max-width:600px)  { .post-grid--4 { grid-template-columns:1fr; } }

/* "Read all articles" call-to-action under home lists */
.section-cta { text-align:center; margin:1.5rem 0 2rem; }
.section-cta .btn { padding:.8rem 1.6rem; font-size:1rem; }
