/* Dev Journal design system: one calm reading column, soft grey surfaces, 8px corners, 15px text. */
:root {
  --ink: #0a0a0a;
  --ink-2: #525252;
  --ink-3: #8a8a8a;
  --line: #ebebeb;
  --wash: #f4f4f4;
  --paper: #fff;
  --sans: "Geist", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --thuluth: "Katibeh", "Amiri", serif; /* Arabic calligraphic face, Thuluth style */
  --serif: "Instrument Serif", Georgia, serif;
  
  --radius: 8px;
  --col: 720px;
  --nav-h: 49px;
  --qp-h: 48px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--paper); color: var(--ink); scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 12px); /* anchors land below the sticky nav */
}
html.qp-on { scroll-padding-top: calc(var(--qp-h) + var(--nav-h) + 12px); }

body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.wrap { max-width: var(--col); margin: 0 auto; padding: 0 20px; }

.mono {
  font-family: var(--mono); font-size: 11px; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-2);
}

/* ---------- nav ---------- */
/* hover styles are gated on (hover: hover) so taps on phones don't leave them stuck on */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 48px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: -.01em; }
.brand .mark { width: 22px; height: 22px; }
.brand .name { font: italic 400 22px/1 var(--serif); letter-spacing: -.02em; }
.nav ul { display: flex; gap: 4px; list-style: none; }
.nav ul a { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 5px 10px; border-radius: var(--radius); color: var(--ink-2); transition: background .15s, color .15s; }
@media (hover: hover) { .nav ul a:hover { background: var(--wash); color: var(--ink); } }

/* ---------- hero ---------- */
.hero .wrap { padding-top: clamp(28px, 6vw, 48px); padding-bottom: 28px; }
.kicker {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.kicker .bismillah {
  font-family: var(--thuluth); font-size: 21px; text-transform: none; letter-spacing: 0;
  color: var(--ink-2); line-height: 1;
}
.headline {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(36px, 6.4vw, 52px); line-height: 1.04; letter-spacing: -.02em;
  max-width: 20ch; margin: clamp(22px, 4vw, 32px) 0 28px; text-wrap: balance;
}
.headline em { font-style: italic; color: var(--ink-2); }

.widgets { display: grid; gap: 12px; }
.card { border-radius: var(--radius); padding: 14px 16px; background: var(--wash); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

.card-byline { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: none; padding: 0; }
.byline { display: flex; align-items: center; gap: 14px; }
.avatar { width: 72px; height: 72px; flex: none; border-radius: var(--radius); overflow: hidden; background: var(--wash); }
.avatar svg { display: block; width: 100%; height: 100%; animation: fade-in .9s ease-out both; }
.byline-name { font-weight: 500; letter-spacing: -.01em; line-height: 1.3; }
.byline-name .ar { font-family: var(--thuluth); font-size: 19px; color: var(--ink-3); margin-left: 6px; }
.byline-meta { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }
.link-arrow { font-size: 14px; font-weight: 500; border-bottom: 1px solid var(--ink); padding-bottom: 1px; }
.link-arrow span { display: inline-block; transition: transform .2s; }
@media (hover: hover) { .link-arrow:hover span { transform: translateX(3px); } }

.card-quran { display: flex; flex-direction: column; gap: 12px; }
.quran-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 0;
  background: none; border: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.ring-wrap { position: relative; width: 44px; height: 44px; flex: none; }
.ring { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg, .ring-fill { fill: none; stroke-width: 2.5; }
.ring-bg { stroke: var(--line); }
.ring-fill {
  stroke: var(--ink); stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .4s linear;
}
.quran-icon {
  position: absolute; inset: 8px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--paper);
}
.quran-icon svg { width: 11px; height: 11px; margin-left: 2px; }
.quran-label { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.quran-title { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quran-sub { font-size: 10px; color: var(--ink-2); margin-top: 3px; }
.i-bars { display: none; gap: 2px; align-items: end; height: 11px; }
.i-bars i { width: 2px; height: 100%; background: currentColor; border-radius: 1px; animation: bar 1s ease-in-out infinite; transform-origin: bottom; }
.i-bars i:nth-child(2) { animation-delay: -.4s; }
.i-bars i:nth-child(3) { animation-delay: -.7s; }
.quran-btn[aria-pressed="true"] .i-play { display: none; }
.quran-btn[aria-pressed="true"] .i-bars { display: flex; }
@keyframes bar { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* one dot per surah: filled once reached, the current one ringed */
.dots { display: grid; grid-template-columns: repeat(38, 1fr); gap: 3px; }
.dots i { display: block; aspect-ratio: 1; border-radius: 50%; background: #dcdcdc; }
.dots i.on { background: var(--ink); }
.dots i.cur { box-shadow: 0 0 0 1.5px var(--wash), 0 0 0 2.5px var(--ink); }

/* ---------- sticky Quran player: a slim dark bar above the nav ---------- */
.qp {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; height: var(--qp-h);
  background: var(--ink); color: var(--paper); transform: translateY(-100%); transition: transform .3s ease;
}
html.qp-on .qp { transform: none; }
html.qp-on body { padding-top: var(--qp-h); }
html.qp-on .nav { top: var(--qp-h); }
.qp-in { height: 100%; display: flex; align-items: center; gap: 10px; }
.qp-play {
  position: relative; flex: none; width: 36px; height: 36px; padding: 0;
  display: grid; place-items: center; background: none; border: 0; cursor: pointer; color: var(--ink);
}
.qp-play .ring { position: absolute; inset: 0; }
.qp .ring-bg { stroke: rgba(255, 255, 255, .22); }
.qp .ring-fill { stroke: var(--paper); }
.qp-disc { position: absolute; inset: 6px; border-radius: 50%; background: var(--paper); }
.qp-play .i-play, .qp-play .i-pause { position: relative; width: 11px; height: 11px; }
.qp-play .i-pause, .qp.playing .qp-play .i-play { display: none; }
.qp.playing .qp-play .i-pause { display: block; }
.qp-play .i-play { margin-left: 2px; }
.qp-meta {
  flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px;
  white-space: nowrap; overflow: hidden; cursor: pointer;
}
.qp-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.qp-sub { font-family: var(--mono); font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: #a3a3a3; }
.qp-time { font-family: var(--mono); font-size: 11px; color: #a3a3a3; font-variant-numeric: tabular-nums; }
.qp-ctl {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer;
  background: none; border: 0; border-radius: 50%; color: var(--paper); transition: background .15s;
}
.qp-ctl svg { width: 13px; height: 13px; }
@media (hover: hover) { .qp-ctl:hover { background: rgba(255, 255, 255, .14); } }

/* ---------- sections ---------- */
section { padding: 28px 0 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.section-head h2 { font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.section-head .ar { font-family: var(--thuluth); font-size: 24px; color: var(--ink-3); line-height: 1; }

.posts { list-style: none; }
.posts li { border-bottom: 1px solid var(--line); }
.posts a {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: baseline;
  padding: 16px 10px; margin: 0 -10px; border-radius: var(--radius); transition: background .15s;
}
@media (hover: hover) { .posts a:hover { background: var(--wash); } }
.posts .num { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.posts h3 { font-size: 16px; font-weight: 500; letter-spacing: -.01em; line-height: 1.35; }
.posts p { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.posts .side { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.posts .go { color: var(--ink-3); transition: transform .15s, color .15s; }
@media (hover: hover) { .posts a:hover .go { color: var(--ink); transform: translateX(3px); } }

.about-grid { display: grid; gap: 6px; padding-top: 14px; }
.about-grid > p.mono { color: var(--ink-3); font-size: 11px; line-height: 1.4; }
.about-grid p { font-size: 15px; line-height: 1.65; color: var(--ink-2); }
.about-grid p + p { margin-top: .8em; }

/* ---------- article ---------- */
.article { max-width: 640px; margin: 0 auto; padding: clamp(28px, 6vw, 48px) 20px 0; }
.back { display: inline-flex; gap: 6px; margin-bottom: 20px; }
@media (hover: hover) { .back:hover { color: var(--ink); } }
.article h1 {
  font-family: var(--serif); font-size: clamp(34px, 6vw, 44px); font-weight: 400; letter-spacing: -.02em;
  line-height: 1.05; margin: 8px 0 24px; text-wrap: balance;
}
.article p { font-size: 16px; line-height: 1.7; margin-bottom: 1.1em; color: #262626; }
.article p.mono { font-size: 11px; line-height: 1.4; margin: 0; color: var(--ink-3); }
.article .ayah {
  font-family: var(--thuluth); font-size: clamp(28px, 5vw, 36px); line-height: 1.8; text-align: right;
  color: var(--ink); background: var(--wash); border-radius: var(--radius);
  padding: 18px 20px; margin: 1.6em 0 .5em;
}
.article .ayah-tr { font-size: 14px; color: var(--ink-2); margin-bottom: 1.8em; }
.article code { font-family: var(--mono); font-size: .86em; background: var(--wash); padding: 1px 5px; border-radius: 4px; }

/* ---------- footer ---------- */
footer { margin-top: 48px; border-top: 1px solid var(--line); }
footer .wrap {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding-top: 16px; padding-bottom: 20px; flex-wrap: wrap;
}
footer .ar { font-family: var(--thuluth); font-size: 22px; }
footer .mono { color: var(--ink-3); font-size: 10.5px; }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .kicker .bismillah { font-size: 19px; }
  .dots { grid-template-columns: repeat(29, 1fr); }
  .qp-sub { display: none; }
  .posts a { grid-template-columns: 1fr auto; gap: 8px; }
  .posts .num, .posts time { display: none; }
  .avatar { width: 64px; height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- duotone icons and tags ---------- */
.ico { width: 1.2em; height: 1.2em; flex: none; --i1: #0f766e; --i2: #99f6e4; }
.ico.amber { --i1: #b45309; --i2: #fde68a; }
.ico.violet { --i1: #6d28d9; --i2: #ddd6fe; }
.ico.rose { --i1: #be123c; --i2: #fecdd3; }
.ico.teal { --i1: #0f766e; --i2: #99f6e4; }
.section-head h2, .with-ico, .back { display: inline-flex; align-items: center; gap: 7px; }
.section-head h2 .ico { width: 17px; height: 17px; }
.with-ico .ico { width: 16px; height: 16px; }
.back .ico { width: 18px; height: 18px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 8px;
  font: 500 10.5px/1 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2);
  background: var(--wash); border-radius: 99px; padding: 5px 9px 5px 6px;
}
.tag .ico { width: 13px; height: 13px; }
.article .tag { margin: 0 8px 0 0; }
