/*
 * AaSal Web — shared product design layer.
 * Contract: one AnKaRaWi ambient background, three AaSal foreground themes,
 * family-specific information hierarchy, RTL/mobile/accessibility preserved.
 */

.asal-shell[data-ankarawi-ambient="active"] {
  --asal-page-gap: clamp(1rem, 2.2vw, 1.75rem);
  --asal-section-pad: clamp(1rem, 2.6vw, 1.65rem);
  --asal-hero-pad: clamp(1.3rem, 4vw, 3rem);
  --asal-readable: 68ch;
  --asal-wide: 78rem;
  --asal-reading: 62rem;
  --asal-control-bg: color-mix(in srgb, var(--asal-surface-raised) 48%, transparent);
  --asal-control-border: color-mix(in srgb, var(--asal-border) 74%, transparent);
  --asal-divider: color-mix(in srgb, var(--asal-border-soft) 78%, transparent);
  --asal-glow-soft: color-mix(in srgb, var(--asal-accent) 12%, transparent);
  --asal-glow-strong: color-mix(in srgb, var(--asal-accent-strong) 16%, transparent);
}

.asal-shell[data-ankarawi-ambient="active"] main {
  max-width: var(--asal-wide);
  padding-block-start: clamp(0.75rem, 2vw, 1.25rem);
  padding-block-end: clamp(4.5rem, 8vw, 7rem);
}

.asal-shell[data-ankarawi-ambient="active"] main > :is(.stack, .premium-web-shell, [class$="-shell"]) {
  gap: var(--asal-page-gap);
}

.asal-shell[data-ankarawi-ambient="active"] :is(h1, h2, h3) {
  color: var(--asal-text);
  text-wrap: balance;
}

.asal-shell[data-ankarawi-ambient="active"] h1 {
  max-inline-size: 22ch;
  letter-spacing: -0.035em;
}

.asal-shell[data-ankarawi-ambient="active"] :is(p, li) {
  text-wrap: pretty;
}

.asal-shell[data-ankarawi-ambient="active"] .muted {
  color: color-mix(in srgb, var(--asal-text-muted) 92%, var(--asal-text));
}

.asal-shell[data-ankarawi-ambient="active"] :is(.eyebrow, .overline) {
  letter-spacing: 0.02em;
  color: var(--asal-accent-strong);
  font-weight: 750;
}

.asal-shell[data-ankarawi-ambient="active"] :is(.card, .section-card, .module-card, .metric-card, .insight-panel, .asal-tasbih-card, .asal-tasbih-hero) {
  overflow: clip;
  border-color: var(--ankarawi-glass-border) !important;
}

.asal-shell[data-ankarawi-ambient="active"] :is(.card, .section-card, .module-card, .metric-card, .insight-panel, .asal-tasbih-card) {
  padding: var(--asal-section-pad);
}

.asal-shell[data-ankarawi-ambient="active"] :is(.hero-card, .premium-hero, .quran-product-hero, .asal-tasbih-hero) {
  padding: var(--asal-hero-pad);
}

.asal-shell[data-ankarawi-ambient="active"] :is(.panel, .reader-surface, .fine-print-card, .ayah-practice-card, .recitation-ayah-card, .route-pill, .hero-orbit-card, .asal-tasbih-session-grid .panel.stack) {
  border-color: color-mix(in srgb, var(--ankarawi-glass-border) 82%, transparent) !important;
}

.asal-shell[data-ankarawi-ambient="active"] :is(.hero-orbit-card, .route-pill, .asal-tasbih-hero, .asal-tasbih-card, .asal-tasbih-session-grid .panel.stack) {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--ankarawi-glass-highlight) 84%, transparent), transparent 52%),
    var(--ankarawi-glass-panel) !important;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--ankarawi-glass-highlight) 88%, transparent),
    0 18px 54px rgb(0 0 0 / 16%) !important;
  backdrop-filter: blur(22px) saturate(1.14);
  -webkit-backdrop-filter: blur(22px) saturate(1.14);
}

.asal-shell[data-ankarawi-ambient="active"] :is(input, select, textarea) {
  min-height: 2.85rem;
  border-color: var(--asal-control-border);
  background: var(--asal-control-bg);
  box-shadow: inset 0 1px 0 color-mix(in srgb, white 6%, transparent);
}

.asal-shell[data-ankarawi-ambient="active"] :is(input, select, textarea)::placeholder {
  color: color-mix(in srgb, var(--asal-text-muted) 74%, transparent);
}

.asal-shell[data-ankarawi-ambient="active"] fieldset {
  min-width: 0;
  border: 1px solid var(--asal-divider);
  border-radius: var(--asal-radius);
  padding: var(--asal-section-pad);
  background: color-mix(in srgb, var(--asal-surface) 34%, transparent);
  backdrop-filter: blur(16px) saturate(1.08);
  -webkit-backdrop-filter: blur(16px) saturate(1.08);
}

.asal-shell[data-ankarawi-ambient="active"] legend {
  color: var(--asal-accent-strong);
  font-weight: 750;
  padding-inline: 0.45rem;
}

.asal-shell[data-ankarawi-ambient="active"] :is(button, .button-link, .asal-btn) {
  border-radius: var(--asal-radius-pill);
  min-height: 2.8rem;
  padding-inline: 1rem;
}

.asal-shell[data-ankarawi-ambient="active"] :is(button.secondary, .button-link.secondary, .asal-btn--secondary) {
  background: color-mix(in srgb, var(--asal-surface-raised) 46%, transparent);
  backdrop-filter: blur(14px) saturate(1.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
}

.asal-shell[data-ankarawi-ambient="active"] :is(button.danger, .button-link.danger, .asal-btn--danger, .danger-zone button) {
  border-color: color-mix(in srgb, var(--asal-danger) 72%, transparent);
}

.asal-shell[data-ankarawi-ambient="active"] :is(.badge, .status-badge, [class*="status-badge"]) {
  border: 1px solid color-mix(in srgb, var(--asal-border) 72%, transparent);
  background: color-mix(in srgb, var(--asal-surface-raised) 42%, transparent);
  backdrop-filter: blur(12px) saturate(1.08);
  -webkit-backdrop-filter: blur(12px) saturate(1.08);
}

.asal-shell[data-ankarawi-ambient="active"] :is(table, .data-table) {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--asal-divider);
  border-radius: var(--asal-radius);
  background: color-mix(in srgb, var(--asal-surface) 38%, transparent);
  backdrop-filter: blur(18px) saturate(1.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
}

.asal-shell[data-ankarawi-ambient="active"] :is(th, td) {
  padding: 0.75rem 0.85rem;
  border-block-end: 1px solid var(--asal-divider);
  text-align: start;
  vertical-align: top;
}

.asal-shell[data-ankarawi-ambient="active"] th {
  color: var(--asal-text);
  background: color-mix(in srgb, var(--asal-surface-raised) 42%, transparent);
  font-size: var(--asal-text-sm);
}

.asal-shell[data-ankarawi-ambient="active"] tr:last-child td {
  border-block-end: 0;
}

.asal-shell[data-ankarawi-ambient="active"] details {
  border: 1px solid var(--asal-divider);
  border-radius: var(--asal-radius);
  background: color-mix(in srgb, var(--asal-surface) 36%, transparent);
  overflow: clip;
}

.asal-shell[data-ankarawi-ambient="active"] details > summary {
  cursor: pointer;
  color: var(--asal-text);
  font-weight: 700;
  padding: 0.85rem 1rem;
}

.asal-shell[data-ankarawi-ambient="active"] details[open] > summary {
  border-block-end: 1px solid var(--asal-divider);
  background: color-mix(in srgb, var(--asal-accent) 8%, transparent);
}

.asal-shell[data-ankarawi-ambient="active"] :is([role="alert"], .danger-zone, .warning-panel, .error-panel) {
  border: 1px solid color-mix(in srgb, var(--asal-danger) 52%, transparent);
  border-radius: var(--asal-radius);
  background: color-mix(in srgb, var(--asal-danger) 9%, var(--ankarawi-glass-panel));
  padding: var(--asal-section-pad);
}

/* Home / discovery: wide, expressive, but still quiet. */
.asal-shell[data-product-family="home"] main {
  max-width: 82rem;
}

.asal-shell[data-product-family="home"] :is(.hero-card, .premium-hero) {
  min-height: clamp(21rem, 48vw, 35rem);
  align-content: end;
}

.asal-shell[data-product-family="home"] .product-domain-card {
  min-height: 18rem;
  align-content: start;
}

.asal-shell[data-product-family="home"] #experiencePathPanel .panel {
  min-height: 11rem;
}

/* Tasbih / dhikr: action first, warm, compact navigation. */
.asal-shell[data-product-family="dhikr"] main {
  max-width: 68rem;
}

.asal-shell[data-product-family="dhikr"] :is(.asal-tasbih-shell, [data-premium-web-shell="tasbih"]) {
  gap: clamp(0.9rem, 2vw, 1.35rem);
}

.asal-shell[data-product-family="dhikr"] :is(.asal-tasbih-hero, .hero-card) {
  min-height: auto;
  text-align: start;
}

.asal-shell[data-product-family="dhikr"] :is([data-tasbih-counter], .tasbih-counter, .counter-value, [id*="Counter"], [id*="counter"]) {
  font-variant-numeric: tabular-nums;
}

.asal-shell[data-product-family="dhikr"] .asal-tasbih-session-grid .panel.stack p {
  color: var(--asal-accent-strong);
  font-size: clamp(1.15rem, 4vw, 1.8rem);
  font-weight: 760;
}

/* Quran: reading surface dominates; controls recede. */
.asal-shell[data-product-family="quran"] main {
  max-width: 88rem;
}

.asal-shell[data-product-family="quran"] .quran-product-shell {
  gap: clamp(1rem, 2.4vw, 1.8rem);
}

.asal-shell[data-product-family="quran"] :is(.quran-product-hero, .hero-card) {
  min-height: auto;
}

.asal-shell[data-product-family="quran"] :is(.reader-surface, .quran-reading-panel, [class*="ayah-card"], [class*="ayah-row"]) {
  max-width: var(--asal-reading);
  margin-inline: auto;
}

.asal-shell[data-product-family="quran"] :is(.ayah-text, .quran-text, .ayah-practice-text, .recitation-ayah-text, [data-quran-text]) {
  color: var(--asal-reader-ink);
  font-family: var(--asal-font-quran);
  font-size: clamp(1.45rem, 3.4vw, 2.15rem);
  line-height: var(--asal-leading-quran);
  text-align: center;
}

.asal-shell[data-product-family="quran"] :is(.reader-toolbar, .quran-toolbar, [data-reader-controls]) {
  position: sticky;
  top: 5.25rem;
  z-index: calc(var(--z-sticky) - 1);
  border: 1px solid var(--asal-divider);
  border-radius: var(--asal-radius);
  background: color-mix(in srgb, var(--asal-surface-raised) 52%, transparent);
  backdrop-filter: blur(24px) saturate(1.12);
  -webkit-backdrop-filter: blur(24px) saturate(1.12);
}

/* Prayer: functional clarity, next action/time is visually central. */
.asal-shell[data-product-family="prayer"] main {
  max-width: 72rem;
}

.asal-shell[data-product-family="prayer"] :is(.hero-card, .premium-hero) {
  min-height: auto;
}

.asal-shell[data-product-family="prayer"] :is(.prayer-tool-panel, [data-prayer-tool], [class*="next-prayer"]) {
  border-color: color-mix(in srgb, var(--asal-accent) 42%, transparent) !important;
  box-shadow: 0 28px 72px color-mix(in srgb, var(--asal-accent) 12%, transparent) !important;
}

.asal-shell[data-product-family="prayer"] :is(time, [data-prayer-time], [class*="prayer-time"]) {
  font-variant-numeric: tabular-nums;
}

/* Gift/public pages: intimate, narrower reading and sharing surfaces. */
.asal-shell[data-product-family="gift"] main {
  max-width: 72rem;
}

.asal-shell[data-product-family="gift"] :is(.hero-card, .premium-hero) {
  min-height: auto;
}

.asal-shell[data-product-family="gift"] :is(.share-card, .qr-card, [data-share-card], [data-qr]) {
  border: 1px solid var(--asal-divider);
  border-radius: var(--asal-radius-xl);
  background: color-mix(in srgb, var(--asal-surface-raised) 50%, transparent);
  box-shadow: var(--asal-shadow-soft);
  backdrop-filter: blur(22px) saturate(1.12);
  -webkit-backdrop-filter: blur(22px) saturate(1.12);
}

/* Campaigns: progress/state scanability over ornament. */
.asal-shell[data-product-family="campaign"] main {
  max-width: 82rem;
}

.asal-shell[data-product-family="campaign"] :is(progress, meter) {
  inline-size: 100%;
  min-height: 0.7rem;
  accent-color: var(--asal-accent);
}

.asal-shell[data-product-family="campaign"] :is(.campaign-progress-card, [class*="campaign-card"], [data-campaign-card]) {
  min-height: 12rem;
}

/* Account: quiet, trustworthy, forms and security states first. */
.asal-shell[data-product-family="account"] main {
  max-width: 64rem;
}

.asal-shell[data-product-family="account"] :is(.hero-card, .premium-hero) {
  min-height: auto;
}

.asal-shell[data-product-family="account"] form {
  max-width: 48rem;
}

/* Admin/ops: dense but readable; no decorative hero dominance. */
.asal-shell[data-product-family="admin"] main {
  max-width: 92rem;
}

.asal-shell[data-product-family="admin"] :is(.hero-card, .premium-hero) {
  min-height: auto;
  padding-block: clamp(1rem, 2vw, 1.5rem);
}

.asal-shell[data-product-family="admin"] :is(.grid, .action-grid) {
  align-items: start;
}

.asal-shell[data-product-family="admin"] :is(.card, .panel) {
  box-shadow: inset 0 1px 0 var(--ankarawi-glass-highlight), 0 14px 34px rgb(0 0 0 / 12%) !important;
}

/* Community: warmer grouping and identity surfaces. */
.asal-shell[data-product-family="community"] main {
  max-width: 80rem;
}

.asal-shell[data-product-family="community"] :is(.card, .section-card) {
  border-radius: calc(var(--asal-radius) + 4px);
}

/* Legal/service: high readability and minimal ornament. */
.asal-shell[data-product-family="legal"] main {
  max-width: var(--asal-legal-max);
}

.asal-shell[data-product-family="legal"] :is(.hero-card, .premium-hero) {
  min-height: auto;
  padding-block: clamp(1rem, 2.8vw, 2rem);
}

.asal-shell[data-product-family="legal"] :is(.card, .panel, .section-card) {
  box-shadow: inset 0 1px 0 var(--ankarawi-glass-highlight), 0 12px 28px rgb(0 0 0 / 10%) !important;
}

.asal-shell[data-product-family="legal"] :is(p, li) {
  max-inline-size: var(--asal-readable);
}

@media (max-width: 760px) {
  .asal-shell[data-ankarawi-ambient="active"] main {
    padding-inline: clamp(0.75rem, 3.2vw, 1rem);
  }

  .asal-shell[data-ankarawi-ambient="active"] :is(.card, .section-card, .module-card, .panel, .asal-tasbih-card, .asal-tasbih-hero) {
    border-radius: clamp(14px, 4vw, 20px);
  }

  .asal-shell[data-ankarawi-ambient="active"] :is(.row, .spread) {
    min-width: 0;
  }

  .asal-shell[data-ankarawi-ambient="active"] .row {
    flex-wrap: wrap;
  }

  .asal-shell[data-ankarawi-ambient="active"] :is(button, .button-link, .asal-btn) {
    max-width: 100%;
  }

  .asal-shell[data-product-family="quran"] :is(.ayah-text, .quran-text, .ayah-practice-text, .recitation-ayah-text, [data-quran-text]) {
    font-size: clamp(1.35rem, 6.6vw, 1.85rem);
    line-height: 2.2;
  }

  .asal-shell[data-product-family="quran"] :is(.reader-toolbar, .quran-toolbar, [data-reader-controls]) {
    position: static;
  }

  .asal-shell[data-ankarawi-ambient="active"] :is(table, .data-table) {
    display: block;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }
}

@media (max-width: 480px) {
  .asal-shell[data-ankarawi-ambient="active"] h1 {
    font-size: clamp(2rem, 11vw, 3.2rem);
  }

  .asal-shell[data-ankarawi-ambient="active"] :is(.hero-card, .premium-hero, .quran-product-hero, .asal-tasbih-hero) {
    padding: 1.1rem;
  }

  .asal-shell[data-ankarawi-ambient="active"] :is(.card, .section-card, .module-card, .metric-card, .insight-panel, .asal-tasbih-card) {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .asal-shell[data-ankarawi-ambient="active"] {
    --asal-dur-fast: 0.01ms;
    --asal-dur-base: 0.01ms;
    --asal-dur-slow: 0.01ms;
    --asal-dur-orbital: 0.01ms;
    --asal-motion-fast: 0.01ms linear;
    --asal-motion: 0.01ms linear;
    --asal-motion-slow: 0.01ms linear;
  }

  .asal-shell[data-ankarawi-ambient="active"] *,
  .asal-shell[data-ankarawi-ambient="active"] *::before,
  .asal-shell[data-ankarawi-ambient="active"] *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .asal-shell[data-ankarawi-ambient="active"] :is(.hero-orbit-card, .route-pill, .asal-tasbih-hero, .asal-tasbih-card, fieldset, table, details) {
    background: var(--asal-surface-raised) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}
