:root {
    --accent: #0b5c40;
    --accent-strong: #084832;
    --accent-soft: #e7f2ec;
    --brass: #a8823c;
    --text: #0f1a16;
    --muted: #5a6b64;
    --line: #e0e7e2;
    --bg: #f2f5f3;
    --sunken: #eef2ef;
    --dark: #0d2019;
    --dark-fg: #eaf2ed;
    --dark-muted: #93a8a0;
    --shadow: 0 10px 10px -10px rgba(10, 26, 20, .12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-weight: 600;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

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

a:hover {
    color: var(--brass);
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
}

.header {
    position: relative;
    z-index: 2;
    background: #fff;
    box-shadow: var(--shadow);
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    color: var(--accent);
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 30px;
}

.nav a {
    color: var(--muted);
    text-decoration: none;
}

.nav a:hover {
    color: var(--brass);
}

.breadcrumbs,
h1,
h1 + p,
h1 + .date + p:not(.stale) {
    margin: 0;
    color: #fff;
    background: var(--accent);
    box-shadow: 0 0 0 100vmax var(--accent);
    clip-path: inset(-1px -100vmax);
}

.breadcrumbs {
    padding-top: 20px;
    font-size: 13px;
}

.breadcrumbs a {
    color: #fff;
    text-decoration: none;
}

h1 {
    padding: 16px 0 12px;
    font-size: 36px;
    font-weight: 800;
    line-height: 1.25;
}

h1 + p,
h1 + .date + p:not(.stale) {
    padding-bottom: 8px;
    color: rgba(255, 255, 255, .9);
    font-size: 15px;
}

h1:not(:has(+ p:not(.stale, [hidden]))),
h1 + p:not(:has(+ p:not(.stale, [hidden]))),
h1 + .date + p:not(.stale) {
    padding-bottom: 72px;
}

h1 + p a {
    color: #fff;
}

:is(main, .madhab-root) > :nth-child(1 of :not(.breadcrumbs, h1, h1 + p, .date + p:not(.stale), [hidden], .madhab-root)) {
    margin-top: 24px;
}

:is(main, .madhab-root) > :is(.block, .card, .table-wrap):nth-child(1 of :not(.breadcrumbs, h1, h1 + p, .date + p:not(.stale), [hidden], .madhab-root)) {
    position: relative;
    z-index: 1;
    margin-top: -40px;
}

h2 {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
}

.date {
    font-size: 15px;
}

.block,
.card,
main > .table-wrap,
.method {
    background: #fff;
    border-radius: 5px;
    box-shadow: var(--shadow);
}

.block {
    margin: 0 0 20px;
    padding: 24px 30px;
}

.block > h2:first-child {
    position: relative;
    margin: -24px -30px 20px;
    padding: 18px 30px;
    box-shadow: 0 1px 0 var(--line);
}

.block > h2:first-child::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100px;
    height: 1px;
    background: var(--brass);
}

.card {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    margin: 0 0 20px;
    overflow: hidden;
}

.card__label {
    padding: 18px 0 18px 30px;
    font-weight: 700;
}

.card__timer {
    padding: 18px 30px 18px 6px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.card__prayers {
    position: relative;
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(5, 1fr);
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--line);
}

.card__prayers::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 0;
    width: 100px;
    height: 1px;
    background: var(--brass);
}

.card__prayers li {
    padding: 26px 8px;
    text-align: center;
}

.card__prayers span {
    display: block;
    font-size: 15px;
    font-weight: 700;
}

.card__prayers strong {
    display: block;
    font-size: 34px;
    font-weight: 800;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

.card__prayers small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.card__prayers li.is-next {
    color: #fff;
    background: var(--brass);
}

.card__prayers li.is-next small {
    color: rgba(255, 255, 255, .85);
}

.madhab {
    display: inline-flex;
    margin: 0 0 20px;
    padding: 4px;
    border-radius: 5px;
    background: #fff;
    box-shadow: var(--shadow);
}

.madhab__item {
    padding: 8px 16px;
    border: 0;
    border-radius: 4px;
    color: var(--muted);
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.madhab-hanafi [data-madhab="shafii"],
.madhab-shafii [data-madhab="hanafi"] {
    display: none;
}

.madhab__item.is-active {
    color: #fff;
    background: var(--accent);
}

.method {
    margin: 0 0 20px;
    padding: 16px 30px;
    color: var(--muted);
    font-size: 15px;
}

.table-wrap {
    overflow-x: auto;
}

main > .table-wrap {
    margin: 0 0 20px;
}

.block .table-wrap {
    margin: 0 -30px;
    width: calc(100% + 60px);
}

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

.table th,
.table td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    text-align: center;
    white-space: nowrap;
}

.table th {
    font-size: 14px;
    color: var(--muted);
}

.table tr > :first-child {
    padding-left: 30px;
    text-align: left;
}

.table tr > :last-child {
    padding-right: 30px;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table .is-today {
    color: #fff;
    background: var(--accent);
}

.table .is-today a {
    color: #fff;
}

.table .is-muted td {
    color: var(--muted);
}

.table--wrap th,
.table--wrap td {
    white-space: normal;
    vertical-align: top;
}

.cities {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    padding: 0;
    list-style: none;
}

.cities a {
    display: block;
    height: 100%;
    padding: 8px 12px;
    border-radius: 5px;
    color: var(--text);
    background: var(--sunken);
    text-decoration: none;
}

.cities a:hover {
    color: #fff;
    background: var(--accent);
}

.faq {
    border-bottom: 1px solid var(--line);
}

.faq:last-child {
    border-bottom: 0;
}

.faq summary {
    position: relative;
    padding: 14px 32px 14px 0;
    list-style: none;
    font-weight: 700;
    cursor: pointer;
}

.faq summary::-webkit-details-marker {
    display: none;
}

.faq summary::after {
    content: "+";
    position: absolute;
    top: 12px;
    right: 0;
    color: var(--brass);
    font-size: 20px;
    line-height: 1;
}

.faq[open] summary::after {
    content: "−";
}

.faq p {
    margin: 0 0 16px;
    color: var(--muted);
}

.prose p {
    margin: 0 0 16px;
}

.prose p:last-child {
    margin-bottom: 0;
}

.letter {
    margin: 20px 0 8px;
    font-size: 18px;
    color: var(--brass);
}

.pager {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 20px;
}

.pager a,
.button {
    display: inline-block;
    padding: 8px 18px;
    border: 0;
    border-radius: 5px;
    color: var(--accent);
    background: #fff;
    box-shadow: var(--shadow);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

.pager a:hover,
.button:hover {
    color: #fff;
    background: var(--accent);
}

.button {
    margin: 0 0 20px;
}

.block .button {
    margin: 12px 0 0;
    background: var(--accent-soft);
    box-shadow: none;
}

.block .button:hover {
    background: var(--accent);
}

.qibla {
    display: flex;
    gap: 20px;
    align-items: center;
}

.qibla p {
    margin: 0;
}

.qibla__compass {
    position: relative;
    flex: 0 0 96px;
    height: 96px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    background: #fff;
}

.qibla__compass::before {
    content: "С";
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--muted);
}

.qibla__compass span {
    position: absolute;
    top: 12px;
    left: calc(50% - 2px);
    width: 4px;
    height: 36px;
    border-radius: 2px;
    background: var(--brass);
    transform-origin: 50% 36px;
}

.qibla__compass.is-aligned {
    border-color: var(--brass);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.qibla-map {
    height: 360px;
    margin-top: 12px;
    border-radius: 5px;
}

.compass-status {
    color: var(--muted);
    font-size: 14px;
}

.stale {
    margin: 24px 0 0;
    padding: 12px 20px;
    border-radius: 5px;
    background: #fff3cd;
    color: #664d03;
}

.footer {
    margin-top: 40px;
    padding: 32px 0 20px;
    color: var(--dark-muted);
    background: var(--dark);
    font-size: 14px;
}

.footer__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.footer__grid a {
    display: block;
    margin-bottom: 6px;
    color: var(--dark-muted);
    text-decoration: none;
}

.footer__grid a:hover,
.footer__bottom a:hover {
    color: #fff;
}

.footer__title {
    margin-bottom: 10px;
    color: var(--dark-fg);
    font-weight: 700;
}

.footer__bottom {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, .1);
    font-size: 13px;
}

.footer__bottom a {
    color: inherit;
}

.cookie {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 10;
    display: flex;
    gap: 16px;
    align-items: center;
    max-width: 460px;
    padding: 16px 20px;
    border-radius: 5px;
    background: #fff;
    box-shadow: 0 4px 24px rgba(10, 26, 20, .18);
    font-size: 14px;
}

.cookie[hidden] {
    display: none;
}

.cookie p {
    margin: 0;
}

.cookie .button {
    flex: none;
    margin: 0;
    color: #fff;
    background: var(--accent);
}

.cookie .button:hover {
    background: var(--accent-strong);
}

.ad {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    margin: 0 0 20px;
    border: 2px dashed var(--line);
    border-radius: 5px;
    color: var(--muted);
    font-size: 14px;
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .nav {
        gap: 16px;
    }

    h1 {
        font-size: 28px;
    }

    .block {
        padding: 16px 20px;
    }

    .block > h2:first-child {
        margin: -16px -20px 16px;
        padding: 14px 20px;
    }

    .block .table-wrap {
        margin: 0 -20px;
        width: calc(100% + 40px);
    }

    .table tr > :first-child {
        padding-left: 20px;
    }

    .table tr > :last-child {
        padding-right: 20px;
    }

    .method {
        padding: 14px 20px;
    }

    .card__label {
        padding-left: 20px;
    }

    .card__prayers {
        grid-template-columns: 1fr;
    }

    .card__prayers li {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        padding: 12px 20px;
        text-align: left;
    }

    .card__prayers li[hidden] {
        display: none;
    }

    .card__prayers li + li {
        border-top: 1px solid var(--line);
    }

    .card__prayers span {
        margin-right: auto;
        font-size: 17px;
    }

    .card__prayers strong {
        font-size: 20px;
        line-height: 1.3;
    }

    .card__prayers small {
        width: 100%;
        margin-top: 2px;
    }

    .cookie {
        right: 12px;
        bottom: 12px;
        left: 12px;
        max-width: none;
    }
}

@media print {
    .ad,
    .header,
    .footer,
    .cookie,
    .breadcrumbs,
    .block,
    .pager,
    .button {
        display: none;
    }

    .breadcrumbs,
    h1,
    h1 + p,
    h1 + .date + p:not(.stale) {
        padding-bottom: 0;
        color: var(--text);
        background: none;
        box-shadow: none;
    }

    .table th,
    .table td {
        padding: 3px 6px;
        font-size: 11px;
    }
}
