/* Shared theme colors and transitions. */
:root {
  --theme-transition-properties: background-color, border-color, box-shadow;
  --theme-transition-duration: 0.3s;
  transition-property: --text-primary, --muted-text-color, --icon-contrast-color;
  transition-duration: var(--theme-transition-duration);
  transition-timing-function: ease;
  --bg-primary: #ffffff;
  --bg-raised: #f0f0f0;
  --bg-selected: #f0f0f0;
  --text-primary: #212121;
  --border-color: #dddddd;
  /* Same as body text: icons and icon-like controls are part of the text color. */
  --icon-contrast-color: #212121;
  --focus-accent-color: #4aa3ff;
  /* Matches Anonyway: faint accent fill behind a selected option (paywall plan). */
  --accent-tint: rgba(74, 163, 255, 0.1);
  /* Matches Anonyway: gray filled buttons and the dimmed page behind modals. */
  --button-secondary: #444444;
  --backdrop: rgba(0, 0, 0, 0.7);
  /* Matches Anonyway: toasts stay dark in both themes. */
  /* Matches Anonyway: text and icons on filled color, both themes. */
  --on-fill-text: #ffffff;
  --toast-background: #333333;
  --toast-border: #555555;
  /* Removable chip outline; chips have no fill. */
  --chip-border: #333333;
  /* Matches Anonyway: danger red for text and filled backgrounds in both themes. */
  --danger-color: #ef4444;
  --muted-text-color: #666666;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --chip-border: #cccccc;
  --bg-primary: #121212;
  --bg-raised: #2a2a2a;
  --bg-selected: #2a2a2a;
  --text-primary: #ffffff;
  --border-color: #333333;
  --icon-contrast-color: #ffffff;
  --muted-text-color: #888888;
  color-scheme: dark;
}

.theme-surface {
  background-color: var(--bg-primary);
}

html,
body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

input {
  caret-color: var(--focus-accent-color);
}

/* Keep Safari's browser-chrome backgrounds immediate; animate the visible surface. */
*:not(html):not(body),
*::before,
*::after {
  transition-property: var(--theme-transition-properties);
  transition-duration: var(--theme-transition-duration);
  transition-timing-function: ease;
}

/* Animate inherited theme colors once, at their source. Descendants consume
   the same value instead of starting another color transition each frame. */
@property --text-primary {
  syntax: "<color>";
  inherits: true;
  initial-value: #212121;
}
@property --muted-text-color {
  syntax: "<color>";
  inherits: true;
  initial-value: #666666;
}
@property --icon-contrast-color {
  syntax: "<color>";
  inherits: true;
  initial-value: #212121;
}
html[data-theme-no-transition],
html[data-theme-no-transition] *,
html[data-theme-no-transition] *::before,
html[data-theme-no-transition] *::after {
  transition-duration: 0s !important;
}
html[data-theme-transitioning] *,
html[data-theme-transitioning] *::before,
html[data-theme-transitioning] *::after {
  transition-property: var(--theme-transition-properties) !important;
}
