:root {
  --bg: #f4f2ec;
  --bg-alt: #ece9e0;
  --surface: #ffffff;
  --text: #1f2421;
  --muted: #5a615c;
  --border: #dcd7cb;
  --ring-track: #d9d3c9;

  --aqidah: #7fa08b;
  --fiqh: #c67b6b;
  --tafseer: #88a2b0;
  --hadith: #a4b362;
  --history: #d2b862;

  --accent: #2f4f42;
  --accent-contrast: #ffffff;
  --shadow: 0 10px 30px rgba(31, 36, 33, 0.08);
  --radius: 16px;
}

[data-theme="dark"] {
  --bg: #141816;
  --bg-alt: #1b201d;
  --surface: #222824;
  --text: #eef1ee;
  --muted: #b0b8b2;
  --border: #343d37;
  --ring-track: #2e3631;
  --accent: #8fb89d;
  --accent-contrast: #141816;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.6rem 1rem;
  z-index: 100;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.container {
  width: min(1140px, 92%);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text small {
  color: var(--muted);
  font-size: 0.78rem;
}

.main-nav {
  display: flex;
  gap: 1.5rem;
}

.main-nav a,
.mobile-nav a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
}

.main-nav a:hover,
.mobile-nav a:hover {
  color: var(--accent);
}

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

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
}

.mobile-only {
  display: none;
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 4%;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.hero {
  padding: 3.5rem 0 4rem;
}

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

.pill {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.15;
  margin: 0.9rem 0 1rem;
}

.hero h1 span {
  color: var(--accent);
}

.lead {
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 54ch;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 1.75rem 0 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.35rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.trust-badges {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.trust-badges li::before {
  content: "✓ ";
  color: var(--aqidah);
  font-weight: 700;
}

.hub-wrapper {
  position: relative;
  width: min(440px, 100%);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}

.hub-ring {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  border: 26px solid var(--ring-track);
}

.hub-center {
  position: absolute;
  inset: 33%;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 800;
  font-size: clamp(0.85rem, 1.8vw, 1.15rem);
  letter-spacing: 0.04em;
  z-index: 3;
}

.petal {
  position: absolute;
  width: 34%;
  height: 34%;
  border-radius: 50%;
  border: none;
  padding: 12px;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow);
}

.petal:hover,
.petal:focus-visible {
  transform: scale(1.06);
  z-index: 4;
}

.petal-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.35rem;
  line-height: 1.2;
}

.petal-inner strong {
  font-size: clamp(0.75rem, 1.4vw, 0.96rem);
}

.petal-inner small {
  font-size: clamp(0.6rem, 1vw, 0.72rem);
  color: var(--muted);
  margin-top: 2px;
}

.petal-aqidah { background: var(--aqidah); top: 2%; left: 33%; }
.petal-fiqh { background: var(--fiqh); top: 27%; right: 2%; }
.petal-tafseer { background: var(--tafseer); bottom: 5%; right: 13%; }
.petal-hadith { background: var(--hadith); bottom: 5%; left: 13%; }
.petal-history { background: var(--history); top: 27%; left: 2%; }

.section {
  padding: 4rem 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-head {
  text-align: center;
  max-width: 620px;
  margin: 0 auto 2.5rem;
}

.section-head h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 0.5rem;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.25rem;
}

.branch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: var(--shadow);
}

.branch-dot {
  width: 36px;
  height: 10px;
  border-radius: 999px;
}
.dot-aqidah { background: var(--aqidah); }
.dot-fiqh { background: var(--fiqh); }
.dot-tafseer { background: var(--tafseer); }
.dot-hadith { background: var(--hadith); }
.dot-history { background: var(--history); }

.branch-card h3 {
  margin: 0.25rem 0 0;
}

.branch-sub {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.branch-card p {
  margin: 0.25rem 0;
  font-size: 0.93rem;
}

.text-link {
  margin-top: auto;
  background: none;
  border: none;
  padding: 0.4rem 0 0;
  text-align: left;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.9rem;
}

.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
}

.filter-btn.active {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

.search-wrap input {
  width: min(300px, 100%);
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
}

.progress-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

#progress-text {
  font-weight: 600;
  font-size: 0.9rem;
}

.progress-track {
  flex: 1;
  min-width: 160px;
  height: 10px;
  background: var(--bg-alt);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--aqidah);
  transition: width 0.25s ease;
}

.curriculum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.module-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.badge {
  display: inline-block;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #1f2421;
}
.badge-aqidah { background: var(--aqidah); }
.badge-fiqh { background: var(--fiqh); }
.badge-tafseer { background: var(--tafseer); }
.badge-hadith { background: var(--hadith); }
.badge-history { background: var(--history); }

.level-tag {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.module-card h3 {
  margin: 0.2rem 0 0;
  font-size: 1.08rem;
}

.module-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.module-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.status-pill {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--aqidah);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 2rem;
}

.roadmap-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.roadmap-list li {
  display: flex;
  align-items: flex-start;
  gap: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
}

.step-num {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--bg-alt);
  font-weight: 800;
  display: grid;
  place-items: center;
  color: var(--accent);
}

.roadmap-list h3 {
  margin: 0 0 0.25rem;
}

.roadmap-list p {
  margin: 0;
  color: var(--muted);
}

.contact-box {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 2.5rem;
  align-items: start;
}

.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
}

.form-row {
  display: grid;
  gap: 0.35rem;
}

.form-row label {
  font-weight: 600;
  font-size: 0.9rem;
}

.form-row input,
.form-row select,
.form-row textarea {
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.form-feedback {
  margin: 0;
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 600;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
}

.footer-inner a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.lesson-modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  width: min(560px, 92%);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.lesson-modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.modal-card {
  padding: 1.6rem;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: -0.25rem;
}

.modal-topics {
  padding-left: 1.2rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.4rem;
}

@media (max-width: 860px) {
  .hero-grid,
  .contact-box {
    grid-template-columns: 1fr;
  }

  .main-nav {
    display: none;
  }

  .mobile-only {
    display: grid;
  }
}
