:root {
  --ink: #262019;
  --ink-soft: #4a4034;
  --parchment: #f7f0df;
  --parchment-deep: #efe4c8;
  --gold: #b9902e;
  --gold-bright: #d4af37;
  --maroon: #7a1f2b;
  --indigo: #232a5c;
  --terracotta: #8a3324;
  --royal-blue: #1a3a8f;

  /* Guru Gobind Singh Ji gave the Khalsa three colours — blue, white, and
     basanti (saffron) yellow — so the site chrome (everything outside the
     illuminated parchment card itself) is built from this palette rather
     than the earlier brown/parchment scheme. */
  --page-bg-top: #2a4faf;
  --page-bg-mid: #16265f;
  --page-bg-deep: #0a1230;
  --basanti: #f0b429;
  --basanti-soft: #f7cf6b;
  --on-blue: #f8f5ec;
  --on-blue-soft: rgba(248, 245, 236, 0.76);
  --on-blue-faint: rgba(248, 245, 236, 0.4);

  --shadow: rgba(6, 10, 30, 0.35);
  --carousel-fade: var(--page-bg-top);
  --radius-lg: 22px;
  --radius-md: 14px;
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  /* Mukta Mahee is a Google Font drawn specifically for Gurmukhi (part of
     the Ek Type "Mukta" family) rather than a generic pan-Indic Unicode
     face — its rakar/vakar/haha subjoined strokes (the hook that turns
     ਬਰਹਮ into ਬ੍ਰਹਮ) render as a clearly separate, larger mark instead of
     the near-invisible sliver Noto Serif/Sans Gurmukhi, Baloo Paaji 2 and
     Mukta (the Devanagari member of the same family) all produced. */
  --font-gurmukhi: "Mukta Mahee", "Noto Serif Gurmukhi", "Noto Sans Gurmukhi", serif;
  --accent: var(--gold);
  --accent-strong: var(--maroon);
}

.theme-indigo {
  --accent: var(--indigo);
  --accent-strong: var(--terracotta);
}

.theme-accent {
  --accent: var(--royal-blue);
  --accent-strong: var(--royal-blue);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--page-bg-deep);
}

body {
  background: radial-gradient(circle at top, var(--page-bg-top) 0%, var(--page-bg-mid) 48%, var(--page-bg-deep) 100%);
  background-attachment: fixed;
  color: var(--on-blue);
  font-family: var(--font-serif);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  /* Top safe-area is handled by the hero carousel itself on pages that have
     one (it bleeds under the notch/status bar) — see .sources-page for the
     plain pages that don't. */
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  animation: page-fade-in 0.35s ease both;
}

@keyframes page-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Hero carousel — bleeds full-bleed edge to edge and under the status
   bar/notch (the safe-area inset is added on top of an aspect-ratio-driven
   height rather than a fixed clamp: a fixed max-height regardless of
   viewport width let the box's aspect ratio run away from the banner
   photos' own ~1.4–2.5:1 ratio on wide/short desktop windows, so
   object-fit:cover cropped hard into the top of every image — the
   "squished" look. Sizing the box off its own aspect ratio keeps the crop
   proportional to what the photos actually look like at any width, and
   object-position keeps the crop weighted toward the upper part of the
   frame (where these paintings put their architecture/subjects) rather
   than centring it. Only two slides are ever loaded at once (see app.js);
   the rest sit inert with data-src until their turn. A soft gradient at
   the base blends it into the page background so it reads as one
   continuous surface rather than a photo pasted on top. */
.hero-carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 2.6 / 1;
  min-height: calc(190px + env(safe-area-inset-top));
  max-height: calc(420px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  overflow: hidden;
  background: var(--page-bg-deep);
}

.hero-slides {
  position: absolute;
  inset: 0;
}

.hero-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 32%;
  opacity: 0;
  transition: opacity 1.4s ease;
  will-change: opacity;
}

.hero-slide.active {
  opacity: 1;
}

.hero-carousel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(6, 10, 30, 0.22) 0%, rgba(6, 10, 30, 0) 45%, var(--carousel-fade) 96%);
  pointer-events: none;
}

.hero-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  display: flex;
  justify-content: center;
  gap: 7px;
}

.hero-dot {
  width: 7px;
  height: 7px;
  /* Padding + background-clip give this a comfortable ~23px tap target
     on touch devices while keeping the visible dot small. */
  padding: 8px;
  background-clip: content-box;
  border-radius: 999px;
  border: none;
  background-color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.25s ease;
}

.hero-dot.active {
  background-color: var(--basanti);
  transform: scale(1.3);
}

/* A slimmer version of the same carousel, reused as a banner strip inside
   long-form pages (FAQ / Sources) rather than only at the top of the
   hukamnama page. */
.banner-strip {
  position: relative;
  width: 100%;
  aspect-ratio: 4.5 / 1;
  min-height: 90px;
  max-height: 180px;
  overflow: hidden;
  border-radius: var(--radius-md);
  margin: 28px 0;
  box-shadow: 0 14px 34px var(--shadow);
}

.banner-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 32%;
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .hero-slide {
    transition: none;
  }
}

.masthead {
  text-align: center;
  margin-bottom: 22px;
}

.eyebrow {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  color: var(--basanti);
  margin: 0 0 10px;
}

.site-title {
  font-family: var(--font-gurmukhi);
  font-weight: 600;
  font-size: clamp(22px, 5vw, 30px);
  margin: 0 0 4px;
  color: var(--on-blue);
}

.site-title-en {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  color: var(--on-blue-soft);
  margin: 0;
}

/* ---- Source selector: a native <select> dropdown rather than a pill
   toggle, so the growing set of options (single granth / any pair / all
   three) stays compact and legible on every screen size. ---- */
.source-select-wrap {
  position: relative;
  margin-bottom: 22px;
  max-width: 320px;
  width: 100%;
}

.source-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  color: var(--on-blue);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 12px 40px 12px 20px;
  cursor: pointer;
  text-align: center;
  text-align-last: center;
  min-height: 44px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.source-select:hover,
.source-select:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.4);
  outline: none;
}

.source-select option {
  color: var(--ink);
  background: var(--parchment);
}

.source-select-wrap::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--basanti);
  border-bottom: 2px solid var(--basanti);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* Legacy pill toggle — still used where a handful of options fit comfortably
   (e.g. Dasam/Sarbloh's 3-way choice). */
.source-toggle {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 6px;
  border-radius: 20px;
  margin-bottom: 22px;
  max-width: 100%;
}

.toggle-btn {
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--on-blue-soft);
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.toggle-btn.active {
  background: var(--accent);
  color: #fff8ea;
}

/* The border art is applied as a CSS border-image (9-slice) rather than a
   stretched background: a background-image sized to 100% 100% combined with
   percentage padding (which CSS resolves against the element's WIDTH, even
   for top/bottom) meant the ornamental corners shrank to a sliver of the
   frame's height for long shabads, letting the growing text card cover
   them. border-image keeps each corner a fixed, undistorted pixel size no
   matter how tall the content gets — only the straight edges between
   corners stretch, and only along their own axis (top/bottom stretch
   horizontally, left/right stretch vertically), which is what an ornate
   letter border actually looks like when the "page" grows longer. */
.letter-frame {
  width: 100%;
  border-style: solid;
  border-image-source: var(--frame-image);
  border-image-repeat: stretch;
  display: flex;
  justify-content: center;
}

.theme-gold .letter-frame {
  border-width: 44px 34px;
  border-image-slice: 27% 28% fill;
}

.theme-indigo .letter-frame {
  border-width: 78px 30px 34px;
  border-image-slice: 43% 9% 11% fill;
}

/* The accent (Sarbloh) art is an arch design whose ornate corner shoulders
   sit further inward than the other two borders' — 14%/28px was slicing
   the corner box too small, so most of the shoulder's floral/vine detail
   fell into the horizontally-*stretched* top-middle strip instead of the
   fixed corner tile, visibly warping into disconnected "floating flower"
   smears on any shabad taller than a couple of lines. Widening the
   left/right slice (and border width to match) moves the whole shoulder
   into the unstretched corner tile. Verified with a local border-image
   render at several content heights before and after. */
.theme-accent .letter-frame {
  border-width: 70px 45px 32px;
  border-image-slice: 39% 40% 11% fill;
}

.letter-inner {
  background: rgba(255, 253, 246, 0.97);
  border-radius: var(--radius-md);
  padding: 28px clamp(16px, 4vw, 36px) 34px;
  box-shadow: 0 18px 44px var(--shadow);
  width: 100%;
  text-align: center;
}

.citation {
  font-family: var(--font-gurmukhi);
  font-weight: 600;
  font-size: 15px;
  color: var(--accent-strong);
  margin: 0 0 20px;
  line-height: 1.5;
}

.citation-en {
  font-family: var(--font-ui);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.verse-block {
  text-align: center;
}

.verse-block .verse {
  font-family: var(--font-gurmukhi);
  /* 600 rather than the font's default 400: at reading size, Gurmukhi's
     subjoined-consonant marks (rakar/vakar/haha, e.g. ਬ੍ਰਹਮ vs ਬਰਹਮ) are a
     small hooked stroke that all but disappears at regular weight, making
     conjunct and non-conjunct spellings look identical at a glance. */
  font-weight: 600;
  font-size: clamp(19px, 3.4vw, 24px);
  line-height: 1.85;
  color: var(--ink);
  margin: 0 0 18px;
}

.verse-block .verse.larivaar {
  /* Larivaar joins every word into one continuous run with no spaces,
     matching how gurbani is printed "in a row" — the reading aid is the
     rhythm of matras, not word boundaries. */
  word-spacing: -0.24em;
}

.verse-block .translation {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(15px, 2.6vw, 17px);
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0 0 26px;
}

.verse-block .translation-alt {
  font-family: var(--font-gurmukhi);
  font-style: normal;
  font-weight: 500;
  font-size: clamp(14px, 2.3vw, 16px);
  line-height: 1.7;
  color: var(--ink-soft);
  margin: -18px 0 26px;
}

.controls {
  width: 100%;
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.btn {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 44px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #fffaf0;
  box-shadow: 0 8px 20px var(--shadow);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(248, 245, 236, 0.3);
  color: var(--on-blue);
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--basanti-soft);
}

.btn-toggle {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(248, 245, 236, 0.3);
  color: var(--on-blue-soft);
}

.btn-toggle.active {
  background: var(--basanti);
  border-color: var(--basanti);
  color: #2a1d00;
}

.status {
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--on-blue-soft);
  min-height: 16px;
  margin: 0;
  text-align: center;
}

/* ---- Translation / display settings panel ---- */
.settings-panel {
  width: 100%;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  text-align: left;
}

.settings-panel summary {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--on-blue);
  cursor: pointer;
  list-style: none;
}

.settings-panel summary::-webkit-details-marker { display: none; }

.settings-group {
  margin-top: 14px;
}

.settings-group h3 {
  font-family: var(--font-ui);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--on-blue-faint);
  margin: 0 0 8px;
}

.settings-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-chip {
  font-family: var(--font-ui);
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: var(--on-blue-soft);
  cursor: pointer;
}

.settings-chip.active {
  background: var(--basanti);
  border-color: var(--basanti);
  color: #2a1d00;
  font-weight: 600;
}

.site-footer {
  margin-top: 46px;
  text-align: center;
  font-family: var(--font-gurmukhi);
  color: var(--on-blue-soft);
  font-size: 14px;
}

.footnote {
  font-family: var(--font-ui);
  font-size: 11px;
  margin-top: 8px;
}

.footnote a {
  color: var(--basanti-soft);
}

.sources-page,
.faq-page,
.landing-page {
  text-align: left;
  font-family: var(--font-serif);
  color: var(--on-blue-soft);
  /* These pages have no hero carousel bleeding under the status bar, so
     they need their own top safe-area allowance. */
  padding-top: max(32px, calc(env(safe-area-inset-top) + 12px));
}

.sources-page h1,
.faq-page h1,
.landing-page h1 {
  font-family: var(--font-gurmukhi);
  color: var(--on-blue);
}

.sources-page h2 {
  color: var(--on-blue);
}

.sources-page section {
  margin-bottom: 22px;
}

.sources-page a,
.faq-page a,
.landing-page a {
  color: var(--basanti-soft);
}

.faq-page {
  max-width: 640px;
}

.faq-page h1 {
  text-align: center;
  margin-top: 0;
}

.faq-hero {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin-bottom: 22px;
  box-shadow: 0 12px 30px var(--shadow);
}

.faq-page details {
  border-bottom: 1px solid rgba(248, 245, 236, 0.16);
  padding: 16px 2px;
}

.faq-page summary {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--on-blue);
}

.faq-page summary::-webkit-details-marker {
  display: none;
}

.faq-page summary::after {
  content: "+";
  font-size: 20px;
  color: var(--basanti);
  margin-left: 12px;
  transition: transform 0.2s ease;
}

.faq-page details[open] summary::after {
  transform: rotate(45deg);
}

.faq-body {
  margin-top: 12px;
  color: var(--on-blue-soft);
  font-size: 16px;
  line-height: 1.6;
}

.faq-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: rgba(248, 245, 236, 0.14);
  padding: 1px 6px;
  border-radius: 6px;
}

.faq-body ul,
.faq-body ol {
  padding-left: 22px;
}

.faq-body li {
  margin-bottom: 8px;
}

.resource-desc {
  display: block;
  font-size: 13.5px;
  color: var(--on-blue-faint);
  margin-top: 2px;
}

/* ---- "All three side by side" layout on hukam.dosanjhlabs.com ---- */
.triptych {
  display: flex;
  gap: 14px;
  width: 100%;
  align-items: flex-start;
}

.triptych .letter-frame-col {
  display: flex;
  flex-direction: column;
}

/* Column width is set per-instance via the --col-width custom property
   (inline on the element) rather than a literal inline flex value, so the
   mobile stacking rule below — a plain stylesheet rule — can still win at
   narrow widths. A custom property's cascade doesn't have the "inline
   always wins" problem a literal inline style value would. */
.triptych .letter-frame-col { flex: 0 1 var(--col-width, 33%); }

.triptych .col-label {
  font-family: var(--font-ui);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--on-blue-faint);
  text-align: center;
  margin: 0 0 8px;
}

.triptych .letter-inner {
  padding: 18px 12px 22px;
  max-height: 70vh;
  overflow-y: auto;
}

.triptych .verse-block .verse { font-size: clamp(14px, 1.6vw, 17px); line-height: 1.7; }
.triptych .verse-block .translation { font-size: clamp(11px, 1.2vw, 13px); }
.triptych .citation { font-size: 12px; margin-bottom: 12px; }

@media (max-width: 760px) {
  .triptych {
    flex-direction: column;
  }
  .triptych .letter-frame-col[data-source="dasam"],
  .triptych .letter-frame-col[data-source="aad"],
  .triptych .letter-frame-col[data-source="sarbloh"] {
    flex: 1 1 auto;
    width: 100%;
  }
  .triptych .letter-inner {
    max-height: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}

@media (max-width: 420px) {
  .theme-gold .letter-frame { border-width: 32px 22px; }
  .theme-indigo .letter-frame { border-width: 56px 20px 24px; }
  .theme-accent .letter-frame { border-width: 50px 32px 22px; }
  .letter-inner { padding: 22px 14px 28px; }
}
