/* Home page look: warm gradient, thin gold Islamic star pattern, crescent, fanned sample cards. */
:root {
  --rose: #b3123f;
  --gold: #c9a24a;
  --cream: #fbf6ee;
  /* 8-point star lattice drawn with a thin gold line; tiles seamlessly. */
  --star-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23c9a24a' stroke-width='1.1'%3E%3Crect x='27' y='27' width='42' height='42'/%3E%3Crect x='27' y='27' width='42' height='42' transform='rotate(45 48 48)'/%3E%3Ccircle cx='48' cy='48' r='7'/%3E%3Cpath d='M0 0l18.5 18.5M96 0L77.5 18.5M0 96l18.5-18.5M96 96L77.5 77.5M48 0v18M48 96V78M0 48h18M96 48H78'/%3E%3C/g%3E%3C/svg%3E");
}
body.home { background: var(--bg); }

.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand-moon { width: 22px; height: 22px; color: var(--gold); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 520px at 8% 0%, #fde3ec 0%, transparent 60%),
    radial-gradient(820px 520px at 100% 30%, var(--tint-2) 0%, transparent 62%),
    radial-gradient(600px 400px at 55% 110%, #fff1d6 0%, transparent 70%),
    var(--cream);
}
.hero-pattern {
  position: absolute; inset: 0; background-image: var(--star-pattern); background-size: 96px; opacity: .32;
  -webkit-mask-image: radial-gradient(ellipse at 70% 40%, #000 0%, rgba(0, 0, 0, .55) 45%, transparent 85%);
  mask-image: radial-gradient(ellipse at 70% 40%, #000 0%, rgba(0, 0, 0, .55) 45%, transparent 85%);
}
.hero-moon { position: absolute; top: 18px; right: max(16px, calc(50% - 660px)); width: clamp(90px, 12vw, 150px); opacity: .9; }
.twinkle { transform-box: fill-box; transform-origin: center; animation: twinkle 3.2s ease-in-out infinite; }
.twinkle.t2 { animation-delay: 1.1s; }
.twinkle.t3 { animation-delay: 2.2s; }
@keyframes twinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }

.hero-inner {
  position: relative; max-width: 1280px; margin: 0 auto; padding: 56px 16px 96px;
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center;
}
.hero-bismillah {
  font-family: 'Noto Naskh Arabic', serif; font-weight: 700; font-size: 22px; color: #9a7428;
  margin: 0 0 14px; text-align: left;
}
.hero h1 {
  font-family: 'PT Serif', serif; font-size: clamp(30px, 4.6vw, 54px); line-height: 1.08; margin: 0 0 18px; color: #2a1d1a;
}
.hero h1 .accent {
  color: var(--rose);
  background: linear-gradient(transparent 68%, rgba(201, 162, 74, .32) 68%);
}
.hero-lead { font-size: 18px; color: #5d5249; max-width: 560px; margin: 0 0 26px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn.light { background: rgba(255, 255, 255, .8); border-color: rgba(var(--accent-rgb), .35); color: var(--accent); }
.btn.big { box-shadow: 0 8px 22px rgba(var(--accent-rgb), .18); }
.hero-points { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-wrap: wrap; gap: 8px 18px; color: #5d5249; font-size: 14px; }
.hero-points li::before { content: '✦'; color: var(--gold); margin-right: 6px; }

/* Three real cards fanned out. */
.hero-showcase { position: relative; height: clamp(300px, 36vw, 470px); }
.show-card {
  position: absolute; top: 50%; left: 50%; width: clamp(200px, 23vw, 300px); aspect-ratio: 1;
  border-radius: 14px; overflow: hidden; background: #f6eedf;
  box-shadow: 0 22px 50px rgba(60, 35, 20, .22), 0 2px 6px rgba(60, 35, 20, .12);
  transition: transform .4s ease;
}
.show-card > .card { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.show-card.s1 { transform: translate(-112%, -46%) rotate(-9deg); animation: float1 7s ease-in-out infinite; }
.show-card.s2 { transform: translate(-50%, -54%); z-index: 2; animation: float2 6s ease-in-out infinite; }
.show-card.s3 { transform: translate(12%, -44%) rotate(8deg); animation: float3 8s ease-in-out infinite; }
@keyframes float1 { 50% { transform: translate(-112%, -49%) rotate(-10deg); } }
@keyframes float2 { 50% { transform: translate(-50%, -58%); } }
@keyframes float3 { 50% { transform: translate(12%, -47%) rotate(9deg); } }

.hero-wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 60px; }

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; padding-top: 36px; gap: 8px; text-align: center; }
  .hero-bismillah { text-align: center; }
  .hero-lead { margin-left: auto; margin-right: auto; }
  .hero-actions, .hero-points { justify-content: center; }
  .hero-showcase { height: 300px; }
  .show-card { width: min(46vw, 230px); }
  .hero-moon { width: 60px; top: 8px; right: 10px; opacity: .7; }
}
@media (prefers-reduced-motion: reduce) {
  .show-card, .twinkle { animation: none !important; }
}

/* ---------- Steps ---------- */
.steps {
  max-width: 1280px; margin: -28px auto 0; padding: 0 16px; position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
@media (max-width: 800px) { .steps { grid-template-columns: 1fr; margin-top: 0; } }
.step { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; box-shadow: 0 6px 20px rgba(60, 35, 20, .05); }
.step h3 { margin: 10px 0 6px; font-size: 17px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }
.step-icon {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #fde3ec, #fff1d6);
}
.step-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--rose); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Catalogue ---------- */
.catalog { scroll-margin-top: 70px; }
.section-head {
  max-width: 1280px; margin: 0 auto; padding: 40px 16px 4px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap;
}
.section-head h2 { margin: 0; font-family: 'PT Serif', serif; font-size: clamp(24px, 3vw, 32px); }
.filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Booklet CTA ---------- */
.cta {
  position: relative; overflow: hidden;
  max-width: 1248px; margin: 16px auto 40px; padding: 36px clamp(20px, 4vw, 48px); border-radius: 24px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 55%, var(--accent-3) 100%); color: #fff;
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: center;
}
@media (max-width: 1280px) { .cta { margin-left: 16px; margin-right: 16px; } }
@media (max-width: 800px) { .cta { grid-template-columns: 1fr; text-align: center; } }
.cta-pattern { position: absolute; inset: 0; background-image: var(--star-pattern); background-size: 96px; opacity: .14; filter: brightness(1.6); }
.cta-text { position: relative; }
.cta-kicker { display: inline-block; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: #f7d98b; margin-bottom: 8px; }
.cta h2 { margin: 0 0 10px; font-family: 'PT Serif', serif; font-size: clamp(26px, 3.4vw, 38px); }
.cta-text p { margin: 0 0 22px; color: rgba(255, 255, 255, .85); max-width: 560px; }
@media (max-width: 800px) { .cta-text p { margin-left: auto; margin-right: auto; } }
.cta .btn.primary { background: #f7d98b; border-color: #f7d98b; color: #3b2a08; box-shadow: 0 8px 22px rgba(0, 0, 0, .2); }
.cta-cover { position: relative; display: flex; justify-content: center; }
.cta-cover .thumb { transform: rotate(-4deg); box-shadow: 0 24px 50px rgba(0, 0, 0, .35); border-radius: 10px; }

.site-foot {
  max-width: 1280px; margin: 0 auto; padding: 20px 16px 110px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-family: 'PT Serif', serif; color: #6b5d50;
}


/* Short pages: keep the beige background down to the bottom of the window. */
html:has(body.home) { background: var(--bg, #f6f2ec); }

/* Card actions: one compact row under the picture, "other background" floats on the picture. */
.card-tools { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; flex-wrap: nowrap; }
.card-tools .btn, .btn-float { display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.card-tools svg, .btn-float svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.card-tools .btn { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.card-tools .tool-icon { padding: 8px 10px; }
.card-tools .btn.busy { opacity: .7; }
.btn-float {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 36px; height: 36px; border-radius: 50%;
  border: 0; cursor: pointer; background: rgba(255, 255, 255, .92); color: var(--accent);
  box-shadow: 0 4px 12px rgba(60, 35, 20, .2); opacity: .85; transition: opacity .15s ease, transform .3s ease;
}
.card-wrap:hover .btn-float, .btn-float:focus-visible { opacity: 1; }
.btn-float:hover { transform: rotate(-60deg); }
@media (prefers-reduced-motion: reduce) { .btn-float:hover { transform: none; } }

/* "How it works": its own band with the star pattern, big serif headings and numbered steps. */
.how {
  position: relative; overflow: hidden; margin-top: -1px;
  background: linear-gradient(180deg, var(--bg) 0%, #fbf3e3 45%, #f6ecdb 100%);
}
.how-pattern {
  position: absolute; inset: 0; background-image: var(--star-pattern); background-size: 120px; opacity: .22;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
}
.how-inner { position: relative; max-width: 1280px; margin: 0 auto; padding: 34px 16px 48px; text-align: center; }
.how-kicker { margin: 0 0 6px; font: 700 13px system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: #9a7428; }
.how-title { margin: 0 0 28px; font-family: 'PT Serif', serif; font-size: clamp(30px, 4.2vw, 46px); color: #2a1d1a; }
.how .steps { margin: 0 auto; padding: 0; gap: 22px; }
.how .step {
  position: relative; overflow: hidden; text-align: left; padding: 26px 24px 26px; border-radius: 22px;
  background: linear-gradient(160deg, #ffffff 0%, #fffaf1 100%); border: 1px solid #efe2c9;
  box-shadow: 0 14px 34px rgba(60, 35, 20, .08); transition: transform .2s ease, box-shadow .2s ease;
}
.how .step:hover { transform: translateY(-4px); box-shadow: 0 20px 40px rgba(60, 35, 20, .12); }
.step-num {
  position: absolute; right: 14px; top: -14px; font-family: 'PT Serif', serif; font-weight: 700; font-size: 96px; line-height: 1;
  color: rgba(201, 162, 74, .18); pointer-events: none;
}
.how .step-icon { width: 58px; height: 58px; border-radius: 18px; background: linear-gradient(135deg, #b3123f, #e0577b); box-shadow: 0 8px 18px rgba(179, 18, 63, .25); }
.how .step:nth-child(2) .step-icon { background: linear-gradient(135deg, var(--accent), var(--accent-light)); box-shadow: 0 8px 18px rgba(var(--accent-rgb), .25); }
.how .step:nth-child(3) .step-icon { background: linear-gradient(135deg, #c9902a, #f0c25e); box-shadow: 0 8px 18px rgba(201, 144, 42, .3); }
.how .step-icon svg { width: 28px; height: 28px; stroke: #fff; }
.how .step h3 { margin: 18px 0 8px; font-family: 'PT Serif', serif; font-size: 24px; color: #2a1d1a; }
.how .step p { font-size: 16px; line-height: 1.5; color: #6d6153; }

/* Catalogue heading centred, with a large series switch under it. */
.section-head.centered { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; gap: 0; padding-top: 52px; padding-bottom: 14px; }
.section-head.centered h2 { font-size: clamp(30px, 4.2vw, 46px); margin: 0 0 20px; }
.section-head.centered .filters { flex-direction: column; gap: 8px; }
.section-head.centered .segmented { padding: 5px; border-radius: 16px; box-shadow: 0 8px 22px rgba(60, 35, 20, .08); }
.section-head.centered .segmented button { padding: 12px 28px; font-size: 17px; border-radius: 12px; }
.section-head.centered #count { font-size: 14px; }

/* Card titles link to the dua's own page. */
.card-link { color: inherit; text-decoration: none; }
.card-link:hover { text-decoration: underline; text-decoration-color: var(--gold, #c9a24a); }

/* Server-rendered list of every dua (also the crawl path to the dua pages). */
.all-duas { max-width: 1248px; margin: 0 auto; padding: 8px 16px 24px; }
.all-duas:empty { display: none; }
.all-duas h2 { font-family: 'PT Serif', serif; font-size: 24px; margin: 0 0 12px; text-align: center; color: var(--ink-deep, #13305f); }
.all-duas ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 18px; }
.all-duas a { color: var(--accent); text-decoration: none; font-size: 15px; }
.all-duas a:hover { text-decoration: underline; }

/* ---------- Dua page (/xx/dua/<slug>) ---------- */
.dua-head .wizard-head-inner { padding-bottom: 70px; }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--gold-light, #f6d9a0); text-decoration: none; font-size: 15px; }
.back-link:hover { text-decoration: underline; }
.dua-main {
  max-width: 1100px; margin: 0 auto; padding: 10px 16px 30px;
  display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 36px; align-items: start;
}
@media (max-width: 820px) { .dua-main { grid-template-columns: 1fr; } }
.dua-card { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 14px; background: #f6eedf; box-shadow: 0 20px 44px rgba(var(--shade-rgb, 2, 25, 60), .22); }
.dua-card > .card { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.dua-actions { display: grid; gap: 10px; margin-top: 16px; }
.dua-actions .btn { text-align: center; }
.dua-text { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 26px 28px; box-shadow: 0 10px 30px rgba(var(--shade-rgb, 2, 25, 60), .07); }
.dua-arabic { font-family: 'Noto Naskh Arabic', serif; font-weight: 700; font-size: clamp(26px, 3.4vw, 36px); line-height: 2; text-align: center; white-space: pre-line; margin: 0 0 18px; color: var(--ink-deep, #13305f); }
.dua-text h2 { font: 700 13px system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #9a7428; margin: 18px 0 6px; }
.dua-translation { font-family: 'PT Serif', 'Noto Serif', serif; font-size: 20px; line-height: 1.55; margin: 0; }
.dua-translit { font-size: 17px; line-height: 1.55; margin: 0; color: var(--muted-deep, #4f5f78); }
.dua-chain { margin-top: 22px; padding: 14px 16px; border-radius: 14px; background: var(--tint, #eef4fd); }
.dua-chain p { margin: 0 0 6px; font-weight: 600; color: var(--accent); }
.dua-chain ol { margin: 0; padding-left: 22px; }
.dua-chain li.current { font-weight: 700; }
.dua-chain a { color: var(--accent); }
.dua-source { margin: 16px 0 0; font-size: 14px; color: var(--muted-deep, #4f5f78); }
.dua-source:empty { display: none; }
.dua-source span { font-weight: 600; }
.dua-source a { color: var(--accent); }

/* License page */
.license-main { max-width: 820px; margin: 0 auto; padding: 8px 16px 48px; }
.license-text { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 28px 32px; box-shadow: 0 10px 30px rgba(var(--shade-rgb, 2, 25, 60), .07); line-height: 1.6; }
.license-text h2 { font-family: 'PT Serif', serif; font-size: 22px; margin: 26px 0 10px; color: var(--ink-deep, #13305f); }
.license-text p { margin: 0 0 12px; }
.license-text ul { margin: 0 0 12px; padding-left: 22px; }
.license-text li { margin-bottom: 8px; }
.license-text a { color: var(--accent); }
.license-ask { margin-top: 22px; padding: 16px 18px; border-radius: 14px; background: var(--tint, #eef4fd); font-weight: 600; text-align: center; }
.license-ask p { margin: 0; }
@media (max-width: 600px) { .license-text { padding: 20px 18px; } }

/* Card picture from the server (/cards/<lang>/<slug>.jpg) over the live card; fades in once loaded. */
.dua-card-img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; display: block; transition: opacity .25s ease; }
.dua-card-img.pending { opacity: 0; }
