:root {
  --bg: #0b0f0d;
  --bg-raised: #121815;
  --border: #223028;
  --text: #d9e6df;
  --text-dim: #8aa397;
  --accent: #39d98a;
  --accent-dim: #1f7a4d;
  --danger: #e0765a;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  line-height: 1.55;
}

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

.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: var(--bg-raised); }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.logo { font-family: 'Courier New', monospace; font-size: 1.3rem; font-weight: bold; color: var(--text); }
.logo span { color: var(--accent); }
.main-nav { display: flex; align-items: center; gap: 18px; font-size: 0.92rem; }
.nav-user { color: var(--text-dim); margin-right: 4px; }
.logout-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.link-button { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.92rem; padding: 0; }
.link-button:hover { text-decoration: underline; }

main.container { padding: 32px 20px 64px; min-height: 60vh; }

.site-footer { border-top: 1px solid var(--border); padding: 20px 0; color: var(--text-dim); font-size: 0.85rem; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 20px; }
.messages li { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 8px; }

/* Hero */
.hero { padding: 24px 0 36px; border-bottom: 1px solid var(--border); margin-bottom: 32px; }
.hero h1 { margin: 0 0 8px; font-size: 1.9rem; }
.hero p { color: var(--text-dim); margin: 0; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-head h2, .section-head h1 { margin: 0; }

.empty { color: var(--text-dim); font-style: italic; }

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 32px; }
.card {
  display: block; background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; color: var(--text);
}
.card:hover { border-color: var(--accent-dim); text-decoration: none; }
.card-img { width: 100%; height: 140px; object-fit: cover; display: block; }
.card-body { padding: 12px 14px; }
.card-body h3 { margin: 6px 0 6px; font-size: 1.05rem; }
.card-body p { margin: 0; color: var(--text-dim); font-size: 0.88rem; }

.badge {
  display: inline-block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--accent); border: 1px solid var(--accent-dim); border-radius: 999px; padding: 2px 9px;
}

/* Thread / forum lists */
.thread-list, .category-list { list-style: none; padding: 0; margin: 0 0 32px; }
.thread-list li, .category-list li {
  border-bottom: 1px solid var(--border); padding: 12px 0; display: flex; flex-direction: column; gap: 2px;
}
.thread-meta, .meta { color: var(--text-dim); font-size: 0.85rem; }
.category-name { font-size: 1.1rem; font-weight: 600; }

/* Filter bar */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-bar a { padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 0.85rem; color: var(--text-dim); }
.filter-bar a.active { border-color: var(--accent); color: var(--accent); }

/* Buttons */
.button {
  display: inline-block; background: var(--accent-dim); color: #eafff2; border: none; border-radius: var(--radius);
  padding: 9px 16px; font-size: 0.9rem; cursor: pointer;
}
.button:hover { background: var(--accent); color: #04140b; text-decoration: none; }

/* Forms */
.form-page p, .commento-form p, .inline-form p { margin: 0 0 14px; }
.form-page label, .commento-form label, .inline-form label { display: block; margin-bottom: 4px; color: var(--text-dim); font-size: 0.85rem; }
input, textarea, select {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); padding: 8px 10px; font-family: inherit; font-size: 0.95rem;
}
textarea { resize: vertical; }
.form-page, .commento-form { max-width: 560px; }

/* Progetto detail */
.progetto-cover { width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--radius); margin: 16px 0; }
.progetto-corpo { margin: 20px 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 20px 0; }
.gallery img { width: 100%; border-radius: var(--radius); display: block; }
.gallery figcaption { color: var(--text-dim); font-size: 0.8rem; margin-top: 4px; }

.inline-form { border: 1px dashed var(--border); border-radius: var(--radius); padding: 10px 14px; margin: 20px 0; }
.inline-form summary { cursor: pointer; color: var(--accent); }

/* Comments / thread messages */
.commenti, .thread { margin: 24px 0; }
.commento, .messaggio { border-bottom: 1px solid var(--border); padding: 14px 0; }
.commento-meta { color: var(--text-dim); font-size: 0.8rem; margin: 0 0 4px; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 14px; justify-content: center; margin: 24px 0; color: var(--text-dim); font-size: 0.9rem; }
