/* ============================================================
   Al Munadi - mosque finder
   Warm + spiritual, subtle Islamic geometry. Auto light/dark.
   Native CSS only (zero dependencies).
   ============================================================ */

@font-face {
    font-family: "Bricolage Grotesque";
    font-style: normal; font-weight: 700; font-display: swap;
    src: url("./fonts/bricolage-700.woff2") format("woff2");
}
@font-face {
    font-family: "Bricolage Grotesque";
    font-style: normal; font-weight: 800; font-display: swap;
    src: url("./fonts/bricolage-800.woff2") format("woff2");
}
@font-face {
    font-family: "Hanken Grotesk";
    font-style: normal; font-weight: 400; font-display: swap;
    src: url("./fonts/hanken-400.woff2") format("woff2");
}
@font-face {
    font-family: "Hanken Grotesk";
    font-style: normal; font-weight: 500; font-display: swap;
    src: url("./fonts/hanken-500.woff2") format("woff2");
}
@font-face {
    font-family: "Hanken Grotesk";
    font-style: normal; font-weight: 700; font-display: swap;
    src: url("./fonts/hanken-700.woff2") format("woff2");
}

:root {
    color-scheme: light dark;

    /* Forest family - warm + spiritual (NOT beige+brass) */
    --bg: #f5f3ec;
    --bg-2: #efece2;
    --surface: #fffdf8;
    --text: #1b231e;
    --muted: #5c6960;
    --line: #e1ddd0;
    --primary: #0f5d47;
    --primary-strong: #0a4636;
    --on-primary: #ffffff;
    --accent: #c0801a;           /* saffron - secondary, used sparingly */
    --accent-soft: #f3e7cb;

    --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
    --font-body: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;

    --r-sm: 8px;
    --r: 14px;
    --r-lg: 22px;
    --r-pill: 999px;

    --shadow: 0 1px 2px rgba(20, 45, 35, 0.06), 0 14px 34px rgba(20, 45, 35, 0.10);
    --shadow-sm: 0 1px 2px rgba(20, 45, 35, 0.05), 0 6px 16px rgba(20, 45, 35, 0.07);
    --ring: 0 0 0 3px rgba(15, 93, 71, 0.40);
    --maxw: 1180px;
    --t: 150ms cubic-bezier(0.16, 1, 0.3, 1);

    /* geometric lattice (light) */
    --lattice: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%230f5d47' stroke-width='1'%3E%3Crect x='20' y='20' width='24' height='24'/%3E%3Crect x='20' y='20' width='24' height='24' transform='rotate(45 32 32)'/%3E%3C/g%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14130f;
        --bg-2: #1a1813;
        --surface: #1f1d17;
        --text: #f1ede2;
        --muted: #a6ac9f;
        --line: #2d2b23;
        --primary: #46c79e;
        --primary-strong: #6ed7b6;
        --on-primary: #0c1a14;
        --accent: #e3b15a;
        --accent-soft: #322a18;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.40), 0 16px 40px rgba(0, 0, 0, 0.50);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 20px rgba(0, 0, 0, 0.40);
        --ring: 0 0 0 3px rgba(70, 199, 158, 0.45);
        --lattice: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%2346c79e' stroke-width='1'%3E%3Crect x='20' y='20' width='24' height='24'/%3E%3Crect x='20' y='20' width='24' height='24' transform='rotate(45 32 32)'/%3E%3C/g%3E%3C/svg%3E");
    }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.05; margin: 0; }

a { color: inherit; }

p { margin: 0; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 14px; top: -52px; z-index: 30;
    padding: 10px 16px; border-radius: var(--r-sm);
    background: var(--primary-strong); color: var(--on-primary);
    font-weight: 700; text-decoration: none; transition: top var(--t);
}
.skip-link:focus { top: 14px; }

:focus-visible {
    outline: 2px solid transparent; outline-offset: 2px;
    box-shadow: var(--ring); border-radius: var(--r-sm);
}

/* ---------- top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    padding: 14px clamp(18px, 4vw, 48px);
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); }
.brand-mark { display: grid; place-items: center; color: var(--primary); }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: -0.01em; }
nav { display: flex; align-items: center; gap: clamp(14px, 3vw, 28px); }
nav a { text-decoration: none; color: var(--muted); font-weight: 500; transition: color var(--t); }
nav a:hover { color: var(--text); }

/* ---------- layout ---------- */
main { width: min(var(--maxw), calc(100vw - 36px)); margin: 0 auto; }

/* ---------- hero ---------- */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    align-items: center; gap: clamp(28px, 5vw, 64px);
    padding: clamp(40px, 7vw, 84px) 0 clamp(28px, 4vw, 48px);
}
.hero-arabic {
    font-size: clamp(28px, 4vw, 40px); color: var(--accent);
    margin-bottom: 6px; font-weight: 600; line-height: 1;
}
.hero-copy h1 { font-size: clamp(40px, 6.4vw, 70px); font-weight: 800; max-width: 14ch; }
#finder-desc { margin-top: 18px; color: var(--muted); font-size: clamp(16px, 1.6vw, 18px); max-width: 52ch; }

.search { margin-top: clamp(22px, 3vw, 32px); }
.search label { display: block; margin-bottom: 9px; font-weight: 600; font-size: 14px; color: var(--muted); }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }

input[type="search"] {
    width: 100%; min-height: 54px; border: 1.5px solid var(--line);
    border-radius: var(--r); padding: 0 18px; font: inherit; font-size: 17px;
    color: var(--text); background: var(--surface); transition: border-color var(--t), box-shadow var(--t);
}
input[type="search"]:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
input[type="search"]::placeholder { color: color-mix(in srgb, var(--muted) 85%, transparent); }

button, .solid, .ghost, .download-grid a, .quick-links a {
    font: inherit; cursor: pointer; border-radius: var(--r-sm); border: 1.5px solid transparent;
    font-weight: 700; text-decoration: none; transition: background var(--t), border-color var(--t), color var(--t), transform var(--t);
}
.search button[type="submit"], .solid {
    min-height: 54px; padding: 0 26px; background: var(--primary); color: var(--on-primary);
    display: inline-flex; align-items: center; justify-content: center;
}
.search button[type="submit"]:hover, .solid:hover { background: var(--primary-strong); }
.ghost {
    min-height: 40px; padding: 0 16px; background: transparent; color: var(--text);
    border-color: var(--line); display: inline-flex; align-items: center; justify-content: center;
}
.ghost:hover { border-color: var(--primary); color: var(--primary); }
button:active, .solid:active, .ghost:active { transform: translateY(1px); }

.quick-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; font-size: 14px; }
.quick-links > span { color: var(--muted); margin-right: 2px; }
.quick-links a {
    min-height: 34px; padding: 0 13px; display: inline-flex; align-items: center;
    border-color: var(--line); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13.5px;
}
.quick-links a:hover { border-color: var(--primary); color: var(--primary); }

/* hero decorative geometry panel */
.hero-aside {
    position: relative; align-self: stretch; min-height: 320px; border-radius: var(--r-lg);
    overflow: hidden; border: 1px solid var(--line);
    background:
        radial-gradient(120% 120% at 70% 20%, color-mix(in srgb, var(--primary) 16%, var(--surface)), var(--surface));
    box-shadow: var(--shadow);
}
.hero-aside::before {
    content: ""; position: absolute; inset: 0;
    background-image: var(--lattice); background-size: 64px 64px; opacity: 0.5;
    -webkit-mask-image: radial-gradient(120% 100% at 70% 30%, #000, transparent 78%);
    mask-image: radial-gradient(120% 100% at 70% 30%, #000, transparent 78%);
}
.hero-aside::after {
    content: ""; position: absolute; inset: 0; margin: auto; width: 168px; height: 168px;
    background:
        conic-gradient(from 0deg, color-mix(in srgb, var(--primary) 70%, transparent), color-mix(in srgb, var(--accent) 70%, transparent), color-mix(in srgb, var(--primary) 70%, transparent));
    -webkit-mask:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='black'%3E%3Crect x='24' y='24' width='52' height='52'/%3E%3Crect x='24' y='24' width='52' height='52' transform='rotate(45 50 50)'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
    mask:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='black'%3E%3Crect x='24' y='24' width='52' height='52'/%3E%3Crect x='24' y='24' width='52' height='52' transform='rotate(45 50 50)'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
    opacity: 0.92;
}

/* ---------- results ---------- */
.results-section { padding-bottom: 40px; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 28px; margin-bottom: 14px; color: var(--muted); font-weight: 500; }

.empty-state {
    display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: clamp(18px, 4vw, 40px);
    padding: clamp(22px, 4vw, 40px); border: 1px solid var(--line); border-radius: var(--r-lg);
    background: var(--bg-2);
}
.empty-figure { color: color-mix(in srgb, var(--primary) 55%, var(--muted)); }
.empty-lead { font-family: var(--font-display); font-weight: 700; font-size: clamp(20px, 2.4vw, 26px); color: var(--text); margin-bottom: 8px; }
.empty-copy p:last-child { color: var(--muted); max-width: 56ch; }

.results-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }

.card {
    border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
    box-shadow: var(--shadow-sm); padding: clamp(18px, 2.4vw, 24px);
}
.card-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.card h3 { font-size: clamp(19px, 2vw, 23px); font-weight: 700; }
.card-loc { margin-top: 4px; color: var(--muted); }
.card-actions { display: flex; gap: 8px; align-items: center; }

.times { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(88px, 100%), 1fr)); gap: 8px; margin-top: 18px; }
.time {
    padding: 11px 12px 12px; border-radius: var(--r-sm); background: var(--bg-2);
    border: 1px solid transparent;
}
.time-label { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); text-transform: uppercase; }
.time-val { display: block; font-family: var(--font-display); font-weight: 700; font-size: 21px; margin-top: 3px; }
.time-iqama { display: block; font-size: 11.5px; color: var(--accent); margin-top: 3px; font-weight: 600; }

.jumua { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.jumua span { font-size: 13px; color: var(--text); background: var(--accent-soft); border-radius: var(--r-pill); padding: 5px 12px; font-weight: 600; }
.jumua strong { color: var(--accent); }

.badges { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.badges span {
    font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: var(--r-pill);
    background: color-mix(in srgb, var(--primary) 10%, var(--surface)); color: var(--primary);
    border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
}

.card-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px;
}
.card-foot code {
    flex: 1; min-width: 0;
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 12.5px; color: var(--muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-foot a { color: var(--primary); font-weight: 600; text-decoration: none; white-space: nowrap; }
.card-foot a:hover { text-decoration: underline; }

/* ---------- bands (downloads / setup) ---------- */
.band {
    margin: clamp(28px, 5vw, 52px) 0; padding: clamp(24px, 4vw, 40px);
    border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm);
}
.band-head h2 { font-size: clamp(24px, 3vw, 34px); font-weight: 800; }
.band-head p { margin-top: 8px; color: var(--muted); max-width: 56ch; }

.download-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 22px; }
.download-grid a {
    display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; min-height: 64px; justify-content: center;
    border-color: var(--line); background: var(--bg-2); color: var(--text);
}
.download-grid a strong { font-family: var(--font-display); font-size: 16px; }
.download-grid a span { color: var(--muted); font-weight: 500; font-size: 13.5px; }
.download-grid a:hover { border-color: var(--primary); transform: translateY(-2px); }

.setup .steps { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 12px; }
.steps li {
    display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px;
    padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-2); color: var(--text);
}
.step-n {
    display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-pill);
    background: var(--primary); color: var(--on-primary); font-family: var(--font-display); font-weight: 700;
}

/* ---------- footer ---------- */
footer {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 22px;
    padding: 34px 18px 44px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); margin-top: 12px;
}
.footer-brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; color: var(--text); }
.footer-brand .brand-mark { color: var(--primary); }
.footer-links { display: inline-flex; gap: 18px; }
.footer-links a { color: var(--primary); text-decoration: none; font-weight: 600; }
.footer-links a:hover { text-decoration: underline; }

/* ---------- motion: scroll reveal (JS adds .reveal / .in) ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s var(--t), transform 0.6s var(--t); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
    .hero { grid-template-columns: 1fr; padding-top: clamp(28px, 6vw, 48px); }
    .hero-aside { display: none; }
    .empty-state { grid-template-columns: 1fr; text-align: left; }
    .empty-figure { display: none; }
}
@media (max-width: 560px) {
    main { width: calc(100vw - 28px); }
    .topbar { padding: 12px 16px; }
    .search-row { grid-template-columns: 1fr; }
    .search button[type="submit"] { width: 100%; }
    .card-head { grid-template-columns: 1fr; }
    .card-actions { width: 100%; }
    .card-actions .ghost, .card-actions .solid { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
