/* Moncton Gurdwara — lightweight PWA hub (matches main site greens + gold) */

:root {
  --g-deep: #2d4a1c;
  --g-mid: #79b91c;
  --g-gold: #c9a227;
  --g-bg: #f6f3ea;
  --g-card: #fffef8;
  --g-text: #2a2d3a;
  --g-muted: #5c6178;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body.app-body {
  margin: 0;
  font-family: 'Ubuntu', 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(180deg, var(--g-bg) 0%, #e8e4d8 100%);
  color: var(--g-text);
  min-height: 100vh;
  min-height: 100dvh;
}

.mt-8 { margin-top: 8px; }

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  background: linear-gradient(180deg, rgba(246, 243, 234, 0.98) 0%, rgba(246, 243, 234, 0.92) 100%);
  backdrop-filter: blur(8px);
}

.app-back-btn {
  border: 2px solid var(--g-mid);
  background: #fff;
  color: var(--g-deep);
  font-weight: 700;
  padding: 0.4rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-block;
}

.app-back-btn:hover {
  background: var(--g-mid);
  color: #fff;
}

.app-topbar-title {
  font-weight: 800;
  color: var(--g-deep);
  font-size: 1rem;
  line-height: 1.2;
}

.app-header {
  text-align: center;
  padding: 1.25rem 0 0.5rem;
}

.app-header img,
.app-header .app-logo-mark {
  max-width: min(260px, 82vw);
  width: auto;
  height: 64px;
  object-fit: contain;
  border-radius: 12px;
  margin-bottom: 0.5rem;
}

.app-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--g-deep);
}

.app-sub {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--g-muted);
}

.app-install-row {
  display: flex;
  justify-content: center;
  margin: 1rem 0 0.5rem;
}

.app-install-btn {
  border: 2px solid var(--g-mid);
  background: #fff;
  color: var(--g-deep);
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
}

.app-install-btn:hover {
  background: var(--g-mid);
  color: #fff;
}

/* Install UI removed from HTML (kept styles harmless) */

.app-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

@media (min-width: 400px) {
  .app-tiles {
    gap: 1rem;
  }
}

.app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 112px;
  padding: 1rem 0.65rem;
  border-radius: 14px;
  background: var(--g-card);
  border: 1px solid #e8e0d0;
  text-decoration: none;
  color: var(--g-deep);
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.25;
  box-shadow: 0 6px 18px rgba(53, 56, 88, 0.06);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.app-tile:hover,
.app-tile:focus {
  border-color: var(--g-mid);
  box-shadow: 0 10px 26px rgba(121, 185, 28, 0.18);
  outline: none;
  transform: translateY(-2px);
}

.app-tile-icon {
  font-size: 1.65rem;
  margin-bottom: 0.45rem;
  color: var(--g-mid);
}

.app-tile--wide {
  grid-column: 1 / -1;
  min-height: auto;
  flex-direction: row;
  gap: 0.75rem;
  justify-content: flex-start;
  padding: 0.85rem 1rem;
}

.app-tile--wide .app-tile-icon {
  margin-bottom: 0;
  font-size: 1.5rem;
}

.app-foot {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #dcd6c8;
  font-size: 0.78rem;
  color: var(--g-muted);
  text-align: center;
  line-height: 1.45;
}

.app-foot a {
  color: var(--g-deep);
  font-weight: 600;
}

.app-view {
  margin-top: 0.5rem;
}

.app-card {
  background: linear-gradient(165deg, #fffef8 0%, #f9f6ee 100%);
  border: 1px solid #e8e0d0;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(53, 56, 88, 0.08);
  overflow: hidden;
}

.app-card--flush {
  background: #fff;
}

.app-card-head {
  padding: 1rem 1rem 0.75rem;
  background: linear-gradient(90deg, var(--g-deep) 0%, var(--g-mid) 45%, var(--g-gold) 100%);
  color: #fff;
  text-align: left;
}

.app-card-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.app-card-sub {
  margin-top: 0.25rem;
  font-size: 0.88rem;
  opacity: 0.95;
  font-weight: 600;
}

.app-card-body {
  padding: 1rem;
  background: #fff;
}

.app-skel {
  color: var(--g-muted);
  font-weight: 600;
  font-size: 0.95rem;
}

.app-muted {
  color: var(--g-muted);
  font-size: 0.92rem;
}

.app-mini-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.app-station {
  border: 1px solid #ece5d5;
  border-radius: 14px;
  padding: 0.85rem;
  background: linear-gradient(165deg, #fffef8 0%, #f9f6ee 100%);
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.app-station-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid #ece5d5;
  background: #fff;
  object-fit: contain;
  flex-shrink: 0;
}

.app-station-title {
  margin: 0;
  font-weight: 800;
  color: var(--g-deep);
  font-size: 0.98rem;
  line-height: 1.25;
}

.app-station-meta {
  margin-top: 0.15rem;
  font-size: 0.82rem;
  color: #6c7288;
}

.app-station-actions {
  margin-top: 0.5rem;
}

.app-btn {
  border: 2px solid var(--g-mid);
  background: #fff;
  color: var(--g-deep);
  font-weight: 800;
  padding: 0.4rem 0.75rem;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  touch-action: manipulation;
}

.app-btn-primary {
  background: var(--g-mid);
  border-color: var(--g-mid);
  color: #fff;
}

.app-textarea {
  width: 100%;
  margin-top: 0.75rem;
  border-radius: 14px;
  border: 1px solid #e8e0d0;
  padding: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.35;
  background: #fffef8;
  color: #2a2d3a;
}

.app-input {
  width: 100%;
  margin-top: 0.6rem;
  border-radius: 14px;
  border: 1px solid #e8e0d0;
  padding: 0.7rem 0.75rem;
  font-size: 0.92rem;
  background: #fffef8;
  color: #2a2d3a;
}

.app-input:focus,
.app-textarea:focus {
  outline: none;
  border-color: rgba(45, 74, 28, 0.45);
  box-shadow: 0 0 0 3px rgba(45, 74, 28, 0.12);
}

.app-audio {
  width: 100%;
  height: 42px;
}

.app-audio-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: rgba(255, 254, 248, 0.96);
  border-top: 1px solid #ece5d5;
  padding: 0.6rem 0.85rem calc(0.6rem + env(safe-area-inset-bottom));
  backdrop-filter: blur(8px);
}

.app-audio-dock[hidden] {
  display: none;
}

.app-audio-dock-title {
  font-weight: 800;
  color: var(--g-deep);
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.app-has-audio-dock .app-shell {
  padding-bottom: 96px;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.app-iframe {
  width: 100%;
  height: calc(100vh - 180px);
  height: calc(100dvh - 180px);
  border: 0;
  background: #fff;
}

.app-map-embed {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #ece5d5;
  background: #fff;
  box-shadow: 0 10px 28px rgba(53, 56, 88, 0.08);
}

.app-map-embed iframe {
  width: 100%;
  height: 260px;
  border: 0 !important;
  outline: 0 !important;
  display: block;
}

.app-lines {
  display: grid;
  gap: 0.75rem;
}

.app-line {
  border: 1px solid #ece5d5;
  border-radius: 12px;
  padding: 0.85rem;
  background: #fffef8;
}

.app-line-pa {
  font-weight: 800;
  color: var(--g-deep);
  font-size: 1.05rem;
  line-height: 1.35;
}

.app-line-en {
  margin-top: 0.5rem;
  color: var(--g-muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.app-line--speaking {
  outline: 3px solid var(--g-mid);
  outline-offset: 2px;
  background: #fff;
}

.app-hukam-tts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid #ece5d5;
  background: rgba(121, 185, 28, 0.08);
}

.app-hukam-tts-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--g-deep);
}

.app-hukam-tts-speed {
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 0.9rem;
  background: #fff;
}

.app-hukam-tts-status {
  flex: 1 1 140px;
  font-size: 0.78rem;
  color: var(--g-muted);
  line-height: 1.3;
  min-width: 0;
}

.app-hukam-archive {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid #ece5d5;
  background: #fffef8;
}

.app-hukam-date-input {
  width: 4.2rem;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 0.9rem;
  background: #fff;
}

/* Gallery (iOS-style cards) */
.app-gallery-modal[hidden] {
  display: none;
}

.app-gallery-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 200;
  touch-action: pan-y pinch-zoom;
}

.app-gallery-modal img {
  max-width: 100%;
  max-height: 82vh;
  max-height: 82dvh;
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.35);
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.app-gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 2px solid rgba(255,255,255,0.65);
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-weight: 900;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  z-index: 2;
  touch-action: manipulation;
}

.app-gallery-close {
  position: absolute;
  top: 18px;
  right: 18px;
  border: 2px solid rgba(255,255,255,0.65);
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-weight: 800;
  padding: 0.45rem 0.75rem;
  border-radius: 12px;
  z-index: 2;
  touch-action: manipulation;
}

.app-gallery-prev { left: 14px; }
.app-gallery-next { right: 14px; }

.app-gallery-nav:active {
  background: rgba(255,255,255,0.22);
}

.app-gallery-cats {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  overflow: hidden;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
}

.app-cat-pill {
  white-space: nowrap;
  border: 1px solid #e8e0d0;
  background: #fffef8;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-weight: 800;
  color: var(--g-deep);
  font-size: 0.88rem;
  cursor: pointer;
  touch-action: manipulation;
}

.app-cat-pill.is-active {
  background: var(--g-mid);
  border-color: var(--g-mid);
  color: #fff;
}

.app-gallery-grid {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.app-gallery-card {
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #ece5d5;
  box-shadow: 0 10px 28px rgba(53, 56, 88, 0.08);
  cursor: pointer;
  touch-action: manipulation;
}

.app-gallery-card img {
  width: 100%;
  object-fit: cover;
  display: block;
}

.app-gallery-card .app-gallery-cap {
  padding: 0.6rem 0.7rem;
  font-weight: 800;
  color: var(--g-deep);
  font-size: 0.82rem;
  background: linear-gradient(180deg, #ffffff 0%, #faf8f3 100%);
}

.app-offline .app-shell {
  padding-top: 3rem;
}

.app-offline-msg {
  text-align: center;
  color: var(--g-muted);
  margin-bottom: 1.5rem;
}

.app-tile-link {
  display: block;
  text-align: center;
  color: var(--g-deep);
  font-weight: 600;
}
