/* web.css - website-only layout, injected by the web build into its copy of
   index.html (never loaded by the TV app or the widget). Scoped to
   html[data-mode="web"], which the build stamps on the city pages.

   The first screen stays the app exactly as it is (100vh); the page can
   scroll past it to the server-rendered sections (.city-seo). The layers
   the app keeps fixed on a TV are confined to the first screen here. */

html[data-mode="web"] {
    height: auto;
    overflow-y: auto;
}

html[data-mode="web"] body {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
    overflow-x: hidden;   /* the full-bleed clouds layer is 100vw wide */
    /* The app paints the sky with background-attachment: fixed + cover. On a
       scrolling page that re-fits the image every time the mobile address bar
       shows or hides and jumps; a fixed backdrop element sized to the large
       viewport does not. */
    background-image: none;
    background-attachment: scroll;
}

html[data-mode="web"] body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100lvh;
    background: var(--bg-color) var(--bg-image) no-repeat center center;
    background-size: cover;
    z-index: -1;
    pointer-events: none;
}

/* city pages: no weather widget, no effects, no switch for them */
html[data-page="city"] #weatherWidget,
html[data-page="city"] .alarm-item:has(#weather_effects) {
    display: none !important;
}

/* city pages: no settings screen; a Home link sits where the settings button is */
html[data-page="city"] .setting-div,
html[data-page="city"] #settingsPopup,
html[data-page="city"] #popupOverlay,
html[data-page="city"] #adhanPickerPanel {
    display: none !important;
}

.city-home-link {
    position: absolute;
    top: 2vw;
    left: 0.4vw;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 0.5vw;
    padding: 0.3vw 0.9vw;
    color: #fff;
    text-decoration: none;
    font-size: 1.4vw;
    line-height: 1;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.28);
}

.city-home-link:hover,
.city-home-link:focus-visible {
    background: rgba(0, 0, 0, 0.45);
    outline: 2px solid rgba(255, 213, 79, 0.7);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .city-home-link {
        top: 1vh;
        left: 1vh;
        gap: 1vh;
        padding: 1vh 1.8vh;
        font-size: 2.4vh;
    }
}

html[data-mode="web"] .container {
    height: 100vh;
    margin: 0 auto;
}

html[data-mode="web"] .birds {
    height: 100vh;
}

html[data-mode="web"] .clouds-layer {
    position: absolute;
    height: 85vh;
    /* Full bleed. The layer lives inside .container (95% wide, centred), so
       as an absolute box it stopped at the prayer cards' edges; the clouds
       and the overcast cover must reach both screen edges as on the TV.
       body overflow-x is hidden below so the 100vw box never adds a
       horizontal scrollbar. */
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
}

html[data-mode="web"] footer {
    position: static;
    box-sizing: border-box;   /* width:100% from the app + side padding here */
    padding: 1.5rem 1rem 1rem;
    /* The links are emitted without whitespace between them, so the row
       needs flex wrapping or it clips at phone width. */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    row-gap: 0.3rem;
    /* Readable on every theme image, the pale fajar/dhur/asr skies included:
       a soft scrim fading up from the page edge, plus a text shadow. */
    background: linear-gradient(to top, rgba(15, 18, 28, 0.55) 0%, rgba(15, 18, 28, 0.35) 55%, rgba(15, 18, 28, 0) 100%);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* footer links of the website copies (privacy policy, MCP page) */
.web-footer-link {
    color: #fff;
    font-size: 0.85rem;
    margin-left: 1rem;
    text-decoration: underline;
    text-underline-offset: 2px;
}

html[data-mode="web"] #version {
    color: rgba(255, 255, 255, 0.75);
    /* The app's phone rule sets footer { font-size: 3vh !important }, which
       this label inherits; an explicit size keeps it in the link row. */
    font-size: 0.8rem;
}

/* Publisher note: its own full-width row under the link row (flex order puts
   it after the #version span that follows the links in the markup). */
.web-footer-note {
    order: 10;
    flex-basis: 100%;
    max-width: 62ch;
    margin: 0.8rem auto 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
}

html[data-mode="web"] #version {
    position: static;
    display: inline-block;
    margin-left: 1rem;
}

/* The AM/PM indicator takes part in the clock's centring, same as on the TV,
   so "10:29:42 AM" is centred as a whole (Asif, 14 Sep 2026). An earlier
   web-only rule hung it beside the digits to avoid a ~0.01 CLS when index.js
   shows it, but that left the visible time sitting right of centre. */

/* ---- server-rendered sections below the first screen ---- */

.city-seo {
    position: relative;
    /* Above the weather-effects layer (z 5): fog/mist otherwise whites out
       the scrolled content on the home page. */
    z-index: 6;
    box-sizing: border-box;
    width: min(1100px, calc(100% - 2rem));
    margin: 2rem auto 1rem;
    padding: clamp(1.25rem, 3vw, 2.5rem);
    border-radius: 12px;
    background: rgba(8, 20, 16, 0.55);
    color: #f4f7f5;
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    font-size: 1rem;
    line-height: 1.55;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.city-seo h1 {
    margin: 0.25rem 0 1rem;
    font-size: clamp(1.5rem, 3.5vw, 2.25rem);
    line-height: 1.2;
    text-wrap: balance;
}

.city-seo h2 {
    margin: 2rem 0 0.75rem;
    font-size: clamp(1.15rem, 2.4vw, 1.5rem);
    line-height: 1.25;
}

.city-seo p {
    margin: 0.6rem 0;
    max-width: 75ch;
}

.city-seo a {
    color: #ffd54f;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.city-seo a:hover,
.city-seo a:focus-visible {
    color: #ffe58a;
    outline: none;
}

.city-seo code {
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.92em;
    background: rgba(255, 255, 255, 0.12);
    padding: 0 0.3em;
    border-radius: 3px;
}

.city-crumbs {
    font-size: 0.9rem;
    opacity: 0.85;
}

.city-lead {
    font-size: 1.05rem;
}

.city-meta {
    font-size: 0.92rem;
    opacity: 0.85;
}

.city-tablewrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.city-seo table {
    border-collapse: collapse;
    width: 100%;
    font-variant-numeric: tabular-nums;
}

.city-seo th,
.city-seo td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    white-space: nowrap;
}

.city-seo thead th {
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.8;
}

.city-times {
    max-width: 28rem;
}

.city-times td {
    font-size: 1.15rem;
    font-weight: bold;
}

.city-month tr.is-today th,
.city-month tr.is-today td {
    background: rgba(255, 213, 79, 0.18);
    font-weight: bold;
}

.city-faq dt {
    margin-top: 0.9rem;
    font-weight: bold;
}

.city-faq dd {
    margin: 0.2rem 0 0;
    max-width: 75ch;
}

.city-links {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
}

.city-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.3rem 1rem;
}

.city-countries {
    font-size: 0.92rem;
    line-height: 1.9;
}

.city-more {
    margin-top: 2rem;
}

@media (max-width: 600px) {
    .city-seo {
        width: calc(100% - 1.5rem);
        border-radius: 8px;
    }
    .city-seo th,
    .city-seo td {
        padding: 0.4rem 0.5rem;
        font-size: 0.9rem;
    }
    .city-times td {
        font-size: 1.05rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html[data-mode="web"] {
        scroll-behavior: auto;
    }
}

/* ---- home page city list ---- */

.city-home h3 {
    margin: 1.4rem 0 0.4rem;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.85;
}

.city-home .city-links-grid li {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.city-home small {
    opacity: 0.75;
    font-size: 0.85em;
}

/* featured pair (Makkah and Madinah) above the continents */

.city-featured {
    margin: 1.2rem 0 0.5rem;
    gap: 0.75rem 1rem;
}

.city-featured li {
    flex: 1 1 14rem;
    padding: 0.9rem 1.1rem;
    border: 1px solid rgba(255, 213, 79, 0.55);
    border-radius: 8px;
    background: rgba(255, 213, 79, 0.10);
}

.city-featured a {
    display: block;
    font-size: 1.35rem;
    font-weight: bold;
    text-decoration: none;
}

.city-featured a:hover,
.city-featured a:focus-visible {
    text-decoration: underline;
}

.city-featured small {
    display: block;
    margin-top: 0.15rem;
    opacity: 0.8;
}

.city-home h1 {
    font-size: clamp(1.35rem, 3vw, 1.9rem);
}

/* ---- phone-size website: a tappable settings button on the home page ----
   The app sizes the icon in vw/vh for a TV; on a phone that is a few pixels.
   Website copies only (html[data-mode="web"]); city pages hide it anyway. */
@media (max-width: 900px) {
    html[data-mode="web"] .setting-div {
        top: 0.6rem !important;
        left: 0.6rem !important;
        z-index: 5;
    }
    html[data-mode="web"] .settings-icon {
        font-size: 1.5rem !important;
        padding: 0.6rem 0.75rem !important;
        min-width: 44px;
        min-height: 44px;
        border-radius: 999px;
        background: rgba(0, 0, 0, 0.28);
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ---- phone-size website: the settings dialog in readable, tappable sizes ----
   settingModal.css sizes everything in vw for a TV screen; on a phone that
   yields 5-6 px text. These apply to website copies only. */
@media (max-width: 900px) {
    html[data-mode="web"] .popup-window {
        max-width: 94vw !important;
        max-height: 92vh !important;
        padding: 1rem !important;
        scroll-padding: 1rem !important;
        border-radius: 12px;
        font-size: 1rem;
    }
    html[data-mode="web"] .popup-close {
        font-size: 1.75rem !important;
        padding: 0.25rem 0.6rem;
        line-height: 1;
    }
    html[data-mode="web"] .popup-window label,
    html[data-mode="web"] .popup-window .input-label {
        font-size: 0.95rem !important;
        margin-bottom: 0.3rem !important;
    }
    html[data-mode="web"] .popup-window input[type="text"] {
        font-size: 1.05rem !important;
        padding: 0.7rem 0.8rem !important;
        margin: 0.35rem 0 !important;
        border-width: 1px !important;
        border-radius: 8px !important;
        min-height: 44px;
        box-sizing: border-box;
    }
    html[data-mode="web"] .popup-window #countryInput {
        padding-right: 7.5rem !important;
    }
    html[data-mode="web"] .popup-window input[type="text"]:focus,
    html[data-mode="web"] .popup-window input[type="text"].focused,
    html[data-mode="web"] .popup-window [tabindex]:focus {
        outline-width: 2px !important;
    }
    html[data-mode="web"] .nearby-btn {
        right: 0.5rem !important;
        gap: 0.4rem !important;
        padding: 0.45rem 0.75rem !important;
        border-radius: 8px !important;
        font-size: 0.9rem !important;
        min-height: 36px;
    }
    html[data-mode="web"] .nearby-btn i {
        width: 1.3rem !important;
        height: 1.3rem !important;
        font-size: 0.75rem !important;
    }
    html[data-mode="web"] .autocomplete-item {
        font-size: 1rem !important;
        padding: 0.6rem 0.75rem !important;
    }
    html[data-mode="web"] button.save-btn {
        font-size: 1.05rem !important;
        padding: 0.8rem 1.25rem !important;
        border-radius: 10px !important;
        margin: 0.75rem 0 !important;
        min-height: 44px;
        width: 100%;
    }
    html[data-mode="web"] .alarm-setting-header,
    html[data-mode="web"] .alarm-fold-row .alarm-fold-title {
        font-size: 1rem !important;
        padding: 0 !important;
    }
    html[data-mode="web"] .alarm-fold-hint {
        font-size: 0.8rem !important;
        margin-right: 0.5rem !important;
    }
    html[data-mode="web"] .alarm-fold-btn {
        font-size: 1.4rem !important;
        padding: 0.2rem 0.7rem !important;
        border-radius: 8px !important;
        min-width: 44px;
        min-height: 40px;
    }
    html[data-mode="web"] .alarm-item {
        padding: 0.55rem 0.25rem !important;
        gap: 0.6rem !important;
        border-radius: 8px !important;
    }
    html[data-mode="web"] .alarm-prayer-name {
        font-size: 1rem !important;
        min-width: 4.5rem !important;
    }
    html[data-mode="web"] .alarm-prayer-time {
        font-size: 0.95rem !important;
        min-width: 4.5rem !important;
    }
    html[data-mode="web"] .alarm-adhan-inline {
        gap: 0.4rem !important;
    }
    html[data-mode="web"] .alarm-adhan-label {
        font-size: 0.8rem !important;
    }
    html[data-mode="web"] .alarm-adhan-btn {
        font-size: 0.8rem !important;
        padding: 0.25rem 0.6rem !important;
        border-width: 1px !important;
        border-radius: 6px !important;
    }
    /* the on/off switch: 48 x 26 with a 22 px knob */
    html[data-mode="web"] .switch {
        width: 48px !important;
        height: 26px !important;
    }
    html[data-mode="web"] .slider {
        border-radius: 26px !important;
    }
    html[data-mode="web"] .slider:before {
        width: 22px !important;
        height: 22px !important;
        left: 2px !important;
        bottom: 2px !important;
    }
    html[data-mode="web"] input:checked + .slider:before {
        transform: translateX(22px) !important;
    }
    /* adhan picker panel */
    html[data-mode="web"] .adhan-picker {
        padding: 1rem !important;
        border-radius: 0 0 12px 12px !important;
    }
    html[data-mode="web"] .adhan-picker-title { font-size: 1.1rem !important; }
    html[data-mode="web"] .adhan-picker-close { font-size: 1.6rem !important; }
    html[data-mode="web"] .adhan-picker-type-row label,
    html[data-mode="web"] .adhan-picker-type-select,
    html[data-mode="web"] .adhan-type-option,
    html[data-mode="web"] .ap-name { font-size: 0.95rem !important; }
    html[data-mode="web"] .ap-row { padding: 0.6rem 0.6rem !important; border-radius: 8px !important; }
    html[data-mode="web"] .ap-dl-icon, html[data-mode="web"] .ap-badge, html[data-mode="web"] .ap-preview-btn { font-size: 0.85rem !important; }
    html[data-mode="web"] .ap-preview-btn { width: 2rem !important; height: 2rem !important; border-radius: 6px !important; }
}

/* phone-size dialog: rows wrap instead of overflowing; the adhan choice goes
   under the prayer name and time */
@media (max-width: 900px) {
    html[data-mode="web"] .popup-window {
        overflow-x: hidden !important;
        left: 50% !important;
        right: auto !important;
    }
    html[data-mode="web"] .popup-window input[type="text"],
    html[data-mode="web"] .autocomplete-container {
        max-width: 100%;
    }
    html[data-mode="web"] .alarm-item {
        flex-wrap: wrap !important;
        row-gap: 0.35rem !important;
    }
    html[data-mode="web"] .alarm-item .alarm-adhan-inline {
        order: 10;
        flex: 1 0 100% !important;
        justify-content: flex-start;
        padding-left: 0.1rem;
    }
    html[data-mode="web"] .alarm-item .alarm-adhan-label {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 60%;
    }
}

/* ---- phone-size website home page: clock and date centred, weather below ----
   weather.css puts the widget beside the date on small screens (space-between
   row); on a phone that squeezes both. Website copies only. */
@media (max-width: 600px) {
    html[data-mode="web"] .header {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 1.2vh !important;
        padding-top: 3.9rem !important;      /* clear of the settings button */
        padding-left: 3vw !important;
        padding-right: 3vw !important;
    }
    html[data-mode="web"] .display {
        order: 1;
        width: 100% !important;
        flex: 0 0 auto !important;
        text-align: center !important;
    }
    html[data-mode="web"] #weatherWidget {
        order: 2;
        position: static !important;
        max-width: 100% !important;
        justify-content: center;
        margin-top: 0.4vh;
    }
}

/* The footer line is a <p> on the website (the app's <h6> skipped heading levels); keep the h6's weight. */
.footer-text { font-weight: 700; }

/* Qibla compass on city pages: one inline SVG, no script, no map requests. */
.qibla-wrap {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.qibla-wrap p {
    margin: 0;
    flex: 1;
    min-width: 14rem;
}
.qibla-compass { flex: none; }

/* Until the theme's photo has loaded, the body shows --bg-color, the app's
   pale peach for every theme. On the website each theme's colour is the
   average of its photo (measured), so that moment looks like the photo,
   not a flash of peach. The home page, still in theme-loading until ip.php
   has answered, uses the theme its head script guessed from the visitor's
   clock (data-theme-guess, see build-web-pages.js). Website copies only. */
html[data-mode="web"] body.theme-fajar,   html[data-theme-guess="fajar"]   body.theme-loading { --bg-color: #92b3c1; }
html[data-mode="web"] body.theme-sunrise, html[data-theme-guess="sunrise"] body.theme-loading { --bg-color: #d39044; }
html[data-mode="web"] body.theme-dhur,    html[data-theme-guess="dhur"]    body.theme-loading { --bg-color: #fbd968; }
html[data-mode="web"] body.theme-asr,     html[data-theme-guess="asr"]     body.theme-loading { --bg-color: #f2928a; }
html[data-mode="web"] body.theme-magrib,  html[data-theme-guess="magrib"]  body.theme-loading { --bg-color: #bb6a94; }
html[data-mode="web"] body.theme-isha,    html[data-theme-guess="isha"]    body.theme-loading { --bg-color: #53463f; }
