/* ---------------------------------------------------------------------------
 * The palette, taken from Dhwani rather than chosen again.
 *
 * This is the other half of the same product, so it wears the same three
 * palettes with the same token names, copied verbatim from
 * ../VoiceApp/web/src/styles.css. They were measured there -- every
 * text-on-surface pair passes WCAG AA -- and re-deriving them here would mean
 * two sets of colours drifting apart, and two answers to "what colour is a
 * button".
 *
 * Mysore is the default, as it is on the board.
 * ------------------------------------------------------------------------- */

:root {
  --tap: 44px;
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --shadow: 0 1px 2px rgb(0 0 0 / 18%), 0 10px 30px rgb(0 0 0 / 22%);
  --radius-sm: 9px;
}

:root[data-theme='mysore'] {
  color-scheme: dark;

  --bg: #0d111a;
  --bg-raised: #161c29;
  --bg-sunken: #080b12;
  --line: #242c3d;
  --text: #fbf9f4;
  --text-dim: #97a0b3;

  --accent: #ea580c;
  --accent-soft: #1e3a8a;
  --accent-strong: #c2410c;
  --link: #fdba74;
  --accent-2: #fb923c;
  --accent-glow: rgba(234, 88, 12, 0.5);
  --on-accent: #0d111a;
  --on-accent-soft: #fbf9f4;
  --on-accent-faint: rgba(13, 17, 26, 0.35);

  --ok: #fb923c;
  --on-ok: #0d111a;
  --ok-bg: rgba(251, 146, 60, 0.13);
  --ok-line: rgba(251, 146, 60, 0.4);
  --ok-text: #fdba74;

  --danger: #f43f5e;
  --on-danger: #ffffff;
  --danger-bg: rgba(244, 63, 94, 0.13);
  --danger-line: rgba(244, 63, 94, 0.42);
  --danger-text: #fb7185;

  --pin: #fdba74;
  --wave-idle: #33405c;
  --scrim: rgba(4, 6, 10, 0.68);
  --backdrop: rgba(4, 6, 10, 0.6);

  --radius: 16px;
  --bubble-radius: 18px;
  --bubble-tail: 6px;
  --row-pad: 13px;
  --bar-bg: var(--bg);
  --on-bar: var(--text);
}

:root[data-theme='opal'] {
  color-scheme: light;

  --bg: #f0fdf4;
  --bg-raised: #ffffff;
  --bg-sunken: #e2f5e9;
  --line: #d3e9dc;
  --text: #06211a;
  /* 4.83 on the canvas. The obvious mid-green landed on 4.49, which is under
     the line for a timestamp by a hundredth and would have failed an audit
     while looking perfectly fine. */
  --text-dim: #587567;

  --accent: #047857;
  --accent-soft: #d6f5e6;
  --accent-strong: #035c43;
  --accent-2: #10b981;
  --accent-glow: rgba(4, 120, 87, 0.4);
  --on-accent: #ffffff;
  --on-accent-soft: #04503a;
  --on-accent-faint: rgba(255, 255, 255, 0.55);
  --link: #035c43;

  --ok: #047857;
  --on-ok: #ffffff;
  --ok-bg: rgba(4, 120, 87, 0.1);
  --ok-line: rgba(4, 120, 87, 0.34);
  --ok-text: #04503a;

  --danger: #be123c;
  --on-danger: #ffffff;
  --danger-bg: rgba(190, 18, 60, 0.09);
  --danger-line: rgba(190, 18, 60, 0.3);
  --danger-text: #9f1239;

  --pin: #b7791f;
  --wave-idle: #bfe0cf;
  --scrim: rgba(6, 33, 26, 0.5);
  --backdrop: rgba(6, 33, 26, 0.38);

  --radius: 12px;
  --bubble-radius: 14px;
  --bubble-tail: 4px;
  --row-pad: 14px;
  --bar-bg: var(--bg);
  --on-bar: var(--text);
}

:root[data-theme='ethereal'] {
  color-scheme: dark;

  --bg: #070b14;
  --bg-raised: #101724;
  --bg-sunken: #04070d;
  --line: #1d2537;
  --text: #f0f9ff;
  --text-dim: #8e9bb1;

  --accent: #06b6d4;
  --accent-soft: #3b3aa8;
  --accent-strong: #0891b2;
  --link: #67e8f9;
  --accent-2: #38bdf8;
  --accent-glow: rgba(6, 182, 212, 0.5);
  --on-accent: #070b14;
  --on-accent-soft: #e0e7ff;
  --on-accent-faint: rgba(7, 11, 20, 0.35);

  --ok: #06b6d4;
  --on-ok: #070b14;
  --ok-bg: rgba(6, 182, 212, 0.12);
  --ok-line: rgba(6, 182, 212, 0.4);
  --ok-text: #67e8f9;

  --danger: #fb7185;
  --on-danger: #1a0610;
  --danger-bg: rgba(251, 113, 133, 0.13);
  --danger-line: rgba(251, 113, 133, 0.42);
  --danger-text: #fda4af;

  --pin: #a5b4fc;
  --wave-idle: #2a3550;
  --scrim: rgba(2, 4, 8, 0.68);
  --backdrop: rgba(2, 4, 8, 0.6);

  --radius: 16px;
  --bubble-radius: 18px;
  --bubble-tail: 6px;
  --row-pad: 13px;
  --bar-bg: var(--bg);
  --on-bar: var(--text);
}

/* The names this side's own stylesheets were written against, pointing at the
   tokens above. Aliases rather than a find-and-replace across three files:
   the meaning is the same, and one indirection is cheaper than a rewrite that
   has to be right in two hundred places. */
:root {
  --surface: var(--bg-raised);
  --surface-2: var(--bg-sunken);
  --ink: var(--text);
  --ink-2: var(--text-dim);
  --muted: var(--text-dim);
  --accent-ink: var(--on-accent);
  --focus: var(--accent);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151412;
    --surface: #1e1c19;
    --surface-2: #282521;
    --ink: #f1ede6;
    --ink-2: #cdc6ba;
    --muted: #9c9588;
    --line: #35312b;
    --accent: #f0712b;
    --accent-strong: #ff8747;
    --accent-soft: #3a2519;
    --danger: #ff6b6b;
    --ok: #51cf66;
    --focus: #74c0fc;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 12px 32px rgb(0 0 0 / 40%);
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  font: 15px/1.5 var(--font);
  color: var(--ink);
  background: var(--bg);
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

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

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.spacer {
  flex: 1;
}

.icon {
  display: inline-flex;
  font-size: 1.1em;
}

.icon svg {
  display: block;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn.primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
}

.btn.ghost:hover {
  background: var(--surface-2);
}

.btn.danger {
  color: var(--danger);
}

.btn.small {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-strong);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.play-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 18px;
  cursor: pointer;
}

.play-btn:hover {
  background: var(--accent-strong);
}

/* Segmented control */

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
}

.seg button {
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.seg button[aria-pressed='true'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgb(0 0 0 / 12%);
}

/* Forms */

.field {
  display: grid;
  gap: 6px;
}

.field > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.field em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
}

input[type='text'],
input[type='url'],
input[type='password'],
input[type='search'],
input[type='email'],
input:not([type]),
textarea,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent);
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row.end {
  justify-content: flex-end;
}

/* Cards, avatars, progress */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--c, var(--accent));
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.progress {
  position: relative;
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  cursor: pointer;
}

.progress i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--accent);
  border-radius: inherit;
}

.time {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--ink-2);
}

.notice {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 14px;
}

/* Dialogs */

.dialog {
  width: min(460px, calc(100% - 32px));
  padding: 24px;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgb(20 16 10 / 45%);
  backdrop-filter: blur(2px);
}

.dialog.small {
  width: min(380px, calc(100% - 32px));
}

.dialog form,
.dialog {
  display: grid;
  gap: 14px;
}

.dialog:not([open]) {
  display: none;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  top: 16px;
  z-index: 100;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  transform: translate(-50%, -150%);
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
  pointer-events: none;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.toast.is-error {
  background: var(--danger);
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ಧ್ವನಿ beside Dhwani, the same wordmark the board wears. There was briefly a
   second name here -- ಲೇಖ, Lekha -- and it was one name too many: the people
   using this do not experience two products, and being asked to know which was
   which was a cost with nothing on the other side of it. */
.brand__script {
  margin-left: 6px;
  font-size: 0.85em;
  font-weight: 400;
  opacity: 0.55;
}
