/**
 * PAAS theme tokens — aligned with kyre.ai layout.css monochrome + charcoal dark.
 * Semantic aliases (--bg, --text, …) map onto shade ramps; accent via --link-shade1.
 */

:root {
  --bg-shade1: rgba(255, 255, 255, 1);
  --bg-shade2: rgba(255, 255, 255, 1);
  --bg-shade3: rgba(245, 245, 245, 0.5);
  --bg-shade4: rgba(205, 205, 205, 0.1);
  --text-shade1: rgba(0, 0, 0, 1);
  --text-shade2: rgba(0, 0, 0, 0.75);
  --text-shade3: rgba(0, 0, 0, 0.5);
  --text-shade4: rgba(0, 0, 0, 0.25);
  --link-shade1: rgba(127, 169, 255, 1);
  --link-shade2: rgba(35, 17, 188, 1);
  --link-shade3: rgba(35, 17, 188, 0.5);
  --shadow-shade1: rgba(0, 0, 0, 0.25);
  --shadow-shade2: rgba(0, 0, 0, 0.1);
  --highlight-shade1: rgba(0, 0, 0, 1);
  --highlight-shade2: rgba(0, 0, 0, 0.25);
  --highlight-shade3: rgba(0, 0, 0, 0.1);
  --highlight-shade4: rgba(0, 0, 0, 0.05);
  --button-bg: var(--bg-shade2);
  --button-text: var(--text-shade1);
  --button-border: rgba(0, 0, 0, 0.25);
}

[data-theme='light'] {
  --bg-shade1: rgba(255, 255, 255, 1);
  --bg-shade2: rgba(255, 255, 255, 1);
  --bg-shade3: rgba(245, 245, 245, 0.5);
  --bg-shade4: rgba(205, 205, 205, 0.1);
  --text-shade1: rgba(0, 0, 0, 1);
  --text-shade2: rgba(0, 0, 0, 0.75);
  --text-shade3: rgba(0, 0, 0, 0.5);
  --text-shade4: rgba(0, 0, 0, 0.25);
  --shadow-shade1: rgba(0, 0, 0, 0.25);
  --shadow-shade2: rgba(0, 0, 0, 0.1);
  --highlight-shade1: rgba(0, 0, 0, 1);
  --highlight-shade2: rgba(0, 0, 0, 0.25);
  --highlight-shade3: rgba(0, 0, 0, 0.1);
  --highlight-shade4: rgba(0, 0, 0, 0.05);
  --button-bg: var(--bg-shade2);
  --button-text: var(--text-shade1);
  --button-border: rgba(0, 0, 0, 0.25);
}

[data-theme='dark'] {
  --bg-shade1: rgba(0, 0, 0, 1);
  --bg-shade2: rgba(32, 32, 32, 1);
  --bg-shade3: rgba(80, 80, 80, 0.5);
  --bg-shade4: rgba(140, 140, 140, 0.1);
  --text-shade1: rgba(255, 255, 255, 1);
  --text-shade2: rgba(255, 255, 255, 0.75);
  --text-shade3: rgba(255, 255, 255, 0.5);
  --text-shade4: rgba(255, 255, 255, 0.25);
  --shadow-shade1: rgba(255, 255, 255, 0.25);
  --shadow-shade2: rgba(255, 255, 255, 0.1);
  --highlight-shade1: rgba(255, 255, 255, 1);
  --highlight-shade2: rgba(255, 255, 255, 0.25);
  --highlight-shade3: rgba(255, 255, 255, 0.1);
  --highlight-shade4: rgba(255, 255, 255, 0.05);
  --button-bg: var(--bg-shade2);
  --button-text: var(--text-shade1);
  --button-border: rgba(255, 255, 255, 0.25);
}

/* PAAS semantic aliases (used across platform.css) */
:root,
[data-theme='light'],
[data-theme='dark'] {
  --bg: var(--bg-shade2);
  --bg-subtle: var(--bg-shade3);
  --text: var(--text-shade1);
  --text-muted: var(--text-shade3);
  --accent: var(--link-shade1);
  --cta-bg: var(--link-shade1);
  --cta-text: #fff;
  --border: var(--highlight-shade3);
  /* Form controls — slightly above page bg (KYRE textarea uses bg-shade4) */
  --input-bg: var(--bg-shade1);
  --input-border: var(--highlight-shade3);
}

[data-theme='dark'] {
  /* One subtle step above page (--bg-shade2); keeps fields readable without a gray slab */
  --input-bg: color-mix(in srgb, var(--text-shade1) 5%, var(--bg-shade2));
  --input-border: var(--highlight-shade3);
}

html {
  color-scheme: light dark;
  background-color: var(--bg-shade2);
}

html,
body {
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

/* —— Left-rail bottom tray (theme + accent) —— */

.platform-nav-bottom-tray {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--highlight-shade3);
  border-radius: 8px;
  padding: 0 0.4rem;
  background: var(--bg-shade2);
  box-shadow: 0 1px 2px var(--shadow-shade2);
  box-sizing: border-box;
  overflow: visible;
}

.platform-nav-bottom-tray__accents {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  justify-content: flex-end;
  gap: 0.28rem;
  flex-wrap: nowrap;
  overflow: visible;
  padding: 2px 1px;
}

.platform-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 0.55rem;
  border: 1px solid var(--button-border);
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--text-shade1);
  cursor: pointer;
  font-size: 0.95rem;
  font: inherit;
}

.platform-theme-toggle__label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.platform-theme-toggle:hover {
  color: var(--text-shade1);
  border-color: var(--link-shade1);
}

.platform-theme-toggle.platform-theme-toggle--tray {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-width: 0;
  height: auto;
  min-height: 0;
  align-self: center;
  padding: 0.12rem 0.5rem;
  line-height: 1.15;
  font-size: 0.875rem;
}

.platform-theme-toggle--tray .platform-theme-toggle__label {
  padding: 0;
  margin: 0;
}

.platform-accent-swatches {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.platform-accent-swatch {
  width: calc(1.05rem - 2px);
  height: calc(1.05rem - 2px);
  padding: 0;
  border: 1px solid var(--highlight-shade3);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px transparent;
  box-sizing: border-box;
}

.platform-accent-swatch:hover {
  transform: scale(1.05);
}

.platform-accent-swatch.is-active {
  box-shadow: 0 0 0 1px var(--bg-shade2), 0 0 0 2px var(--link-shade1);
}

.platform-accent-custom-wrap {
  position: relative;
  width: calc(1.35rem - 2px);
  height: calc(1.35rem - 2px);
  flex-shrink: 0;
}

.platform-accent-custom-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid var(--highlight-shade3);
  pointer-events: none;
}

.platform-accent-custom-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}