/* ─────────────────────────────────────────────
   base.css — Reset, defaults, global rules
   ───────────────────────────────────────────── */

/* ── Reset ── */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  hanging-punctuation: first last;
}

body {
  min-height: 100dvh;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Global no-select ── */

*,
*::before,
*::after {
  user-select: none;
  -webkit-user-select: none;
}

/* ── Allow selection only in message content + inputs ── */

.msg-content,
.msg-content *,
textarea,
input[type="text"],
input[type="search"],
input[type="password"] {
  user-select: text;
  -webkit-user-select: text;
}

/* ── Typography reset ── */

h1, h2, h3, h4, h5, h6 {
  font-size: inherit;
  font-weight: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Lists ── */

ul, ol {
  list-style: none;
}

/* ── Media ── */

img, svg, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── Form elements ── */

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

textarea {
  resize: none;
}

select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

/* ── Dialog reset ── */

dialog {
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  max-width: unset;
  max-height: unset;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ── Details/Summary reset ── */

details > summary {
  cursor: pointer;
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

/* ── Scrollbar — thin, subtle ── */

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

/* ── Focus visible — keyboard-only focus ring ── */

:focus-visible {
  outline: 1.5px solid var(--color-accent-red);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ── Hidden utility ── */

[hidden] {
  display: none !important;
}

/* ── Screen reader only ── */

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