/* ==========================================================================
   chatter — base.css
   Reset, typography baselines, layout skeleton, utility classes.
   Dark first. No light-mode override in v1.
   ========================================================================== */

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

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

html,
body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote,
ul, ol, dl, dd {
  margin: 0;
  padding: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
}

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

body {
  min-height: 100vh;
  background-color: var(--bg-0);
  color: var(--fg-0);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01", "ss03";
}

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

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

button {
  background: none;
  border: none;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-ui);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--fg-0);
}

h1 {
  font-size: var(--fs-2xl);
  letter-spacing: -0.01em;
}

h2 {
  font-size: var(--fs-xl);
}

h3 {
  font-size: var(--fs-lg);
}

h4 {
  font-size: var(--fs-md);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-caps);
  color: var(--fg-2);
  font-weight: var(--fw-medium);
}

p {
  color: var(--fg-1);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
}

small,
.text-sm {
  font-size: var(--fs-sm);
  color: var(--fg-2);
}

code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-variant-numeric: tabular-nums;
}

pre {
  background: var(--bg-2);
  border: 1px solid var(--border-weak);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  overflow-x: auto;
  color: var(--fg-1);
}

code {
  padding: 1px 4px;
  background: var(--bg-2);
  border-radius: var(--radius-xs);
  color: var(--fg-0);
}

pre code {
  padding: 0;
  background: transparent;
  border-radius: 0;
}

/* --------------------------------------------------------------------------
   Links, selection, focus
   -------------------------------------------------------------------------- */

a {
  color: var(--sig-info);
  text-decoration: none;
  transition: color var(--motion-fast);
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:visited {
  color: var(--sig-info);
}

::selection {
  background-color: rgba(58, 213, 255, 0.30);
  color: var(--fg-0);
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 1px solid var(--border-glow);
  outline-offset: 1px;
  box-shadow: 0 0 0 3px rgba(58, 213, 255, 0.15);
  border-radius: var(--radius-xs);
}

/* --------------------------------------------------------------------------
   Scrollbars (webkit + firefox)
   -------------------------------------------------------------------------- */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--bg-1);
}

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

::-webkit-scrollbar-track {
  background: var(--bg-1);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-xs);
  border: 2px solid var(--bg-1);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--fg-3);
}

::-webkit-scrollbar-corner {
  background: var(--bg-1);
}

/* --------------------------------------------------------------------------
   Layout skeleton
   -------------------------------------------------------------------------- */

.container {
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: var(--space-4);
}

.layout {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: calc(100vh - var(--header-h) - var(--tabs-h));
}

.layout__main {
  background: var(--bg-1);
  padding: var(--space-4);
  overflow-x: auto;
}

/* --------------------------------------------------------------------------
   Page / section titles
   -------------------------------------------------------------------------- */

.page-title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--fg-0);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  color: var(--fg-0);
  margin-bottom: var(--space-3);
}

/* --------------------------------------------------------------------------
   Utility classes
   -------------------------------------------------------------------------- */

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.text-xs {
  font-size: var(--fs-xs);
}

.text-sm {
  font-size: var(--fs-sm);
}

.text-md {
  font-size: var(--fs-md);
}

.text-muted {
  color: var(--fg-2);
}

.text-dim {
  color: var(--fg-3);
}

.text-fg-0 {
  color: var(--fg-0);
}

.text-fg-1 {
  color: var(--fg-1);
}

.text-fg-brand {
  color: var(--fg-brand);
}

.uppercase-eyebrow {
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-caps);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--fg-2);
}

.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* --------------------------------------------------------------------------
   HTMX loading states
   -------------------------------------------------------------------------- */

.htmx-request {
  cursor: wait;
}

.htmx-indicator {
  opacity: 0;
  transition: opacity var(--motion-fast);
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

/* Top-border progress strip on htmx requests */
body.htmx-request::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--sig-info);
  animation: htmx-progress 120ms linear infinite;
  z-index: 9999;
}

@keyframes htmx-progress {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
