/* Khidmah Roster — design tokens and base styles (spec 07). */

/* A hidden element stays hidden even when other rules set display. */
[hidden] { display: none !important; }

:root {
  --emerald-900: #0b3d2e;   /* header, headings */
  --emerald-700: #14664a;   /* primary buttons, active tab */
  --emerald-500: #1f8a63;   /* hover, accents */
  --emerald-100: #dff0e8;   /* table stripes, chips */
  --gold-500:   #c9a227;    /* ornament, borders, today ring */
  --gold-300:   #e6cf7a;    /* ornament on dark */
  --cream:      #fbf6e9;    /* page background */
  --sand:       #f1e8cf;    /* cards */
  --ink:        #1d2b26;    /* body text */
  --ink-soft:   #51635b;    /* secondary text */
  --midnight:   #14213d;    /* dialogs header, cancelled day accent */
  --danger:     #a63d2f;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(11, 61, 46, .12);
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Amiri", "Noto Naskh Arabic", "Scheherazade New", Georgia, serif;
}
* {
  box-sizing: border-box;
}

/* Khatam (8-pointed star) pattern on cream. */
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--cream);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill='none' stroke='%23c9a227' stroke-opacity='.28' stroke-width='1'%3E%3Crect x='15' y='15' width='30' height='30'/%3E%3Crect x='15' y='15' width='30' height='30' transform='rotate(45 30 30)'/%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/svg%3E");
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
}

/* Typography: display font for headings and Arabic text. */
h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.3;
  margin: 0 0 .5em;
}
[lang="ar"] {
  font-family: var(--font-display);
  line-height: 1.8;
}

/* Screen-reader-only helper. */
.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;
}

/* Header plate: emerald-900 star field, gold rule, arched inner plate. */
.site-header {
  background-color: var(--emerald-900);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill='none' stroke='%23e6cf7a' stroke-opacity='.35' stroke-width='1'%3E%3Crect x='15' y='15' width='30' height='30'/%3E%3Crect x='15' y='15' width='30' height='30' transform='rotate(45 30 30)'/%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/svg%3E");
  border-bottom: 4px solid var(--gold-500);
}
.header-plate {
  max-width: 720px;
  margin: 0 auto;
  padding: 26px 24px 20px;
  text-align: center;
  background-color: var(--emerald-700);
  border-radius: 120px 120px 0 0 / 70px 70px 0 0;
}
.bismillah {
  margin: 0;
  font-size: 1.8rem;
  color: var(--gold-300);
}
.title {
  margin: .15em 0 0;
  font-size: 2.1rem;
  color: #ffffff;
}
.title-ar {
  color: var(--gold-300);
  font-size: 1.15em;
}
.subtitle {
  margin: .2em 0 0;
  color: var(--emerald-100);
}

/* Buttons: pill-shaped, ≥44px, subtle 150ms motion. */
.btn {
  min-height: 44px;
  padding: 8px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.btn:focus-visible {
  outline: 3px solid var(--gold-500);
  outline-offset: 2px;
}
.btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
}
.btn-primary {
  background-color: var(--emerald-700);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--emerald-500);
}
.btn-secondary {
  background-color: transparent;
  border-color: var(--emerald-700);
  color: var(--emerald-900);
}
.btn-secondary:hover {
  background-color: var(--emerald-100);
}
.btn-danger {
  background-color: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger:hover {
  background-color: rgba(166, 61, 47, .08);
}

/* Buttons sitting on the dark header. */
.header-row .btn-secondary {
  border-color: var(--gold-300);
  color: var(--emerald-100);
}
.header-row .btn-secondary:hover {
  background-color: rgba(255, 255, 255, .1);
}

/* Badges: words, never color alone. */
.badge {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
}
.badge-today {
  background-color: var(--gold-500);
  color: var(--emerald-900);
}
.badge-upcoming {
  background-color: var(--emerald-100);
  color: var(--emerald-900);
}
.badge-noclass {
  background-color: var(--midnight);
  color: #ffffff;
}

/* Loading skeleton. */
.skeleton {
  min-height: 1.2em;
  border-radius: 8px;
  background-color: var(--emerald-100);
  animation: pulse 1.2s ease-in-out infinite alternate;
}
@keyframes pulse {
  from { opacity: .5; }
  to { opacity: 1; }
}

/* Toasts (dom.js). */
.toast-host {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 1000;
}
.toast {
  padding: 10px 18px;
  border: 1px solid var(--gold-500);
  border-radius: 999px;
  background-color: var(--emerald-900);
  color: var(--emerald-100);
  box-shadow: var(--shadow);
}

/* Dialogs and drawer: midnight header strip, gold rule, cream body. */
dialog {
  border: none;
  border-radius: var(--radius);
  background-color: var(--cream);
  box-shadow: var(--shadow);
  max-width: 90vw;
}
dialog::backdrop {
  background-color: rgba(20, 33, 61, .45);
}
#drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  background-color: var(--cream);
  box-shadow: var(--shadow);
  z-index: 900;
}

/* Footer. */
.site-footer {
  padding: 24px 16px 32px;
  text-align: center;
  color: var(--ink-soft);
  font-size: .85rem;
}
.site-footer p {
  margin: 4px 0;
}

/* Honor reduced-motion. */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
