/* =================================================================
   رواد الجامعة — Stylesheet
   Aesthetic: Scholar's Manuscript (warm parchment + ink + gold)
   ================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Reem+Kufi:wght@400;500;600;700&family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=Amiri:ital,wght@0,400;0,700;1,400&display=swap');

/* -----------------------------------------------------------------
   1. Design Tokens (Light theme — default)
   ----------------------------------------------------------------- */
:root {
  /* Surfaces */
  --bg:          #f4ede0;
  --bg-alt:      #ebe0cb;
  --bg-card:     #fbf6ec;
  --bg-elevated: #ffffff;

  /* Ink */
  --ink:         #1d1813;
  --ink-soft:    #4a3f33;
  --ink-muted:   #7a6b58;
  --ink-faint:   #b3a48d;

  /* Accents */
  --gold:        #a67c2e;
  --gold-soft:   #c89a4a;
  --gold-faint:  #e8d4a8;
  --crimson:     #8b3a2f;     /* for important highlights */
  --sage:        #5a6b4a;     /* for success */

  /* Lines */
  --line:        #d6c9ad;
  --line-soft:   #e3d8c0;

  /* Shadows */
  --shadow-sm:   0 1px 2px rgba(29, 24, 19, 0.06);
  --shadow-md:   0 4px 12px rgba(29, 24, 19, 0.08), 0 1px 3px rgba(29, 24, 19, 0.04);
  --shadow-lg:   0 12px 32px rgba(29, 24, 19, 0.12), 0 4px 8px rgba(29, 24, 19, 0.06);

  /* Type scale */
  --font-display: 'Reem Kufi', serif;
  --font-body:    'IBM Plex Sans Arabic', sans-serif;
  --font-classic: 'Amiri', serif;

  /* Geometry */
  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Motion */
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --max-w:     1240px;
}

[data-theme="dark"] {
  --bg:          #16120d;
  --bg-alt:      #1f1a13;
  --bg-card:     #1c1812;
  --bg-elevated: #25201a;

  --ink:         #f1e7d4;
  --ink-soft:    #d4c5a8;
  --ink-muted:   #9b8d76;
  --ink-faint:   #5a4f3e;

  --gold:        #d4a849;
  --gold-soft:   #b8862e;
  --gold-faint:  #4a3a1c;
  --crimson:     #c4685a;
  --sage:        #8ba078;

  --line:        #2e2820;
  --line-soft:   #25201a;

  --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:   0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg:   0 12px 32px rgba(0, 0, 0, 0.5);
}

/* -----------------------------------------------------------------
   2. Reset & Base
   ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  transition: background-color 0.4s var(--ease-soft), color 0.4s var(--ease-soft);

  /* Subtle paper grain */
  background-image:
    radial-gradient(circle at 20% 10%, rgba(166, 124, 46, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(139, 58, 47, 0.03) 0%, transparent 40%);
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(circle at 20% 10%, rgba(212, 168, 73, 0.05) 0%, transparent 45%),
    radial-gradient(circle at 80% 90%, rgba(196, 104, 90, 0.03) 0%, transparent 45%);
}

img, svg { max-width: 100%; display: block; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

a {
  color: var(--ink);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

a:hover { color: var(--gold); }

/* Selection */
::selection { background: var(--gold-faint); color: var(--ink); }

/* -----------------------------------------------------------------
   3. Typography
   ----------------------------------------------------------------- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}

h1 { font-size: clamp(2.4rem, 5vw, 4rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
h3 { font-size: clamp(1.3rem, 2.5vw, 1.6rem); }
h4 { font-size: 1.15rem; }

p { margin: 0 0 1em; }

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--gold);
  display: inline-block;
}

.section-num {
  font-family: var(--font-classic);
  font-size: 0.9rem;
  color: var(--gold);
  letter-spacing: 0.05em;
  font-feature-settings: "ss01";
}

/* -----------------------------------------------------------------
   4. Layout
   ----------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 5rem 0;
}

@media (min-width: 768px) {
  .section { padding: 7rem 0; }
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 0;
  border: none;
}

/* -----------------------------------------------------------------
   5. Header / Navigation
   ----------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  max-width: var(--max-w);
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--bg);
  border-radius: 10px;
  font-family: var(--font-classic);
  font-weight: 700;
  font-size: 1rem;
  position: relative;
  flex-shrink: 0;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 1px solid var(--gold);
  border-radius: 13px;
  opacity: 0.6;
}

.brand-name { line-height: 1.1; }
.brand-tag {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
  display: block;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 2rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
  position: relative;
  padding: 0.4rem 0;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--ink);
}

.nav-links a.active::after {
  content: "";
  position: absolute;
  bottom: -4px;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--gold);
}

@media (min-width: 900px) {
  .nav-links { display: flex; }
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  transition: all 0.2s var(--ease);
  border: 1px solid var(--line);
}

.theme-toggle:hover {
  background: var(--bg-alt);
  color: var(--gold);
  border-color: var(--gold-soft);
}

.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.menu-toggle {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
}

@media (min-width: 900px) { .menu-toggle { display: none; } }

.mobile-menu {
  display: none;
  flex-direction: column;
  padding: 1rem 1.5rem 2rem;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg);
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line-soft);
  font-weight: 500;
  color: var(--ink-soft);
}
.mobile-menu a:last-child { border-bottom: none; }
@media (min-width: 900px) { .mobile-menu { display: none !important; } }

/* -----------------------------------------------------------------
   6. Hero
   ----------------------------------------------------------------- */
.hero {
  position: relative;
  padding: 5rem 0 3rem;
  overflow: hidden;
}

@media (min-width: 768px) {
  .hero { padding: 7rem 0 5rem; }
}

.hero-grid {
  display: grid;
  gap: 3rem;
  align-items: center;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: 1.4fr 1fr;
    gap: 4rem;
  }
}

.hero-eyebrow {
  margin-bottom: 1.5rem;
}

.hero-title {
  margin-bottom: 1.5rem;
}

.hero-title .accent { color: var(--gold); font-style: italic; font-family: var(--font-classic); font-weight: 700; }

.hero-lede {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 56ch;
  margin-bottom: 2.5rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero-art {
  position: relative;
  aspect-ratio: 1 / 1.1;
  max-width: 420px;
  margin-right: auto;
}

/* -----------------------------------------------------------------
   7. Buttons
   ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.95rem 1.6rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: -0.005em;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover {
  background: var(--gold);
  color: var(--bg);
  transform: translateY(-1px);
}

.btn-ghost {
  border-color: var(--ink-faint);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--ink);
  background: var(--bg-card);
  color: var(--ink);
}

.btn-gold {
  background: var(--gold);
  color: var(--bg);
}
.btn-gold:hover {
  background: var(--ink);
  transform: translateY(-1px);
}

.btn-icon {
  padding: 0.7rem;
  width: 44px;
  height: 44px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* -----------------------------------------------------------------
   8. Section Cards (Landing)
   ----------------------------------------------------------------- */
.section-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 3rem;
  gap: 1rem;
}

@media (min-width: 768px) {
  .section-header {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }
}

.section-header h2 { max-width: 18ch; }
.section-header p { color: var(--ink-muted); max-width: 42ch; margin: 0; }

.cards-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 700px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .cards-grid { grid-template-columns: repeat(3, 1fr); }
  .cards-grid .card-feature { grid-column: span 2; }
}

.card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: all 0.35s var(--ease);
  display: flex;
  flex-direction: column;
  min-height: 280px;
  overflow: hidden;
  cursor: pointer;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, var(--gold-faint) 200%);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--gold-soft);
  box-shadow: var(--shadow-md);
}

.card:hover::before { opacity: 1; }

.card-num {
  font-family: var(--font-classic);
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-num::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.card h3 {
  margin-bottom: 0.75rem;
}

.card p {
  color: var(--ink-muted);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

.card-arrow {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.card-arrow svg { transition: transform 0.3s var(--ease); }
.card:hover .card-arrow svg { transform: translateX(-6px); }

.card-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--bg-alt);
  display: grid;
  place-items: center;
  margin-bottom: 1.25rem;
  color: var(--gold);
  border: 1px solid var(--line);
}

.card-feature {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.card-feature h3, .card-feature .card-num { color: var(--gold); }
.card-feature p { color: var(--ink-faint); }
.card-feature .card-arrow { color: var(--bg); }
.card-feature .card-icon { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); color: var(--gold); }
.card-feature::before { background: linear-gradient(135deg, transparent 60%, rgba(212, 168, 73, 0.15) 200%); }

/* -----------------------------------------------------------------
   9. Page Header (sub-pages)
   ----------------------------------------------------------------- */
.page-head {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 3rem;
}

.page-head .breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.page-head .breadcrumb a { color: var(--ink-muted); }
.page-head .breadcrumb a:hover { color: var(--gold); }

.page-head h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin-bottom: 0.75rem;
}

.page-head p {
  color: var(--ink-muted);
  font-size: 1.05rem;
  max-width: 60ch;
  margin: 0;
}

/* -----------------------------------------------------------------
   10. Tabs (Qudurat page)
   ----------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 3rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 1rem 1.25rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}

.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--gold);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp 0.4s var(--ease); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -----------------------------------------------------------------
   11. Topic Cards (Expandable)
   ----------------------------------------------------------------- */
.topics {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 700px) {
  .topics { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1100px) {
  .topics { grid-template-columns: repeat(3, 1fr); }
}

.topic {
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s var(--ease);
}

.topic.expanded {
  grid-column: 1 / -1;
  border-color: var(--gold-soft);
  box-shadow: var(--shadow-lg);
}

.topic-head {
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  cursor: pointer;
  width: 100%;
  text-align: right;
}

.topic-head:hover { background: var(--bg-alt); }

.topic-num {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--font-classic);
  font-weight: 700;
  color: var(--gold);
}

.topic.expanded .topic-num {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
}

.topic-title {
  flex: 1;
  min-width: 0;
}

.topic-title h3 {
  font-size: 1.15rem;
  margin: 0 0 0.25rem;
}

.topic-title p {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin: 0;
}

.topic-toggle {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: grid;
  place-items: center;
  color: var(--ink-muted);
  transition: transform 0.3s var(--ease);
}

.topic.expanded .topic-toggle { transform: rotate(45deg); color: var(--gold); }

.topic-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s var(--ease);
}

.topic.expanded .topic-body { grid-template-rows: 1fr; }

.topic-body-inner {
  overflow: hidden;
  min-height: 0;
}

.topic-content {
  padding: 0 1.5rem 1.5rem;
  border-top: 1px solid var(--line-soft);
  margin-top: 0.25rem;
  padding-top: 1.5rem;
}

.topic-content h4 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 1.5rem 0 0.75rem;
}

.topic-content h4:first-child { margin-top: 0; }

.topic-content p { color: var(--ink-soft); }

.formula {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-family: var(--font-classic);
  font-size: 1.1rem;
  color: var(--ink);
  margin: 0.75rem 0;
  line-height: 1.8;
  border-right: 3px solid var(--gold);
}

.example {
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 0.75rem 0;
  border-right: 3px solid var(--ink-faint);
}

.example .q { font-weight: 500; color: var(--ink); margin-bottom: 0.5rem; }
.example .a { color: var(--ink-soft); font-size: 0.95rem; }
.example .a strong { color: var(--gold); }

/* -----------------------------------------------------------------
   12. Pomodoro Timer
   ----------------------------------------------------------------- */
.pomodoro-wrap {
  max-width: 540px;
  margin: 0 auto;
  text-align: center;
  padding: 2rem 0 4rem;
}

.pomodoro-modes {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 3rem;
}

.mode-btn {
  padding: 0.6rem 1.25rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-muted);
  border-radius: 999px;
  transition: all 0.2s var(--ease);
}

.mode-btn.active {
  background: var(--ink);
  color: var(--bg);
}

.timer-ring {
  position: relative;
  width: min(360px, 80vw);
  height: min(360px, 80vw);
  margin: 0 auto 2.5rem;
}

.timer-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-track { stroke: var(--line); fill: none; stroke-width: 6; }

.timer-progress {
  stroke: var(--gold);
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s var(--ease-soft);
}

.timer-display {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.timer-time {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 12vw, 5.5rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.timer-label {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.timer-controls {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.timer-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 3rem;
  border: 1px solid var(--line);
}

.stat {
  background: var(--bg-card);
  padding: 1.25rem 1rem;
  text-align: center;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 0.4rem;
  letter-spacing: 0.04em;
}

/* -----------------------------------------------------------------
   13. Schedule Table
   ----------------------------------------------------------------- */
.schedule-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
  justify-content: space-between;
  align-items: center;
}

.schedule-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.schedule-table th,
.schedule-table td {
  padding: 1rem 1.25rem;
  text-align: right;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  font-size: 0.95rem;
}

.schedule-table thead {
  background: var(--bg-alt);
}

.schedule-table th {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--line);
}

.schedule-table tbody tr:last-child td { border-bottom: none; }
.schedule-table tbody tr:hover td { background: var(--bg-alt); }

.schedule-day {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  width: 120px;
  white-space: nowrap;
}

.schedule-table td[contenteditable="true"]:focus {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
  background: var(--bg);
}

.schedule-time {
  font-family: var(--font-classic);
  color: var(--gold);
  font-size: 0.95rem;
  white-space: nowrap;
  width: 110px;
}

.schedule-task { color: var(--ink-soft); }

/* -----------------------------------------------------------------
   14. Links Page
   ----------------------------------------------------------------- */
.links-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 700px) {
  .links-grid { grid-template-columns: repeat(2, 1fr); }
}

.link-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  transition: all 0.25s var(--ease);
  color: var(--ink);
}

.link-card:hover {
  border-color: var(--gold-soft);
  background: var(--bg);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}

.link-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--gold);
}

.link-body { flex: 1; min-width: 0; }
.link-body h3 {
  font-size: 1.05rem;
  margin: 0 0 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.link-body p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

.link-arrow {
  align-self: center;
  color: var(--ink-faint);
  transition: all 0.2s var(--ease);
}

.link-card:hover .link-arrow { color: var(--gold); transform: translateX(-4px); }

.links-section {
  margin-bottom: 3rem;
}

.links-section h2 {
  margin-bottom: 0.5rem;
  font-size: 1.6rem;
}

.links-section .lead {
  color: var(--ink-muted);
  margin-bottom: 1.5rem;
}

/* -----------------------------------------------------------------
   15. Chatbot
   ----------------------------------------------------------------- */
.chat-shell {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 180px);
  min-height: 560px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-alt);
}

.chat-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--gold);
  display: grid;
  place-items: center;
  font-family: var(--font-classic);
  font-weight: 700;
  font-size: 1.2rem;
  position: relative;
  flex-shrink: 0;
}

.chat-avatar::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 11px; height: 11px;
  background: var(--sage);
  border: 2px solid var(--bg-alt);
  border-radius: 50%;
}

.chat-head-info { flex: 1; min-width: 0; }
.chat-head-info h3 { margin: 0; font-size: 1rem; }
.chat-head-info p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-muted);
}
.chat-head-info p::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--sage);
  border-radius: 50%;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.chat-clear {
  font-size: 0.82rem;
  color: var(--ink-muted);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  transition: all 0.2s var(--ease);
}
.chat-clear:hover { color: var(--crimson); border-color: var(--crimson); }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  scroll-behavior: smooth;
}

.chat-body::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.chat-body::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }

.message {
  display: flex;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
  animation: msgIn 0.3s var(--ease);
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message.user { flex-direction: row-reverse; }

.msg-avatar {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-alt);
  display: grid;
  place-items: center;
  font-family: var(--font-classic);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gold);
  border: 1px solid var(--line);
}

.message.user .msg-avatar {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.msg-bubble {
  max-width: 78%;
  padding: 0.85rem 1.1rem;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  font-size: 0.97rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.msg-bubble p { margin: 0 0 0.5em; }
.msg-bubble p:last-child { margin: 0; }
.msg-bubble strong { color: var(--ink); font-weight: 600; }
.msg-bubble code {
  background: var(--bg-alt);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-family: var(--font-classic);
  font-size: 0.95em;
  color: var(--gold);
}

.msg-bubble ul, .msg-bubble ol {
  padding-right: 1.2em;
  margin: 0.4em 0;
}

.msg-bubble .formula-inline {
  background: var(--bg-alt);
  border-right: 2px solid var(--gold);
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  margin: 0.5rem 0;
  font-family: var(--font-classic);
  display: block;
}

.message.user .msg-bubble {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.message.user .msg-bubble strong { color: var(--gold); }
.message.user .msg-bubble code { background: rgba(255,255,255,0.08); color: var(--gold); }

.typing { display: flex; gap: 4px; padding: 0.5rem 0; }
.typing span {
  width: 7px; height: 7px;
  background: var(--ink-faint);
  border-radius: 50%;
  animation: typingDot 1.4s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.quick-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  overflow-x: auto;
  border-top: 1px solid var(--line-soft);
  scrollbar-width: none;
  background: var(--bg-card);
}
.quick-actions::-webkit-scrollbar { display: none; }

.quick-btn {
  flex-shrink: 0;
  padding: 0.5rem 0.95rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-weight: 500;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}
.quick-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--bg-card);
}

/* ----- Quiz card inside chat bubble ----- */
.quiz-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0.4rem 0;
}
.quiz-q {
  font-weight: 600;
  margin-bottom: 0.85rem;
  line-height: 1.7;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.7rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  transition: all 0.18s var(--ease);
  font-size: 0.95rem;
}
.quiz-option:hover:not(.disabled) {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, var(--bg-card));
  transform: translateX(-2px);
}
.quiz-option.disabled { cursor: default; opacity: 0.6; }
.quiz-option.selected {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 12%, var(--bg-card));
  opacity: 1;
}
.quiz-letter {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  font-family: var(--font-display, var(--font-body));
}
.quiz-text { flex: 1; line-height: 1.6; }

.quiz-feedback {
  display: inline-block;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  margin: 0.2rem 0 0.4rem;
  font-size: 0.95rem;
}
.quiz-feedback.correct {
  background: color-mix(in srgb, #2d7a4a 15%, var(--bg));
  color: #2d7a4a;
  border: 1px solid color-mix(in srgb, #2d7a4a 35%, transparent);
}
.quiz-feedback.wrong {
  background: color-mix(in srgb, #b04545 12%, var(--bg));
  color: #b04545;
  border: 1px solid color-mix(in srgb, #b04545 35%, transparent);
}
[data-theme="dark"] .quiz-feedback.correct { color: #6ed393; background: color-mix(in srgb, #2d7a4a 25%, transparent); }
[data-theme="dark"] .quiz-feedback.wrong { color: #ff8a8a; background: color-mix(in srgb, #b04545 22%, transparent); }

.chat-form {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-card);
  align-items: flex-end;
}

.chat-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.4rem 0.4rem 1rem;
  transition: border-color 0.2s var(--ease);
}

.chat-input-wrap:focus-within {
  border-color: var(--gold);
}

.chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 0.65rem 0.5rem;
  font-family: inherit;
  font-size: 0.97rem;
  color: var(--ink);
  resize: none;
  max-height: 120px;
  line-height: 1.5;
}

.chat-input::placeholder { color: var(--ink-faint); }

.send-btn {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  display: grid;
  place-items: center;
  transition: all 0.2s var(--ease);
}

.send-btn:hover { background: var(--gold); transform: scale(1.05); }
.send-btn:disabled { background: var(--ink-faint); cursor: not-allowed; transform: none; }

/* -----------------------------------------------------------------
   16. Footer
   ----------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 3rem 0 2rem;
  margin-top: 5rem;
  background: var(--bg-alt);
}

.footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
  margin-bottom: 2.5rem;
}

@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; }
}

.footer-grid h4 {
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 1rem;
}

.footer-grid p { color: var(--ink-muted); font-size: 0.92rem; max-width: 38ch; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 0.5rem; }
.footer-grid a { font-size: 0.92rem; color: var(--ink-soft); }
.footer-grid a:hover { color: var(--gold); }

.footer-bottom {
  border-top: 1px solid var(--line-soft);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

/* -----------------------------------------------------------------
   17. Hero ornamental SVG illustration  
   ----------------------------------------------------------------- */
.hero-illustration {
  width: 100%;
  height: 100%;
}

.illust-circle { fill: none; stroke: var(--gold); stroke-width: 1.2; }
.illust-circle-faint { fill: none; stroke: var(--gold); stroke-width: 0.6; opacity: 0.4; }
.illust-text { font-family: var(--font-classic); font-weight: 700; fill: var(--ink); }
.illust-num { font-family: var(--font-display); fill: var(--gold); font-weight: 600; }
.illust-shape { fill: var(--ink); }
.illust-shape-soft { fill: var(--gold-faint); }

/* -----------------------------------------------------------------
   18. Reveal-on-load animations
   ----------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  animation: revealIn 0.8s var(--ease) forwards;
}

.reveal:nth-child(1) { animation-delay: 0.05s; }
.reveal:nth-child(2) { animation-delay: 0.15s; }
.reveal:nth-child(3) { animation-delay: 0.25s; }
.reveal:nth-child(4) { animation-delay: 0.35s; }
.reveal:nth-child(5) { animation-delay: 0.45s; }
.reveal:nth-child(6) { animation-delay: 0.55s; }

@keyframes revealIn {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal * { animation: none !important; opacity: 1 !important; transform: none !important; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* -----------------------------------------------------------------
   19. Toast / Notice
   ----------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 50%;
  transform: translateX(50%) translateY(100px);
  background: var(--ink);
  color: var(--bg);
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all 0.4s var(--ease);
  z-index: 100;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(50%) translateY(0);
}

/* -----------------------------------------------------------------
   20. Utilities
   ----------------------------------------------------------------- */
.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;
}

.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
