/**
 * Little Social - Base CSS
 * Resets, accessible focus rings, typography, and atomic primitives.
 */

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

html {
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--surface-bg);
  color-scheme: dark;
}

[data-theme="light"] {
  color-scheme: light;
}

[data-theme="oled"] {
  color-scheme: dark;
}

body {
  min-height: 100vh;
  overflow: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography Defaults */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-semibold);
  line-height: 1.25;
  color: var(--text-primary);
}

a {
  color: var(--text-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

p {
  margin-bottom: var(--space-2);
}

p:last-child {
  margin-bottom: 0;
}

/* Accessible Focus Outlines */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
  outline: none;
}

/* Interactive Elements */
button {
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

input, textarea, select {
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--text-primary);
  background-color: var(--surface-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  width: 100%;
  transition: border-color var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--border-focus);
  outline: none;
}

/* Buttons System */
.btn {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-weight: var(--font-semibold);
  border: 1px solid transparent;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: var(--accent-text);
}
.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: var(--surface-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background-color: var(--surface-card-hover);
  border-color: var(--border-focus);
}

.btn-ghost {
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
}
.btn-ghost:hover {
  background-color: var(--surface-card-hover);
  color: var(--text-primary);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}
.btn-icon:hover {
  background-color: var(--surface-card-hover);
  color: var(--text-primary);
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  line-height: 1.25;
  white-space: nowrap;
}

.badge-account-1 {
  background-color: var(--account-1-bg);
  color: var(--account-1-color);
  border: 1px solid var(--account-1-border);
}

.badge-account-2 {
  background-color: var(--account-2-bg);
  color: var(--account-2-color);
  border: 1px solid var(--account-2-border);
}

.badge-account-3 {
  background-color: var(--account-3-bg);
  color: var(--account-3-color);
  border: 1px solid var(--account-3-border);
}

/* Icons */
.icon {
  width: 1.25rem;
  height: 1.25rem;
  display: inline-block;
  vertical-align: middle;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}

.icon-sm {
  width: 1rem;
  height: 1rem;
}

.icon-lg {
  width: 1.5rem;
  height: 1.5rem;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

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

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

/* Progress Spinner */
.spinner {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-primary);
  animation: spinner-rotate 0.8s linear infinite;
  flex-shrink: 0;
}

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

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
}

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