/* Suhoolah shared design system and site shell */
:root {
  --suh-bg: #ffffff;
  --suh-surface: #f8fafc;
  --suh-surface-strong: #f1f5f9;
  --suh-text: #111827;
  --suh-muted: #4b5563;
  --suh-border: #cbd5e1;
  --suh-primary: #0f766e;
  --suh-primary-dark: #115e59;
  --suh-primary-soft: #ccfbf1;
  --suh-focus: #f59e0b;
  --suh-danger: #991b1b;
  --suh-success: #166534;
  --suh-radius: 0.75rem;
  --suh-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --suh-content: 72rem;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 20rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.6;
  color: var(--suh-text);
  background: var(--suh-bg);
}

img { max-width: 100%; height: auto; }

/* Shared keyboard focus */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--suh-focus);
  outline-offset: 3px;
}

/* Skip link */
.skip-link {
  position: fixed !important;
  inset-block-start: 0.75rem !important;
  inset-inline-start: 0.75rem !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0.7rem 1rem !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
  transform: translateY(-200%);
  background: #000 !important;
  color: #fff !important;
  border-radius: 0.4rem;
  text-decoration: none;
  font-weight: 700;
  z-index: 1000000;
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  inset-inline-start: 50% !important;
  transform: translate(-50%, 0);
}
html[dir="rtl"] .skip-link:focus,
html[dir="rtl"] .skip-link:focus-visible { transform: translate(50%, 0); }

/* Global header */
.suhoolah-global-header {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: start !important;
  color: var(--suh-text) !important;
  background: #fff !important;
  border-bottom: 1px solid var(--suh-border);
  position: relative;
  z-index: 1000;
}

.suhoolah-header-inner {
  max-width: var(--suh-content);
  margin-inline: auto;
  padding: 0.75rem 1rem;
  display: grid;
  grid-template-columns: minmax(13rem, auto) minmax(0, 1fr) auto auto;
  grid-template-areas: "brand primary utility account";
  align-items: center;
  gap: 0.55rem 1rem;
}

.suhoolah-brand {
  grid-area: brand;
  margin: 0 !important;
  padding: 0 !important;
}

.suhoolah-brand a {
  display: inline-flex !important;
  align-items: center;
  gap: 0.65rem;
  color: var(--suh-text) !important;
  text-decoration: none !important;
  font-weight: 800;
  line-height: 1.2;
}

.suhoolah-logo {
  display: block !important;
  width: auto !important;
  height: 3.5rem !important;
  max-width: 11rem !important;
  max-height: 3.5rem !important;
  min-width: 0 !important;
  min-height: 0 !important;
  object-fit: contain;
  visibility: visible !important;
  opacity: 1 !important;
}

.suhoolah-brand-text { max-width: 14rem; white-space: nowrap; }

.suhoolah-language-switcher {
  grid-area: utility;
  justify-self: end;
}

.suhoolah-language-switcher a {
  display: inline-block;
  padding: 0.4rem 0.6rem;
  color: var(--suh-primary-dark) !important;
  font-weight: 700;
}

.suhoolah-global-nav {
  grid-area: primary;
  min-width: 0;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
}

.suhoolah-global-nav ul,
.suhoolah-footer-links,
.suhoolah-account-nav ul {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.suhoolah-global-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.35rem;
}

.suhoolah-global-nav li { margin: 0 !important; }

.suhoolah-global-nav a {
  display: inline-block;
  padding: 0.45rem 0.6rem !important;
  border-radius: 0.4rem;
  color: var(--suh-primary-dark) !important;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.suhoolah-global-nav a:hover { background: var(--suh-primary-soft); }
.suhoolah-global-nav a[aria-current="page"] {
  color: var(--suh-text) !important;
  background: var(--suh-surface-strong);
  text-decoration-thickness: 0.15em;
}

/* Account menu */
.suhoolah-account-nav {
  grid-area: account;
  justify-self: end;
  align-self: center;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
}

.suhoolah-account-nav details { position: relative; }
.suhoolah-account-nav summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--suh-primary-dark);
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--suh-border);
  border-radius: 0.45rem;
  background: #fff;
}

.suhoolah-account-nav details[open] summary { background: var(--suh-surface-strong); }

.suhoolah-account-panel {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 0.4rem);
  width: min(21rem, calc(100vw - 2rem));
  padding: 0.75rem;
  border: 1px solid var(--suh-border);
  border-radius: var(--suh-radius);
  background: #fff;
  box-shadow: var(--suh-shadow);
  z-index: 1100;
}

.suhoolah-account-email {
  margin: 0 0 0.6rem !important;
  color: var(--suh-muted);
  overflow-wrap: anywhere;
}

.suhoolah-account-nav li { margin: 0 !important; }
.suhoolah-account-nav li + li { margin-top: 0.15rem !important; }
.suhoolah-account-nav li a {
  display: block;
  padding: 0.5rem 0.55rem;
  border-radius: 0.35rem;
  color: var(--suh-primary-dark);
}
.suhoolah-account-nav li a:hover { background: var(--suh-surface-strong); }

/* Main content foundation: intentionally conservative so page-specific layouts remain intact */
body > main {
  width: min(100% - 2rem, var(--suh-content));
  margin-inline: auto;
}

body > main:first-of-type { padding-block-start: 1.5rem; }

:where(main) h1 { line-height: 1.2; }
:where(main) h2, :where(main) h3 { line-height: 1.3; }

/* Shared component polish for existing common classes */
:where(.card, .panel, .summary-box) {
  border-color: var(--suh-border);
}

:where(button, .button, .button-link, input[type="submit"], input[type="button"]) {
  font: inherit;
}

:where(input, select, textarea) {
  max-width: 100%;
}

:where(.notice, .alert, .status-message) {
  overflow-wrap: anywhere;
}

/* Global footer */
.suhoolah-global-footer {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  margin: 3rem 0 0 !important;
  padding: 0 !important;
  text-align: start !important;
  color: var(--suh-text) !important;
  background: var(--suh-surface) !important;
  border-top: 1px solid var(--suh-border);
}

.suhoolah-footer-inner {
  max-width: var(--suh-content);
  margin-inline: auto;
  padding: 1.4rem 1rem;
}

.suhoolah-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

.suhoolah-footer-links li { margin: 0 !important; }
.suhoolah-footer-links a { color: var(--suh-primary-dark) !important; }
.suhoolah-copyright { margin: 0.85rem 0 0 !important; color: var(--suh-muted); }

/* RTL-safe placement uses logical properties; only alignment-specific adjustment needed. */
html[dir="rtl"] .suhoolah-header-inner { text-align: right; }
html[dir="rtl"] .suhoolah-footer-inner { text-align: right; }

@media (max-width: 1100px) {
  .suhoolah-header-inner {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "brand utility account"
      "primary primary primary";
  }
  .suhoolah-global-nav ul { justify-content: flex-start; }
}

@media (max-width: 560px) {
  .suhoolah-header-inner { padding: 0.65rem 0.75rem; }
  .suhoolah-logo { height: 2.8rem !important; max-height: 2.8rem !important; }
  .suhoolah-brand-text { font-size: 0.95rem; max-width: 9rem; }
  .suhoolah-global-nav ul { display: grid; grid-template-columns: 1fr; gap: 0; }
  .suhoolah-global-nav a { width: 100%; padding-block: 0.5rem !important; }
  .suhoolah-account-nav { justify-self: stretch; }
  .suhoolah-account-nav summary { width: 100%; }
  .suhoolah-account-panel { inset-inline-start: 0; inset-inline-end: auto; width: 100%; }
  body > main { width: min(100% - 1.25rem, var(--suh-content)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .suhoolah-global-header,
  .suhoolah-global-footer,
  .suhoolah-account-panel,
  .suhoolah-account-nav summary {
    border: 1px solid CanvasText;
  }
}
