/* Put Drishti — a lamp-lit world, with four color themes to pick from. */

:root, :root[data-app-theme="gold"] {
  --night:      #0E1330;
  --night-2:    #161D45;
  --night-3:    #1D2757;
  --nazar:      #2B5CE6;
  --sky:        #9DBBFF;
  --haldi:      #F2B23E;
  --mirchi:     #E23D2E;
  --ivory:      #FAF3E3;
  --ivory-dim:  #BDBBD0;
  --ring:       rgba(157, 187, 255, 0.16);
  --title-top:  #FCE3A0;
  --title-bot:  #C4831E;
}

:root[data-app-theme="rose"] {
  --night:      #200E17;
  --night-2:    #35182A;
  --night-3:    #452136;
  --nazar:      #E0855C;
  --sky:        #F0B39B;
  --haldi:      #F0637D;
  --mirchi:     #C9375B;
  --ivory:      #FCEEE7;
  --ivory-dim:  #D9BFC4;
  --ring:       rgba(224, 133, 92, 0.2);
  --title-top:  #FBB3C6;
  --title-bot:  #B23155;
}

:root[data-app-theme="teal"] {
  --night:      #0A2224;
  --night-2:    #103436;
  --night-3:    #17454A;
  --nazar:      #2FA89A;
  --sky:        #8FD4CB;
  --haldi:      #33D9BE;
  --mirchi:     #E0662E;
  --ivory:      #EFF9F6;
  --ivory-dim:  #B7D6D0;
  --ring:       rgba(47, 168, 154, 0.2);
  --title-top:  #A6F2E0;
  --title-bot:  #12897A;
}

:root[data-app-theme="jasmine"] {
  --night:      #14120C;
  --night-2:    #211C10;
  --night-3:    #2C2515;
  --nazar:      #C9A227;
  --sky:        #E6D28F;
  --haldi:      #F5EFD6;
  --mirchi:     #B8501E;
  --ivory:      #FAF6E8;
  --ivory-dim:  #C9C0A4;
  --ring:       rgba(201, 162, 39, 0.2);
  --title-top:  #FFFCF0;
  --title-bot:  #C9A227;
}

:root {
  --display: 'Baloo Thambi 2', 'Mukta', system-ui, sans-serif;
  --body:    'Mukta', 'Segoe UI', system-ui, sans-serif;
  --serif:   'Cormorant Garamond', Georgia, serif;

  --ritual-ms: 7500ms;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  position: relative;
  min-height: 100svh;
  background: var(--night);
  background-image:
    radial-gradient(circle at 50% -8%, color-mix(in srgb, var(--nazar) 34%, transparent), transparent 55%),
    radial-gradient(circle at 88% 92%, color-mix(in srgb, var(--mirchi) 12%, transparent), transparent 42%);
  background-attachment: fixed;
  color: var(--ivory);
  font-family: var(--body);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(22px, env(safe-area-inset-top)) 16px
           calc(34px + env(safe-area-inset-bottom));
  /* the app is a toy you tap, not a document you select */
  -webkit-tap-highlight-color: transparent;
}

/* ---------------- masthead ---------------- */

.masthead {
  text-align: center;
  /* clears the corner controls (theme picker, language toggle), which are
     position:absolute and would otherwise sit on top of this text */
  margin-top: 40px;
}

@media (min-width: 560px) {
  .masthead { margin-top: 0; }
}

.ta {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.1rem, 4.4vw, 1.4rem);
  letter-spacing: 0.05em;
  color: var(--haldi);
}

h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.2rem, 8vw, 3.2rem);
  margin: 0;
  line-height: 1.05;
  text-wrap: balance;
  background: linear-gradient(180deg, var(--title-top) 0%, var(--haldi) 55%, var(--title-bot) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 10px color-mix(in srgb, var(--haldi) 25%, transparent));
}

.tagline {
  margin: 8px 0 0;
  color: var(--ivory-dim);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.05rem, 3.6vw, 1.22rem);
  text-wrap: balance;
}

/* ---------------- stage ---------------- */

main {
  width: min(100%, 460px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stage {
  position: relative;
  width: min(78vw, 360px);
  height: min(78vw, 360px);
  margin: 22px 0 6px;
  flex-shrink: 0;
  /* no clipping here — the hand's orbit needs to extend past the ring
     freely; the vignette itself is shaped to never reach this box's edge */
  cursor: pointer;
  transition: transform 200ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.stage:hover { transform: scale(1.015); }
.stage:active { transform: scale(0.99); }

.kolam {
  position: absolute;
  inset: 2%;
  border-radius: 50%;
  border: 2px dotted color-mix(in srgb, var(--haldi) 42%, transparent);
  pointer-events: none;
  z-index: 1;
  animation: kolam-spin 90s linear infinite;
}

@keyframes kolam-spin {
  to { transform: rotate(360deg); }
}

.subject {
  position: absolute;
  inset: 13%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, var(--night-2) 0%, var(--night) 100%);
  border: 1px solid var(--ring);
  box-shadow:
    0 0 0 10px color-mix(in srgb, var(--nazar) 8%, transparent),
    0 0 60px color-mix(in srgb, var(--nazar) 18%, transparent) inset;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: ring-breathe 5s ease-in-out infinite;
}

@keyframes ring-breathe {
  0%, 100% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--nazar) 8%, transparent), 0 0 60px color-mix(in srgb, var(--nazar) 18%, transparent) inset; }
  50%      { box-shadow: 0 0 0 13px color-mix(in srgb, var(--nazar) 13%, transparent), 0 0 70px color-mix(in srgb, var(--nazar) 24%, transparent) inset; }
}

.subject .portrait {
  width: 62%;
  height: 62%;
  user-select: none;
}

.subject img,
.subject video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.live-camera {
  /* mirrored, like a phone's selfie camera */
  transform: scaleX(-1);
}

/* ---------------- the ritual canvas ---------------- */

.fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.stamp { z-index: 3; }

.stamp {
  position: absolute;
  right: 4%;
  bottom: 4%;
  width: clamp(44px, 15vw, 60px);
  transform: scale(0);
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--nazar) 90%, transparent));
}

.stamp svg,
.stamp img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}

.stamp.show {
  animation: stamp-in 520ms cubic-bezier(0.2, 1.6, 0.4, 1) forwards;
}

@keyframes stamp-in {
  from { transform: scale(0) rotate(-40deg); }
  to   { transform: scale(1) rotate(0deg); }
}

/* ---------------- status ---------------- */

.status {
  min-height: 2.9em;
  text-align: center;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.15rem, 4.6vw, 1.45rem);
  color: var(--haldi);
  margin: 2px 0 18px;
  max-width: 24ch;
  text-wrap: balance;
}

.status.calm {
  color: var(--ivory-dim);
  font-family: var(--body);
  font-size: 1rem;
}

.story {
  text-align: center;
  font-family: var(--display);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(0.95rem, 3.6vw, 1.12rem);
  color: var(--haldi);
  opacity: 0;
  max-width: 28ch;
  margin: -10px 0 18px;
  min-height: 1.3em;
  text-wrap: balance;
  transform: translateY(-4px);
  transition: opacity 420ms ease, transform 420ms ease;
}

.story.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---------------- controls ---------------- */

.panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.panel.card {
  background: color-mix(in srgb, var(--night-2) 55%, transparent);
  border: 1px solid var(--ring);
  border-radius: 22px;
  padding: 18px 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.field + .field {
  padding-top: 15px;
  border-top: 1px solid var(--ring);
}

.label {
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sky);
  text-align: center;
}

.row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
}

.row.after {
  margin-top: 2px;
  gap: 8px;
}

.privacy-note {
  margin: -2px 0 0;
  text-align: center;
  font-size: 0.74rem;
  color: var(--ivory-dim);
  opacity: 0.75;
}

.install-hint {
  margin: 2px auto 0;
  max-width: 30ch;
  text-align: center;
  font-size: 0.82rem;
  color: var(--sky);
  background: color-mix(in srgb, var(--night-2) 70%, transparent);
  border: 1px solid var(--ring);
  border-radius: 12px;
  padding: 8px 12px;
}

.chip {
  font-family: var(--body);
  background:
    radial-gradient(circle at 50% 22%, color-mix(in srgb, var(--haldi) 10%, transparent), transparent 60%),
    var(--night-2);
  border: 1.5px solid transparent;
  border-radius: 999px;
  color: var(--ivory);
  cursor: pointer;
  padding: 9px 14px;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: transform 160ms cubic-bezier(0.2, 1.4, 0.4, 1), border-color 120ms ease, background 120ms ease, box-shadow 160ms ease;
}

.chip .ic {
  width: 26px;
  height: 26px;
  display: block;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.4));
  transition: transform 160ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.chip .ic.line { color: var(--sky); }

.chip:hover { transform: translateY(-2px); background: var(--night-3); }
.chip:hover .ic { transform: rotate(-6deg) scale(1.06); }
.chip:focus-visible { outline: 2px solid var(--haldi); outline-offset: 3px; }

.chip[aria-pressed="true"] {
  border-color: var(--haldi);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--haldi) 25%, transparent), 0 0 18px color-mix(in srgb, var(--haldi) 35%, transparent);
}

.chip[aria-pressed="true"] .ic {
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.4)) drop-shadow(0 0 8px color-mix(in srgb, var(--haldi) 55%, transparent));
}

.chip[disabled] { opacity: 0.4; cursor: default; }
.chip[disabled]:hover { transform: none; background: var(--night-2); }

.chip.wide {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 11px 16px;
}

.chip .name { font-size: 0.9rem; font-weight: 500; }

.text-input {
  font-family: var(--body);
  font-size: 1rem;
  color: var(--ivory);
  background: var(--night-2);
  border: 1.5px solid rgba(157, 187, 255, 0.22);
  border-radius: 14px;
  padding: 12px 16px;
  width: 100%;
  text-align: center;
}

.text-input::placeholder { color: rgba(189, 187, 208, 0.55); }
.text-input:focus { outline: 2px solid var(--haldi); outline-offset: 2px; border-color: transparent; }
.text-input[disabled] { opacity: 0.45; }

.cta {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.2rem, 4.8vw, 1.55rem);
  color: var(--night);
  background: var(--haldi);
  border: none;
  border-radius: 999px;
  padding: 15px 40px;
  cursor: pointer;
  align-self: center;
  box-shadow: 0 8px 28px color-mix(in srgb, var(--haldi) 32%, transparent);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.cta:hover { transform: translateY(-2px); box-shadow: 0 12px 34px color-mix(in srgb, var(--haldi) 42%, transparent); }
.cta:active { transform: translateY(1px); }
.cta:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
.cta[disabled] { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }

.ghost {
  font-family: var(--body);
  font-size: 0.88rem;
  color: var(--sky);
  background: transparent;
  border: 1.5px solid rgba(157, 187, 255, 0.28);
  border-radius: 999px;
  padding: 9px 15px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.ghost:hover { background: var(--night-2); border-color: var(--sky); }
.ghost:focus-visible { outline: 2px solid var(--haldi); outline-offset: 2px; }

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1.5px solid color-mix(in srgb, var(--sky) 28%, transparent);
  border-radius: 50%;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.icon-btn img { width: 22px; height: 22px; display: block; }
.icon-btn:hover { background: var(--night-2); border-color: var(--sky); transform: scale(1.06); }
.icon-btn:focus-visible { outline: 2px solid var(--haldi); outline-offset: 2px; }

/* ---------------- language toggle ---------------- */

.lang-toggle {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  display: flex;
  border: 1.5px solid color-mix(in srgb, var(--sky) 28%, transparent);
  border-radius: 999px;
  overflow: hidden;
  background: var(--night-2);
}

/* ---------------- color theme toggle ---------------- */
/* one button: tap cycles Temple Gold -> Kumkum Rose -> Peacock Teal ->
   Midnight Jasmine -> back to Gold. No popover, no row of dots. */

.corner-controls {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
}

.theme-toggle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--sky) 28%, transparent);
  background: var(--night-2);
  padding: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 160ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.corner-controls .icon-btn { width: 34px; height: 34px; }
.corner-controls .icon-btn img { width: 20px; height: 20px; }

.theme-toggle:hover { transform: scale(1.1); }
.theme-toggle:focus-visible { outline: 2px solid var(--haldi); outline-offset: 2px; }

.theme-toggle-dot {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--haldi);
  display: block;
  transition: background 200ms ease;
}

.lang-toggle button {
  font-family: var(--body);
  font-size: clamp(0.68rem, 2.6vw, 0.8rem);
  font-weight: 500;
  color: var(--ivory-dim);
  background: transparent;
  border: none;
  padding: 7px 9px;
  white-space: nowrap;
  cursor: pointer;
}

.lang-toggle button[aria-pressed="true"] {
  background: var(--haldi);
  color: var(--night);
  font-weight: 700;
}

.lang-toggle button:focus-visible { outline: 2px solid var(--haldi); outline-offset: -2px; }

/* ---------------- about: what is drishti ---------------- */

.about {
  width: min(100%, 460px);
  margin-top: 30px;
  border-top: 1px solid rgba(157, 187, 255, 0.16);
  padding-top: 8px;
}

.about summary {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--sky);
  cursor: pointer;
  padding: 10px 4px;
  list-style-position: outside;
}

.about summary:focus-visible { outline: 2px solid var(--haldi); outline-offset: 2px; }

.about summary h2 {
  display: inline;
  margin: 0;
  font: inherit;
  color: inherit;
}

.about-body {
  color: var(--ivory-dim);
  font-size: 0.97rem;
  line-height: 1.65;
  padding: 2px 4px 8px;
  max-width: 62ch;
}

.about-body p { margin: 0 0 12px; }

.about-body strong { color: var(--ivory); font-weight: 700; }

.about-body .dt {
  color: var(--haldi);
  font-family: var(--display);
  font-weight: 500;
}

.about-body h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.02rem;
  color: var(--sky);
  margin: 20px 0 8px;
}

.about-body ul {
  margin: 0 0 12px;
  padding-left: 20px;
}

.about-body li { margin-bottom: 6px; }

.about-body a {
  color: var(--haldi);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------------- footer ---------------- */

footer {
  margin-top: 28px;
  text-align: center;
  color: var(--ivory-dim);
  font-size: 0.92rem;
}

footer p { margin: 0 0 6px; }

.tally {
  color: var(--sky);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fineprint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  opacity: 0.62;
}
.fineprint.offline { color: var(--sky); opacity: 0.8; }

.credit {
  margin-top: 10px;
  font-size: 0.72rem;
  opacity: 0.45;
}

.credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.credit a:hover,
.credit a:focus-visible { opacity: 1; color: var(--sky); }

/* ---------------- reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  .orbit.going,
  .orbit.going .hand,
  .stamp.show,
  .bit,
  .spark,
  .held.flame,
  .kolam,
  .subject {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
  .chip:hover, .cta:hover, .chip:hover .ic { transform: none; }
}
