/* ============================================================
   Ágora — CSS Custom Properties & Reset (Brutalist Renaissance)
   ============================================================ */

:root {
  /* Backgrounds — mineral palette */
  --bg-base: #161410;
  --bg-panel: #1e1b16;
  --bg-elevated: #25221a;
  --bg-input: #1a1714;

  /* Text — parchment */
  --text-primary: #e8ddcb;
  --text-secondary: #9b917a;

  /* Accents — pigment on surface */
  --accent-olive: #5c7a4a;
  --accent-gold: #b8934e;
  --alert-terracotta: #c26a4e;

  /* Borders — subtle, mineral */
  --border-subtle: #3d3522;
  --border-panel: #2a2720;

  /* Status */
  --status-online: #5c7a4a;
  --status-idle: #b8934e;
  --status-dnd: #c26a4e;
  --status-offline: #4a4540;

  /* Typography */
  --font-serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;

  /* Metrics — hard edges, fast transitions */
  --radius-hard: 2px;
  --radius-lg: 4px;
  --transition-fast: 100ms ease;

  /* Textures — inline SVG */
  --texture-fresco: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");

  /* Variable aliases — legacy code references these names */
  --text-muted: var(--text-secondary);
  --bg-secondary: var(--bg-elevated);
  --radius: var(--radius-hard);
  --bg-primary: var(--bg-panel);
  --border: var(--border-subtle);
  --success: var(--accent-olive);
  --danger: var(--alert-terracotta);
  --accent: var(--accent-gold);
}

/* ============================================================
   Reset
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

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

a:hover {
  text-decoration: underline;
  color: var(--text-primary);
}

button {
  cursor: pointer;
  font-family: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

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

/* ============================================================
   Focus & Accessibility
   ============================================================ */

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

/* Remove default focus ring for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 1px;
}

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

/* ============================================================
   Scrollbar — narrow, mineral
   ============================================================ */

::-webkit-scrollbar {
  width: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: #3d3522;
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-olive);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #3d3522 transparent;
}

/* ============================================================
   Shared Components
   ============================================================ */

/* Buttons — hard edges, left-border hover */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-hard);
  font-size: 14px;
  font-weight: 600;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  border-left: 2px solid transparent;
}

.btn-primary {
  background: var(--accent-olive);
  color: var(--bg-base);
}

.btn-primary:hover {
  background: #6b8a55;
  border-left-color: transparent;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: #2d2a20;
  border-left-color: var(--accent-olive);
}

.btn-cancel {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-cancel:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-left-color: var(--accent-olive);
}

.btn-danger {
  background: var(--alert-terracotta);
  color: var(--bg-base);
}

.btn-danger:hover {
  background: #d47a5a;
}

.btn-block {
  width: 100%;
}

.btn-large {
  padding: 14px 32px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

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

/* Form fields */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-hard);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent-olive);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-secondary);
}

/* Mentions */
.mention {
  background: #2d2a20;
  color: var(--accent-gold);
  padding: 0 4px;
  border-radius: var(--radius-hard);
  cursor: pointer;
  font-weight: 500;
}

.mention:hover {
  background: #3d3522;
}

.mention-everyone {
  background: rgba(184, 147, 78, 0.12);
  color: var(--accent-gold);
  padding: 0 4px;
  border-radius: var(--radius-hard);
  font-weight: 600;
}

/* Google OAuth button (shared: login page + profile modal) */
.btn-google {
  background: #fff;
  color: #333;
  width: 100%;
  justify-content: center;
  gap: 10px;
  font-weight: 500;
}

.btn-google:hover {
  background: #eee;
  text-decoration: none;
}

/* Auth separator "ou" */
.auth-separator {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.auth-separator::before,
.auth-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.auth-separator span {
  padding: 0 12px;
}

/* ============================================================
   Textures
   ============================================================ */

/* Fresco texture — apply to main surfaces */
.texture-fresco {
  background-image: var(--texture-fresco);
  background-repeat: repeat;
}

/* Radial vignette — chat area depth */
.vignette-chat {
  background: radial-gradient(ellipse at center, #1e1b16 0%, #161410 70%);
}

/* ============================================================
   Utilities
   ============================================================ */

.hidden {
  display: none !important;
}

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

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