@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --saffron: #e67127;
  --marigold: #ffcc66;
  --peacock: #0f4f59;
  --ink: #1b1f23;
  --cloud: #f5f0e8;
  --card: rgba(255, 248, 237, 0.92);
  --shadow: 0 16px 40px rgba(15, 79, 89, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  background: radial-gradient(circle at 10% 12%, #ffe8bc 0%, #f4c58f 34%, #efd5b3 62%, #f8ecdc 100%);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(120deg, rgba(13, 54, 61, 0.75), rgba(230, 113, 39, 0.45)),
    url("../images/bhadrachal_temple_background.avif") center / cover no-repeat;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.23;
  z-index: -1;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.top-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: rgba(255, 247, 232, 0.88);
  border: 1px solid rgba(15, 79, 89, 0.2);
  border-radius: 20px;
  padding: 14px 20px;
  box-shadow: var(--shadow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-strip img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 14px;
  background: #fff;
  padding: 4px;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(230, 113, 39, 0.3);
  background: linear-gradient(135deg, var(--saffron), #ec8c26);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 800;
  cursor: pointer;
  min-width: 98px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lang-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(230, 113, 39, 0.35);
  filter: brightness(1.06);
}

.lang-toggle .lang-text {
  font-size: 0.82rem;
  font-weight: 700;
}

.lang-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(15, 79, 89, 0.55);
  background:
    radial-gradient(circle at 50% 50%, transparent 5px, rgba(15, 79, 89, 0.2) 6px, transparent 7px),
    linear-gradient(90deg, transparent 7px, rgba(15, 79, 89, 0.4) 7px, rgba(15, 79, 89, 0.4) 8px, transparent 8px),
    linear-gradient(transparent 7px, rgba(15, 79, 89, 0.4) 7px, rgba(15, 79, 89, 0.4) 8px, transparent 8px);
  flex-shrink: 0;
}

.lang-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 3px 8px;
  min-width: 42px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(140deg, #115f68, #157f8a);
}

.lang-toggle.is-te .lang-chip {
  background: linear-gradient(140deg, #d35f1f, #ee8b2a);
}

.title-block {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.title-block h1 {
  margin: 0;
  color: #111111;
  font-family: "Cinzel", serif;
  font-size: clamp(1.4rem, 2.6vw, 2.3rem);
  letter-spacing: 0.03em;
  text-shadow: none;
}

.title-block p {
  margin: 8px 0 0;
  color: #222222;
  font-weight: 600;
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
}

.frost-card {
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.page-intro {
  margin-top: 18px;
  padding: 18px 20px;
}

.page-intro h2 {
  margin: 0;
  font-family: "Cinzel", serif;
  color: var(--peacock);
  font-size: clamp(1.25rem, 2.2vw, 2rem);
}

.page-intro p {
  margin: 10px 0 0;
  line-height: 1.65;
  font-size: 1rem;
}

.nav-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.nav-pills a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--saffron), #ec8c26);
  border: none;
  color: #fff;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-pills a:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(230, 113, 39, 0.3);
  filter: brightness(1.08);
}

.primary-btn {
  background: linear-gradient(130deg, var(--saffron), #ec8c26);
  border: none;
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.primary-btn:hover {
  filter: brightness(1.06);
}

.footer-note {
  margin-top: 22px;
  text-align: center;
  color: #fff9ec;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.powered-by {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.powered-by-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(15, 79, 89, 0.34);
  padding: 10px 14px;
  box-shadow: 0 12px 26px rgba(15, 79, 89, 0.26);
}

.powered-by-label {
  color: var(--peacock);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.powered-by-badge img {
  width: auto;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid rgba(15, 79, 89, 0.18);
  padding: 2px 4px;
}

@media (max-width: 640px) {
  .powered-by-badge {
    padding: 8px 12px;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }

  .powered-by-label {
    font-size: 0.82rem;
  }

  .powered-by-badge img {
    height: 28px;
  }
}

.page-transition-layer {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(140deg, rgba(230, 113, 39, 0.2), rgba(15, 79, 89, 0.65));
  transform: scaleX(0.96);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

body.page-ready .page-shell {
  animation: page-fade-in 0.34s ease;
}

body.page-leaving .page-transition-layer {
  opacity: 1;
  transform: scaleX(1);
}

@keyframes page-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
    animation: none;
  }

  body.page-ready .page-shell {
    animation: none;
  }

  .page-transition-layer {
    display: none;
  }
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  animation: reveal-up 0.7s ease forwards;
}

.reveal.delay-1 {
  animation-delay: 0.08s;
}

.reveal.delay-2 {
  animation-delay: 0.14s;
}

.reveal.delay-3 {
  animation-delay: 0.2s;
}

@keyframes reveal-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 840px) {
  .top-strip {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: space-between;
  }

  .top-strip img {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
  }

  .title-block {
    flex: 1;
    min-width: 0;
  }

  .title-block h1 {
    font-size: 1.35rem;
    margin: 0;
    line-height: 1.2;
  }

  .title-block p {
    font-size: 0.85rem;
    margin: 4px 0 0 0;
    line-height: 1.25;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }

  .header-actions > img {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
  }

  .lang-toggle {
    min-width: 0;
    padding: 6px 10px;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .page-intro {
    padding: 16px;
  }

  .nav-pills {
    gap: 8px;
  }

  .nav-pills a {
    padding: 9px 14px;
    font-size: 0.9rem;
  }

  .page-shell {
    padding: 16px 14px 30px;
  }
}

@media (max-width: 560px) {
  .top-strip {
    padding: 8px 10px;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .top-strip > img {
    width: 50px;
    height: 50px;
  }

  .title-block h1 {
    font-size: 1.2rem;
  }

  .title-block p {
    font-size: 0.8rem;
    margin: 2px 0 0 0;
  }

  .header-actions > img {
    width: 50px;
    height: 50px;
  }

  .lang-toggle {
    padding: 5px 8px;
    font-size: 0.75rem;
  }

  .lang-chip {
    font-size: 0.7rem;
    padding: 2px 6px;
  }

  .nav-pills a {
    flex: 1 1 calc(50% - 8px);
    min-height: 44px;
    font-size: 0.94rem;
  }

  .primary-btn {
    min-height: 44px;
    font-size: 0.92rem;
  }
}

@media (max-width: 430px) {
  .lang-toggle .lang-text {
    display: none;
  }
}

@media (max-width: 380px) {
  .page-shell {
    padding: 12px 10px 24px;
  }

  .top-strip {
    border-radius: 16px;
    padding: 10px;
  }

  .frost-card {
    border-radius: 16px;
  }

  .nav-pills a {
    flex-basis: 100%;
  }
}

/* Language Preference Modal */
.lang-preference-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.lang-preference-modal.hidden {
  display: none;
}

.lang-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 79, 89, 0.6);
  animation: fadeIn 0.3s ease-out;
}

.lang-modal-content {
  position: relative;
  max-width: 420px;
  width: 90%;
  padding: 40px;
  border-radius: 24px;
  background: var(--card);
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 20px 60px rgba(15, 79, 89, 0.3);
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

.lang-modal-content h2 {
  font-family: "Cinzel", serif;
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--ink);
}

.lang-modal-content p {
  font-size: 15px;
  color: #666;
  margin: 0 0 32px 0;
  line-height: 1.5;
}

.lang-modal-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.lang-modal-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 16px;
  border: 2px solid transparent;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lang-modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 79, 89, 0.2);
}

.lang-modal-btn.lang-en {
  color: var(--saffron);
  border-color: var(--saffron);
  background: rgba(230, 113, 39, 0.08);
}

.lang-modal-btn.lang-en:hover {
  background: rgba(230, 113, 39, 0.15);
  border-color: var(--saffron);
}

.lang-modal-btn.lang-te {
  color: var(--saffron);
  border-color: var(--saffron);
  background: rgba(230, 113, 39, 0.08);
}

.lang-modal-btn.lang-te:hover {
  background: rgba(230, 113, 39, 0.15);
  border-color: var(--saffron);
}

.lang-flag {
  font-size: 32px;
}

.lang-name {
  display: block;
  font-size: 13px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lang-modal-backdrop,
  .lang-modal-content {
    animation: none;
  }

  .lang-modal-btn {
    transition: none;
  }
}

@media (max-width: 560px) {
  .lang-modal-content {
    max-width: 100%;
    padding: 32px 24px;
  }

  .lang-modal-content h2 {
    font-size: 24px;
  }

  .lang-modal-buttons {
    grid-template-columns: 1fr;
  }
}

/* Page Spinner for Transitions */
.page-spinner {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 9999;
  transition: opacity 0.3s ease;
  opacity: 1;
}

.page-spinner.hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease 0.5s;
}

.spinner-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
}

.spinner-text {
  font-size: clamp(20px, 5vw, 32px);
  font-weight: 700;
  letter-spacing: 3px;
  color: #ffd700;
  text-transform: uppercase;
  animation: spinner-text-fade 2s ease-in-out infinite;
  text-shadow: 
    0 0 10px rgba(255, 215, 0, 0.8),
    0 0 20px rgba(255, 140, 0, 0.7),
    0 0 30px rgba(255, 69, 0, 0.6),
    2px 2px 4px rgba(0, 0, 0, 0.5);
  font-family: "Georgia", serif;
}

/* Police Badge Spinner */
.police-badge {
  position: relative;
  width: clamp(140px, 35vw, 260px);
  height: clamp(180px, 45vw, 336px);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 30px rgba(26, 84, 144, 0.8)) drop-shadow(0 0 60px rgba(212, 175, 55, 0.6));
}

.police-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: badge-pulse 2.5s ease-in-out infinite;
  filter: brightness(1);
}

@keyframes badge-pulse {
  0%, 100% {
    filter: brightness(1);
    transform: scale(1);
  }
  50% {
    filter: brightness(1.1);
    transform: scale(1.03);
  }
}

@keyframes spinner-text-fade {
  0%, 100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-spinner {
    transition: none;
  }

  .page-spinner.hidden {
    transition: none;
  }

  .spinner .outer-ring,
  .spinner .middle-ring,
  .spinner .mandala {
    animation: none;
  }
}
