/* ============================================================
   MuslimPath - static developer site styles
   Single file. Layers: tokens, reset, base, utilities, layout,
   components, media queries.
   ============================================================ */

/* ---------- 1. Design tokens ---------- */
:root {
  --bg-primary: #10221D;
  --bg-deep: #0F1F1A;
  --bg-secondary: #1A2E28;
  --bg-surface: #064C39;
  --bg-surface-light: #2D5E4F;
  --card-alt: #243D35;
  --accent-emerald: #4ADE80;
  --accent-gold: #D4AF37;
  --text-primary: #F1F5F9;
  --text-secondary: rgba(255, 255, 255, 0.80);
  --text-muted: #94A3B8;
  --text-on-light: #1A2E28;
  --divider: rgba(255, 255, 255, 0.10);
  --radius: 14px;
  --radius-sm: 10px;
  --container: 72rem;
  --transition: 160ms ease;
  --font-ui: "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-arabic: "Amiri", "Noto Naskh Arabic", serif;
  color-scheme: dark;
}

@layer reset, base, utilities, layout, components;

/* ---------- 2. Reset ---------- */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { scroll-behavior: smooth; }
  body { min-height: 100vh; }
  img, svg { display: block; max-width: 100%; }
  ul, ol { list-style: none; padding: 0; margin: 0; }
  h1, h2, h3, p { overflow-wrap: break-word; }
}

/* ---------- 3. Base ---------- */
@layer base {
  html { color-scheme: dark; scroll-behavior: smooth; }
  body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 1rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }
  ::selection { background: var(--accent-emerald); color: var(--text-on-light); }
  :focus-visible {
    outline: 2px solid var(--accent-emerald);
    outline-offset: 3px;
  }
  h1 { font-size: clamp(2.25rem, 6vw, 3.75rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; }
  h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); font-weight: 700; line-height: 1.2; }
  h3 { font-size: 1.25rem; font-weight: 700; line-height: 1.3; }
  p { line-height: 1.65; }
  section[id] { scroll-margin-top: 96px; }
  a { color: var(--accent-emerald); text-decoration: none; transition: color var(--transition); }
  a:hover { text-decoration: underline; }
  a:visited { color: var(--accent-emerald); }
  small { font-size: 0.875rem; }
}

/* ---------- 4. Utilities ---------- */
@layer utilities {
  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .skip-link {
    position: absolute;
    left: 0.75rem;
    top: -100%;
    z-index: 200;
    background: var(--accent-emerald);
    color: var(--text-on-light);
    font-weight: 700;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-sm);
    transition: top var(--transition);
  }
  .skip-link:focus {
    top: 0.75rem;
    text-decoration: none;
  }
  .gold { color: var(--accent-gold); }
  .footnote { font-size: 0.8125rem; color: var(--text-muted); }
}

/* ---------- 5. Layout ---------- */
@layer layout {
  .container {
    width: min(100% - 2rem, var(--container));
    margin-inline: auto;
  }

  /* Header */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(16, 34, 29, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--divider);
  }
  .header-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: 4.25rem;
  }
  .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.125rem;
  }
  .brand:hover { color: var(--text-primary); text-decoration: none; }
  .brand-star { width: 28px; height: 28px; flex-shrink: 0; }
  .brand img { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; }
  .site-nav {
    display: none;
    margin-left: auto;
    align-items: center;
    gap: 1.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
  }
  .site-nav a { color: var(--text-secondary); }
  .site-nav a:hover { color: var(--accent-emerald); text-decoration: none; }
  .header-cta { margin-left: auto; }
  @media (min-width: 640px) {
    .site-nav { display: flex; }
    .header-cta { margin-left: 0; }
  }

  /* Hero */
  .hero {
    position: relative;
    overflow: hidden;
    padding-block: 5rem;
    text-align: center;
    background-color: var(--bg-primary);
    background-image:
      radial-gradient(ellipse 80% 50% at 50% 0%, rgba(74, 222, 128, 0.06), transparent 70%),
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23D4AF37' fill-opacity='0.06' d='M12 2 L15.88 10.39 L19.07 4.93 L13.61 8.12 L22 12 L13.61 15.88 L19.07 19.07 L15.88 13.61 L12 22 L8.12 13.61 L4.93 19.07 L10.39 15.88 L2 12 L10.39 8.12 L4.93 4.93 L8.12 10.39 Z'/%3E%3C/svg%3E");
    background-size: auto, 64px 64px;
    background-repeat: no-repeat, repeat;
    background-position: center top, center;
  }
  .hero .container {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    align-items: center;
  }
  .hero-text { max-width: 46rem; }
  .hero h1 { max-width: 26ch; margin: 1.25rem auto 0; }
  .tagline { max-width: 46ch; margin: 1.25rem auto 0; color: var(--text-secondary); }
  .cta-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
  }
  .trust { margin-top: 1.5rem; color: var(--text-muted); font-size: 0.875rem; }
  .hero-visual {
    width: 100%;
    height: auto;
    border-radius: 20px;
    border: 1px solid var(--divider);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  }
  @media (min-width: 900px) {
    .hero .container { grid-template-columns: 1.05fr 0.95fr; text-align: left; }
    .hero h1 { margin: 1.25rem 0 0; }
    .tagline { margin: 1.25rem 0 0; }
    .cta-row { justify-content: flex-start; }
  }

  /* Generic sections */
  .section { padding-block: 5rem; }
  .section-head { text-align: center; max-width: 44rem; margin-inline: auto; }
  .section-head h2 { margin-top: 1rem; }
  .section-head .lede { margin-top: 1rem; color: var(--text-secondary); }

  /* Feature grid */
  .feature-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    margin-top: 3rem;
  }

  /* Screenshots grid */
  .shot-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    margin-top: 3rem;
  }

  /* Technology chips */
  .tech-chips {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    margin-top: 3rem;
  }

  /* Download */
  .download {
    position: relative;
    padding-block: 5rem;
    text-align: center;
  }
  .download::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.55), transparent);
  }
  .download h2 { margin-top: 1rem; }
  .download .lede {
    margin-top: 1rem;
    color: var(--text-secondary);
    max-width: 52ch;
    margin-inline: auto;
  }
  .store-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2.25rem;
  }

  /* Footer */
  .site-footer {
    background: var(--bg-deep);
    border-top: 1px solid var(--divider);
  }
  .footer-grid {
    display: grid;
    gap: 2.5rem;
    padding-block: 4rem;
  }
  .footer-brand { max-width: 24rem; }
  .footer-brand .brand { margin-bottom: 1rem; }
  .footer-brand p { color: var(--text-secondary); }
  .footer-brand .footnote { color: var(--text-muted); margin-top: 0.5rem; }
  .footer-col h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
  }
  .footer-col ul { display: grid; gap: 0.65rem; }
  .footer-col a { color: var(--text-secondary); }
  .footer-col a:hover { color: var(--accent-emerald); text-decoration: none; }
  .footer-bottom { position: relative; padding-block: 1.5rem; }
  .footer-bottom::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.55), transparent);
  }
  .footer-bottom .container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.75rem;
    justify-content: center;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
  }
  .footer-bottom a { color: var(--text-muted); }
  .footer-bottom a:hover { color: var(--accent-gold); }
  @media (min-width: 1024px) {
    .footer-grid { grid-template-columns: 2fr 1fr 1fr; gap: 4rem; }
    .footer-bottom .container { justify-content: space-between; }
  }

  /* Privacy policy */
  .privacy {
    max-width: 65ch;
    margin-inline: auto;
    padding-block: 4rem 6rem;
  }
  .privacy h1 { margin-bottom: 0.5rem; }
  .privacy .updated { color: var(--text-muted); font-size: 0.875rem; }
  .privacy section { margin-top: 2.25rem; }
  .privacy h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
  .privacy p { color: var(--text-secondary); }
  .privacy p + p { margin-top: 0.75rem; }
  .privacy h3 { margin: 1.5rem 0 0.5rem; }
  .privacy ul { margin: 0.75rem 0 0; padding-left: 1.25rem; list-style: disc; }
  .privacy li { color: var(--text-secondary); }
  .privacy li + li { margin-top: 0.35rem; }
  .privacy ul ul { margin-top: 0.35rem; }
  .privacy code {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--divider);
    border-radius: 6px;
    padding: 0.1em 0.35em;
    font-size: 0.875em;
  }
  .privacy table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9375rem;
  }
  .privacy th,
  .privacy td {
    padding: 0.75rem;
    border: 1px solid var(--divider);
    text-align: left;
    vertical-align: top;
  }
  .privacy th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
  }
  .privacy td { color: var(--text-secondary); }
  .privacy section + p.updated { margin-top: 2rem; }

  /* 404 */
  .page-404 {
    min-height: 100svh;
    display: grid;
    place-items: center;
    text-align: center;
    padding-block: 4rem;
  }
  .page-404 .container { display: grid; justify-items: center; gap: 1.25rem; }
  .page-404 .brand-star { width: 56px; height: 56px; }
  .page-404 p { color: var(--text-secondary); max-width: 40ch; }
  .page-404 .btn { margin-top: 0.5rem; }

  @media (min-width: 1024px) {
    .section, .hero, .download { padding-block: 7rem; }
  }
}

/* ---------- 6. Components ---------- */
@layer components {
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    border-radius: 12px;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: filter var(--transition), background-color var(--transition),
                border-color var(--transition), color var(--transition);
  }
  .btn svg { width: 20px; height: 20px; flex-shrink: 0; }
  .btn-lg svg { width: 22px; height: 22px; }
  .btn-primary {
    background-color: var(--accent-emerald);
    color: var(--text-on-light);
    height: 48px;
    padding-inline: 1.5rem;
  }
  .btn-primary:hover { filter: brightness(0.92); text-decoration: none; color: var(--text-on-light); }
  .btn-primary:active { filter: brightness(0.88); }
  .btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.16);
    height: 48px;
    padding-inline: 1.5rem;
  }
  .btn-secondary:hover {
    background-color: var(--bg-secondary);
    border-color: rgba(74, 222, 128, 0.40);
    color: var(--text-primary);
    text-decoration: none;
  }
  .btn-lg { height: 56px; padding-inline: 1.75rem; }
  .btn-sm { height: 40px; padding-inline: 1.1rem; font-size: 0.9375rem; }
  .store-btn { height: 56px; padding-inline: 1.75rem; }
  .btn.is-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.4);
  }
  .btn.is-disabled:hover,
  .btn.is-disabled:active {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.4);
    background-color: transparent;
    border-color: rgba(255, 255, 255, 0.16);
    color: var(--text-primary);
    text-decoration: none;
  }

  .card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--divider);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  }
  .card h3 { margin-bottom: 0.5rem; }
  .card p { color: var(--text-secondary); }
  @media (hover: hover) {
    .card:hover {
      transform: translateY(-4px);
      border-color: rgba(74, 222, 128, 0.35);
      box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
    }
  }

  .icon-box {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background-color: rgba(74, 222, 128, 0.08);
    border: 1px solid rgba(74, 222, 128, 0.15);
    color: var(--accent-emerald);
    margin-bottom: 1.25rem;
  }
  .icon-box svg { width: 24px; height: 24px; }

  .shot-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--divider);
    border-radius: 16px;
    padding: 0.75rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  }
  .shot { width: 100%; height: auto; border-radius: 12px; display: block; }

  .chip {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1rem 1.25rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--divider);
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--text-primary);
  }
  .chip-dot { width: 8px; height: 8px; flex-shrink: 0; }

  .eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-gold);
    background-color: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
  }

  .bismillah {
    font-family: var(--font-arabic);
    font-size: 1.75rem;
    line-height: 1.6;
    color: var(--accent-gold);
    margin-bottom: 1.75rem;
  }
}

/* ---------- 7. Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}