/*
 * app/assets/stylesheets/application.css
 * -----------------------------------------------------------------------------
 * O Design System vive em design-system/{tokens,reset,foundations,components,
 * patterns}.css (carregados antes deste arquivo). Este arquivo é a "cola":
 *  - alia os tokens legados (--ink/--accent/...) para os tokens do DS, para que
 *    telas ainda não migradas (admin, legal) herdem a nova identidade;
 *  - mantém o CSS legado da Fase 0 numa camada de baixa prioridade (@layer
 *    legacy) até cada tela ser migrada para classes `.ds-*`.
 * Ver docs/design/system.md.
 */

@layer legacy;

/* Ponte: nomes legados -> tokens do DS (fora de @layer, sempre vence). */
:root {
  --ink: var(--color-text);
  --muted: var(--color-text-secondary);
  --line: var(--color-border);
  --accent: var(--color-primary);
  --bg: var(--color-bg);
}

@layer legacy {

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--accent); }

.flash { max-width: 640px; margin: 12px auto; padding: 10px 16px; border-radius: 8px; }
.flash.notice { background: #e7f5ff; color: #0b5394; }
.flash.alert { background: #fdecea; color: #8a1c1c; }

.linkish {
  background: none; border: none; padding: 0;
  color: var(--accent); cursor: pointer; font: inherit;
}

.composer textarea {
  width: 100%; min-height: 88px; padding: 10px;
  border: 1px solid var(--line); border-radius: 10px; font: inherit; resize: vertical;
}
.composer .row { display: flex; justify-content: flex-end; margin-top: 8px; }
.composer button {
  background: var(--accent); color: #fff; border: 0;
  padding: 8px 18px; border-radius: 999px; font-weight: 600; cursor: pointer;
}

.errors { color: #8a1c1c; margin: 8px 0; }

.post { padding: 14px 0; border-bottom: 1px solid var(--line); }
.post .meta { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.post .meta a { color: var(--muted); text-decoration: none; }
.post .meta a.author { color: var(--ink); font-weight: 600; }
.post .body { word-wrap: break-word; }
.post .body p { margin: 0 0 6px; white-space: pre-wrap; }

.post-images {
  display: grid; gap: 4px; margin: 8px 0; border-radius: 12px; overflow: hidden;
  max-width: 100%;
}
.post-images a { display: block; line-height: 0; }
.post-images img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-images.count-1 { grid-template-columns: 1fr; }
.post-images.count-2 { grid-template-columns: 1fr 1fr; }
.post-images.count-3 { grid-template-columns: 1fr 1fr; }
.post-images.count-3 a:first-child { grid-row: span 2; }
.post-images.count-4 { grid-template-columns: 1fr 1fr; }
.post-images.count-2 img, .post-images.count-3 img, .post-images.count-4 img { aspect-ratio: 1 / 1; }
.post-images.count-1 img { max-height: 480px; aspect-ratio: auto; }

.attach { font-size: 13px; color: var(--muted); cursor: pointer; }
.attach input[type="file"] { display: block; margin-top: 4px; }
.post .context { color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.post .actions { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 13px; color: var(--muted); align-items: center; }
.post .actions a, .post .actions .linkish { font-size: 13px; }
.post .actions form { display: inline; margin: 0; }
.post .actions .linkish.act-on { color: var(--accent); font-weight: 600; }
.post .actions .danger-link { color: #8a1c1c; }

.mention, .hashtag { text-decoration: none; }

blockquote.quoted {
  margin: 8px 0 0; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px;
}
blockquote.quoted .meta { color: var(--muted); font-size: 13px; }

.thread-parent { opacity: 0.75; }
.replies .post:first-of-type { border-top: 1px solid var(--line); }

.profile-header { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 8px; }
.profile-header h1 { font-size: 20px; margin: 0 0 6px; }
.profile-stats { display: flex; gap: 16px; color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.profile-stats a { color: var(--muted); text-decoration: none; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-actions button {
  background: var(--accent); color: #fff; border: 0;
  padding: 6px 14px; border-radius: 999px; font-weight: 600; cursor: pointer; font-size: 13px;
}
.profile-actions .linkish { align-self: center; }

.user-list p { padding: 8px 0; border-bottom: 1px solid var(--line); margin: 0; }

.notification { padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0; }
.notification.unread { font-weight: 600; }
.notification .meta { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }

.badge {
  display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 4px;
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 11px; line-height: 16px; text-align: center;
}

.context.why { color: var(--accent); }

.nav-search { flex: 0 1 200px; }
.nav-search input {
  width: 100%; padding: 6px 12px; border: 1px solid var(--line);
  border-radius: 999px; font: inherit; background: #f7f9fc;
  -webkit-appearance: none; appearance: none;
}
.search-tabs { display: flex; gap: 14px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.search-tabs a { padding: 6px 0; text-decoration: none; color: var(--muted); }
.search-tabs a.active { color: var(--ink); border-bottom: 2px solid var(--accent); font-weight: 600; }
.search-section { margin-bottom: 20px; }

.report-link { font-size: 13px; color: var(--muted); }

.post.removed { opacity: 0.55; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; object-fit: cover; flex-shrink: 0; background: #e1e8ed;
}
.avatar-sm { width: 40px; height: 40px; font-size: 13px; }
.avatar-lg { width: 96px; height: 96px; font-size: 30px; }
.avatar-fallback { color: #536471; font-weight: 700; text-transform: uppercase; }
.avatar-link { display: inline-flex; }

.post-head { display: flex; gap: 10px; align-items: flex-start; }
.post-head .meta { margin: 0; }
.post .handle { color: var(--muted); }
.post .author { color: var(--ink); font-weight: 600; }

.profile-id { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 10px; }
.profile-id h1 { margin: 0; font-size: 20px; }
.profile-id .handle { color: var(--muted); margin: 2px 0; }
.profile-id .bio { margin: 6px 0; white-space: pre-wrap; }

.settings-nav { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; font-size: 14px; }

.site-footer {
  max-width: 640px; margin: 40px auto 24px; padding: 12px 16px;
  border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 16px;
  font-size: 13px;
}
.site-footer a { color: var(--muted); text-decoration: none; }

.legal { max-width: 640px; }
.legal h2 { font-size: 16px; margin: 18px 0 6px; }
.legal p, .legal li { line-height: 1.6; }
.legal-draft {
  background: #fff4e5; color: #8a5a00; border: 1px solid #f0d9b5;
  border-radius: 8px; padding: 10px 12px; font-size: 13px;
}
.legal-nav { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 12px; }

.field.consent { font-size: 13px; margin: 12px 0; }
.field.consent label { display: flex; gap: 8px; align-items: flex-start; }
.danger-zone { border: 1px solid #f0d9b5; }
.avatar-field { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.user-row { display: flex; align-items: center; gap: 10px; }
.moderation-history p { padding: 6px 0; border-bottom: 1px solid var(--line); margin: 0; font-size: 14px; }
a.active { font-weight: 600; color: var(--ink); }

} /* @layer legacy */
