/* home-hub.css — chrome for the waqt.uk hub: search-first layout + Khatt brand.
 *
 * Loaded by index.html only, after /brand-tokens.css. Layout rules are scoped
 * under body[data-hub-design="a"] and brand rules under
 * body[data-hub-theme="khatt"]; both attributes ship on <body> in index.html.
 * The `?design=live` debug view removes them, so the pre-redesign hub renders
 * exactly as it did before this file existed. Khatt colours are var(--wq-…)
 * from brand-tokens.css — do not duplicate that palette here (ADR 0002).
 *
 * Shared vocabulary:
 *   .wh-row        one masjid — accent + name/address + meta + optional action
 *   .wh-action     secondary icon button (Directions) at the row's trailing edge
 *   .wh-block      titled section (Nearest to you / Favourites / Recently viewed)
 *   .wh-chip-btn   quick action or area chip
 *   .wh-back       back chip at the top of an area drill-down
 */

/* ── Tokens ─────────────────────────────────────────────────────────────── */
body[data-hub-design] {
    --wh-fg: #fff;
    --wh-teal: #00bfa5;
    --wh-accent-rgb: 0, 191, 165;
    --wh-surface: rgba(255, 255, 255, 0.06);
    --wh-surface-hover: rgba(255, 255, 255, 0.12);
    --wh-border: rgba(255, 255, 255, 0.1);
    --wh-border-strong: rgba(255, 255, 255, 0.2);
    --wh-text-dim: rgba(255, 255, 255, 0.58);
    --wh-text-faint: rgba(255, 255, 255, 0.38);
    --wh-radius: 14px;
    --wh-row-pad: 12px 14px;
}

/* The hub is a tool, not a poster: shrink the masthead so results start
 * above the fold on a phone. */
body[data-hub-design="a"] .icon {
    font-size: 34px;
    margin-bottom: 4px;
}
body[data-hub-design="a"] h1 {
    font-size: clamp(19px, 5vw, 26px);
    margin-bottom: 2px;
}
body[data-hub-design="a"] .subtitle {
    margin-bottom: 14px;
    font-size: 12px;
}
body[data-hub-design="a"] .label {
    display: none;
}
body[data-hub-design="a"] .container {
    max-width: 640px;
}
/* The list sits above the chat launcher (fixed, bottom-left) — keep the last
 * row tappable instead of tucked under it. */
body[data-hub-design="a"] #masjidList {
    padding-bottom: 72px;
}
body[data-hub-design="a"] .submit-section {
    margin-top: 28px;
}
/* The chat launcher (injected by chat.js at bottom:140px) used to float in the
 * middle of the list. Docking it to the bottom edge on the hub keeps it off the
 * rows; mosque pages keep chat.js's own placement. */
body[data-hub-design="a"] .chat-btn {
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: 14px;
    width: 46px;
    height: 46px;
    font-size: 20px;
    opacity: 0.92;
}
body[data-hub-design="a"] .no-results {
    display: none !important;
}

/* ── Sticky/hero control bar (tabs + search) ────────────────────────────── */
.wh-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}
.wh-bar .view-toggle,
.wh-bar .search-wrap {
    margin-bottom: 0;
}
.wh-bar .view-toggle {
    display: flex;
    width: 100%;
}
.wh-bar .view-toggle button {
    flex: 1 1 0;
    min-width: 0;
}
/* Design A treats search as the page's primary control. */
body[data-hub-design="a"] .search-bar {
    padding: 17px 46px 17px 42px;
    font-size: 16px;
    border-radius: 14px;
    border-color: rgba(var(--wh-accent-rgb), 0.35);
    background: rgba(255, 255, 255, 0.1);
}
body[data-hub-design="a"] .search-bar:focus {
    border-color: rgba(var(--wh-accent-rgb), 0.7);
    box-shadow: 0 0 0 3px rgba(var(--wh-accent-rgb), 0.14);
}
body[data-hub-design="a"] .wh-bar {
    gap: 12px;
    margin-bottom: 8px;
}
body[data-hub-design="a"] .wh-search-note {
    margin: -2px 2px 14px;
    font-size: 12px;
    color: var(--wh-text-dim);
    text-align: left;
}
.wh-area-chips .wh-chip-btn {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 12.5px;
}

/* The first-visit location hint used to sit above the pin and cover the
 * Design A tabs. Flip it under the search field, and when it is showing
 * reserve a row so it cannot cover the reminders CTA beneath. Margin, not
 * extra wrap height: the pin/icon are absolutely centered on .search-wrap. */
body[data-hub-design="a"] .location-tooltip {
    bottom: auto;
    top: calc(100% + 8px);
}
body[data-hub-design="a"] .search-wrap:has(.location-tooltip.visible) {
    margin-bottom: 3rem;
}
body[data-hub-design="a"] .location-tooltip::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: rgba(0, 0, 0, 0.85);
}

/* ── Quick chips ────────────────────────────────────────────────────────── */
.wh-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.wh-chip-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--wh-border);
    background: var(--wh-surface);
    color: var(--wh-fg);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s;
}
.wh-chip-btn:hover {
    background: var(--wh-surface-hover);
    border-color: var(--wh-border-strong);
}
.wh-chip-btn[aria-pressed="true"],
.wh-chip-btn.is-on {
    background: rgba(var(--wh-accent-rgb), 0.18);
    border-color: rgba(var(--wh-accent-rgb), 0.45);
    color: var(--wh-teal);
}
.wh-chip-btn svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
    flex-shrink: 0;
}
.wh-chip-btn .wh-chip-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--wh-text-dim);
}

/* ── Blocks ─────────────────────────────────────────────────────────────── */
.wh-block {
    margin-bottom: 20px;
    text-align: left;
}
.wh-block-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 0 2px 8px;
}
.wh-block-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--wh-text-dim);
}
.wh-block-count {
    font-size: 11px;
    color: var(--wh-text-faint);
}
.wh-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── Row ────────────────────────────────────────────────────────────────── */
.wh-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
    background: var(--wh-surface);
    border: 1px solid var(--wh-border);
    border-radius: var(--wh-radius);
    overflow: hidden;
    transition: background 0.18s, border-color 0.18s;
}
.wh-row:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--wh-border-strong);
}
.wh-row-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
    padding: var(--wh-row-pad);
    background: none;
    border: none;
    font: inherit;
    color: var(--wh-fg);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.wh-row-link:focus-visible,
.wh-action:focus-visible,
.wh-chip-btn:focus-visible,
.wh-more:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: -3px;
}
.wh-accent {
    width: 4px;
    align-self: stretch;
    min-height: 34px;
    border-radius: 3px;
    background: linear-gradient(to bottom, var(--wh-c1, rgba(255, 255, 255, 0.25)), var(--wh-c2, rgba(255, 255, 255, 0.1)));
    flex-shrink: 0;
}
.wh-row.is-directory .wh-accent {
    background: rgba(255, 255, 255, 0.14);
}
.wh-row-main {
    flex: 1 1 auto;
    min-width: 0;
}
.wh-row-name {
    display: block;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.wh-row-sub {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--wh-text-dim);
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.wh-row-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.wh-dist {
    font-size: 11px;
    color: var(--wh-text-dim);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 3px 8px;
    white-space: nowrap;
}
.wh-cue {
    font-size: 18px;
    color: var(--wh-text-faint);
    line-height: 1;
}

/* Small type badges reuse the row's text rhythm rather than a separate tile. */
.wh-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    vertical-align: middle;
}
.wh-tag.is-timetable {
    background: rgba(var(--wh-accent-rgb), 0.16);
    color: #4dd0e1;
}
.wh-tag.is-prayer-room {
    background: rgba(255, 193, 7, 0.16);
    color: #ffc107;
}
.wh-tag.is-community {
    background: rgba(33, 150, 243, 0.16);
    color: #64b5f6;
}

/* Directions: a quiet 44px icon button at the trailing edge. It replaces the
 * oversized labelled tile that used to lead the row and collide with the chat
 * launcher. */
.wh-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    align-self: stretch;
    flex-shrink: 0;
    border: none;
    border-left: 1px solid var(--wh-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--wh-text-dim);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}
.wh-action svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}
.wh-action:hover,
.wh-action:active {
    background: rgba(var(--wh-accent-rgb), 0.16);
    color: var(--wh-teal);
}

/* Jumu'ah times keep the existing pill styling, just inside the shared row. */
.wh-row .jumuah-times {
    margin-top: 6px;
}

/* ── Area drill-down ────────────────────────────────────────────────────── */
.wh-back {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    margin-bottom: 12px;
    padding: 8px 14px 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--wh-border);
    background: var(--wh-surface);
    color: var(--wh-fg);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.wh-back:hover {
    background: var(--wh-surface-hover);
}
.wh-drill-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    text-align: left;
    padding: 0 2px 10px;
}
.wh-drill-title {
    font-size: 18px;
    font-weight: 700;
}
.wh-drill-count {
    font-size: 12px;
    color: var(--wh-text-dim);
}

/* ── Empty states, paging ───────────────────────────────────────────────── */
.wh-empty {
    padding: 26px 18px;
    text-align: center;
    font-size: 13px;
    color: var(--wh-text-dim);
    border: 1px solid var(--wh-border);
    border-radius: var(--wh-radius);
    background: rgba(255, 255, 255, 0.03);
}
.wh-empty strong {
    display: block;
    margin-bottom: 4px;
    font-size: 15px;
    color: var(--wh-fg);
}
.wh-more {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid var(--wh-border);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.82);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.wh-more:hover {
    background: var(--wh-surface-hover);
}

/* ── Brand: Khatt ───────────────────────────────────────────────────────────
 * Deep green + ivory, the Arabic word وقت (waqt, "time") as the mark, serif
 * wordmark. The shared rules below re-point every accent index.html paints in
 * teal at the theme variables; the per-brand block sets them. Body text is
 * >10:1 against both gradient stops and accent-on-tinted-chip is >4.5:1 (the
 * old teal managed 2.7:1 on the active tab and Near me chip).
 */
body[data-hub-theme] {
    background: linear-gradient(135deg, var(--wh-bg-a) 0%, var(--wh-bg-b) 100%);
}
body[data-hub-theme] .shimmer-overlay {
    background: linear-gradient(135deg, var(--wh-bg-a) 0%, var(--wh-bg-b) 50%, var(--wh-bg-a) 100%);
}
/* Accents that live in index.html's own stylesheet, re-pointed at the theme. */
body[data-hub-theme] .view-toggle button.active {
    background: rgba(var(--wh-accent-rgb), 0.22);
    color: var(--wh-teal);
    box-shadow: 0 2px 8px rgba(var(--wh-accent-rgb), 0.15);
}
body[data-hub-theme] .nearest-reminder-cta {
    background: rgba(var(--wh-accent-rgb), 0.1);
    border-color: rgba(var(--wh-accent-rgb), 0.28);
}
body[data-hub-theme] .nearest-reminder-cta svg {
    stroke: var(--wh-teal);
}
body[data-hub-theme] .nearest-reminder-panel-actions button.confirm {
    background: rgba(var(--wh-accent-rgb), 0.28);
    color: #fff;
}
body[data-hub-theme] .location-btn.active svg {
    fill: var(--wh-teal);
}
body[data-hub-theme] .popup-btn-directions {
    background: rgba(var(--wh-accent-rgb), 0.16);
    border-color: rgba(var(--wh-accent-rgb), 0.32);
    color: var(--wh-teal);
}
body[data-hub-theme] .popup-btn-directions svg {
    fill: var(--wh-teal);
}

/* Hero: shared theme layout, then per-theme type. */
body[data-hub-theme] .icon {
    font-size: 0;
    margin-bottom: 10px;
    line-height: 0;
}
body[data-hub-theme] .icon svg {
    width: 58px;
    height: 58px;
    filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.35));
}
body[data-hub-theme] h1 {
    font-weight: 600;
}
body[data-hub-theme] .wh-tld {
    color: var(--wh-teal);
    font-weight: 400;
}
body[data-hub-theme] .subtitle {
    color: rgba(255, 255, 255, 0.62);
    opacity: 1;
    font-size: 12.5px;
    letter-spacing: 0.2px;
}
body[data-hub-theme] .wh-ramadan {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(var(--wh-accent-rgb), 0.18);
    color: var(--wh-teal);
    font-size: 11px;
    font-weight: 700;
}
/* The prompt returns as a quiet lead-in line instead of a spaced-out shout. */
body[data-hub-theme][data-hub-design="a"] .label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    opacity: 0.75;
}

/* Mark: the Arabic word plus a rule beneath it. */
body[data-hub-theme] .icon .wh-rule {
    display: block;
    margin: 0 auto;
    filter: none;
}
.wh-arabic {
    display: block;
    font-family: 'Noto Naskh Arabic', 'Geeza Pro', 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
    font-size: 52px;
    line-height: 1.05;
    color: var(--wh-fg);
    letter-spacing: 0;
}

/* Palette + type. Values come from /brand-tokens.css (ADR 0002) — do not
   restate Khatt hex here. */
body[data-hub-theme="khatt"] {
    --wh-teal: var(--wq-khatt-sand);
    --wh-accent-rgb: var(--wq-khatt-sand-rgb);
    --wh-bg-a: var(--wq-khatt-green-deep);
    --wh-bg-b: var(--wq-khatt-green);
}
body[data-hub-theme="khatt"] .icon {
    margin-bottom: 6px;
}
body[data-hub-theme="khatt"] .icon .wh-rule {
    width: 64px;
    height: 6px;
    margin-top: 2px;
}
body[data-hub-theme="khatt"] h1 {
    font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
    font-weight: 400;
    letter-spacing: 1px;
}
body[data-hub-theme="khatt"] .subtitle {
    color: rgba(255, 255, 255, 0.7);
}
body[data-hub-theme="khatt"] .view-toggle button.active,
body[data-hub-theme="khatt"] .wh-chip-btn.is-on {
    color: var(--wq-khatt-ivory);
}

@media (prefers-reduced-motion: reduce) {
    .wh-row,
    .wh-action {
        transition: none !important;
    }
}

@media print {
    .wh-action,
    .wh-chips {
        display: none !important;
    }
}
