/* The homepage story: "Ohio, lit up" and the masjid rail (js/home-story.js).
 *
 * Nothing is pinned, so the page stays short. "Ohio, lit up" is a CSS
 * timeline that runs once when JS adds .play: the base styles are the
 * finished picture, the "before" state only applies while JS is waiting to
 * play it, and .story-static (reduced motion) always shows the finished map.
 * Only transform, opacity and two stroke draws animate.
 */

/* theme.css clips sideways overflow, which keeps the story stage pinned.
   Browsers without `clip` get theme.css's `hidden` fallback, which would
   unpin it; the homepage has nothing wide to hide, so there body stays
   visible (html still hides sideways overflow) and the stage stays pinned. */
@supports not (overflow: clip) { body { overflow-x: visible; } }

:root { --ease-out: cubic-bezier(0.22, 1, 0.36, 1); --spring: cubic-bezier(0.34, 1.56, 0.64, 1); }

/* ---------------------------------------------------------------- hero -- */
.home-hero .hero-drift { will-change: transform, opacity; }
/* a small hop on the quick-link icons */
.quick-link:hover .qi i, .quick-link:focus-visible .qi i { animation: mo-hop .55s var(--spring); }
@keyframes mo-hop { 0% { transform: none; } 40% { transform: translateY(-4px) rotate(-8deg); } 100% { transform: none; } }

/* ------------------------------------------------------ Ohio, lit up -- */
section.ohio-live {
    position: relative; overflow: clip; color: var(--cream); padding: 4.5rem 0;
    background:
        radial-gradient(55% 60% at 78% 18%, rgba(227, 163, 64, 0.14), rgba(227, 163, 64, 0) 70%),
        radial-gradient(60% 70% at 8% 100%, rgba(47, 115, 98, 0.4), rgba(47, 115, 98, 0) 70%),
        var(--forest-950);
}
.ol-grid {
    display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: 3.5rem; row-gap: 1.6rem;
    grid-template-areas: "head stage" "stats stage" "regions stage"; align-items: start; align-content: center;
}
.ol-head { grid-area: head; align-self: end; }
.ol-stats { grid-area: stats; }
.ol-regions { grid-area: regions; }
.ol-stage { grid-area: stage; position: relative; align-self: center; }
.ol-head .eyebrow { color: var(--amber); }
.ol-head h2 { font: 600 clamp(30px, 3.6vw, 52px)/1.04 var(--font-display); letter-spacing: -0.03em; margin: .5rem 0 0; text-wrap: balance; color: var(--cream); }
.ol-head h2 em { font-style: normal; color: var(--amber); }

.ol-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem 1.5rem; margin: 0; }
.ol-stats > div { border-top: 1px solid rgba(250, 246, 238, 0.14); padding-top: .7rem; }
.ol-stats dd { margin: 0; font: 600 clamp(30px, 3vw, 44px)/1 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: #fff; }
.ol-stats dt { font: 500 13px/1.3 var(--font-body); color: rgba(250, 246, 238, 0.66); margin-top: .3rem; }

.ol-regions { display: flex; flex-wrap: wrap; gap: .5rem; }
.ol-chip {
    display: inline-flex; align-items: center; gap: .55rem; padding: .5rem .6rem .5rem .9rem; border-radius: 999px;
    background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14); color: var(--cream);
    font: 600 14px var(--font-display); text-decoration: none; white-space: nowrap;
    transition: background .2s, border-color .2s, transform .25s var(--spring);
}
.ol-chip b { min-width: 1.7rem; padding: .1rem .45rem; border-radius: 999px; background: rgba(227, 163, 64, 0.18); color: var(--amber-100); font-variant-numeric: tabular-nums; text-align: center; }
.ol-chip:hover, .ol-chip:focus-visible { color: #fff; text-decoration: none; background: rgba(227, 163, 64, 0.16); border-color: rgba(227, 163, 64, 0.6); transform: translateY(-2px); }

.ohio-map { width: 100%; height: auto; max-height: 74svh; overflow: visible; display: block; }
.ohio-map .lake { fill: url(#ol-lake); }
.ohio-map .waves path { fill: none; stroke: rgba(170, 214, 222, 0.45); stroke-width: 1; stroke-linecap: round; animation: ol-wave 5s ease-in-out infinite alternate; animation-play-state: paused; }
.ohio-map .waves path:nth-child(2) { animation-duration: 6.5s; animation-delay: -2s; }
.ohio-map .waves path:nth-child(3) { animation-duration: 7.5s; animation-delay: -4s; }
.ohio-live.on-screen .ohio-map .waves path { animation-play-state: running; }
@keyframes ol-wave { from { transform: translateX(-4px); } to { transform: translateX(5px); } }
.ohio-map .land { fill: url(#ol-land); }
.ohio-map .lattice { opacity: .9; pointer-events: none; }
.ohio-map .edge { fill: none; stroke: rgba(227, 163, 64, 0.75); stroke-width: 1.3; stroke-linejoin: round; }
.ohio-map .road { fill: none; stroke: var(--amber); stroke-width: 1.6; stroke-dasharray: 1 5; stroke-linecap: round; opacity: .85; }
.ohio-map .road-reveal { fill: none; stroke: #fff; stroke-width: 8; stroke-linecap: round; }
.ohio-map .city { font: 600 10.5px var(--font-display); fill: rgba(250, 246, 238, 0.78); letter-spacing: .02em; paint-order: stroke; stroke: rgba(8, 28, 24, 0.65); stroke-width: 3px; pointer-events: none; }
.ohio-map .moon-body { fill: #fbeed6; }
.ohio-map .moon-halo { fill: rgba(251, 238, 214, 0.1); }
.ohio-map .star-dot { fill: #fbeed6; opacity: .7; animation: ol-star 3.6s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -0.7s); animation-play-state: paused; }
.ohio-live.on-screen .ohio-map .star-dot { animation-play-state: running; }
@keyframes ol-star { from { opacity: .25; } to { opacity: .85; } }
.ohio-map .traveler polygon { fill: var(--amber); stroke: #fff; stroke-width: .8; }
.ohio-map .traveler { opacity: 0; }
.ohio-live.played .ohio-map .traveler { opacity: 1; }

.ohio-map a { transition: opacity .3s ease; }
.ohio-map a:focus { outline: none; }
.ohio-map .dot { transform-box: fill-box; transform-origin: center; }
.ohio-map .dot .glow { fill: rgba(227, 163, 64, 0.3); transform-box: fill-box; transform-origin: center; }
.ohio-map .dot .core { fill: var(--amber); stroke: #fff8ea; stroke-width: 1; transform-box: fill-box; transform-origin: center; transition: transform .25s var(--spring), fill .2s; }
.ohio-map .dot .ring { fill: none; stroke: var(--amber); stroke-width: 1; opacity: 0; transform-box: fill-box; transform-origin: center; }
.ohio-map a:hover .core, .ohio-map a:focus-visible .core, .ohio-map a.hl .core { fill: #fff; transform: scale(1.45); }
.ohio-map.focus a:not(.hl) { opacity: .22; }
.ohio-map .dot.tw .glow { animation: ol-glint 1.4s ease-in-out; }
@keyframes ol-glint { 0%, 100% { transform: none; opacity: 1; } 45% { transform: scale(1.9); opacity: .55; } }

.map-pop { position: absolute; pointer-events: none; background: var(--cream); color: var(--forest); font: 600 13px var(--font-display); padding: .35rem .6rem; border-radius: 8px; transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap; opacity: 0; transition: opacity .15s; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .6); }
.map-pop.show { opacity: 1; }
.ol-replay {
    position: absolute; right: 0; bottom: 0; display: inline-flex; align-items: center; gap: .4rem;
    padding: .4rem .8rem; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06);
    color: rgba(250, 246, 238, 0.8); font: 600 13px var(--font-display); backdrop-filter: blur(8px);
    animation: ol-fade .6s var(--ease-out) both;
}
.ol-replay:hover { color: #fff; border-color: rgba(227, 163, 64, 0.6); }
.ol-replay:hover i { display: inline-block; animation: ol-spin .6s var(--ease-out); }
@keyframes ol-spin { to { transform: rotate(360deg); } }

/* --- before it plays (JS on, not played yet) --- */
html:not(.story-static) .ohio-live:not(.play):not(.played) :is(.lake, .waves, .land, .lattice, .city, .dot, .road, .sky, .ol-stats > div, .ol-chip) { opacity: 0; }
html:not(.story-static) .ohio-live:not(.play):not(.played) .edge { stroke-dasharray: var(--edge-len, 0); stroke-dashoffset: var(--edge-len, 0); }

/* --- the timeline --- */
.ohio-live.play .edge { stroke-dasharray: var(--edge-len, 0); animation: ol-draw 1.3s var(--ease-out) both; }
@keyframes ol-draw { from { stroke-dashoffset: var(--edge-len, 0); } to { stroke-dashoffset: 0; } }
.ohio-live.play .lake { animation: ol-fade 1s ease .15s both; }
.ohio-live.play .waves { animation: ol-fade 1s ease .7s both; }
.ohio-live.play .land { animation: ol-fade .9s ease .45s both; }
.ohio-live.play .lattice { animation: ol-fade 1.2s ease 1s both; }
.ohio-live.play .sky { animation: ol-fade 1.2s ease .2s both; }
.ohio-live.play .moon { animation: ol-rise 1.6s var(--ease-out) .25s both; }
@keyframes ol-rise { from { transform: translateY(22px); opacity: 0; } to { transform: none; opacity: 1; } }
.ohio-live.play .city { animation: ol-fade .7s ease both; animation-delay: calc(1.3s + var(--i) * 90ms); }
.ohio-live.play .dot { animation: ol-pop .6s var(--spring) both; animation-delay: var(--d); }
@keyframes ol-pop { from { transform: scale(0); opacity: 0; } 30% { opacity: 1; } to { transform: none; opacity: 1; } }
.ohio-live.play .dot .ring { animation: ol-ring 1.1s var(--ease-out) both; animation-delay: var(--d); }
@keyframes ol-ring { from { transform: scale(.6); opacity: .9; } to { transform: scale(3.4); opacity: 0; } }
.ohio-live.play .road { animation: ol-fade .3s ease var(--road) both; }
.ohio-live.play .road-reveal { stroke-dasharray: var(--road-px, 0); animation: ol-road var(--road-len) ease-in-out var(--road) both; }
@keyframes ol-road { from { stroke-dashoffset: var(--road-px, 0); } to { stroke-dashoffset: 0; } }
.ohio-live.play .traveler { animation: ol-fade .3s ease var(--road) both; }
.ohio-live.played .traveler polygon { animation: ol-land .7s var(--spring); transform-box: fill-box; transform-origin: center; }
@keyframes ol-land { 0% { transform: none; } 45% { transform: scale(1.7); } 100% { transform: none; } }
.ohio-live.play .ol-stats > div { animation: ol-up .8s var(--ease-out) both; animation-delay: calc(.5s + var(--i) * 120ms); }
.ohio-live.play .ol-chip { animation: ol-up .7s var(--ease-out) both; animation-delay: calc(1.4s + var(--i) * 70ms); }
@keyframes ol-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ol-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (max-width: 991.98px) {
    section.ohio-live { padding: 3rem 0 2.5rem; }
    .ol-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "stage" "stats" "regions"; row-gap: 1.2rem; }
    .ohio-map { max-height: 56svh; margin: 0 auto; }
    .ol-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
    .ol-stats dd { font-size: 26px; }
    .ol-stats dt { font-size: 11.5px; }
    .ol-regions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem; padding: 0 1rem .25rem; scroll-snap-type: x proximity; }
    .ol-regions::-webkit-scrollbar { display: none; }
    .ol-chip { scroll-snap-align: start; }
    .ol-replay { bottom: -.25rem; }
}

/* ------------------------------------------------------ masjid rail -- */
.masjid-rail { background: var(--sand); padding: 4rem 0 4.25rem; }
.masjid-rail .head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.6rem; }
.masjid-rail h2 { font: 600 clamp(28px, 3.4vw, 46px)/1.04 var(--font-display); letter-spacing: -0.03em; margin: .4rem 0 0; color: var(--forest); }
.mr-nav { display: flex; align-items: center; gap: .5rem; }
.mr-nav .link-arrow { margin-right: .5rem; }
.mr-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(18, 54, 47, 0.2); background: #fff; color: var(--forest); display: grid; place-items: center; transition: transform .25s var(--spring), background .2s, opacity .2s; }
.mr-btn:hover:not(:disabled) { background: var(--forest); color: #fff; transform: scale(1.06); }
.mr-btn:disabled { opacity: .35; }
.m-track {
    display: flex; gap: 1.1rem; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
    padding: .5rem max(1rem, calc((100vw - 1320px) / 2 + 0.75rem)) 1.5rem; scroll-padding-inline: max(1rem, calc((100vw - 1320px) / 2 + 0.75rem));
}
.m-track::-webkit-scrollbar { display: none; }
.m-track:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }
.m-track.dragging { scroll-snap-type: none; cursor: grabbing; }
.m-track.dragging .m-card { pointer-events: none; }
@media (pointer: fine) { .m-track { cursor: grab; } }
.m-card { position: relative; flex: 0 0 clamp(220px, 21vw, 290px); aspect-ratio: 3 / 4; border-radius: 22px; overflow: hidden; background: var(--forest-700); color: #fff; text-decoration: none;
    scroll-snap-align: start; box-shadow: 0 24px 48px -28px rgba(8, 28, 24, 0.55); isolation: isolate; user-select: none; -webkit-user-drag: none;
    transition: transform .45s var(--ease-out), box-shadow .45s var(--ease-out); }
.m-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.06); transition: transform .8s var(--ease-out); }
.m-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 28, 24, 0) 45%, rgba(8, 28, 24, 0.86)); }
.m-card:hover { color: #fff; text-decoration: none; transform: translateY(-6px); box-shadow: 0 34px 56px -28px rgba(8, 28, 24, 0.6); }
.m-card:hover img, .m-card:focus-visible img { transform: scale(1.13); }
.m-card .cap { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 1.1rem 1.2rem 1.2rem; display: grid; gap: .2rem; }
.m-card .cap strong { font: 600 19px/1.15 var(--font-display); }
.m-card .cap small { color: rgba(255, 255, 255, 0.74); }
.m-card .cap .time-pill { justify-self: start; margin-top: .35rem; background: rgba(255, 255, 255, 0.16); color: #fff; border: 1px solid rgba(255, 255, 255, 0.22); backdrop-filter: blur(8px); }
.m-card.more { display: grid; place-content: center; text-align: center; gap: .6rem; background: linear-gradient(160deg, var(--forest-600), var(--forest-900)); padding: 1.5rem; }
.m-card.more::after { display: none; }
.m-card.more strong { font: 600 26px/1.1 var(--font-display); }
.m-card.more i { font-size: 1.6rem; color: var(--amber); }
/* the cards deal in from the right as the rail arrives */
html:not(.story-static) .masjid-rail:not(.dealt) .m-card { opacity: 0; transform: translateX(48px) rotate(1.5deg); }
.masjid-rail.dealt .m-card { transition: opacity .7s var(--ease-out), transform .8s var(--spring), box-shadow .45s var(--ease-out); transition-delay: calc(var(--i, 0) * 70ms); }
.masjid-rail.dealt .m-card:hover { transition-delay: 0s; }
@media (max-width: 991.98px) {
    .masjid-rail { padding: 2.75rem 0 2.5rem; }
    .masjid-rail .head { margin-bottom: 1rem; }
    .mr-btn { display: none; }
    .mr-nav .link-arrow { margin-right: 0; }
    .m-card { flex-basis: 64vw; max-width: 260px; }
}

/* ---------------------------------------------------- news covers -- */
.news-card .cover-type { position: relative; display: grid; align-content: end; padding: 1.2rem 1.3rem; color: #fff; overflow: hidden; aspect-ratio: 16 / 9; }
.news-card .cover-type::before { content: ''; position: absolute; right: -18%; top: -30%; width: 75%; aspect-ratio: 1;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='white' stroke-width='1.2' opacity='.5'%3E%3Cpath d='M50 7.57L62.43 20L80 20L80 37.57L92.43 50L80 62.43L80 80L62.43 80L50 92.43L37.57 80L20 80L20 62.43L7.57 50L20 37.57L20 20L37.57 20Z'/%3E%3Ccircle cx='50' cy='50' r='18'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
    transition: transform 1.2s var(--ease-out); }
.news-card:hover .cover-type::before { transform: rotate(22deg) scale(1.05); }
.news-card .cover-type span { position: relative; font: 600 clamp(26px, 2.4vw, 34px)/1 var(--font-display); letter-spacing: -0.02em; }
.news-card .cover-type small { position: relative; font: 500 12px var(--font-display); letter-spacing: .14em; text-transform: uppercase; opacity: .75; margin-bottom: .35rem; }
.cover-type.t0 { background: linear-gradient(150deg, var(--forest-500), var(--forest-900)); }
.cover-type.t1 { background: linear-gradient(150deg, #c98424, #7a4a12); }
.cover-type.t2 { background: linear-gradient(150deg, #2f6f8f, #16324a); }
.cover-type.t3 { background: linear-gradient(150deg, #8e4a5e, #3e1a2a); }

/* ------------------------------------------- gentle rise on reveal -- */
.rise { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); transition-delay: calc(var(--d, 0) * 70ms); }
.rise.is-in { opacity: 1; transform: none; }

/* --------------------------------------------- smooth scroll (Lenis) -- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

/* ------------------------------- static: no JS or reduced motion -- */
.story-static .rise { opacity: 1; transform: none; }
.story-static .ohio-map .traveler { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
    .rise { opacity: 1; transform: none; }
    .ohio-map .waves path, .ohio-map .star-dot, .ohio-map .dot.tw .glow, .quick-link:hover .qi i { animation: none !important; }
    .m-card, .m-card img { transition: none; }
}
