:root {
  --bg: #f6f4ef;
  --fg: #00205b;
  --muted: #5a6b85;
  --accent: #ba0c2f;
  --line: rgba(0, 32, 91, 0.18);
  --stripe: rgba(0, 32, 91, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
}
html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 0.4s ease,
    color 0.4s ease;
}

.page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0 clamp(24px, 5vw, 56px) 32px;
  gap: 40px;
}

/* ── Topbar ─────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  transition: background-color 0.4s ease;
}

.brand {
  color: var(--fg);
  font-family: "Instrument Serif", serif;
  font-size: 20px;
  letter-spacing: 0.005em;
  text-transform: none;
  text-decoration: none;
}
.brand em {
  font-style: italic;
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 22px;
  align-items: center;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}
.nav a:hover,
.nav a.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}
.nav-divider {
  width: 1px;
  height: 18px;
  background: var(--line);
  display: inline-block;
}

/* Non-clickable "coming soon" nav item with hover tooltip */
.nav-soon {
  position: relative;
  color: var(--muted);
  opacity: 0.6;
  cursor: default;
  padding: 4px 0;
  outline: none;
}
.nav-soon::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  top: calc(100% + 11px);
  transform: translateX(-50%) translateY(-4px);
  width: max-content;
  max-width: min(220px, 72vw);
  background: var(--fg);
  color: var(--bg);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 12px 30px -16px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 6;
}
.nav-soon:hover::after,
.nav-soon:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.nav-toggle {
  display: none;
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--fg);
  padding: 6px 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.12em;
}

/* ── Hero ───────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) clamp(220px, 24vw, 300px) minmax(220px, 0.65fr);
  gap: clamp(28px, 4.5vw, 60px);
  align-items: center;
  padding: 24px 0 8px;
  min-height: calc(100vh - 140px);
}

.text-col {
  max-width: 560px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 28px;
}
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.greeting {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 28px;
}

h1 {
  font-family: "Instrument Serif", "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(48px, 8.5vw, 124px);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
}
h1 em {
  font-style: italic;
  color: var(--accent);
}
h1 .h1-sub {
  display: block;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-style: normal;
  font-size: 0.16em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 6px 0 10px;
}

.lede {
  max-width: 480px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 36px;
}
.lede strong {
  color: var(--fg);
  font-weight: 400;
}

/* Hover/focus keyword tooltips in the lede */
.kw {
  position: relative;
  color: var(--fg);
  border-bottom: 1px dotted var(--accent);
  cursor: help;
  outline: none;
}
.kw::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 11px);
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: min(240px, 72vw);
  background: var(--fg);
  color: var(--bg);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-transform: none;
  text-align: center;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 12px 30px -16px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 6;
}
.kw::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  transform: translateX(-50%) translateY(4px);
  border: 6px solid transparent;
  border-top-color: var(--fg);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 6;
}
.kw:hover::after,
.kw:focus-visible::after,
.kw:hover::before,
.kw:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Projects CTA ───────────────────────────────── */
.cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--fg);
  color: var(--bg);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 16px 28px;
  border: 1px solid var(--fg);
  border-radius: 999px;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}
.cta:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  transform: translateY(-2px);
}
.cta .arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}
.cta:hover .arrow {
  transform: translate(2px, 2px);
}

/* ── Portrait + links ───────────────────────────── */
.portrait {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 300px;
  justify-self: center;
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    0 30px 60px -24px rgba(0, 0, 0, 0.35),
    0 12px 24px -16px rgba(0, 0, 0, 0.25);
}
.portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.portrait .corner {
  display: none;
}

.links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 260px;
  justify-self: end;
}
.links a,
.links button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--fg);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: inherit;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    color 0.2s ease,
    background 0.2s ease;
}
.links a:hover,
.links button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--stripe);
}
.links .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.links .label {
  flex: 1;
  text-align: left;
}
.links .ext {
  opacity: 0.5;
  font-size: 14px;
}
.links a.link-disabled,
.links a[aria-disabled="true"] {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

/* Hadith block (used in place of .links on Madinah page) */
.hadith-card {
  width: 100%;
  max-width: 280px;
  justify-self: end;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}
.hadith-ar {
  font-family: "Amiri", "Scheherazade New", "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.75;
  color: var(--fg);
  direction: rtl;
  text-align: right;
}
.hadith-en {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: 15px;
  line-height: 1.5;
  color: var(--fg);
  opacity: 0.9;
}
.hadith-ref {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Sections ───────────────────────────────────── */
.section {
  padding: 64px 0 32px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 80px;
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.section-head .section-link {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}
.section-head .section-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.section-head .section-link .arrow {
  display: inline-block;
  margin-left: 4px;
  transition: transform 0.2s ease;
}
.section-head .section-link:hover .arrow {
  transform: translate(2px, -2px);
}
.section-num {
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--muted);
}
.section h2 {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.section h2 em {
  font-style: italic;
  color: var(--accent);
}

.section-body {
  max-width: 720px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--muted);
}
.section-body strong {
  color: var(--fg);
  font-weight: 400;
}
.section-body p + p {
  margin-top: 16px;
}

/* Projects grid */
.projects-wrap {
  position: relative;
  margin-top: 16px;
}
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.founder-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 24px;
}

/* Founder cards — name only, expand the rest on click */
.project-card.founder-card {
  flex: 1 1 320px;
  gap: 0;
  align-self: start;
  padding: 12px 20px;
}
.founder-card-head {
  appearance: none;
  background: transparent;
  border: none;
  padding: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: inherit;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
}
.founder-card-head h3 {
  white-space: nowrap;
  flex-shrink: 0;
}
.founder-card-head .project-wip {
  flex-shrink: 0;
}
.founder-card-chevron {
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  transition:
    transform 0.3s ease,
    color 0.2s ease;
}
.founder-card-head:hover .founder-card-chevron {
  color: var(--accent);
}
.founder-card.is-open .founder-card-chevron {
  transform: rotate(180deg);
}
.founder-card-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s ease;
}
.founder-card.is-open .founder-card-panel {
  grid-template-rows: 1fr;
}
.founder-card-inner {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}
.founder-card-inner > :first-child {
  margin-top: 14px;
}
.founder-card-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  width: 100%;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.founder-card-links .project-link {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  gap: 6px;
}
.project-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}
.project-card:hover {
  border-color: var(--accent);
  background: var(--stripe);
}
.project-card h3 {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: 22px;
  color: var(--fg);
}
.project-card p {
  color: var(--muted);
  font-size: 13px;
  flex: 1;
}
.project-card .tag {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.project-wip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.project-wip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s infinite;
}
.project-flags {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.project-star {
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
}
.project-card.starred {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.project-link {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: color 0.2s ease;
}
.project-link:hover {
  color: var(--accent);
}
.project-link .arrow {
  transition: transform 0.2s ease;
}
.project-link:hover .arrow {
  transform: translate(3px, -3px);
}
.project-link.link-disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: default;
}

/* Gradient + view-more overlay (shown only when 5+ cards) */
.projects-more {
  display: none;
}
.projects-wrap:has(.project-card:nth-child(n + 5)) .projects-grid::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 240px;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.4s ease;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    var(--bg) 85%
  );
}
.projects-wrap:has(.project-card:nth-child(n + 5)) .projects-grid {
  position: relative;
  max-height: 27rem;
  overflow: hidden;
  transition: max-height 0.5s ease;
}
.projects-wrap:has(.project-card:nth-child(n + 5)) .projects-more {
  display: flex;
  position: relative;
  z-index: 2;
  justify-content: center;
  margin-top: -64px;
  transition: margin-top 0.4s ease;
}
/* Expanded: reveal the rows hidden behind the gradient.
   The grid's max-height is animated by JS (between the real content height
   and the collapsed height) so the motion is smooth in both directions.
   Mirror the :has() prefix so these win the specificity battle. */
.projects-wrap.is-expanded:has(.project-card:nth-child(n + 5))
  .projects-grid::after {
  opacity: 0;
}
.projects-wrap.is-expanded:has(.project-card:nth-child(n + 5)) .projects-more {
  margin-top: 24px;
}
.projects-wrap.is-expanded .pm-arrow {
  transform: rotate(-90deg);
}
.pm-arrow {
  display: inline-block;
  transition: transform 0.3s ease;
}
.projects-more button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border: 1px solid var(--fg);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}
.projects-more button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

/* Story (chapter-labeled paragraphs in a 2×2 grid) */
.story {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 36px 48px;
  max-width: 960px;
}
.story-part {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.story-part::before {
  content: "";
  display: block;
  width: 32px;
  height: 1px;
  background: var(--accent);
  margin-bottom: 4px;
}
.story-label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.story-part p {
  font-size: 15px;
  line-height: 1.8;
  color: var(--muted);
}
.story-part p strong {
  color: var(--fg);
  font-weight: 400;
}
@media (max-width: 820px) {
  .story {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .story-part {
    padding-bottom: 24px;
    border-bottom: 1px dashed var(--line);
  }
  .story-part:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
  .story-part::before {
    display: none;
  }
}

/* Education list */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.timeline-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px dashed var(--line);
}
.timeline-item:last-child {
  border-bottom: none;
}
/* Greyed-out (upcoming / tentative) education entries */
.edu-upcoming {
  opacity: 0.45;
}
.edu-insha {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: none;
  font-style: italic;
}
.timeline-when {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 4px;
}
.timeline-what h3 {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: 22px;
  color: var(--fg);
  margin-bottom: 4px;
}
.timeline-what .where {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.timeline-what p {
  font-size: 14px;
  color: var(--muted);
}
.timeline-what p a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color 0.2s ease;
}
.timeline-what p a:hover {
  color: var(--accent);
}

/* ── Footer ─────────────────────────────────────── */
footer {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  padding: 32px 0 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}
.domain {
  text-align: right;
}
.footer-note {
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.6;
  max-width: 560px;
  color: var(--muted);
  opacity: 0.8;
}

/* ── Back to top ────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  z-index: 9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    border-color 0.2s ease,
    color 0.2s ease;
  box-shadow: 0 10px 30px -16px rgba(0, 0, 0, 0.25);
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Theme controls ─────────────────────────────── */
.controls {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 16px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px -16px rgba(0, 0, 0, 0.25);
  z-index: 10;
  min-width: 240px;
  user-select: none;
}
.controls.dragging {
  transition: none;
  cursor: grabbing;
}
.controls.hidden {
  display: none;
}
.controls-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 -4px 2px;
  padding: 2px 4px;
  cursor: grab;
}
.controls-header:active {
  cursor: grabbing;
}
.drag-dots {
  display: inline-grid;
  grid-template-columns: repeat(2, 3px);
  gap: 2px;
  opacity: 0.55;
}
.drag-dots span {
  width: 3px;
  height: 3px;
  background: var(--muted);
  border-radius: 50%;
}
.controls-title {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.controls-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.controls-close {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: inherit;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}
.controls-close:hover {
  color: var(--fg);
  border-color: var(--fg);
}

.controls-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  box-shadow: 0 10px 30px -16px rgba(0, 0, 0, 0.25);
  font-family: inherit;
  font-size: 16px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition:
    border-color 0.2s ease,
    color 0.2s ease;
}
.controls-toggle.visible {
  display: inline-flex;
}
.controls-toggle:hover {
  border-color: var(--fg);
  color: var(--accent);
}

.swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 4px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
  font-family: inherit;
}
.swatch:hover {
  background: var(--stripe);
}
.swatch.active {
  border-color: var(--fg);
  background: var(--stripe);
}
.swatch-colors {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
}
.swatch-colors .a,
.swatch-colors .b {
  position: absolute;
  inset: 0;
}
.swatch-colors .b {
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.swatch-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
}

.mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.mode-row .mode-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  flex: 1;
}
.mode-seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  padding: 2px;
  gap: 2px;
}
.mode-seg button {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}
.mode-seg button.active {
  background: var(--fg);
  color: var(--bg);
}
.mode-seg button:hover:not(.active) {
  color: var(--fg);
}

/* ── CV picker modal ────────────────────────────── */
.cv-link {
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  width: 100%;
  background: transparent;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}
.modal.open {
  display: flex;
}
.modal-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.45);
  position: relative;
}
.modal-card h3 {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: 26px;
  margin-bottom: 6px;
  color: var(--fg);
}
.modal-card p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}
.modal-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-options a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--fg);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}
.modal-options a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--stripe);
}
.modal-options a .opt-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-transform: none;
  letter-spacing: 0;
}
.modal-options a .opt-title {
  font-size: 14px;
  font-family: "Instrument Serif", serif;
  color: var(--fg);
}
.modal-options a .opt-sub {
  font-size: 11px;
  color: var(--muted);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}
.modal-close:hover {
  color: var(--fg);
  border-color: var(--fg);
}

/* ── ShowTime page lockout notice ──────────────── */
.locked-note {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 6px;
}

/* ── Quran verse ────────────────────────────────── */
.verse {
  padding: 28px 0 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  scroll-margin-top: 80px;
}
.verse-ar {
  font-family: "Amiri", "Scheherazade New", "Times New Roman", serif;
  font-size: clamp(20px, 2.8vw, 28px);
  line-height: 1.6;
  color: var(--fg);
  max-width: 620px;
  direction: rtl;
}
.verse-en {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: clamp(14px, 1.5vw, 17px);
  line-height: 1.45;
  color: var(--fg);
  max-width: 560px;
  opacity: 0.9;
}
.verse-ref {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 820px) {
  .hero {
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-height: auto;
    padding: 8px 0 32px;
    align-items: stretch;
  }
  .portrait {
    max-width: 220px;
    margin: 0 auto;
    order: 1;
    justify-self: auto;
  }
  .text-col {
    order: 2;
    text-align: center;
    max-width: none;
  }
  .text-col .lede {
    margin-left: auto;
    margin-right: auto;
  }
  .links {
    order: 3;
    max-width: 360px;
    margin: 0 auto;
    width: 100%;
    justify-self: auto;
  }
  .hadith-card {
    order: 3;
    max-width: 360px;
    margin: 0 auto;
    width: 100%;
    justify-self: auto;
  }
  .nav-divider {
    width: 100%;
    height: 1px;
    margin: 6px 0;
    align-self: stretch;
  }
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    padding: 12px 16px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 180px;
    margin-top: 8px;
  }
  .nav.open {
    display: flex;
  }
  .nav a {
    padding: 8px 0;
    width: 100%;
    text-align: right;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .topbar {
    position: sticky;
    align-items: center;
  }
  .timeline-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
@media (max-width: 560px) {
  footer {
    grid-template-columns: 1fr;
  }
  .domain {
    text-align: left;
  }
  .controls {
    bottom: 12px;
    right: 12px;
    left: 12px;
    min-width: 0;
    padding: 12px 14px 10px;
  }
  .back-to-top {
    bottom: 12px;
    left: 12px;
  }
}
