:root {
  --bg: #0c1210;
  --surface: #141c19;
  --surface-2: #1a2420;
  --line: rgba(237, 239, 234, 0.12);
  --text: #f4f6f2;
  --text-dim: #b7c1ba;
  --amber: #ffb020;
  --teal: #2dd4bf;
  --on-accent: #0c1210;
  --radius: 2px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #eae7dc;
  --line: rgba(20, 32, 28, 0.12);
  --text: #141f1a;
  --text-dim: #4d5851;
  --amber: #b8560a;
  --teal: #1f8a7a;
  --on-accent: #fbf7ee;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }

h1, h2, h3 { font-family: 'Space Grotesk', sans-serif; font-weight: 600; letter-spacing: -0.01em; margin: 0; }

.mono { font-family: 'JetBrains Mono', monospace; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* ---------- Nav ---------- */
nav {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
}

.wordmark {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
}

.wordmark span { color: var(--amber); }

.nav-right { display: flex; align-items: center; gap: 18px; }

.back-link {
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
}

.back-link:hover { color: var(--amber); }

.theme-toggle {
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface-2); color: var(--text-dim); cursor: pointer; transition: 0.2s;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--amber); color: var(--amber); }
.theme-toggle__icon { display: none; line-height: 0; }
:root:not([data-theme="light"]) .theme-toggle__sun { display: flex; }
:root[data-theme="light"] .theme-toggle__moon { display: flex; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 56px 0 44px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.bg-glow {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 480px;
  background-image:
    radial-gradient(circle at 30% 30%, rgba(45, 212, 191, 0.16), transparent 60%),
    radial-gradient(circle at 75% 40%, rgba(255, 176, 32, 0.12), transparent 60%);
  pointer-events: none;
}

.bg-devanagari {
  position: absolute;
  top: -40px;
  right: -10px;
  font-family: 'Noto Sans Devanagari', sans-serif;
  font-size: 220px;
  font-weight: 600;
  color: var(--text);
  opacity: 0.035;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

.eyebrow {
  font-size: 13px; color: var(--amber); text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 14px; display: inline-flex; align-items: center; gap: 8px; position: relative; z-index: 1;
}
.eyebrow::before { content: ''; width: 22px; height: 1px; background: var(--amber); display: inline-block; }

.hero h1 { font-size: 2.4rem; margin-bottom: 14px; position: relative; z-index: 1; }

.lede {
  color: var(--text-dim); font-size: 15.5px; max-width: 640px; margin: 0 0 18px;
  position: relative; z-index: 1;
}

.byline {
  font-size: 13px; color: var(--text-dim); text-decoration: none; position: relative; z-index: 1;
  transition: color 0.2s;
}
.byline:hover { color: var(--amber); }

/* ---------- Cards ---------- */
main { padding: 40px 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
}

.mode-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  margin-bottom: 1.1rem;
  gap: 2px;
}

.mode-toggle input { display: none; }

.mode-toggle label {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-dim);
  user-select: none;
  transition: color 0.15s;
}

.mode-toggle input:checked + label {
  background: var(--amber);
  color: var(--on-accent);
}

.mode-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin: -0.6rem 0 1.1rem;
  line-height: 1.5;
}

textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.05rem;
  font-family: inherit;
  line-height: 1.5;
}

textarea:focus {
  outline: 2px solid var(--amber);
  outline-offset: -1px;
}

.output-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin: 1.25rem 0 0.5rem;
}

.output-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.icon-btn {
  width: 2rem;
  height: 2rem;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
}

.icon-btn:hover { border-color: var(--amber); }

.icon-btn[hidden] { display: none; }

.icon-btn.recording {
  background: var(--amber);
  color: var(--on-accent);
  border-color: var(--amber);
  animation: icon-btn-pulse 1.1s ease-in-out infinite;
}

@keyframes icon-btn-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.field-wrap { position: relative; }

.field-wrap .icon-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
}

.api-row { display: flex; gap: 0.5rem; }

.api-row input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
}

.api-row input:focus {
  outline: 2px solid var(--amber);
  outline-offset: -1px;
}

.api-row button {
  border: none;
  background: var(--amber);
  color: var(--on-accent);
  border-radius: var(--radius);
  padding: 0.6rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
  transition: background 0.15s;
}

.api-row button:hover { background: #ffc250; }

.api-row button:disabled { opacity: 0.6; cursor: default; }

.output {
  min-height: 3.2rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-family: "Noto Sans Devanagari", "Nirmala UI", sans-serif;
  font-size: 1.4rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.examples button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  transition: 0.15s;
}

.examples button:hover {
  border-color: var(--amber);
  color: var(--amber);
}

/* ---------- Explore CTA ---------- */
.explore {
  border-bottom: 1px solid var(--line);
  padding: 48px 0;
  text-align: center;
}

.explore-inner { max-width: 520px; }

.sec-tag {
  font-size: 13px; color: var(--teal); letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: 10px;
}

.explore h2 { font-size: 1.6rem; margin-bottom: 12px; }

.explore p { color: var(--text-dim); font-size: 15px; margin-bottom: 22px; }

.btn {
  font-family: 'JetBrains Mono', monospace; font-size: 14px; padding: 12px 22px;
  border: 1px solid var(--line); border-radius: var(--radius); transition: 0.2s;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--amber); color: var(--on-accent); border-color: var(--amber); font-weight: 500; }
.btn-primary:hover { background: #ffc250; }

/* ---------- Footer ---------- */
footer {
  color: var(--text-dim);
  font-size: 0.82rem;
  text-align: center;
  line-height: 1.8;
  padding: 28px 0 44px;
}

footer p { margin: 0; }

footer a { text-decoration: none; transition: color 0.15s; }
footer a:hover { color: var(--amber); }
