/* MasjidMap page layout. Tokens, nav, buttons and footer come from /assets/site.css. */

/* The one exception to "page stylesheets add layout only": the accent is MasjidMap's
   Deep Emerald (#1b6b4c, the app's primary) instead of DoctorAI green. Same token
   names, same roles, both themes; see DESIGN.md. */
:root {
  --accent: #2a8a63;
  --accent-ink: #1b6b4c;
  --accent-fill: #1b6b4c;
  --accent-fill-hover: #155a3f;
  --on-accent: #f6fbf8;
  --accent-soft: #d5ebe0;
  --accent-softer: #e6f2ec;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #5fc49a;
    --accent-ink: #8bd6af;
    --accent-fill: #8bd6af;
    --accent-fill-hover: #a6f2cc;
    --on-accent: #00210f;
    --accent-soft: #143127;
    --accent-softer: #0f1f19;
  }
}
:root[data-theme="dark"] {
  --accent: #5fc49a;
  --accent-ink: #8bd6af;
  --accent-fill: #8bd6af;
  --accent-fill-hover: #a6f2cc;
  --on-accent: #00210f;
  --accent-soft: #143127;
  --accent-softer: #0f1f19;
}

/* The app icon is a square on an off-white tile; round it like a launcher icon. */
.app-icon { border-radius: 22%; border: 1px solid var(--line); }

/* Real app screens: phone-screen radius, a hairline and a tinted shadow. */
.screen { margin: 0; overflow: hidden; border-radius: 26px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); box-shadow: var(--shadow-lg); }
.screen img { width: 100%; height: 100%; object-fit: cover; object-position: top; }

/* ---------- Hero ---------- */
.hero { padding: clamp(16px, 3vw, 40px) 0 clamp(64px, 8vw, 112px); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px); align-items: center;
  min-height: min(calc(100dvh - var(--nav-h) - 56px), 760px);
}
.hero-copy { display: grid; justify-items: start; }
.hero .status { background: var(--accent-soft); color: var(--accent-ink); margin-bottom: 22px; }
.hero h1 { font-size: var(--display-l); line-height: 1; letter-spacing: -0.048em; max-width: 8.4em; }
.hero-sub { margin-top: 24px; font-size: var(--text-lg); line-height: 1.5; color: var(--muted); max-width: 26em; }
.hero-cta { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 12px; }
.hero-media { position: relative; width: min(100%, 480px); aspect-ratio: 4 / 5; justify-self: end; }
.hero-photo { width: 100%; height: 100%; object-fit: cover; object-position: 50% 70%; border-radius: var(--r-surface); background: var(--sunk); }
.hero-screen { position: absolute; width: 46%; aspect-ratio: 620 / 1120; left: -22%; bottom: -8%; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; min-height: 0; gap: 48px; }
  .hero-media { justify-self: stretch; width: 100%; aspect-ratio: 5 / 4; margin-bottom: 48px; }
  .hero-photo { object-position: 50% 72%; }
  .hero-screen { width: 38%; left: 6%; bottom: -14%; }
}
@media (max-width: 480px) {
  .hero-cta, .hero-cta .btn { width: 100%; }
  .hero-screen { width: 44%; bottom: -18%; }
  .hero-media { margin-bottom: 64px; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * { animation: rise .8s var(--ease) both; }
  .hero-copy > :nth-child(2) { animation-delay: .06s; }
  .hero-copy > :nth-child(3) { animation-delay: .12s; }
  .hero-copy > :nth-child(4) { animation-delay: .18s; }
  .hero-photo { animation: settle 1.2s var(--ease) .05s both; }
  .hero-screen { animation: rise-far 1s var(--ease) .35s both; }
  @keyframes rise { from { opacity: 0; transform: translateY(16px); } }
  @keyframes rise-far { from { opacity: 0; transform: translateY(56px); } }
  @keyframes settle { from { opacity: 0; transform: scale(1.04); } }
}

/* ---------- How it works: search a place, then the map around it ---------- */
.how-stage {
  margin-top: 48px; padding: clamp(28px, 5vw, 64px) clamp(20px, 5vw, 64px) 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(20px, 5vw, 72px);
  border-radius: var(--r-surface); overflow: hidden;
  background: radial-gradient(70% 60% at 50% 100%, var(--accent-soft), transparent 75%), var(--accent-softer);
}
.step { margin: 0; display: flex; flex-direction: column; gap: 24px; }
.step .screen { margin-top: auto; }
/* The map sits lower, so the eye reads search first, result second. */
.step-map { padding-top: clamp(32px, 6vw, 88px); }
.step .screen { order: 2; width: min(100%, 340px); align-self: center; aspect-ratio: 620 / 740; border-radius: 28px 28px 0 0; border-bottom: 0; }
.step figcaption { display: flex; gap: 14px; align-items: flex-start; max-width: 24em; align-self: center; color: var(--ink-2); }
.step figcaption strong { color: var(--ink); font-weight: 650; }
.step figcaption .i { width: 22px; height: 22px; margin-top: 3px; color: var(--accent-ink); }
@media (prefers-reduced-motion: no-preference) {
  .js .how-stage .screen { transform: translateY(40px); transition: transform 1s var(--ease); transition-delay: calc(var(--i, 0) * 120ms + .1s); }
  .js .step-map .screen { --i: 1; }
  .js .how-stage.is-in .screen { transform: none; }
}
@media (max-width: 700px) {
  .how-stage { grid-template-columns: 1fr; gap: 40px; padding-bottom: 32px; }
  .step-map { padding-top: 0; }
  .step .screen { width: min(78%, 320px); aspect-ratio: 620 / 700; border-radius: 26px; border-bottom: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); }
}

/* ---------- Know before you go ---------- */
.place-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.place-stage {
  position: relative; aspect-ratio: 1 / 1.08; overflow: hidden; border-radius: var(--r-surface);
  background: var(--sunk);
}
.place-stage .screen { position: absolute; left: 50%; top: 9%; width: min(60%, 330px); transform: translateX(-50%); }
.place h2 { font-size: var(--display-m); }
.place-sub { margin-top: 16px; color: var(--muted); font-size: var(--text-lg); line-height: 1.5; max-width: 30em; }
.facilities { list-style: none; margin: 32px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.facilities li {
  padding: 7px 14px; border-radius: var(--r-pill); font-size: var(--text-sm); font-weight: 550;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
}
.facilities li:nth-child(-n+2) { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.points { list-style: none; margin: 32px 0 0; padding: 24px 0 0; border-top: 1px solid var(--line); display: grid; gap: 14px; }
.points li { display: flex; gap: 12px; align-items: flex-start; font-weight: 550; }
.points .i { width: 22px; height: 22px; margin-top: 2px; color: var(--accent-ink); }
@media (prefers-reduced-motion: no-preference) {
  .js .place-copy .facilities li { opacity: 0; transform: translateY(8px); transition: opacity .5s var(--ease), transform .5s var(--ease); transition-delay: calc(var(--n, 0) * 35ms + .2s); }
  .js .place-copy.is-in .facilities li { opacity: 1; transform: none; }
  .facilities li:nth-child(2) { --n: 1; } .facilities li:nth-child(3) { --n: 2; } .facilities li:nth-child(4) { --n: 3; }
  .facilities li:nth-child(5) { --n: 4; } .facilities li:nth-child(6) { --n: 5; } .facilities li:nth-child(7) { --n: 6; }
  .facilities li:nth-child(8) { --n: 7; } .facilities li:nth-child(9) { --n: 8; } .facilities li:nth-child(10) { --n: 9; }
  .facilities li:nth-child(11) { --n: 10; } .facilities li:nth-child(12) { --n: 11; }
}
@media (max-width: 860px) {
  .place-grid { grid-template-columns: 1fr; }
  .place-stage { aspect-ratio: 1 / 0.9; }
  .place-stage .screen { width: min(58%, 300px); top: 8%; }
}

/* ---------- More than mosques (bento, 5 cells: 7+5, 5+7, 12) ---------- */
.bento { margin-top: 48px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.cell { position: relative; display: flex; flex-direction: column; overflow: hidden; min-height: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-surface); }
.cell-copy { position: relative; padding: 26px 26px 0; }
.cell h3 { font-size: 1.3125rem; letter-spacing: -0.02em; }
.cell p { margin-top: 6px; color: var(--muted); font-size: var(--text-sm); max-width: 28em; }
.cell-shot { position: relative; flex: 1; min-height: 280px; margin-top: 24px; overflow: hidden; }
.cell-shot img {
  position: absolute; top: 0; left: 50%; width: min(74%, 320px);
  border-radius: 22px; border: 1px solid var(--line); box-shadow: var(--shadow-md);
  transform: translate(-50%, var(--y, 0%));
}
/* Each crop shows the part of the screen the cell is about. */
.cell-types .cell-shot img { --y: -4%; }
.cell-filter .cell-shot img { --y: -41%; }
.cell-add .cell-shot img { --y: -3%; }
.cell-types { grid-column: span 7; }
.cell-filter { grid-column: span 5; }
.cell-fajr { grid-column: span 5; border-color: transparent; background: #0c1714; }
.cell-add { grid-column: span 7; }
.cell-lang { grid-column: 1 / -1; min-height: 0; padding-bottom: 26px; }
.cell-types .cell-shot, .cell-add .cell-shot { background: radial-gradient(70% 80% at 50% 100%, var(--accent-soft), transparent 75%); }

/* Fajr: the dusk photograph is dark in both themes, so its text is fixed light. */
.cell-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.cell-fajr h3 { color: #eef4f0; }
.cell-fajr p { color: #b9c9c1; }
.cell-fajr .cell-copy .i { width: 28px; height: 28px; margin-bottom: 14px; color: #8bd6af; }
.cell-fajr .cell-shot img { --y: 0%; border-color: rgb(255 255 255 / 12%); box-shadow: 0 32px 64px -24px rgb(0 0 0 / 70%); }

.langs { list-style: none; margin: 24px 0 0; padding: 0 26px; display: flex; flex-wrap: wrap; gap: 8px; }
.langs li { padding: 8px 16px; border-radius: var(--r-pill); background: var(--sunk); color: var(--ink-2); font-weight: 500; }
@media (max-width: 960px) {
  .cell-types, .cell-filter, .cell-fajr, .cell-add { grid-column: span 6; }
}
@media (max-width: 640px) {
  .bento { grid-template-columns: 1fr; }
  .cell-types, .cell-filter, .cell-fajr, .cell-add, .cell-lang { grid-column: 1 / -1; }
}

/* ---------- FAQ ---------- */
.faq-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 32px 48px; align-items: start; }
.faq h2 { position: sticky; top: calc(var(--nav-h) + 24px); font-size: var(--display-m); }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list details:first-child { border-top: 1px solid var(--line); }
.faq-list summary {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 22px 0; cursor: pointer; list-style: none;
  font-size: 1.1875rem; font-weight: 650; letter-spacing: -0.015em;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary .i { width: 20px; height: 20px; color: var(--muted); rotate: 45deg; transition: rotate .35s var(--ease); }
.faq-list details[open] summary .i { rotate: 0deg; }
.faq-list details p { padding: 0 48px 24px 0; color: var(--muted); max-width: 60ch; }
@supports (interpolate-size: allow-keywords) {
  @media (prefers-reduced-motion: no-preference) {
    .faq-list { interpolate-size: allow-keywords; }
    .faq-list details::details-content { block-size: 0; overflow: hidden; transition: block-size .4s var(--ease), content-visibility .4s allow-discrete; }
    .faq-list details[open]::details-content { block-size: auto; }
  }
}
@media (max-width: 760px) {
  .faq-grid { grid-template-columns: 1fr; }
  .faq h2 { position: static; }
  .faq-list details p { padding-right: 0; }
}

/* ---------- Closing ---------- */
.end { padding-bottom: clamp(72px, 9vw, 128px); }
.end-panel {
  display: grid; justify-items: center; gap: 24px; text-align: center;
  padding: clamp(48px, 7vw, 96px) 24px; border-radius: var(--r-surface);
  background: radial-gradient(80% 90% at 50% 0%, var(--accent-soft), transparent 70%), var(--accent-softer);
}
.end-panel img { width: 72px; height: 72px; }
.end-panel h2 { font-size: var(--display-s); max-width: 15em; }
.end-panel .status { height: auto; min-height: 34px; padding: 6px 16px; font-size: var(--text-sm); line-height: 1.4; background: var(--surface); color: var(--ink-2); }

.foot-grid { grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); }
@media (max-width: 860px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .foot-grid { grid-template-columns: 1fr; } }
