/*
 * Homepage-only polish: a short entrance on the first visit of a session, soft hover lift on cards
 * and a gold accent on the next prayer. Buttons, the menu underline and scroll reveal live in
 * site-motion.css, which every public page loads.
 * Only opacity and transform are animated; everything is off for prefers-reduced-motion.
 * Brand: emerald #004B36 / #003C2C, gold #D4A73A, ivory #FAF9F5, text #17372D.
 */
:root { --fhp-emerald: #004b36; --fhp-emerald-dark: #003c2c; --fhp-gold: #d4a73a; --fhp-gold-soft: #fbf3df; --fhp-ease: cubic-bezier(.2, .7, .2, 1); }

/* Entrance: first homepage view of the session only (html.fhf-intro is set once per session in <head>). */
@media (prefers-reduced-motion: no-preference) {
    @keyframes fhp-rise { from { opacity: .01; transform: translateY(10px); } to { opacity: 1; transform: none; } }
    @keyframes fhp-fade { from { opacity: .2; } to { opacity: 1; } }
    .fhf-intro .fhf-brand :is(img, picture) { animation: fhp-rise .4s var(--fhp-ease) both; }
    .fhf-intro .fhf-hero-copy > :is(h1, .fhf-hero-title) { animation: fhp-fade .5s var(--fhp-ease) both; }
    .fhf-intro .fhf-hero-copy > p { animation: fhp-rise .45s var(--fhp-ease) .12s both; }
    .fhf-intro .fhf-hero-actions { animation: fhp-rise .45s var(--fhp-ease) .22s both; }
    .fhf-intro .fhf-home-prayer-pair { animation: fhp-rise .45s var(--fhp-ease) .08s both; }
    .fhf-intro :is(.fhh-events, .fhh-actions) { animation: fhp-rise .45s var(--fhp-ease) .16s both; }

    /* Cards lift a little on hover; the whole row stays put (no layout shift). */
    :is(.fhh-event-list, .fhh-actions) a,
    .fhf-home-quick-links a,
    .fhh-tiles a { transition: transform .18s var(--fhp-ease), box-shadow .18s var(--fhp-ease), background-color .18s; }
    :is(.fhh-event-list, .fhh-actions) a:hover,
    .fhf-home-quick-links a:hover,
    .fhh-tiles a:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 60, 44, .10); }
}

/* Next prayer: a soft gold accent on its row (desktop and phone). */
.fhf-public-reference .fhf-home-prayer-clock.is-current,
.fhf-home-prayer-clock.is-current { background: var(--fhp-gold-soft) !important; box-shadow: inset 3px 0 0 var(--fhp-gold) !important; }
.fhf-home-prayer-clock.is-current .fhf-next-badge { background: var(--fhp-gold); color: var(--fhp-emerald-dark); }

/* Prayer icons in one colour family: gold for daytime, emerald for night. */
.fhf-home-prayer-clock dt .fhf-icon { color: #b7862a; }
.fhf-home-prayer-clock[data-prayer-key="isha"] dt .fhf-icon { color: var(--fhp-emerald); }

/* Phones: the "MD prayer times · centre" line no longer splits into two columns. */
@media (max-width: 1023px) {
    .fhf-home-showing { display: block !important; line-height: 1.45; }
    .fhf-home-showing > .fhf-icon { vertical-align: -3px; margin-right: 4px; }
    .fhf-home-showing > span { display: inline !important; }
}

/* Clear keyboard focus on every homepage link and control. */
.fhf-home :is(a, button, summary, select):focus-visible,
.fhh :is(a, button):focus-visible { outline: 3px solid var(--fhp-gold); outline-offset: 2px; border-radius: 8px; }

/* ---------------------------------------------------------------------------------------------
 * Cinematic hero (Homepage → Hero & animation). Layers, back to front: photo(s) or video, soft
 * gold light, geometric pattern, green overlay (::after), content. Only transform and opacity
 * move; hero-motion.js pauses everything off-screen, in a background tab, or on the pause button.
 * ------------------------------------------------------------------------------------------- */
.fhh-hero::after { background: linear-gradient(90deg, rgba(1, 59, 46, var(--fhh-overlay, .82)) 0%, rgba(1, 59, 46, calc(var(--fhh-overlay, .82) * .92)) 45%, rgba(1, 59, 46, calc(var(--fhh-overlay, .82) * .5)) 100%), linear-gradient(0deg, rgba(146, 99, 24, .18), transparent 40%) !important; z-index: 0; }
.fhh-hero-media { position: absolute; inset: -6% 0; will-change: transform; }
.fhh-hero-slide, .fhh-hero-video { position: absolute; inset: 0; opacity: 0; transition: opacity var(--fhh-fade, 1.5s) ease-in-out; }
.fhh-hero-slide.is-active, .fhh-hero-video.is-playing { opacity: 1; }
.fhh-hero-media img, .fhh-hero-video { width: 100%; height: 100%; object-fit: cover; object-position: var(--fhh-focus, center 40%); }
.fhh-hero-light, .fhh-hero-pattern { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.fhh-hero-light { opacity: 0; }
.fhh-hero-pattern { opacity: 0; }
.fhh-hero.has-pattern .fhh-hero-pattern { opacity: .55; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cpath d='M32 6l7.5 18.5L58 32l-18.5 7.5L32 58l-7.5-18.5L6 32l18.5-7.5z' fill='none' stroke='%23d4a73a' stroke-opacity='.16' stroke-width='1'/%3E%3C/svg%3E"); background-size: 64px 64px; -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 55%, #000 100%); mask-image: linear-gradient(90deg, transparent 0%, #000 55%, #000 100%); }
.fhh-hero-copy { z-index: 2; }
.fhh-hero .fhh-hero-welcome { margin: 0 0 6px !important; font-size: 13px !important; font-weight: 700; letter-spacing: .02em; color: #f1ca62 !important; }
.fhh-hero-pause { position: absolute; right: 16px; top: 16px; z-index: 3; display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(255, 255, 255, .4); border-radius: 5px; background: rgba(0, 40, 30, .35); color: #fff; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.fhh-hero-pause[hidden] { display: none; }
.fhh-hero-pause:hover { background: rgba(0, 40, 30, .6); }
.fhh-hero-pause:focus-visible { outline: 2px solid #d4a73a; outline-offset: 2px; }
.fhh-hero-pause .fhh-play-icon, .fhh-hero.is-paused-user .fhh-hero-pause .fhh-pause-icon { display: none; }
.fhh-hero.is-paused-user .fhh-hero-pause .fhh-play-icon { display: block; }

@media (prefers-reduced-motion: no-preference) {
    /* Elegant and cinematic: the photo drifts and breathes (zoom in, pan, zoom back), very slowly. */
    @keyframes fhh-drift-left { 0% { transform: scale(1.04) translate3d(1.5%, 0, 0); } 50% { transform: scale(1.12) translate3d(-1.5%, -1%, 0); } 100% { transform: scale(1.04) translate3d(1.5%, 0, 0); } }
    @keyframes fhh-drift-right { 0% { transform: scale(1.04) translate3d(-1.5%, 0, 0); } 50% { transform: scale(1.12) translate3d(1.5%, -1%, 0); } 100% { transform: scale(1.04) translate3d(-1.5%, 0, 0); } }
    @keyframes fhh-drift-up { 0% { transform: scale(1.05) translate3d(0, 1.5%, 0); } 50% { transform: scale(1.12) translate3d(0, -1.5%, 0); } 100% { transform: scale(1.05) translate3d(0, 1.5%, 0); } }
    @keyframes fhh-drift-down { 0% { transform: scale(1.05) translate3d(0, -1.5%, 0); } 50% { transform: scale(1.12) translate3d(0, 1.5%, 0); } 100% { transform: scale(1.05) translate3d(0, -1.5%, 0); } }
    .fhh-hero.is-moving .fhh-hero-slide img { animation: fhh-drift-left var(--fhh-drift, 32s) ease-in-out infinite; }
    .fhh-hero.is-moving[data-direction="right"] .fhh-hero-slide img { animation-name: fhh-drift-right; }
    .fhh-hero.is-moving[data-direction="up"] .fhh-hero-slide img { animation-name: fhh-drift-up; }
    .fhh-hero.is-moving[data-direction="down"] .fhh-hero-slide img { animation-name: fhh-drift-down; }
    /* Cinematic: a warm light slowly crosses the hall, and the pattern drifts. */
    @keyframes fhh-light { 0%, 100% { transform: translate3d(-10%, 0, 0); opacity: .55; } 50% { transform: translate3d(18%, -4%, 0); opacity: .9; } }
    @keyframes fhh-pattern { from { background-position: 0 0; } to { background-position: 64px 64px; } }
    .fhh-motion-cinematic.is-moving .fhh-hero-light { opacity: .7; background: radial-gradient(40% 70% at 70% 30%, rgba(241, 202, 98, .22), transparent 70%); animation: fhh-light 26s ease-in-out infinite; }
    .fhh-motion-cinematic.is-moving.has-pattern .fhh-hero-pattern { animation: fhh-pattern 40s linear infinite; }
    /* Paused: off-screen, tab hidden, or the visitor pressed pause. */
    .fhh-hero:is(.is-offscreen, .is-paused-user) :is(.fhh-hero-slide img, .fhh-hero-light, .fhh-hero-pattern) { animation-play-state: paused !important; }

    /* Entrance (first homepage view of the session): background at once, then welcome, heading, subtitle, buttons, prayer card; ~800 ms in all. */
    @keyframes fhh-in { from { opacity: .01; transform: translate3d(0, 14px, 0); } to { opacity: 1; transform: none; } }
    @keyframes fhh-in-soft { from { opacity: .55; transform: translate3d(0, 12px, 0); } to { opacity: 1; transform: none; } }
    .fhf-intro .fhh-hero.has-entrance .fhh-hero-welcome { animation: fhh-in .45s ease-out both; }
    .fhf-intro .fhh-hero.has-entrance h1 { animation: fhh-in .5s ease-out .08s both; }
    .fhf-intro .fhh-hero.has-entrance .fhh-hero-copy > p:not(.fhh-hero-welcome) { animation: fhh-in .45s ease-out .18s both; }
    .fhf-intro .fhh-hero.has-entrance .fhh-hero-actions > * { animation: fhh-in .4s ease-out both; }
    .fhf-intro .fhh-hero.has-entrance .fhh-hero-actions > :nth-child(1) { animation-delay: .28s; }
    .fhf-intro .fhh-hero.has-entrance .fhh-hero-actions > :nth-child(2) { animation-delay: .36s; }
    .fhf-intro .fhh-hero.has-entrance .fhh-hero-actions { animation: none; }
    .fhf-intro .fhf-home-prayer-pair { animation: fhh-in-soft .45s ease-out .35s both !important; }
}
@media (prefers-reduced-motion: reduce) {
    .fhh-hero-media { transform: none !important; }
    .fhh-hero-pause { display: none; }
}
@media (max-width: 1023px) {
    .fhh-hero-media img, .fhh-hero-video { object-position: var(--fhh-focus-m, center 35%); }
}

/* Live prayer countdown: digits settle softly each second, and a thin gold bar shows how far we are to the next prayer. */
.fhf-hd-clock strong { font-variant-numeric: tabular-nums; }
.fhf-hd-clock strong.is-tick { animation: fhh-tick .35s ease-out; }
@keyframes fhh-tick { from { opacity: .7; } to { opacity: 1; } }
.fhf-hd-progress { display: block; width: 100%; height: 3px; margin-top: 6px; border-radius: 3px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.fhf-hd-progress > span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #d4a73a, #f1ca62); transform-origin: left; transform: scaleX(var(--fhf-progress, 0)); transition: transform 1s linear; }
@media (prefers-reduced-motion: reduce) { .fhf-hd-clock strong.is-tick { animation: none; } .fhf-hd-progress > span { transition: none; } }
