/* Base: design variables, reset, typography and utilities.
 *
 * The dark theme is the default (like Termius and the desktop app). If the
 * system prefers light, light is used, unless the person has chosen another
 * theme (data-theme attribute on <html>). */

:root {
  color-scheme: dark;
  --bg: #0c100d;
  --bg-soft: #101611;
  --surface: #141b15;
  --surface-2: #19221a;
  --surface-3: #202b21;
  --overlay: rgba(4, 7, 5, 0.72);
  --border: #232e25;
  --border-strong: #324035;
  --text: #e8efe4;
  --text-2: #bcc7b6;
  --muted: #8e9b89;
  --faint: #65725f;
  --accent: #6fbf3b;
  --accent-2: #9fd36b;
  --accent-ink: #0b1408;
  --accent-soft: rgba(111, 191, 59, 0.12);
  --accent-border: rgba(111, 191, 59, 0.38);
  --accent-text: #9fd36b;
  --danger: #f07070;
  --danger-strong: #e05252;
  --danger-soft: rgba(240, 112, 112, 0.12);
  --danger-border: rgba(240, 112, 112, 0.4);
  --warn: #e7bd52;
  --warn-soft: rgba(231, 189, 82, 0.12);
  --warn-border: rgba(231, 189, 82, 0.38);
  --info: #72b0f2;
  --info-soft: rgba(114, 176, 242, 0.12);
  --info-border: rgba(114, 176, 242, 0.38);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.5);
  --glow: radial-gradient(60% 60% at 50% 0%, rgba(111, 191, 59, 0.16), transparent 70%);
  --focus: 0 0 0 3px rgba(159, 211, 107, 0.5);
  --grad-text: linear-gradient(100deg, #9fd36b 0%, #6fbf3b 55%, #c6e39a 100%);
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --header-h: 64px;
  --sidebar-w: 252px;
  --content-w: 1160px;

  /* Terminal: always dark, also in the light theme. */
  --term-bg: #0a0e0b;
  --term-bar: #121813;
  --term-border: #263128;
  --term-text: #d7e3d1;
  --term-dim: #71806c;
  --term-green: #9fd36b;
  --term-blue: #7cb7f5;
  --term-yellow: #e7c15a;
  --term-red: #f07878;
  --term-magenta: #d49cf0;
  --term-cyan: #6fd6cf;
}

/* Light theme: from the system preference or chosen by hand. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f5f7f2;
    --bg-soft: #edf1e9;
    --surface: #ffffff;
    --surface-2: #f3f6f0;
    --surface-3: #e7ede2;
    --overlay: rgba(22, 30, 18, 0.45);
    --border: #dce3d6;
    --border-strong: #c5cfbc;
    --text: #151d12;
    --text-2: #394533;
    --muted: #5b6855;
    --faint: #8b9785;
    --accent: #4f9d22;
    --accent-2: #3e8316;
    --accent-ink: #ffffff;
    --accent-soft: rgba(79, 157, 34, 0.1);
    --accent-border: rgba(79, 157, 34, 0.38);
    --accent-text: #3a7a14;
    --danger: #c93c3c;
    --danger-strong: #b32f2f;
    --danger-soft: rgba(201, 60, 60, 0.08);
    --danger-border: rgba(201, 60, 60, 0.35);
    --warn: #9a6a00;
    --warn-soft: rgba(214, 160, 30, 0.12);
    --warn-border: rgba(180, 130, 20, 0.35);
    --info: #1f6fc2;
    --info-soft: rgba(31, 111, 194, 0.08);
    --info-border: rgba(31, 111, 194, 0.3);
    --shadow-sm: 0 1px 2px rgba(20, 30, 15, 0.08);
    --shadow: 0 12px 32px rgba(20, 30, 15, 0.1);
    --shadow-lg: 0 24px 64px rgba(20, 30, 15, 0.16);
    --glow: radial-gradient(60% 60% at 50% 0%, rgba(111, 191, 59, 0.14), transparent 70%);
    --focus: 0 0 0 3px rgba(79, 157, 34, 0.35);
    --grad-text: linear-gradient(100deg, #5aa82a 0%, #3e8316 60%, #2f6b0f 100%);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7f2;
  --bg-soft: #edf1e9;
  --surface: #ffffff;
  --surface-2: #f3f6f0;
  --surface-3: #e7ede2;
  --overlay: rgba(22, 30, 18, 0.45);
  --border: #dce3d6;
  --border-strong: #c5cfbc;
  --text: #151d12;
  --text-2: #394533;
  --muted: #5b6855;
  --faint: #8b9785;
  --accent: #4f9d22;
  --accent-2: #3e8316;
  --accent-ink: #ffffff;
  --accent-soft: rgba(79, 157, 34, 0.1);
  --accent-border: rgba(79, 157, 34, 0.38);
  --accent-text: #3a7a14;
  --danger: #c93c3c;
  --danger-strong: #b32f2f;
  --danger-soft: rgba(201, 60, 60, 0.08);
  --danger-border: rgba(201, 60, 60, 0.35);
  --warn: #9a6a00;
  --warn-soft: rgba(214, 160, 30, 0.12);
  --warn-border: rgba(180, 130, 20, 0.35);
  --info: #1f6fc2;
  --info-soft: rgba(31, 111, 194, 0.08);
  --info-border: rgba(31, 111, 194, 0.3);
  --shadow-sm: 0 1px 2px rgba(20, 30, 15, 0.08);
  --shadow: 0 12px 32px rgba(20, 30, 15, 0.1);
  --shadow-lg: 0 24px 64px rgba(20, 30, 15, 0.16);
  --glow: radial-gradient(60% 60% at 50% 0%, rgba(111, 191, 59, 0.14), transparent 70%);
  --focus: 0 0 0 3px rgba(79, 157, 34, 0.35);
  --grad-text: linear-gradient(100deg, #5aa82a 0%, #3e8316 60%, #2f6b0f 100%);
}

/* --- Reset -------------------------------------------------------------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

svg {
  flex-shrink: 0;
}

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

button {
  cursor: pointer;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 650;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.3rem;
}

h3 {
  font-size: 1.05rem;
}

p {
  margin: 0;
}

a {
  color: var(--accent-text);
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration: underline;
}

code,
kbd,
pre,
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.1em 0.4em;
  overflow-wrap: anywhere;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
}

::selection {
  background: rgba(111, 191, 59, 0.35);
}

/* Focus ring visible only with the keyboard. */
:focus {
  outline: none;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--radius-xs);
}

/* --- Boot ----------------------------------------------------------- */

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.boot-logo {
  animation: boot-pulse 1.4s ease-in-out infinite;
}

@keyframes boot-pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.96);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.noscript {
  padding: 24px;
  text-align: center;
}

/* --- Utilities --------------------------------------------------------- */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  top: 12px;
}

[hidden] {
  display: none !important;
}

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

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

.small {
  font-size: 0.86rem;
}

.tiny {
  font-size: 0.78rem;
}

.strong {
  font-weight: 600;
}

.nowrap {
  white-space: nowrap;
}

.break {
  overflow-wrap: anywhere;
}

.center {
  text-align: center;
}

.accent {
  color: var(--accent-text);
}

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

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

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

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack-lg {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.grow {
  flex: 1 1 auto;
  min-width: 0;
}

.mt-0 {
  margin-top: 0;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-24 {
  margin-bottom: 24px;
}

.inline-ico {
  display: inline-block;
  vertical-align: -2px;
}

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