/* SPDX-License-Identifier: Apache-2.0 */
:root {
  --bg: #ffffff;
  --fg: #1a1f2b;
  --muted: #5a6473;
  --line: #e3e7ee;
  --panel: #f7f9fc;
  --accent: #6366f1;
  --accent-2: #2dd4bf;
  --error: #c0392b;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --fg: #e6edf3;
    --muted: #9aa5b1;
    --line: #232b36;
    --panel: #141a22;
    --accent: #818cf8;
    --accent-2: #2dd4bf;
    --error: #ff7b72;
  }
}

/* Self-hosted, subsetted typefaces (no external CDN; nothing leaves the browser).
   Space Grotesk (OFL) for the wordmark and UI accents; Noto Sans Devanagari (OFL)
   for the क्षण mark. */
@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/SpaceGrotesk-subset.ttf") format("truetype");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Kshana Deva";
  src: url("assets/fonts/NotoSansDevanagari-subset.ttf") format("truetype");
  font-weight: 400 700;
  font-display: swap;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.55;
}
main {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

/* Precision-instrument hero: a deep, self-contained band (independent of the
   page light/dark theme) with a faint fiducial grid and an aurora glow. */
.site-head {
  position: relative;
  padding: 4.75rem 1.25rem 3.25rem;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(
      120% 95% at 50% -10%,
      rgba(99, 102, 241, 0.16),
      rgba(45, 212, 191, 0.05) 36%,
      transparent 68%
    ),
    linear-gradient(180deg, #090d14 0%, #0b1018 100%);
  border-bottom: 1px solid #1b2230;
}
/* faint instrument grid, faded out toward the edges */
.site-head::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(150, 170, 210, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150, 170, 210, 0.05) 1px, transparent 1px);
  background-size: 58px 58px;
  background-position: center;
  -webkit-mask-image: radial-gradient(78% 70% at 50% 32%, #000 28%, transparent 76%);
  mask-image: radial-gradient(78% 70% at 50% 32%, #000 28%, transparent 76%);
  pointer-events: none;
}

.hero {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.emblem {
  display: block;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 22px rgba(99, 102, 241, 0.28));
}
.eyebrow {
  margin: 0;
  font-family: "Space Grotesk", var(--sans);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.36em;
  font-size: 0.8rem;
  color: #8b97ad;
  padding-left: 0.36em; /* optical balance for the tracking */
}
.eyebrow .deva {
  font-family: "Kshana Deva", serif;
  text-transform: none;
  letter-spacing: 0;
  font-size: 1.3em;
  color: #b7c1d6;
  margin-right: 0.2em;
  vertical-align: -0.05em;
}
.wordmark {
  margin: 0.55rem 0 0;
  font-family: "Space Grotesk", var(--sans);
  font-weight: 700;
  font-size: clamp(4rem, 13vw, 8.75rem);
  line-height: 0.92;
  letter-spacing: -0.025em;
  background: linear-gradient(102deg, #5eead4 0%, #818cf8 48%, #c084fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.rule {
  display: block;
  margin: 1.15rem 0 1.3rem;
}
.tagline {
  margin: 0;
  font-family: "Space Grotesk", var(--sans);
  font-weight: 500;
  font-size: clamp(1.05rem, 2.3vw, 1.35rem);
  color: #c4ccda;
  letter-spacing: 0.01em;
}
.byline {
  margin: 0.95rem 0 0;
  font-family: "Space Grotesk", var(--sans);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  color: #6c7789;
}
.lead {
  position: relative;
  z-index: 1;
  color: #9aa6ba;
  font-size: 1.02rem;
  line-height: 1.6;
  max-width: 60ch;
  margin: 2.1rem auto 0;
}
.lead strong {
  color: #e6edf3;
}

.controls {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.2rem;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}
label {
  font-weight: 600;
}
select {
  flex: 1 1 240px;
  min-width: 200px;
  padding: 0.5rem 0.6rem;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
button {
  padding: 0.5rem 1.2rem;
  font: inherit;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition:
    filter 0.12s ease,
    transform 0.06s ease,
    box-shadow 0.12s ease;
}
button:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 35%, transparent);
}
button:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
  filter: brightness(0.95);
}
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.5;
  cursor: progress;
}
.status {
  color: var(--muted);
  font-size: 0.9rem;
}
.help {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.6rem 0 0.8rem;
}
textarea {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  padding: 0.8rem;
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  tab-size: 2;
}

.results {
  margin-top: 1.5rem;
}
.summary {
  font-family: var(--mono);
  font-size: 0.86rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
/* Flash the result when a run completes, so each Run is visible even when the
   output is unchanged (the engine is deterministic). */
@keyframes kshana-flash {
  from {
    background: color-mix(in srgb, var(--accent) 24%, var(--panel));
    border-left-color: var(--accent-2);
  }
  to {
    background: var(--panel);
    border-left-color: var(--accent);
  }
}
.summary.updated {
  animation: kshana-flash 0.7s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .summary.updated {
    animation: none;
  }
  button {
    transition: none;
  }
}
.status.ran {
  color: var(--accent);
  font-weight: 600;
}
.chart {
  margin: 1.1rem 0;
  text-align: center;
}
.chart svg {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
}
summary {
  cursor: pointer;
  font-weight: 600;
}
.json {
  font-family: var(--mono);
  font-size: 0.8rem;
  overflow-x: auto;
  max-height: 460px;
  overflow-y: auto;
}
.error {
  margin-top: 1.25rem;
  padding: 0.8rem 1rem;
  color: var(--error);
  background: color-mix(in srgb, var(--error) 10%, transparent);
  border: 1px solid var(--error);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.86rem;
  white-space: pre-wrap;
}

/* Deep footer band, bookending the hero. */
.site-foot {
  margin-top: 3rem;
  padding: 2.6rem 1.25rem 3.25rem;
  background: linear-gradient(180deg, #0b1018 0%, #090d14 100%);
  border-top: 1px solid #1b2230;
  color: #8b97ad;
  font-size: 0.9rem;
}
.foot-grid {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  align-items: center;
  justify-content: space-between;
}
.foot-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.foot-emblem {
  flex: none;
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.22));
}
.foot-name {
  margin: 0;
  font-family: "Space Grotesk", var(--sans);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
  color: #e6edf3;
}
.foot-sub {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: #6c7789;
}
.foot-sub .deva {
  font-family: "Kshana Deva", serif;
  font-size: 1.15em;
  color: #8b97ad;
  margin-right: 0.15em;
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.15rem;
}
.foot-links a {
  font-family: "Space Grotesk", var(--sans);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: #aeb8cc;
  text-decoration: none;
}
.foot-links a:hover {
  color: #fff;
}
.foot-meta {
  max-width: 980px;
  margin: 1.7rem auto 0;
  padding-top: 1.4rem;
  border-top: 1px solid #1b2230;
}
.foot-copy {
  margin: 0;
  font-family: "Space Grotesk", var(--sans);
  font-size: 0.85rem;
  color: #9aa6ba;
}
.foot-copy strong {
  color: #cdd5e2;
  font-weight: 600;
}
.fine {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #6c7789;
  max-width: 80ch;
}
.fine strong {
  color: #9aa6ba;
}
code {
  font-family: var(--mono);
  font-size: 0.85em;
}

/* --- Guided mode: start-here panel, preset cards, knobs ----------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.guide {
  margin-bottom: 1rem;
}
.guide-title {
  font-size: 1.15rem;
  margin: 0 0 0.25rem;
}
.guide-sub {
  color: var(--muted);
  margin: 0 0 0.9rem;
  max-width: 60ch;
}
.presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.7rem;
}
.preset {
  /* Reset the gradient button styling: cards are quieter than the Run button. */
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: left;
  padding: 0.8rem 0.9rem;
  color: var(--fg);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    border-color 0.12s ease,
    transform 0.06s ease,
    box-shadow 0.12s ease;
}
.preset:hover:not(:disabled) {
  filter: none;
  border-color: var(--accent);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--accent) 22%, transparent);
}
.preset.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.preset-title {
  font-weight: 700;
}
.preset-q {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 400;
}
.ghost {
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--line);
}
.ghost:hover:not(:disabled) {
  filter: none;
  border-color: var(--accent);
  box-shadow: none;
}
.guided {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.9rem 1.4rem;
  margin: 0.9rem 0 0.2rem;
}
.knob label {
  display: block;
  font-size: 0.92rem;
}
.knob-help {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.1rem;
}
.knob-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.35rem;
}
.knob-row input[type="range"] {
  flex: 1 1 auto;
  accent-color: var(--accent);
}
.knob-out {
  min-width: 3.5ch;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--accent);
}
.advanced {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
}
.advanced > summary,
.reading > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}
.advanced > summary:hover,
.reading > summary:hover {
  color: var(--accent);
}
.reading {
  margin: 0.4rem 0 0.6rem;
}
.reading p {
  color: var(--muted);
  max-width: 70ch;
  margin: 0.5rem 0 0;
}

/* Planned (not-yet-implemented) figure-of-merit note — greyed, clearly future. */
.planned-fom {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0.8rem 0;
  padding: 0.7rem 0.9rem;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: 0.88rem;
  opacity: 0.85;
}
.planned-tag {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}
