/*
 * Homepage (/): hero, info strip, next-service band, quick links, sections.
 * Built on the tokens in custom.css; pairs with cards.css (loaded alongside).
 * Logical properties only; Persian has its own type scale; no letter-spacing.
 */

.hm {
    --hm-max: 1200px;
    --hm-ink: #14232a;
    color: var(--text-primary);
}

.hm-container {
    max-inline-size: var(--hm-max);
    margin-inline: auto;
    padding-inline: var(--space-3);
}

/* ---- Hero ---------------------------------------------------------------- */

.hm-hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-block-size: clamp(560px, 88vh, 820px);
    padding-block: 96px 128px;
    background: var(--hm-ink);
    color: #fff;
    isolation: isolate;
    overflow: hidden;
}

.hm-hero--plain {
    background: linear-gradient(135deg, #14232a, #26383d);
}

.hm-hero-img {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    object-position: center 12%;
    z-index: -2;
}

.hm-hero-shade {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(to top, rgba(10, 18, 22, 0.94) 0%, rgba(10, 18, 22, 0.78) 38%, rgba(10, 18, 22, 0.3) 72%, rgba(10, 18, 22, 0.18) 100%);
}

.hm-hero-content {
    inline-size: 100%;
}

.hm-hero-eyebrow {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0 0 var(--space-3);
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.9375rem;
    font-weight: 600;
}

.hm-hero-eyebrow::before {
    content: "";
    inline-size: 32px;
    block-size: 2px;
    background: var(--swiss-red);
}

.hm-hero h1 {
    max-inline-size: 18ch;
    margin: 0 0 var(--space-4);
    color: #fff;
    font-size: clamp(2.5rem, 6.5vw, 4.75rem);
    font-weight: 800;
    line-height: 1.1;
    text-wrap: balance;
}

html[lang="fa"] .hm-hero h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    line-height: 1.4;
}

.hm-hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-4);
}

.hm-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding-block: var(--space-2);
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.5);
    text-underline-offset: 6px;
}

.hm-btn-ghost:hover {
    color: #fff;
    text-decoration-color: #fff;
}

/* ---- Info strip (overlaps the hero) ------------------------------------- */

.hm-info {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1px;
    margin: -64px 0 0;
    padding: 0;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--border-light);
    box-shadow: var(--shadow-lg);
    list-style: none;
    overflow: hidden;
}

.hm-info > li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
}

.hm-info > li > i {
    flex: 0 0 1.25em;
    margin-block-start: 0.35em;
    color: var(--swiss-red);
    text-align: center;
}

.hm-info span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

html[lang="fa"] .hm-info span {
    font-size: 0.9rem;
}

.hm-info strong {
    display: block;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
}

html[lang="fa"] .hm-info strong {
    font-size: 1.0625rem;
    line-height: 1.8;
}

.hm-info a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--border-light);
    text-underline-offset: 4px;
}

.hm-info .hm-info-social {
    display: flex;
    gap: var(--space-2);
    margin-block-start: var(--space-1);
}

.hm-info .hm-info-social a {
    display: inline-grid;
    place-items: center;
    inline-size: 32px;
    block-size: 32px;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    text-decoration: none;
}

.hm-info-toggle-item {
    display: none;
}

.hm-info-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    inline-size: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-primary);
    font: inherit;
    font-weight: 700;
    text-align: start;
    cursor: pointer;
}

.hm-info-toggle:focus-visible {
    outline: 3px solid var(--swiss-gold);
    outline-offset: 4px;
}

.hm-info-toggle i {
    color: var(--swiss-red);
    transition: transform 0.2s ease;
}

.hm-info.is-open .hm-info-toggle i {
    transform: rotate(180deg);
}

/* Phones: compact by default (worship time + one toggle), expand on tap. */
@media (max-width: 575px) {
    .hm-info.is-compact .hm-info-toggle-item {
        display: block;
        padding: var(--space-3) var(--space-4);
        background: var(--surface);
    }

    .hm-info.is-compact:not(.is-open) .hm-info-extra {
        display: none;
    }
}

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

@media (min-width: 992px) {
    .hm-info {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* ---- Next service ------------------------------------------------------- */

.hm-next {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-4);
    margin-block-start: var(--space-4);
    padding: var(--space-4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    background: var(--hm-ink);
    color: #fff;
}

.hm-next-date {
    display: grid;
    justify-items: center;
    min-inline-size: 76px;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.08);
}

.hm-next-date strong {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.1;
}

.hm-next-date span {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.875rem;
}

.hm-next-label {
    margin: 0 0 var(--space-1);
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.875rem;
    font-weight: 600;
}

.hm-next h2 {
    margin: 0;
    color: #fff;
    font-size: clamp(1.25rem, 2.4vw, 1.625rem);
    font-weight: 800;
    line-height: 1.4;
}

.hm-next-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    margin: var(--space-2) 0 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.9375rem;
}

.hm-next-meta i {
    margin-inline-end: 6px;
    color: var(--swiss-gold);
}

.hm-next-count {
    padding-inline-start: var(--space-4);
    border-inline-start: 1px solid rgba(255, 255, 255, 0.18);
    text-align: center;
}

.hm-next-count strong {
    display: block;
    color: var(--swiss-gold);
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.1;
}

.hm-next-count span {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

@media (max-width: 640px) {
    .hm-next {
        grid-template-columns: auto minmax(0, 1fr);
        padding: var(--space-3);
    }

    .hm-next-count {
        grid-column: 1 / -1;
        display: flex;
        align-items: baseline;
        gap: var(--space-2);
        padding: var(--space-3) 0 0;
        border-inline-start: 0;
        border-block-start: 1px solid rgba(255, 255, 255, 0.18);
        text-align: start;
    }

    .hm-next-count strong {
        display: inline;
    }
}

/* ---- Sections ------------------------------------------------------------ */

.hm-section {
    padding-block: 72px;
}

.hm-section--tint {
    background: var(--bg-section);
}

/* ---- Quick links --------------------------------------------------------- */

.hm-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
    margin: var(--space-4) 0 0;
    padding: 0;
    list-style: none;
}

.hm-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    block-size: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.hm-link:hover {
    transform: translateY(-2px);
    border-color: var(--text-muted);
    box-shadow: var(--shadow-md);
}

.hm-link-icon {
    display: grid;
    flex: none;
    place-items: center;
    inline-size: 48px;
    block-size: 48px;
    border-radius: 50%;
    background: var(--surface-muted);
    color: var(--swiss-red);
    font-size: 1.125rem;
}

.hm-link-text {
    display: grid;
    gap: 2px;
    min-inline-size: 0;
}

.hm-link-text strong {
    font-size: 1.0625rem;
    font-weight: 700;
}

html[lang="fa"] .hm-link-text strong {
    font-size: 1.1875rem;
}

.hm-link-text span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

html[lang="fa"] .hm-link-text span {
    font-size: 0.96875rem;
}

.hm-link-arrow {
    margin-inline-start: auto;
    color: var(--text-secondary);
}

@media (min-width: 992px) {
    .hm-links {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 575px) {
    .hm-hero {
        min-block-size: 520px;
        padding-block: 72px 112px;
    }

    .hm-info {
        margin-block-start: -48px;
    }

    .hm-section {
        padding-block: 56px;
    }

    .hm-link {
        flex-direction: column;
        align-items: flex-start;
        padding: var(--space-3);
    }

    .hm-link-arrow {
        display: none;
    }

    .hm-head {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hm-info-toggle i,
    .hm-link {
        transition: none;
    }

    .hm-link:hover {
        transform: none;
    }
}
