/* Speech - shared design tokens and components.
   Token source: rupees.com (cfai-affiliate frontend/src/index.css dark theme):
   dark navy surfaces, blue->cyan accent.
   Heads up: var names describe each token's ROLE and predate this palette,
   so several no longer match their value - --btn-black is blue, --btn-beige
   is dark navy, --chip-purple and --teal are both blue. Trust the value,
   not the name; renaming them is its own sweep.
   No external fonts, no CDNs. */

:root {
  /* Surfaces */
  --shell: #0A0E17;
  --panel: #0D1526;
  --card: #141829;
  --popover: #141829;
  --nav-active: #1A2035;
  --row-hover: #141829;
  --chip-hover: #1A2035;

  /* Text */
  --ink: #E2E8F0;
  --text-2: #94A3B8;
  /* Was #64748B, which fails AA everywhere it is used. Measured by sampling
     the pixels actually painted behind the text, not by reading the token:
     4.06:1 on the page ground (#0A0E17), 3.83:1 on a sheet (#0D1526) and
     3.70:1 on a raised panel (#141829). 4.5 is the bar for text this size,
     and this token carries the fine print - consent lines, the Windows
     install note, the labels under the hero demo.

     #7C8BA5 keeps the slate cast and clears the bar on all three, worst case
     5.11:1. The next step up the ramp (--text-2, #94A3B8) was already fine at
     6.87:1, so this only closes the gap under it. */
  --text-3: #7C8BA5;
  --placeholder: #7C8BA5;

  /* Borders */
  --hairline: #1E2538;
  --row-sep: #1E2538;
  --divider: #1E2538;
  --input-border: #2A3550;
  --input-focus: #0096FF;

  /* Actions (primary action = rupees accent blue) */
  --btn-black: #0096FF;
  --btn-black-disabled: #2A3550;
  --btn-beige: #1A2035;

  /* Accents */
  --chip-purple: #0E2A45;
  --accent-purple: #00B4FF;
  --teal: #00B4FF;
  --teal-mid: #0077CC;
  --teal-fill: #14223A;
  --red: #EF4444;
  --green: #10B981;
  --amber: #F59E0B;

  /* Promo banner (rupees signature blue->cyan gradient) */
  --banner-dark: linear-gradient(135deg, #0096FF, #00D4FF);
  --banner-cream: #FFFFFF;
  --banner-cream-body: #EAF7FF;
  --banner-cta: #FFFFFF;

  /* Admin (same dark surface) */
  --a-page: #0A0E17;
  --a-sidebar: #0D1526;
  --a-card: #141829;
  --a-nav-active: #1A2035;
  --a-border: #1E2538;
  --a-border-light: #1A2035;
  --a-ink: #E2E8F0;
  --a-text-2: #94A3B8;
  --a-axis: #64748B;
  --a-gridline: #1E2538;
  --a-black-btn: #0096FF;
  --a-avatar: #0E2A45;

  /* Type */
  --font-serif: "Iowan Old Style", Georgia, "Times New Roman", Times, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Shadows */
  --shadow-popover: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.60);
}

/* color-scheme is what tells the UA to paint native controls dark. The
   marketing pages want that. The admin portal must NOT get it: a dark UA
   checkbox fills itself #3B3B3B, which on the admin panel (#141829) is
   1.57:1 and reads as an empty square - "Show test injections" on
   /admin/transcripts.html was effectively invisible. Light UA controls put
   the same checkbox at 17.61:1. WCAG 1.4.11 asks for 3:1. */
:root:not(:has(.admin-body)) { color-scheme: dark; }

/* Counterpart to the rule above. The sidebar sign-out control is a <button>,
   so with no color of its own it falls back to the UA's `buttontext` - which
   followed color-scheme and only looked right by accident. Now that admin no
   longer forces dark, state the colour outright instead of inheriting a UA
   default that flips out from under us. */
.admin-sidebar .sidebar-bottom button.nav-item { color: var(--a-ink); }

* { box-sizing: border-box; }

/* The hidden attribute must always win: .btn/.auth-divider/.otp-link set
   their own display, which silently defeats the UA's [hidden] rule - the
   auth page was showing a dead Google button while the feature ships dark. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--shell);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; }

a { color: inherit; }

::selection { background: var(--chip-purple); }

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

/* ---------- Type scale ---------- */

.overline {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}

.serif-display {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.serif-display em,
.serif-display i {
  font-style: italic;
}

.small { font-size: 13.5px; color: var(--text-2); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 140ms ease, opacity 140ms ease, transform 140ms ease;
}

.btn-black {
  background: var(--btn-black);
  color: #FFFFFF;
}
.btn-black:hover { background: #00B4FF; }
.btn-black:disabled { background: var(--btn-black-disabled); cursor: default; }

.btn-beige {
  background: var(--btn-beige);
  color: var(--ink);
}
.btn-beige:hover { background: var(--chip-hover); }

.btn-light {
  background: var(--banner-cta);
  color: #0A0E17;
}
.btn-light:hover { background: #E2E8F0; }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  padding: 0 12px;
}
.btn-ghost:hover { background: var(--nav-active); color: var(--ink); }

.btn .icon { flex: 0 0 auto; }

/* ---------- Icons ---------- */

.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.icon-20 { width: 20px; height: 20px; }

/* ---------- Site header (public pages) ---------- */

.site-header {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
}

.brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: block;
}

.brand .brand-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link {
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  padding: 9px 14px;
  border-radius: 999px;
  transition: background-color 140ms ease;
}
.nav-link:hover { background: var(--nav-active); }

/* ---------- Sheet: content panel floating on the shell frame ---------- */

.sheet {
  max-width: 1080px;
  margin: 0 auto 20px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  overflow: hidden;
}

/* ---------- Cards ---------- */

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 24px;
}

.card-bordered {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 12px;
}

/* ---------- Forms ---------- */

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  background: var(--shell);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--ink);
}

.input::placeholder { color: var(--placeholder); }

.input:focus {
  outline: none;
  border: 2px solid var(--input-focus);
  padding: 0 12px;
}

.form-error {
  display: none;
  font-size: 13.5px;
  color: var(--red);
  margin: 4px 0 12px;
}
.form-error.visible { display: block; }

.form-note {
  font-size: 13.5px;
  color: var(--text-2);
  margin: 4px 0 12px;
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 32px;
  border-bottom: 1px solid var(--hairline);
}

.tab {
  appearance: none;
  background: none;
  border: 0;
  padding: 0 0 12px;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab.active {
  color: var(--ink);
  font-weight: 500;
  border-bottom-color: var(--ink);
}

/* ---------- Utility ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skeleton {
  display: inline-block;
  min-width: 64px;
  border-radius: 6px;
  background: var(--nav-active);
  color: transparent;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Landing page sections (index.html only; every class .landing- prefixed
   so auth/account/admin pages are untouched) ---------- */

.landing-section {
  padding: 64px 32px 72px;
  border-top: 1px solid var(--hairline);
}

.landing-section-head {
  max-width: 37em;
  margin: 0 auto 40px;
  text-align: center;
}
.landing-section-head .overline { margin: 0 0 14px; }
.landing-section-head h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 0;
}
.landing-section-head p:not(.overline) {
  margin: 12px 0 0;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text-2);
}

/* How it works */
.landing-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.landing-step {
  background: var(--card);
  border-radius: 12px;
  padding: 26px 24px 28px;
}
.landing-step-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  margin-bottom: 18px;
}
.landing-step-num {
  font-family: var(--font-serif);
  font-size: 30px;
  line-height: 1;
  color: var(--text-3);
}
.landing-step-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.landing-step h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 8px;
}
.landing-step p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-2);
}

.landing-key {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  background: #1A2035;
  border: 1px solid #2A3550;
  border-radius: 6px;
  box-shadow: 0 1.5px 0 #0A0E17;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

/* Speech vs typing stat strip */
.landing-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.landing-stat {
  background: var(--card);
  border-radius: 12px;
  padding: 32px 24px 28px;
  text-align: center;
}
.landing-stat-num {
  display: block;
  font-family: var(--font-serif);
  font-size: clamp(38px, 5vw, 50px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 10px;
}
.landing-stat-label {
  font-size: 15px;
  color: var(--text-2);
}
/* The qualifier under a stat row. Deliberately inside the same section as the
   numbers: a condition that lives further down the page is a condition the
   reader of the number never sees. */
.landing-stats-note {
  margin: 18px auto 0;
  max-width: 46em;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-3);
}
.landing-stats-note a { color: var(--text-2); }
.landing-stats-note a:hover { color: var(--ink); }

/* Privacy dark card — text is dark ink, not cream: white/#EAF7FF on the
   blue->cyan gradient measured ~1.5-3:1 (AA fail), #0A0E17 is 6-11:1. */
.landing-privacy-card {
  background: var(--banner-dark);
  border-radius: 16px;
  padding: 56px 48px;
}
.landing-privacy-card .overline {
  /* Alpha, not the hex, decides contrast here: the ink composites onto the
     gradient, and this sits at the card's top-left where the gradient is at
     its darkest (#0096FF). 0.62 measured 3.47:1, 0.78 gives 4.80:1. */
  color: rgba(10, 14, 23, 0.78);
  margin: 0 0 14px;
}
.landing-privacy-card h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.18;
  letter-spacing: -0.01em;
  color: #0A0E17;
  margin: 0 0 28px;
}
.landing-privacy-list {
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 36px;
}
.landing-privacy-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 15.5px;
  line-height: 1.5;
  color: rgba(10, 14, 23, 0.86);
}
.landing-privacy-list .icon {
  flex: 0 0 auto;
  margin-top: 2px;
  color: #0A0E17;
}
.landing-privacy-fineprint {
  margin: 0;
  font-size: 13px;
  /* Same compositing trap as .overline above: 0.68 measured 4.14:1,
     0.78 gives 5.10:1. */
  color: rgba(10, 14, 23, 0.78);
}

/* Requirements + compatibility */
.landing-reqs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.landing-req {
  background: var(--card);
  border-radius: 12px;
  padding: 26px 24px 28px;
}
.landing-req h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 8px;
}
.landing-req p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-2);
}

/* FAQ accordions */
.landing-faq {
  max-width: 720px;
  margin: 0 auto;
  border-top: 1px solid var(--hairline);
}
.landing-faq details {
  border-bottom: 1px solid var(--hairline);
}
.landing-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 2px;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.landing-faq summary::-webkit-details-marker { display: none; }
.landing-faq summary::after {
  content: "+";
  flex: 0 0 auto;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  color: var(--text-3);
  transition: transform 140ms ease;
}
.landing-faq details[open] summary::after { transform: rotate(45deg); }
.landing-faq details > p {
  margin: 0;
  padding: 0 28px 18px 2px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-2);
}

@media (max-width: 860px) {
  .landing-section { padding: 52px 20px 56px; }
  .landing-steps,
  .landing-reqs,
  .landing-privacy-list { grid-template-columns: 1fr; }
  .landing-privacy-card { padding: 40px 28px; }
  /* The stat numbers are short ("140+", "0", "2"): the strip stays 3-up
     on phones instead of stacking three mostly-empty cards. */
  .landing-stats { gap: 10px; }
  .landing-stat { padding: 20px 10px 18px; }
  .landing-stat-num { font-size: 30px; }
  .landing-stat-label { font-size: 12.5px; }
}

/* Brand + Sign in + Download otherwise total ~295px against 32px side
   padding - over a 320px viewport. */
@media (max-width: 480px) {
  .site-header { padding: 16px 20px; }
}

/* ---------- Bottom banner + site footer (shared) ----------
   These lived only in index.html's inline <style>, so every other page that
   used the same markup (guide.html) rendered them unstyled: the footer links
   ran together and the banner lost its gradient card. Shared now. */

.banner-wrap {
  padding: 64px 32px 72px;
  border-top: 1px solid var(--hairline);
}
.banner {
  background: var(--banner-dark);
  border-radius: 16px;
  padding: 60px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}
.banner h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.18;
  color: #0A0E17;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.banner p {
  margin: 0;
  font-size: 15.5px;
  color: rgba(10, 14, 23, 0.82);
  max-width: 30em;
}
.banner .banner-copy { flex: 1 1 380px; }
.banner .banner-cta { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.banner .banner-note {
  flex-basis: 100%;
  margin-top: 4px;
  font-size: 13px;
  color: rgba(10, 14, 23, 0.75);
  text-align: center;
}

.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--text-3);
}
.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.site-footer a {
  color: var(--text-2);
  text-decoration: none;
}
.site-footer a:hover { color: var(--ink); }
/* The legal pages sit outside .sheet: give their footer the same width. */
.site-footer.standalone { max-width: 1080px; margin: 0 auto; padding: 24px 24px 40px; }

@media (max-width: 860px) {
  .banner { padding: 44px 28px; }
  .banner-wrap { padding: 52px 20px 56px; }
}

/* ---------------------------------------------------------------------------
   The second-factor challenge (web/js/api.js, backend/api/mfa.py).

   Lives in site.css, not admin.css: api.js is loaded by the account page too,
   and a dialog that renders unstyled on one of them is worse than no dialog.
   --------------------------------------------------------------------------- */
.mfa-back {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(5, 8, 14, 0.72);
  backdrop-filter: blur(2px);
}
.mfa-card {
  width: 100%; max-width: 380px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: 14px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.mfa-card h2 { margin: 0 0 8px; font-size: 19px; letter-spacing: -0.01em; }
.mfa-card p { margin: 0 0 16px; font-size: 13.5px; color: var(--muted, #94A3B8); line-height: 1.5; }
.mfa-code {
  width: 100%; box-sizing: border-box;
  font: 600 26px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.32em; text-align: center;
  padding: 14px 12px;
  color: var(--ink); background: var(--panel);
  border: 1px solid var(--input-border); border-radius: 10px;
}
.mfa-code:focus { outline: none; border-color: var(--input-focus); }
.mfa-code::placeholder { color: var(--placeholder); }
.mfa-err { margin: 12px 0 0; font-size: 13px; color: var(--red); }
.mfa-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.mfa-row button {
  font: 600 14px/1 inherit; padding: 11px 16px;
  border-radius: 9px; border: 1px solid transparent; cursor: pointer;
}
.mfa-cancel { background: var(--btn-beige); color: var(--ink); border-color: var(--hairline); }
.mfa-go { background: var(--btn-black); color: #04121F; }
.mfa-go:disabled { background: var(--btn-black-disabled); color: var(--placeholder); cursor: default; }
