/* Swara Shastra Prasannam — module styles (scoped under .swara-app) */

.swara-app {
  /* Same 16px → 18.4px scale as clamp(1em, .95em + .35vw, 1.15em), written in px because
     the site's Bootstrap sets html { font-size: 10px }, which would shrink every rem. */
  --font-size-base: clamp(16px, 15.2px + 0.35vw, 18.4px);
  --line-height-base: 1.65;
  --font-body: "Noto Sans Tamil", "Latha", "Tamil Sangam MN", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Noto Serif Tamil", "Noto Serif", Georgia, serif;

  --c-ink: #2a1a10;
  --c-ink-soft: #5b4636;
  --c-paper: #fbf5ea;
  --c-card: #fffdf8;
  --c-line: #e6d6bd;
  --c-kumkum: #9c1c1c;
  --c-kumkum-deep: #6e1010;
  --c-brass: #b8862b;
  --c-brass-light: #f3d991;
  --c-turmeric: #e6a817;
  --c-good: #2f6b3a;
  --c-warn: #a5650a;
  --c-bad: #9c1c1c;
  --c-void: #4a4f7a;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(60 30 10 / .06), 0 8px 24px rgb(60 30 10 / .08);
  --focus: 0 0 0 3px rgb(230 168 23 / .55);

  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--c-ink);
  /* Sits flush inside the template's white .ho-content-box (no extra panel). */
  background: transparent;
  padding: 0;
  container-type: inline-size;
}

.swara-app *, .swara-app *::before, .swara-app *::after { box-sizing: border-box; }
.swara-app :focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

/* ---------- Header strip ---------- */
.sw-hero {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1em;
  padding-bottom: 1em; margin-bottom: 1.25em; border-bottom: 2px solid var(--c-line);
}
.sw-hero h1 {
  font-family: var(--font-display); font-size: clamp(1.6em, 1.2em + 1.6vw, 2.4em);
  line-height: 1.25; margin: 0; color: var(--c-kumkum-deep);
}
.sw-hero p { margin: .25em 0 0; color: var(--c-ink-soft); max-width: 60ch; }

.sw-lang {
  display: inline-flex; border: 2px solid var(--c-kumkum); border-radius: 999px; overflow: hidden;
  font-weight: 700; flex-shrink: 0;
}
.sw-lang button {
  font: inherit; border: 0; background: transparent; color: var(--c-kumkum); padding: .45em 1.1em; cursor: pointer;
  min-height: 44px;
}
.sw-lang button[aria-pressed="true"] { background: var(--c-kumkum); color: #fff; }

/* ---------- Layout ---------- */
.sw-workspace {
  display: grid; gap: 1.5em;
  grid-template-columns: minmax(0, 1fr);
}
/* Two columns only when the content box itself is wide enough (the site's main column is ~2/3 of 1200px). */
@container (min-width: 980px) {
  .sw-workspace { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; }
  .sw-results { position: sticky; top: 1em; }
}

.sw-card {
  background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: clamp(1em, 2vw, 1.5em);
}

/* ---------- Ritual stages ---------- */
.sw-stages { display: grid; gap: 1.25em; perspective: 1200px; }
.sw-stage {
  position: relative;
  transition: transform .5s cubic-bezier(.2,.7,.2,1), box-shadow .5s, border-color .5s;
  border-left: 5px solid var(--c-line);
}
.sw-stage.is-active { border-left-color: var(--c-turmeric); transform: translateZ(14px) rotateY(-1.2deg); box-shadow: 0 12px 32px rgb(120 60 10 / .14); }
.sw-stage.is-done { border-left-color: var(--c-good); }
.sw-stage > h2 {
  font-family: var(--font-display); font-size: 1.2em; margin: 0 0 .9em; color: var(--c-kumkum-deep);
  display: flex; align-items: center; gap: .6em;
}
.sw-stage > h2 .sw-step-dot {
  display: inline-grid; place-items: center; width: 2em; height: 2em; border-radius: 50%;
  background: var(--c-brass-light); color: var(--c-kumkum-deep); font-size: .9em; flex-shrink: 0;
}
.sw-stage.is-done > h2 .sw-step-dot { background: var(--c-good); color: #fff; }

.sw-grid-2 { display: grid; gap: .9em 1em; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14em), 1fr)); }
.sw-field { display: flex; flex-direction: column; gap: .3em; position: relative; }
.sw-field label, .sw-legend { font-weight: 700; color: var(--c-ink); }
.sw-field input, .sw-field select {
  font: inherit; color: inherit; background: #fff; border: 2px solid var(--c-line); border-radius: 10px;
  padding: .6em .75em; min-height: 48px; width: 100%;
}
.sw-field input:focus, .sw-field select:focus { border-color: var(--c-turmeric); outline: none; box-shadow: var(--focus); }
.sw-hint { font-size: .88em; color: var(--c-ink-soft); }
.sw-hint.is-ok { color: var(--c-good); font-weight: 700; }
.sw-hint.is-err { color: var(--c-bad); font-weight: 700; }
.sw-field-error input, .sw-field-error select { border-color: var(--c-bad); }

/* city autocomplete */
.sw-ac-list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin: .2em 0 0; padding: .25em 0; list-style: none;
  background: #fff; border: 2px solid var(--c-turmeric); border-radius: 10px; box-shadow: var(--shadow);
  max-height: 16em; overflow-y: auto;
}
.sw-ac-list[hidden] { display: none; }
.sw-ac-list li { padding: .55em .8em; cursor: pointer; }
.sw-ac-list li[aria-selected="true"], .sw-ac-list li:hover { background: var(--c-brass-light); }
.sw-ac-list li small { color: var(--c-ink-soft); display: block; }

/* invocation & stillness */
.sw-invocation {
  margin-top: 1em; padding: 1em; border-radius: 12px; text-align: center;
  background: radial-gradient(circle at 50% 0, #fff3d1, #fbe7c0 70%); border: 1px dashed var(--c-brass);
}
.sw-invocation .sw-om { font-family: var(--font-display); font-size: 1.6em; color: var(--c-kumkum-deep); display: block; }
.sw-breath-orb {
  width: 4.5em; height: 4.5em; margin: .75em auto; border-radius: 50%;
  background: radial-gradient(circle, #ffe7a3, #e6a817 70%); opacity: .55; transform: scale(.7);
  transition: transform 4s ease-in-out, opacity 4s ease-in-out;
}
.sw-breath-orb.is-in { transform: scale(1.15); opacity: .95; }

/* buttons */
.sw-btn {
  font: inherit; font-weight: 700; cursor: pointer; border-radius: 999px; min-height: 48px; padding: .6em 1.4em;
  border: 2px solid var(--c-kumkum); background: #fff; color: var(--c-kumkum);
  transition: transform .15s, background .2s, color .2s;
}
.sw-btn:hover { background: #fff1ec; }
.sw-btn:active { filter: brightness(.95); }
.sw-btn-primary {
  background: linear-gradient(180deg, var(--c-kumkum), var(--c-kumkum-deep)); color: #fff; border-color: var(--c-kumkum-deep);
  font-size: 1.1em; width: 100%; padding: .9em 1.4em; box-shadow: 0 6px 18px rgb(110 16 16 / .3);
}
.sw-btn-primary:hover { background: linear-gradient(180deg, #b02424, var(--c-kumkum)); }
.sw-btn-ghost { border-color: var(--c-line); color: var(--c-ink-soft); padding: .4em .9em; min-height: 40px; }

/* ---------- Lamp ---------- */
.sw-lamp-wrap { display: grid; gap: 1em; grid-template-columns: minmax(0, 1fr); align-items: center; }
@media (min-width: 640px) { .sw-lamp-wrap { grid-template-columns: 220px minmax(0, 1fr); } }
.sw-lamp-stage {
  perspective: 800px; display: grid; place-items: center; padding: .5em; border-radius: 12px;
  background: radial-gradient(circle at 50% 35%, #3a1d10, #1a0c06 75%);
}
.kuthuvilakku { width: 100%; max-width: 200px; height: auto; transform: rotateY(0deg); transition: transform 1.2s ease; overflow: visible; }
.kuthuvilakku .kv-glow, .kuthuvilakku .kv-flame { pointer-events: none; }
.kuthuvilakku .kv-glow { opacity: 0; transition: opacity 1.5s ease; }
.kuthuvilakku .kv-flame { opacity: 0; transform-box: fill-box; transform-origin: 50% 100%; transition: opacity .6s ease; }
.kuthuvilakku .kv-wick { cursor: pointer; }
.kuthuvilakku .kv-wick.is-target { fill: #ffe08a; }
.is-lit .kuthuvilakku { transform: rotateY(8deg) translateZ(10px); }
.is-lit .kuthuvilakku .kv-glow { opacity: 1; animation: sw-glow 3.2s ease-in-out infinite; }
.kuthuvilakku .kv-flame.is-on { opacity: 1; animation: sw-flicker 1.4s ease-in-out infinite alternate; }
.kuthuvilakku .kv-flame.is-on:nth-of-type(2) { animation-duration: 1.1s; }
.kuthuvilakku .kv-flame.is-on:nth-of-type(3) { animation-duration: 1.7s; }
.kuthuvilakku .kv-flame.is-on:nth-of-type(4) { animation-duration: 1.25s; }
@keyframes sw-flicker {
  0% { transform: scale(1, 1) skewX(0); }
  30% { transform: scale(.94, 1.06) skewX(2deg); }
  60% { transform: scale(1.04, .96) skewX(-2deg); }
  100% { transform: scale(.98, 1.08) skewX(1deg); }
}
@keyframes sw-glow { 0%, 100% { opacity: .85; } 50% { opacity: 1; } }

.sw-flame-token {
  display: inline-grid; place-items: center; width: 3em; height: 3em; border-radius: 50%; cursor: grab;
  background: radial-gradient(circle at 50% 70%, #fff6c4, #ffb02e 55%, #e2501b); box-shadow: 0 0 18px #ffb02e;
  touch-action: none; user-select: none; font-size: 1.3em;
}
.sw-flame-token.is-dragging { cursor: grabbing; position: fixed; z-index: 1000; pointer-events: none; }
.sw-lamp-status { font-weight: 700; }
.sw-lamp-status.is-lit { color: var(--c-good); }
.sw-lamp-actions { display: flex; flex-wrap: wrap; gap: .75em; align-items: center; }

/* ---------- Breath / nostril cards ---------- */
.sw-face { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 1em; align-items: center; margin-bottom: 1em; }
.sw-face svg { width: 120px; height: auto; }
@media (max-width: 480px) { .sw-face { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

.sw-radio-cards { display: grid; gap: .75em; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11em), 1fr)); border: 0; padding: 0; margin: 0 0 1em; }
.sw-radio-card { position: relative; }
.sw-radio-card input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.sw-radio-card .sw-rc-body {
  display: flex; flex-direction: column; align-items: center; gap: .35em; text-align: center; height: 100%;
  border: 2px solid var(--c-line); border-radius: 12px; padding: .9em .6em; background: #fff;
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.sw-radio-card .sw-rc-body svg { width: 56px; height: 40px; }
.sw-radio-card .sw-rc-title { font-weight: 700; }
.sw-radio-card .sw-rc-sub { font-size: .85em; color: var(--c-ink-soft); }
.sw-radio-card input:checked + .sw-rc-body { border-color: var(--c-kumkum); box-shadow: 0 0 0 3px rgb(156 28 28 / .15); transform: translateY(-2px); }
.sw-radio-card input:focus-visible + .sw-rc-body { box-shadow: var(--focus); }

/* ---------- Compass ---------- */
.sw-compass-wrap { display: grid; gap: 1em; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 640px) { .sw-compass-wrap { grid-template-columns: 240px minmax(0, 1fr); } }
.sw-compass { width: 100%; max-width: 240px; height: auto; margin-inline: auto; display: block; perspective: 600px; }
.sw-compass .sw-dir { cursor: pointer; }
.sw-compass .sw-dir circle { fill: #fff; stroke: var(--c-brass); stroke-width: 2; transition: fill .2s; }
.sw-compass .sw-dir text { font: 700 13px var(--font-body); fill: var(--c-ink); pointer-events: none; }
.sw-compass .sw-dir:hover circle, .sw-compass .sw-dir:focus circle { fill: var(--c-brass-light); }
.sw-compass .sw-dir.is-selected circle { fill: var(--c-kumkum); stroke: var(--c-kumkum-deep); }
.sw-compass .sw-dir.is-selected text { fill: #fff; }
.sw-compass .sw-needle { transition: transform .8s cubic-bezier(.3,1.4,.4,1); transform-origin: 120px 120px; }
.sw-compass .sw-dir:focus { outline: none; }
.sw-compass .sw-dir:focus-visible circle { stroke: var(--c-turmeric); stroke-width: 4; }
.sw-dir-label { font-weight: 700; color: var(--c-kumkum-deep); }

.sw-side-options { display: grid; gap: .6em; border: 0; padding: 0; margin: 0; }
.sw-side-options label {
  display: flex; gap: .6em; align-items: center; border: 2px solid var(--c-line); border-radius: 10px; padding: .6em .8em;
  cursor: pointer; background: #fff; min-height: 48px;
}
.sw-side-options input { width: 1.2em; height: 1.2em; accent-color: var(--c-kumkum); }
.sw-side-options label:has(input:checked) { border-color: var(--c-kumkum); background: #fff6f3; }

/* ---------- Errors ---------- */
.sw-errors { border-left: 5px solid var(--c-bad); background: #fff1ef; padding: .9em 1em; border-radius: 10px; margin-bottom: 1em; }
.sw-errors h2 { margin: 0 0 .4em; font-size: 1.05em; color: var(--c-bad); }
.sw-errors ul { margin: 0; padding-left: 1.2em; }

/* ---------- Reference box ---------- */
#user-input-reference-box { border: 2px solid var(--c-ink); background: #fff; }
#user-input-reference-box h2 { margin: 0 0 .75em; font-family: var(--font-display); font-size: 1.15em; }
.sw-ref-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12em), 1fr)); gap: .5em; margin: 0; }
.sw-ref-grid > div { background: var(--c-paper); border-radius: 8px; padding: .5em .7em; }
.sw-ref-grid dt { font-size: .82em; color: var(--c-ink-soft); font-weight: 700; }
.sw-ref-grid dd { margin: 0; font-weight: 700; color: #000; word-break: break-word; }

/* ---------- Report ---------- */
#prasannam-report { margin-top: 1.25em; }
#prasannam-report h2 { font-family: var(--font-display); margin: 0 0 1em; color: var(--c-kumkum-deep); font-size: 1.25em; }
#prasannam-report h3 { font-size: 1.05em; margin: 1.25em 0 .5em; color: var(--c-kumkum-deep); }
.sw-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5em), 1fr)); gap: .5em; }
.sw-strip > div { border: 1px solid var(--c-line); border-radius: 10px; padding: .55em .7em; background: #fffaf0; }
.sw-strip .k { display: block; font-size: .8em; color: var(--c-ink-soft); font-weight: 700; }
.sw-strip .v { display: block; font-weight: 700; }
.sw-source { font-size: .82em; color: var(--c-ink-soft); margin-top: .5em; }

.sw-badge { display: inline-block; padding: .15em .65em; border-radius: 999px; font-weight: 700; font-size: .92em; }
.sw-badge.aligned { background: #e4f2e6; color: var(--c-good); }
.sw-badge.reversed { background: #fde8e6; color: var(--c-bad); }
.sw-badge.transitional { background: #e8e9f5; color: var(--c-void); }

.sw-meter { display: flex; width: 100%; height: 2.6em; border-radius: 10px; overflow: hidden; border: 2px solid var(--c-ink); position: relative; }
.sw-meter .seg { display: grid; place-items: center; font-size: .78em; font-weight: 700; color: #1d140c; position: relative; opacity: .45; transition: opacity .3s; }
.sw-meter .seg.is-active { opacity: 1; box-shadow: inset 0 0 0 3px #000; }
.sw-meter .seg[data-t="akasha"], .sw-meter .seg[data-t="vayu"], .sw-meter .seg[data-t="tejas"] { color: #fff; }
.sw-meter .marker { position: absolute; top: -6px; bottom: -6px; width: 3px; background: #000; border-radius: 2px; }
.sw-meter-legend { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5em; margin-top: .5em; font-weight: 700; }
.sw-countdown { font-variant-numeric: tabular-nums; color: var(--c-kumkum-deep); }

.sw-verdict { border-radius: 12px; padding: 1em 1.1em; margin-top: .5em; color: #fff; }
.sw-verdict.excellent { background: linear-gradient(135deg, #2f6b3a, #3f8a4c); }
.sw-verdict.favorable { background: linear-gradient(135deg, #4d7a2a, #6c9a35); }
.sw-verdict.mixed { background: linear-gradient(135deg, #a5650a, #c98516); }
.sw-verdict.unfavorable { background: linear-gradient(135deg, #7d1515, #a52020); }
.sw-verdict.void { background: linear-gradient(135deg, #3c4070, #5a5f8f); }
.sw-verdict strong { font-size: 1.25em; display: block; font-family: var(--font-display); }
.sw-verdict p { margin: .35em 0 0; }
.sw-reading p { margin: .3em 0; }
.sw-remedies { margin: 0; padding-left: 1.2em; }
.sw-remedies li { margin-bottom: .4em; }
.sw-note { font-size: .9em; color: var(--c-ink-soft); border-top: 1px dashed var(--c-line); margin-top: 1em; padding-top: .6em; }

.sw-placeholder { text-align: center; color: var(--c-ink-soft); padding: 2em 1em; }
.sw-placeholder svg { width: 72px; opacity: .6; }

/* ---------- Info box ---------- */
#swara-info-box { margin-top: 2em; }
#swara-info-box h2 { font-family: var(--font-display); color: var(--c-kumkum-deep); margin: 0 0 .75em; font-size: 1.25em; }
#swara-info-box h3 { color: var(--c-kumkum-deep); font-size: 1.05em; margin: 1em 0 .5em; }
.sw-why { display: grid; gap: .6em; padding: 0; list-style: none; margin: 0 0 1.5em; }
.sw-why li { padding: .7em .9em .7em 2.4em; background: #fffaf0; border-radius: 10px; position: relative; border: 1px solid var(--c-line); }
.sw-why li::before { content: "✦"; position: absolute; left: .9em; color: var(--c-brass); }
.sw-table-wrap { overflow-x: auto; }
.sw-table { width: 100%; border-collapse: collapse; min-width: 32em; }
.sw-table th, .sw-table td { text-align: left; padding: .6em .7em; border-bottom: 1px solid var(--c-line); vertical-align: top; }
.sw-table th { background: var(--c-kumkum-deep); color: #fff; }
.sw-table tr:nth-child(even) td { background: #fffaf0; }
.sw-swatch { display: inline-block; width: .9em; height: .9em; border-radius: 50%; margin-right: .4em; vertical-align: middle; border: 1px solid #0003; }
.sw-accordion details { border: 1px solid var(--c-line); border-radius: 10px; margin-bottom: .5em; background: #fff; }
.sw-accordion summary { cursor: pointer; padding: .75em .9em; font-weight: 700; min-height: 48px; }
.sw-accordion details > div { padding: 0 .9em .9em; }
.sw-disclaimer { font-size: .88em; color: var(--c-ink-soft); margin-top: 1em; }

@media (prefers-reduced-motion: reduce) {
  .swara-app *, .swara-app *::before, .swara-app *::after { animation: none !important; transition: none !important; }
}

/* ---------- Harmonise with the site's Bootstrap 3 ---------- */
.swara-app legend { width: auto; border: 0; font-size: inherit; margin: 0 0 .4em; padding: 0; color: inherit; }
.swara-app h1, .swara-app h2, .swara-app h3 { line-height: 1.3; }
.swara-app label { margin-bottom: 0; }
.swara-app input[type="radio"] { margin: 0; }
.swara-app p { margin: 0 0 .6em; }
.swara-app #search-data { margin-bottom: .3em; display: block; min-height: 48px; font-size: 1em; }
.swara-app #search-result-container { border: 1px solid #BDC7D8; border-radius: 8px; max-height: 18em; overflow-y: auto; background: #fff; margin-bottom: .4em; }
.swara-app .search-result { cursor: pointer; }
.swara-app .search-result:hover { background: var(--c-brass-light); }
