/* Shared by every page: colours, type, buttons, dialogs and toasts. */

:root {
  color-scheme: dark;

  --bg-0: #0a0c10;
  --bg-1: #10131a;
  --bg-2: #161a23;
  --bg-3: #1e2330;
  --line: #232937;
  --line-strong: #323a4d;

  --text: #e8ebf2;
  --text-dim: #a2abbd;
  --text-faint: #6c7589;

  --accent: #7c6cff;
  --accent-2: #4fa3ff;
  --accent-soft: rgba(124, 108, 255, 0.16);
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;

  --topbar-h: 48px;
  --chat-w: 360px;
}

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

* {
  scrollbar-width: thin;
  scrollbar-color: #2c3344 transparent;
}

[hidden] {
  display: none !important;
}


body {
  margin: 0;
  background: var(--bg-0);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

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

textarea::placeholder,
input::placeholder {
  color: var(--text-faint);
}

.icon {
  width: 16px;
  height: 16px;
  flex: none;
}

/* ---- buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 550;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, filter 0.15s, transform 0.05s;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn-success {
  background: var(--ok);
  color: #04261a;
}

.btn-success:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn-ghost {
  background: var(--bg-2);
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--bg-3);
  border-color: var(--line-strong);
}

.btn-danger {
  background: var(--danger);
  color: #26060d;
}

.btn-danger:hover {
  filter: brightness(1.08);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover:not(:disabled) {
  background: var(--bg-3);
  color: var(--text);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.icon-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: #b9b0ff;
}

.btn:focus-visible,
.icon-btn:focus-visible,
.segmented button:focus-visible,
.chip-btn:focus-visible,
.file-item:focus-visible,
.file-chip:focus-visible,
.project-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-0);
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.segmented button:hover {
  color: var(--text);
}

.segmented button[aria-selected="true"] {
  background: var(--bg-3);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.segmented .icon {
  width: 14px;
  height: 14px;
}

/* ---- dialogs and toasts ------------------------------------------------- */

.dialog {
  width: min(400px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--bg-2);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.dialog::backdrop {
  background: rgba(4, 5, 8, 0.6);
  backdrop-filter: blur(2px);
}

.dialog h3 {
  margin: 0 0 6px;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.dialog p {
  margin: 0 0 18px;
  color: var(--text-dim);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  max-width: 380px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  font-size: 13px;
  overflow-wrap: anywhere;
  animation: rise 0.2s ease-out;
}

.toast.is-error {
  border-color: rgba(251, 113, 133, 0.5);
}

/* ---- down for maintenance ------------------------------------------------ */

/* Covers the whole page while the site's owner has it closed (js/maintenance.js). */
.maintenance {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg-0);
  overflow: auto;
}

.maintenance-card {
  max-width: 460px;
  padding: 32px 28px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--bg-2);
  text-align: center;
}

.maintenance-card h1 {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 650;
}

.maintenance-text {
  margin: 0 0 22px;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* ---- motion and small screens ------------------------------------------- */

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@keyframes sweep {
  from { background-position: -70% 0; }
  to { background-position: 170% 0; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
}

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