/* Layth & Layan Love Islam — Styles */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'Nunito', sans-serif;
  min-height: 100vh;
  background: #87CEEB;
  overflow-x: hidden;
}

.desktop-only { display: block; }
.mobile-only  { display: none; }

/* Layout switch — WIDTH ONLY, no orientation clause.
   This MUST stay in sync with index.html's inline <style>, whose mobile
   rule is `@media (max-width: 767px)` with no orientation test. When the
   two disagreed — this rule portrait-only, the inline one width-only — a
   narrow LANDSCAPE phone matched the inline rule (mobile shown) but NOT
   this one (desktop never hidden), so both layouts rendered at once:
   two backgrounds, two titles. Width-only here keeps both halves of the
   switch in agreement at every orientation. Do not re-add an orientation
   test to one half without adding it to the other. */
@media (max-width: 767px) {
  .desktop-only { display: none; }
  .mobile-only  { display: flex; flex-direction: column; }
}

/* ─────────────────────────────────────────────
   DESKTOP SCENE
   ───────────────────────────────────────────── */
.scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #87CEEB;
}

.bg,
.scene-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: max(100vw, 177.78vh);
  height: max(100vh, 56.25vw);
}

.bg {
  z-index: 1;
  object-fit: fill;
  display: block;
}

.scene-inner {
  z-index: 2;
  pointer-events: none;
}

.scene-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(20,60,120,0.05) 0%, rgba(255,255,255,0) 40%, rgba(20,60,10,0.08) 100%);
}

/* ─────────────────────────────────────────────
   TOP NAV — hamburger LEFT, logo RIGHT of it
   Positioned at the same spot a "← back" button
   sits on other pages, for consistency.
   ───────────────────────────────────────────── */
.top-nav {
  position: fixed;
  top: 14px;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 0 20px;
  padding-top: max(14px, env(safe-area-inset-top));
  pointer-events: none;
}

/* Hamburger — frosted pill, first in row */
.hamburger {
  pointer-events: auto;
  background: rgba(255,255,255,0.92);
  border: none;
  border-radius: 50px;
  padding: 11px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.hamburger:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: #2d5a18;
  border-radius: 2px;
}

/* Logo sits next to the hamburger */
.nav-logo-wrap {
  pointer-events: auto;
  display: flex;
  align-items: center;
}
.nav-logo-img {
  width: clamp(40px, 3.4vw, 56px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.25));
  animation: logoBob 6s ease-in-out infinite;
}
@keyframes logoBob {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-4px); }
}

/* ─────────────────────────────────────────────
   SITE TITLE — centered, matches other pages
   ───────────────────────────────────────────── */
.site-title {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  pointer-events: none;
  text-align: center;
  padding: 0 20px;
}
.site-title-main {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(30px, 5vw, 58px);
  color: #fff;
  line-height: 1.05;
  text-shadow:
    0 2px 0 rgba(60,100,30,0.45),
    0 4px 20px rgba(20,70,10,0.42),
    0 0 40px rgba(255,240,180,0.15);
}
.site-title-sub {
  display: block;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: clamp(13px, 1.6vw, 20px);
  color: rgba(255, 240, 160, 0.98);
  margin-top: 4px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(20,70,10,0.5);
}

/* ─────────────────────────────────────────────
   DROPDOWN MENU — frosted, Fredoka items
   ───────────────────────────────────────────── */
.nav-menu {
  position: fixed;
  top: 74px;
  left: 20px;
  z-index: 200;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 18px;
  padding: 8px 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  min-width: 180px;
  display: none;
  flex-direction: column;
  border: 2px solid rgba(255,255,255,0.7);
  animation: menuPop 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
.nav-menu.open { display: flex; }
@keyframes menuPop {
  from { opacity: 0; transform: translateY(-8px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.nav-menu a {
  padding: 11px 22px;
  font-family: 'Fredoka One', cursive;
  font-size: 16px;
  color: #2d5a18;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, padding-left 0.15s ease;
  white-space: nowrap;
}
.nav-menu a:hover {
  background: rgba(255,200,50,0.18);
  padding-left: 28px;
}

/* ─────────────────────────────────────────────
   BUILDINGS
   ───────────────────────────────────────────── */
.bld {
  position: absolute;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  transform-origin: bottom center;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), filter 0.2s ease;
}
.bld:hover {
  transform: scale(1.1) translateY(-5px);
  filter: drop-shadow(0 8px 22px rgba(255,200,50,0.65));
  z-index: 200 !important;
}
.bld:focus { outline: none; }
.bld img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
}

/* TOOLTIP */
.tip {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: rgba(255,255,255,0.97);
  border-radius: 20px;
  padding: 3px 13px;
  font-family: 'Fredoka One', cursive;
  font-size: clamp(10px, 1.1vw, 14px);
  color: #3d2810;
  white-space: nowrap;
  box-shadow: 0 3px 14px rgba(0,0,0,0.18);
  border: 2px solid rgba(255,200,50,0.55);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.bld:hover .tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* FOUNTAIN */
.fountain {
  position: absolute;
  left: 40.6%;
  top: 38.99%;
  width: 16.86%;
  z-index: 18;
  pointer-events: none;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.12));
  animation: fountainBob 4s ease-in-out infinite;
}
.fountain img { width: 100%; height: auto; display: block; }
@keyframes fountainBob {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-3px); }
}

/* CHARACTERS */
.chars {
  position: absolute;
  left: 40.18%;
  top: 65.92%;
  width: 16%;
  z-index: 45;
  pointer-events: none;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.18));
  animation: bob 5s ease-in-out infinite;
}
.chars img { width: 100%; height: auto; display: block; }
@keyframes bob {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-5px); }
}

/* ─────────────────────────────────────────────
   MOBILE — card grid (matching Duas aesthetic)
   ───────────────────────────────────────────── */
.mobile-only {
  align-items: center;
  min-height: 100vh;
  width: 100%;
  background-image: url('images/bg_mobile.webp');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-color: #87CEEB;
  padding-bottom: 20px;
}
.m-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 10px;
  gap: 10px;
}
.m-logo {
  width: clamp(60px, 18vw, 90px);
  height: auto;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,0.15));
  animation: logoBob 6s ease-in-out infinite;
}
.m-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.m-title-main {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(28px, 9vw, 44px);
  color: #fff;
  line-height: 1.05;
  text-align: center;
  text-shadow:
    0 2px 0 rgba(60,100,30,0.45),
    0 4px 14px rgba(20,70,10,0.42);
}
.m-title-sub {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: clamp(12px, 4vw, 17px);
  color: rgba(255,240,160,0.98);
  text-align: center;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 1px 8px rgba(20,70,10,0.5);
}
.m-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 10px 16px;
  width: 100%;
  max-width: 480px;
}
.m-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.90);
  border: none;
  border-radius: 20px;
  padding: 12px 8px 10px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,0.12);
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.m-card:active {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.m-img-wrap {
  width: 100%;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.m-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.12));
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
.m-card:active .m-img-wrap img { transform: scale(0.95); }
.m-label {
  margin-top: 8px;
  font-family: 'Fredoka One', cursive;
  font-size: clamp(14px, 4.5vw, 20px);
  color: #3d2810;
  text-align: center;
}
.m-footer {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 10px 0 0;
}
.m-chars {
  width: clamp(160px, 55vw, 240px);
  height: auto;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.18));
  animation: bob 5s ease-in-out infinite;
}

/* ─────────────────────────────────────────────
   LANDSCAPE-PHONE: fit-to-width, natural scroll, pinch-zoom allowed
   On touch devices in landscape with a short viewport (phones, not tablets),
   render the 16:9 town at full viewport width and let it overflow vertically.
   The page scrolls naturally so users can see everything; pinch-zoom still
   works (viewport meta doesn't disable it). Simpler and more forgiving than
   a fit-to-viewport approach with letterbox.
   ───────────────────────────────────────────── */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  /* Take .scene out of fixed positioning so it flows normally and the page
     scrolls to reveal anything below the viewport. Aspect-ratio preserves
     the 16:9 town shape at whatever width the viewport gives us. */
  .scene {
    position: relative;
    inset: auto;
    width: 100vw;
    height: auto;
    aspect-ratio: 16 / 9;
    transform: none;
    background: #87CEEB;
  }
  /* Background image fills the scene exactly — no cover, no crop */
  .bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: none;
    object-fit: fill;
  }

  /* Body no longer needs min-height:100vh — let it be whatever the content
     requires. overflow-y:auto is the browser default, explicitly stated. */
  body {
    min-height: auto;
    overflow-y: auto;
  }

  /* Top-nav stays fixed (hamburger + logo hover above the scene during
     scroll), compacted for the small viewport. */
  .top-nav {
    top: 6px;
    padding: 0 10px;
    padding-top: max(6px, env(safe-area-inset-top));
    gap: 8px;
  }
  .nav-logo-img { width: clamp(34px, 9vw, 44px); }
  .hamburger { padding: 7px 10px; }
  .hamburger span { width: 18px; height: 2.2px; }

  /* Compact site title */
  /* Mobile: drop the title BELOW the star-counter / mute-toggle
     row (those sit ~14px + button height from the top). Pinning it
     near the top here would overlap them — the bug the old text
     title had. Pairs with the .site-title-img mobile size in
     index.html's inline <style>.

     The width cap is essential: .site-title is position:fixed with
     no width, so its children can resolve "100%" to the image's
     own 1500px intrinsic width and overflow off-screen — which is
     why the title vanished in portrait but showed in landscape.
     Capping the container to the viewport forces it to fit. */
  .site-title {
    top: 74px;
    width: 100vw;
    max-width: 100vw;
  }
  .site-title-main { font-size: clamp(16px, 4.5vmin, 24px); }
  .site-title-sub {
    font-size: clamp(8px, 1.8vmin, 11px);
    margin-top: 1px;
    letter-spacing: 0.13em;
  }

  /* Dropdown menu aligned under the shrunk hamburger */
  .nav-menu {
    top: 52px;
    left: 12px;
    min-width: 140px;
    padding: 6px 0;
    border-radius: 14px;
  }
  .nav-menu a {
    padding: 7px 18px;
    font-size: 13px;
  }
}
