/* Verse map styles. Lives on quranclub.org, also loaded by talhaghannam.com: see verse-map.js. Everything is scoped under .vmap. */
/* Fonts: each site brings its own (quranclub.org loads fonts.css beside this file; talhaghannam.com self-hosts them). */
/* ---------- the band: deep lapis night sky (fixed in both themes by design) ---------- */
.vmap {
  --night: #0e1830;
  --night-2: #15223f;
  --star: #e2b85a;
  --star-dim: rgba(226, 184, 90, .55);
  --sky-empty: rgba(214, 224, 255, .10);
  --moon: #f3eee2;
  --moon-soft: #b8bfd3;
  --display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --vmap-wide: 70rem;
  box-sizing: border-box;
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.6; text-align: left;
  background-color: var(--night); color: var(--moon);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23e2b85a' stroke-opacity='.09' stroke-width='1'%3E%3Cpath d='M36 6l8.8 21.2L66 36l-21.2 8.8L36 66l-8.8-21.2L6 36l21.2-8.8z'/%3E%3Crect x='18' y='18' width='36' height='36' transform='rotate(45 36 36)'/%3E%3Crect x='18' y='18' width='36' height='36'/%3E%3C/g%3E%3C/svg%3E");
  padding: 4.5rem max(16px, env(safe-area-inset-right, 0px)) 4rem max(16px, env(safe-area-inset-left, 0px));
  border-top: 1px solid rgba(226,184,90,.18);
}
.vmap *, .vmap *::before, .vmap *::after { box-sizing: border-box; }
.vmap [hidden] { display: none !important; }
.vmap p { margin: 0; }
.vmap h2, .vmap h3 { font-family: var(--display); font-weight: 600; margin: 0; line-height: 1.05; text-wrap: balance; letter-spacing: normal; }
.vmap :focus-visible { outline: 2px solid var(--star); outline-offset: 3px; }
.vmap .wide { max-width: var(--vmap-wide); margin-inline: auto; }
.vmap .eyebrow { font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; }

.vmap .sky-head { display: flex; flex-wrap: wrap; gap: 1.5rem 3rem; align-items: end; justify-content: space-between; margin-bottom: 2rem; }
.vmap .sky-head .eyebrow { color: var(--star); margin-bottom: .9rem; }
.vmap .sky-head h2 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); max-width: 34rem; color: var(--moon); }
.vmap .sky-head p.sub { margin-top: .9rem; color: var(--moon-soft); max-width: 34rem; }
.vmap .tally { display: flex; gap: 2.25rem; font-variant-numeric: tabular-nums; }
.vmap .tally div { display: grid; gap: .55rem; justify-items: start; }
.vmap .tally b { font-family: var(--display); font-size: 3.6rem; line-height: 1; color: var(--star); font-weight: 600; }
.vmap .tally span { font-size: .8125rem; color: var(--moon-soft); letter-spacing: .06em; text-transform: uppercase; }
.vmap .tally .of b { color: var(--moon); }

/* ---------- the mosaic: one block per surah, one square per verse ---------- */
.vmap .mosaic { --c: 7px; --g: 1px; direction: rtl; display: flex; flex-wrap: wrap; gap: 14px 10px; align-items: flex-end; }
.vmap .sb { direction: ltr; display: grid; gap: 3px; width: calc(var(--cols) * (var(--c) + var(--g)) - var(--g) + 6px); }
.vmap .sb .lbl { font-size: .6875rem; line-height: 1.2; color: var(--moon-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.vmap .sb .lbl b { color: var(--moon); font-weight: 600; margin-right: .25em; }
.vmap .sb.short .lbl .nm { display: none; }
.vmap .sb .cnt { display: none; }
.vmap .sb.on .lbl, .vmap .sb:hover .lbl { color: var(--star); }
.vmap .sb.on .lbl b, .vmap .sb:hover .lbl b { color: var(--star); }
.vmap .surah { display: grid; gap: var(--g); grid-template-columns: repeat(var(--cols), var(--c)); grid-auto-rows: var(--c); padding: 3px; border-radius: 3px; cursor: pointer; }
.vmap .sb:hover .surah, .vmap .sb.on .surah, .vmap .surah:focus-visible { background: rgba(226,184,90,.14); }
.vmap .v { display: block; cursor: pointer; background: var(--sky-empty); border-radius: 1px; }
.vmap .v.s { background: var(--star); box-shadow: 0 0 4px rgba(226,184,90,.55); }
.vmap .v.c { background: transparent; box-shadow: inset 0 0 0 1px var(--star); }
.vmap .v.hit { background: var(--moon); box-shadow: 0 0 6px var(--moon); }

/* ---------- verse pop-up ---------- */
.vmap .tip {
  position: fixed; z-index: 60; width: min(19rem, calc(100vw - 24px)); padding: .9rem 1rem 1rem;
  background: #fbf8f0; color: #1b2233; border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.45);
  font-size: .9375rem; line-height: 1.45; display: grid; gap: .55rem;
}
.vmap .tip::after { content: ""; position: absolute; left: var(--ax, 50%); width: 12px; height: 12px; background: #fbf8f0; transform: translateX(-50%) rotate(45deg); }
.vmap .tip.up::after { bottom: -6px; }
.vmap .tip.down::after { top: -6px; }
.vmap .tip .t-head { display: flex; align-items: center; gap: .6rem; }
.vmap .tip .t-ico { flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; }
.vmap .tip .t-ref { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: #6a7186; font-weight: 600; }
.vmap .tip .t-title { font-family: var(--display); font-size: 1.35rem; font-weight: 600; line-height: 1.15; }
.vmap .tip .t-body { color: #4a5266; }
.vmap .tip .t-btn { justify-self: start; display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; font-size: .9375rem; text-decoration: none; padding: .55rem .95rem; border-radius: 999px; border: 0; cursor: pointer; font-family: inherit; }
.vmap .tip .t-btn.yt { background: #c4302b; color: #fff; }
.vmap .tip .t-btn.sp { background: var(--night); color: var(--star); }
.vmap .tip .t-btn:hover { filter: brightness(1.1); }
.vmap .tip.has-thumb { width: min(23rem, calc(100vw - 24px)); }
.vmap .tip .t-media { display: grid; grid-template-columns: 96px 1fr; gap: .9rem; align-items: start; }
.vmap .tip .t-thumb { position: relative; display: block; width: 96px; aspect-ratio: 9 / 16; border-radius: 8px; overflow: hidden; background: #0e1830; }
.vmap .tip .t-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; max-width: none; }
.vmap .tip .t-thumb .play, .vmap .tip .t-mini .play { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(transparent 55%, rgba(0,0,0,.35)); }
.vmap .tip .t-thumb .play span { width: 34px; height: 24px; border-radius: 7px; background: #c4302b; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.vmap .tip .t-side { display: grid; gap: .6rem; align-content: start; padding-right: 1rem; }
.vmap .tip .t-list { display: grid; gap: .55rem; max-height: 22rem; overflow-y: auto; padding-right: .25rem; }
.vmap .tip .t-row { display: grid; grid-template-columns: 54px 1fr; gap: .75rem; align-items: center; text-decoration: none; color: inherit; padding: .35rem; border-radius: 8px; }
.vmap .tip .t-row:hover { background: #efe9da; }
.vmap .tip .t-mini { position: relative; width: 54px; aspect-ratio: 9 / 16; border-radius: 6px; overflow: hidden; background: #0e1830; display: block; }
.vmap .tip .t-mini img { width: 100%; height: 100%; object-fit: cover; display: block; max-width: none; }
.vmap .tip .t-mini .play span { width: 24px; height: 17px; border-radius: 5px; background: #c4302b; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.vmap .tip .t-rowtext b { display: block; font-family: var(--display); font-size: 1.15rem; line-height: 1.15; }
.vmap .tip .t-rowtext small { display: block; margin-top: .2rem; color: #c4302b; font-weight: 600; font-size: .8125rem; }
.vmap .tip .t-close { position: absolute; top: .4rem; right: .5rem; border: 0; background: none; font-size: 1.2rem; line-height: 1; color: #6a7186; cursor: pointer; padding: .3rem; }
.vmap .tip .t-note { font-size: .8125rem; color: #6a7186; border-top: 1px solid #e4dccb; padding-top: .55rem; }
.vmap .tip .t-note b { color: #1b2233; font-weight: 600; }

/* ---------- readout bar: pinned to the bottom of the screen while the map is in view ---------- */
.vmap .readout {
  position: sticky; bottom: 0; z-index: 5; margin-top: 1.75rem;
  display: grid; grid-template-columns: 1fr auto; gap: .5rem 2rem; align-items: center;
  padding: .85rem 0 calc(.85rem + env(safe-area-inset-bottom, 0px));
  background: rgba(14, 24, 48, .96); border-top: 1px solid rgba(226,184,90,.35);
  box-shadow: 0 -12px 24px rgba(14,24,48,.85);
}
.vmap .ro-surah { font-family: var(--display); font-size: 1.5rem; font-weight: 600; line-height: 1.2; }
.vmap .ro-detail { color: var(--moon-soft); font-variant-numeric: tabular-nums; margin-top: .1rem; min-height: 1.5em; font-size: .9375rem; }
.vmap .ro-detail b { color: var(--star); font-weight: 600; }
.vmap .legend { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; font-size: .8125rem; color: var(--moon-soft); justify-content: flex-end; }
.vmap .legend span { display: inline-flex; align-items: center; gap: .55rem; }
.vmap .sw { width: 10px; height: 10px; border-radius: 1px; display: inline-block; }
.vmap .source { margin-top: 1.1rem; font-size: .8125rem; color: var(--moon-soft); opacity: .85; }
.vmap .lib-open { display: inline-flex; align-items: center; gap: .5rem; margin-top: 1.25rem; padding: .7rem 1.2rem; border-radius: 999px; border: 1px solid rgba(226,184,90,.55); background: rgba(226,184,90,.1); color: var(--moon); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.vmap .lib-open:hover { border-color: var(--star); color: var(--star); }

/* ---------- surah sheet (phones and touch screens): one surah, verses at a tappable size ---------- */
.vmap .sheet-back { position: fixed; inset: 0; z-index: 54; background: rgba(5,9,20,.55); }
.vmap .sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 55; max-height: 78vh; overflow-y: auto;
  background: var(--night-2); color: var(--moon); border-radius: 18px 18px 0 0; border-top: 1px solid rgba(226,184,90,.35);
  padding: 1rem max(16px, env(safe-area-inset-left, 0px)) calc(1.25rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -18px 40px rgba(0,0,0,.5);
}
.vmap .sheet .grab { width: 44px; height: 4px; border-radius: 4px; background: rgba(184,191,211,.4); margin: 0 auto .9rem; }
.vmap .sheet-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.vmap .sheet-head h3 { font-size: 1.8rem; }
.vmap .sheet-head p { color: var(--moon-soft); font-size: .9375rem; margin-top: .2rem; }
.vmap .sheet-head p b { color: var(--star); font-weight: 600; }
.vmap .sheet-close { border: 0; background: rgba(255,255,255,.1); color: var(--moon); width: 36px; height: 36px; border-radius: 50%; font-size: 1.2rem; cursor: pointer; flex: none; }
.vmap .sheet-grid { margin-top: 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.vmap .sheet-grid button {
  aspect-ratio: 1; border: 0; border-radius: 7px; font: inherit; font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer;
  background: rgba(214,224,255,.09); color: var(--moon-soft);
}
.vmap .sheet-grid button.s { background: var(--star); color: var(--night); box-shadow: 0 0 8px rgba(226,184,90,.45); }
.vmap .sheet-grid button.c { background: transparent; color: var(--star); box-shadow: inset 0 0 0 1.5px var(--star); }
.vmap .sheet-grid button.hit { outline: 2px solid var(--moon); outline-offset: 2px; }
.vmap .sheet-hint { margin-top: .9rem; font-size: .8125rem; color: var(--moon-soft); }

@media (max-width: 640px) {
  .vmap .mosaic { --c: 5px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px 6px; align-items: start; }
  .vmap .sb { width: auto; min-width: 0; }
  .vmap .sb .lbl { font-size: .625rem; }
  .vmap .sb .lbl .nm { display: inline; }
  .vmap .surah { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-auto-rows: auto; aspect-ratio: 1; align-content: start; padding: 3px; background: rgba(214,224,255,.05); }
  .vmap .v { aspect-ratio: 1; }
  .vmap .sb .cnt { display: block; font-size: .625rem; color: var(--moon-soft); font-variant-numeric: tabular-nums; }
  .vmap .readout { grid-template-columns: 1fr; gap: .35rem; padding-block: .6rem calc(.6rem + env(safe-area-inset-bottom, 0px)); }
  .vmap .ro-surah { font-size: 1.2rem; }
  .vmap .ro-detail { font-size: .875rem; }
  .vmap .legend { justify-content: flex-start; font-size: .75rem; gap: .25rem .9rem; }
  .vmap .tally b { font-size: 2.8rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .vmap .v.s { animation: vmap-glow 900ms ease-out both; animation-delay: var(--d, 0ms); }
  @keyframes vmap-glow { from { opacity: .25; box-shadow: none; } to { opacity: 1; } }
}
