/*
 * Mosjid base styles: fonts, reset, typography, layout, header and footer, and the few shared pieces.
 * Values come from tokens.css; page-specific styles live in their own files.
 */

/* ---------------------------------------------------------------- fonts (SIL OFL, fonts/OFL.txt) */

@font-face {
    font-family: "Noto Sans Bengali";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/noto-sans-bengali-bengali.woff2") format("woff2");
    unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA,
        U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}

@font-face {
    font-family: "Noto Sans Bengali";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/noto-sans-bengali-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
        U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Noto Sans Bengali";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/noto-sans-bengali-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
        U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Noto Serif Bengali (OFL, assets/fonts/OFL.txt): display headings only (--font-display), so other pages never load it */
@font-face {
    font-family: "Noto Serif Bengali";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/noto-serif-bengali-bengali.woff2") format("woff2");
    unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA,
        U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}

@font-face {
    font-family: "Noto Serif Bengali";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/noto-serif-bengali-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
        U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Noto Serif Bengali";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/noto-serif-bengali-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
        U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------------------------------------------------------------- reset */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-paper);
    color: var(--color-ink);
    font: var(--text-body);
    font-variant-numeric: var(--numeric);
}

main {
    flex: 1;
}

main:focus {
    outline: none;
}

h1,
h2,
h3,
p {
    margin: 0;
}

img,
svg {
    display: block;
    max-width: 100%;
}

/* Components set display (.btn, .banner, .field); hidden must still hide them */
[hidden] {
    display: none !important;
}

/* ---------------------------------------------------------------- links and focus */

a {
    color: var(--color-accent);
    text-underline-offset: 3px;
}

a:hover {
    color: var(--color-accent-pressed);
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--radius-sm);
}

.skip-link {
    position: absolute;
    left: var(--space-4);
    top: calc(-1 * var(--space-8));
    padding: var(--space-2) var(--space-4);
    background: var(--color-surface);
    color: var(--color-ink);
    font: var(--text-label);
}

.skip-link:focus-visible {
    top: var(--space-2);
}

/* ---------------------------------------------------------------- layout */

.container {
    width: 100%;
    max-width: var(--content-max);
    margin-inline: auto;
    padding-inline: var(--space-4);
}

@media (min-width: 600px) {
    .container {
        padding-inline: var(--space-6);
    }
}

.lead {
    font: var(--text-body-lg);
}

/* ---------------------------------------------------------------- header and footer */

.site-header {
    position: relative;
    z-index: 1;
    color: var(--color-on-deep);
    background: var(--color-deep) url("../images/brand/pattern-deep.svg");
}

/* The arcade: a row of arches hanging from the header, cut from the same green */
.site-header::after {
    content: "";
    position: absolute;
    inset: 100% 0 auto;
    height: 20px;
    background: var(--color-deep);
    -webkit-mask: url("../images/brand/arcade-hang.svg") repeat-x center top;
    mask: url("../images/brand/arcade-hang.svg") repeat-x center top;
}

.site-header-inner {
    display: flex;
    align-items: center;
    min-height: 56px;
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font: var(--text-title);
    color: var(--color-on-deep);
    text-decoration: none;
}

.wordmark:hover {
    color: var(--color-on-deep);
}

.wordmark-mark {
    --mark-arch: var(--color-on-deep);
    --mark-word: var(--color-deep);
    width: 27px;
    height: 36px;
    flex: none;
}

/* Without JavaScript the switch can't work, so it isn't there */
.theme-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: var(--touch-min);
    min-height: var(--touch-min);
    padding: 0;
    border: 0;
    color: var(--color-on-deep);
    background: none;
    cursor: pointer;
}

.js .theme-toggle {
    display: inline-flex;
}

.theme-toggle span {
    display: inline-flex;
}

.theme-toggle span[hidden] {
    display: none;
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--color-brass);
    outline-offset: 2px;
    box-shadow: none;
}

.site-footer {
    position: relative;
    margin-top: 40px;
    color: var(--color-on-deep-muted);
    background: var(--color-deep) url("../images/brand/pattern-deep.svg");
    font: var(--text-caption);
}

/* The same arches standing on the footer's top edge */
.site-footer::before {
    content: "";
    position: absolute;
    inset: auto 0 calc(100% - 1px);
    height: 20px;
    background: var(--color-deep);
    -webkit-mask: url("../images/brand/arcade-stand.svg") repeat-x center bottom;
    mask: url("../images/brand/arcade-stand.svg") repeat-x center bottom;
}

.footer-verse {
    display: grid;
    justify-items: center;
    gap: var(--space-2);
    padding-block: var(--space-6) var(--space-5);
    border-bottom: 1px solid rgba(201, 164, 92, 0.35);
    text-align: center;
}

.footer-verse .verse {
    width: min(100%, 460px);
    height: 58px;
    color: var(--color-brass);
    fill: currentColor;
}

.footer-verse p {
    max-width: 60ch;
    color: var(--color-on-deep);
    font: var(--text-label);
}

.footer-verse .footer-verse-source {
    color: var(--color-on-deep-muted);
    font: var(--text-caption);
}

.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-2) var(--space-5);
    padding-block: var(--space-5);
}

/* ---------------------------------------------------------------- shared pieces */

.tag {
    display: inline-block;
    padding: 0 var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--color-accent-soft);
    color: var(--color-ink);
    font: var(--text-label);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--touch-min);
    padding: 0 var(--space-5);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: 600 16px/24px var(--font-ui);
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-standard);
}

.btn-primary {
    background: var(--color-accent);
    color: var(--color-on-accent);
}

.btn-primary:hover {
    background: var(--color-accent-pressed);
    color: var(--color-on-accent);
}

.btn-secondary {
    border-color: var(--color-control);
    background: transparent;
    color: var(--color-ink);
}

.btn-secondary:hover {
    background: var(--color-press);
    color: var(--color-ink);
}

/* ---------------------------------------------------------------- icons (assets/icons/sprite.svg, Lucide) */

.icon {
    flex: none;
    width: var(--icon-md);
    height: var(--icon-md);
    fill: none;
    stroke: currentColor;
    stroke-width: var(--icon-stroke);
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-sm {
    width: var(--icon-sm);
    height: var(--icon-sm);
}

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

/* ---------------------------------------------------------------- forms */

.field {
    display: grid;
    gap: var(--space-1);
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.field-label {
    font: var(--text-label);
    color: var(--color-ink);
}

.field-help {
    font: var(--text-caption);
    color: var(--color-ink-muted);
}

.field-error {
    font: var(--text-caption);
    color: var(--color-error);
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: var(--touch-min);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-control);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-ink);
    font: var(--text-body);
}

.textarea {
    min-height: 112px;
    resize: vertical;
}

.select {
    appearance: none;
    padding-right: var(--space-7);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='%2356605A' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--color-ink-muted);
}

.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
    border-color: var(--color-accent);
    box-shadow: inset 0 0 0 1px var(--color-accent);
    border-radius: var(--radius-sm);
}

.is-invalid .input,
.is-invalid .select,
.is-invalid .textarea {
    border: 2px solid var(--color-error);
}

.input:disabled,
.select:disabled {
    background: var(--color-sunken);
    color: var(--color-ink-muted);
}

/* Radio and checkbox choices drawn as chips: <label class="chip"><input type="radio"> সভাপতি</label> */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--touch-gap);
}

.chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 var(--space-4);
    border: 1px solid var(--color-control);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font: var(--text-label);
    cursor: pointer;
}

.chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chip:has(input:checked) {
    border: 2px solid var(--color-accent);
    background: var(--color-accent-soft);
}

.chip:has(input:focus-visible) {
    box-shadow: var(--focus-ring);
}

/* A group of chips or cards labelled by its legend (.field resets the fieldset), lined up with the other labels */
legend.field-label {
    padding: 0;
}

/* The tick a chosen chip shows before its label (M1, W15) */
.chip .chip-check {
    display: none;
    width: 18px;
    height: 18px;
    margin-inline-end: var(--space-1);
}

.chip:has(input:checked) .chip-check {
    display: inline-block;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    min-height: var(--touch-min);
    padding-block: var(--space-2);
    cursor: pointer;
}

.check input {
    flex: none;
    width: 24px;
    height: 24px;
    margin: 0;
    accent-color: var(--color-accent);
}

/* An on/off switch: <label class="switch-row"><span>…</span><input type="checkbox" class="switch"></label> */
.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    min-height: var(--touch-min);
    cursor: pointer;
}

.switch {
    flex: none;
    position: relative;
    width: 52px;
    height: 32px;
    margin: 0;
    border: 2px solid var(--color-control);
    border-radius: var(--radius-md);
    background: var(--color-sunken);
    appearance: none;
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}

.switch::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    background: var(--color-control);
    transition: transform var(--duration-fast) var(--ease-standard);
}

.switch:checked {
    border-color: var(--color-accent);
    background: var(--color-accent);
}

.switch:checked::before {
    background: var(--color-on-accent);
    transform: translateX(20px);
}

.switch:focus-visible {
    box-shadow: var(--focus-ring);
    outline: none;
}

/* ---------------------------------------------------------------- banners and flash messages */

.banner {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-sm);
    background: var(--color-sunken);
    color: var(--color-ink);
}

.banner-title {
    font: 600 16px/24px var(--font-ui);
}

.banner p + p {
    margin-top: var(--space-1);
}

.banner-success {
    background: var(--color-accent-soft);
}

.banner-success > .icon {
    color: var(--color-accent);
}

.banner-warning {
    background: var(--color-due-soft);
}

.banner-warning > .icon {
    color: var(--color-due);
}

.banner-error {
    background: var(--color-error-soft);
}

.banner-error > .icon {
    color: var(--color-error);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    background: var(--color-sunken);
    border-color: transparent;
    color: var(--color-ink-muted);
    cursor: not-allowed;
}

.btn-quiet {
    min-height: 40px;
    padding: 0 var(--space-3);
    background: transparent;
    color: var(--color-accent);
}

.btn-quiet:hover {
    background: var(--color-press);
    color: var(--color-accent-pressed);
}

.btn-danger {
    background: var(--color-error);
    color: var(--color-surface);
}

.btn-danger:hover {
    background: var(--color-error);
    color: var(--color-surface);
    filter: brightness(0.92);
}

/* ---------------------------------------------------------------- holding and message pages */

.holding,
.message-page {
    display: grid;
    justify-items: start;
    gap: var(--space-4);
    max-width: 44rem;
    padding-block: var(--space-8);
}

.holding h1,
.message-page h1 {
    font: var(--text-headline);
}

@media (min-width: 600px) {
    .holding h1 {
        font: var(--text-display);
        font-family: var(--font-ui);
    }
}

.holding-english {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-line);
    color: var(--color-ink-muted);
    font: var(--text-caption);
}

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ---------------------------------------------------------------- pickers: the area lists, photos and the map pin (W9, W16, C6) */

.area-grid {
    display: grid;
    gap: var(--space-4);
}

@media (min-width: 600px) {
    .area-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.photo-picker {
    display: grid;
    gap: var(--space-3);
}

.photo-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: var(--space-2);
}

.photo-previews img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--color-sunken);
}

.file-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

.file-buttons label {
    position: relative;
}

.file-buttons input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    cursor: pointer;
}

.file-buttons label:has(input:focus-visible) {
    box-shadow: var(--focus-ring);
}

.pick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.btn-remove {
    position: absolute;
    top: var(--space-1);
    right: var(--space-1);
    min-height: 40px;
    width: 40px;
    padding: 0;
    background: var(--color-surface);
    font: 600 20px/1 var(--font-ui);
}

/* ---------------------------------------------------------------- map */

.map {
    position: relative;
    height: 320px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-md);
    background: var(--color-sunken);
    overflow: hidden;
}

@media (min-width: 900px) {
    .map {
        height: 400px;
    }
}

.map-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: var(--space-4);
    color: var(--color-ink-muted);
    font: var(--text-caption);
    text-align: center;
}

.map.is-ready .map-fallback {
    display: none;
}

.map-pin {
    display: flex;
    align-items: flex-start;
    gap: var(--space-1);
    color: var(--color-ink);
    text-decoration: none;
    cursor: pointer;
}

.map-pin::before {
    content: "";
    flex: none;
    width: 24px;
    height: 30px;
    background: url("../images/brand/pin-mosque.svg") center / contain no-repeat;
}

.map-pin-institution::before {
    background-image: url("../images/brand/pin-institution.svg");
}

.map-pin span {
    padding: 0 var(--space-2);
    border-radius: 2px;
    background: var(--color-surface);
    font: 600 13px/22px var(--font-ui);
    white-space: nowrap;
    box-shadow: 0 0 0 1px var(--color-line);
}

.map-pin-dot span {
    display: none;
}

.map-pin-dot:hover span,
.map-pin-dot:focus span,
.map-pin-dot:focus-visible span {
    display: inline;
}

.map-pin-dot:focus {
    outline: none;
}

/* A mosque that isn't live (suspended, archived) on the console's maps */
.map-pin-muted::before {
    opacity: 0.5;
    filter: grayscale(1);
}

/* The mosque being looked at among the others: brass instead of green, a third bigger from its tip, its name always shown */
.map-pin-current {
    z-index: 2;
}

.map-pin-current::before {
    background-image: url("../images/brand/pin-current.svg");
    transform: scale(1.3);
    transform-origin: 50% 100%;
}

.map-pin-current span {
    margin-left: var(--space-1);
    font-weight: 700;
    box-shadow: 0 0 0 2px var(--color-brass);
}

/* The first-visit notice that the data is for testing. No padding on the dialog: a click on it is a click outside. */
.demo-notice {
    width: min(480px, calc(100vw - 32px));
    padding: 0;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-ink);
    box-shadow: var(--shadow-dialog);
}

.demo-notice::backdrop {
    background: rgba(28, 36, 32, 0.55);
}

.demo-notice-body {
    position: relative;
    padding: var(--space-5);
}

.demo-notice h2 {
    padding-right: var(--space-7);
    font: var(--text-title);
}

/* Focus starts here so that a screen reader reads the title; the cross keeps its ring when tabbed to */
.demo-notice h2:focus,
.demo-notice h2:focus-visible {
    outline: none;
    box-shadow: none;
}

.demo-notice p {
    margin-top: var(--space-3);
    font: var(--text-body);
}

.demo-notice .demo-notice-en {
    color: var(--color-ink-muted);
    font: var(--text-label);
}

.demo-notice-close {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--touch-min);
    min-height: var(--touch-min);
    padding: 0;
    border: 0;
    color: var(--color-ink);
    background: none;
    cursor: pointer;
}

@media print {
    .demo-notice {
        display: none;
    }
}

