@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --bg: #060810;
  --bg2: #0b0f1a;
  --bg3: #111827;
  --surface: #131929;
  --border: rgba(100,130,200,0.12);
  --accent: #4f7cff;
  --accent2: #a78bfa;
  --gold: #c9a84c;
  --text: #e8eaf0;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  --red: #ef4444;
  --green: #34d399;
  --glow: rgba(79,124,255,0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Space Mono', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── BACKGROUND NEBULA ─── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 10% 20%, rgba(79,124,255,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 70% at 90% 10%, rgba(167,139,250,0.06) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 50% 90%, rgba(79,124,255,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 40% 60% at 75% 60%, rgba(167,139,250,0.04) 0%, transparent 50%);
  pointer-events: none;
}

/* ─── STARFIELD ─── */
#starfield {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 0; opacity: 0.55;
}

/* ─── LAYOUT ─── */
.app { position: relative; z-index: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ─── NAV ─── */
nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2.5rem; height: 64px;
  background: rgba(6,8,16,0.88);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.7rem; font-weight: 300;
  letter-spacing: 0.25em; color: var(--text);
  cursor: pointer; text-transform: uppercase;
  user-select: none;
}
.nav-logo span { color: var(--accent); }

.nav-links { display: flex; gap: 0.25rem; list-style: none; }
.nav-links li button {
  font-family: 'Space Mono', monospace;
  font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted); background: none; border: none; cursor: pointer;
  padding: 0.4rem 0.9rem; border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}
.nav-links li button:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-links li button.active { color: var(--accent); }

.nav-right { display: flex; align-items: center; gap: 0.75rem; }

.search-bar {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.35rem 0.75rem;
}
.search-bar input {
  background: none; border: none; outline: none;
  font-family: 'Space Mono', monospace; font-size: 0.7rem;
  color: var(--text); width: 150px;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-icon { color: var(--text-muted); font-size: 0.75rem; }

/* Language selector */
.lang-select {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem; letter-spacing: 0.1em;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-dim); border-radius: 5px;
  padding: 0.35rem 0.6rem; cursor: pointer; outline: none;
  transition: border-color 0.2s, color 0.2s;
  appearance: none; -webkit-appearance: none;
  text-transform: uppercase;
}
.lang-select:hover, .lang-select:focus { border-color: rgba(79,124,255,0.4); color: var(--text); }

.avatar-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: 2px solid rgba(79,124,255,0.4); cursor: pointer;
  font-size: 0.85rem; display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif; font-weight: 600; color: white;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.avatar-btn:hover { border-color: var(--accent); box-shadow: 0 0 12px var(--glow); }

/* ─── PAGES ─── */
.page { display: none; animation: fadeIn 0.4s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ─── HERO ─── */
.hero { padding: 5rem 2.5rem 3rem; max-width: 900px; margin: 0 auto; }
.hero-label {
  font-size: 0.65rem; letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 1rem;
}
.hero h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.6rem, 5.5vw, 4.5rem);
  font-weight: 300; line-height: 1.12;
  letter-spacing: -0.01em; margin-bottom: 1.5rem;
}
.hero h1 em { color: var(--accent2); font-style: italic; }
.hero p {
  font-size: 0.78rem; line-height: 1.9; color: var(--text-dim);
  max-width: 520px; margin-bottom: 2rem;
}
.hero-cta { display: flex; gap: 1rem; align-items: center; }

.btn-primary {
  font-family: 'Space Mono', monospace; font-size: 0.68rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.7rem 1.5rem; background: var(--accent);
  color: white; border: none; border-radius: 5px; cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
.btn-primary:hover { background: #3b6aff; box-shadow: 0 0 20px rgba(79,124,255,0.35); }

.btn-ghost {
  font-family: 'Space Mono', monospace; font-size: 0.68rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.7rem 1.5rem; background: transparent;
  color: var(--text-dim); border: 1px solid var(--border);
  border-radius: 5px; cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.btn-ghost:hover { color: var(--text); border-color: rgba(100,130,200,0.3); }

/* ─── DIVIDER ─── */
.divider { max-width: 1100px; margin: 0 auto; border: none; border-top: 1px solid var(--border); }

/* ─── SECTION LABEL ─── */
.section-label {
  font-size: 0.62rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 1.5rem;
  display: flex; align-items: center; gap: 0.75rem;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ─── POSTS SECTION ─── */
.posts-section { max-width: 1100px; margin: 0 auto; padding: 3rem 2.5rem; }

.main-layout {
  max-width: 1100px; margin: 0 auto; padding: 0 2.5rem 4rem;
  display: grid; grid-template-columns: 1fr 280px; gap: 2.5rem;
}

/* ─── POSTS GRID ─── */
.posts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }

.post-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; cursor: pointer;
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
  display: flex; flex-direction: column;
}
.post-card:hover {
  border-color: rgba(100,130,200,0.28);
  transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}

.card-img {
  height: 160px; position: relative; overflow: hidden;
  background: var(--bg3);
}
.card-img img {
  width: 100%; height: 100%; object-fit: cover;
  display: block; transition: transform 0.4s ease;
}
.post-card:hover .card-img img { transform: scale(1.04); }

.card-img-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.5rem; font-weight: 300;
  color: rgba(100,130,200,0.25);
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, #0a1628 0%, #0d0a1e 100%);
}

.card-tag {
  position: absolute; bottom: 0.75rem; left: 0.75rem;
  font-size: 0.58rem; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.25rem 0.6rem; border-radius: 20px;
  backdrop-filter: blur(8px);
  background: rgba(79,124,255,0.18); color: #93b4ff; border: 1px solid rgba(79,124,255,0.25);
}

.fav-btn {
  position: absolute; top: 0.75rem; right: 0.75rem;
  background: rgba(6,8,16,0.65); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.3rem 0.55rem;
  cursor: pointer; font-size: 0.75rem;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  backdrop-filter: blur(8px); color: var(--text-muted);
  font-family: 'Space Mono', monospace;
  line-height: 1;
}
.fav-btn:hover { border-color: var(--gold); color: var(--gold); }
.fav-btn.faved { color: var(--gold); border-color: rgba(201,168,76,0.4); background: rgba(201,168,76,0.1); }

.card-body { padding: 1.25rem; display: flex; flex-direction: column; flex: 1; }
.post-meta {
  font-size: 0.62rem; letter-spacing: 0.08em; color: var(--text-muted);
  margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.6rem;
}
.post-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.card-body h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.18rem; font-weight: 400; line-height: 1.3;
  margin-bottom: 0.6rem;
}
.card-body p { font-size: 0.7rem; line-height: 1.8; color: var(--text-dim); margin-bottom: 1rem; flex: 1; }

.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 0.75rem; border-top: 1px solid var(--border);
  margin-top: auto;
}
.card-stats { display: flex; gap: 1rem; }
.stat { font-size: 0.62rem; color: var(--text-muted); }

.like-btn {
  background: none; border: none; cursor: pointer;
  font-size: 0.72rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 0.35rem;
  transition: color 0.2s; font-family: 'Space Mono', monospace;
}
.like-btn:hover, .like-btn.liked { color: var(--red); }

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  grid-column: 1 / -1;
}
.empty-state .empty-icon {
  font-family: 'Cormorant Garamond', serif;
  font-size: 3rem; font-weight: 300; color: rgba(100,130,200,0.2);
  margin-bottom: 1rem; display: block;
}
.empty-state p { font-size: 0.75rem; color: var(--text-muted); line-height: 1.8; }

/* ─── SIDEBAR ─── */
.sidebar-widget {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.5rem; margin-bottom: 1.25rem;
}
.widget-title {
  font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: 0.6rem;
}
.widget-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.trending-item {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.6rem 0; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: opacity 0.2s;
}
.trending-item:last-child { border-bottom: none; }
.trending-item:hover { opacity: 0.75; }
.trending-num { font-size: 0.7rem; color: var(--accent); font-weight: 700; min-width: 18px; padding-top: 2px; }
.trending-item h4 { font-family: 'Cormorant Garamond', serif; font-size: 0.95rem; font-weight: 400; line-height: 1.3; margin-bottom: 0.2rem; }
.trending-item span { font-size: 0.6rem; color: var(--text-muted); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-pill {
  font-size: 0.62rem; letter-spacing: 0.08em;
  padding: 0.3rem 0.7rem; border-radius: 20px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.tag-pill:hover { background: rgba(79,124,255,0.1); color: var(--accent); border-color: rgba(79,124,255,0.3); }

/* newsletter rimossa */

/* ─── ARTICLE MODAL ─── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(6,8,16,0.93); backdrop-filter: blur(12px);
  overflow-y: auto; padding: 2rem;
}
.modal-overlay.open { display: flex; justify-content: center; align-items: flex-start; }
.modal-content {
  max-width: 740px; width: 100%;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; margin: auto;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }

.modal-hero {
  height: 260px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0d1b3e 0%, #1a1040 50%, #0a0a1a 100%);
}
.modal-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.modal-hero-placeholder {
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse 60% 40% at 30% 60%, rgba(79,124,255,0.22) 0%, transparent 70%),
    radial-gradient(ellipse 40% 60% at 72% 28%, rgba(167,139,250,0.18) 0%, transparent 70%);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 5rem; font-weight: 300; color: rgba(100,130,200,0.12);
}
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: rgba(6,8,16,0.65); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer;
  width: 32px; height: 32px; border-radius: 6px; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px); transition: color 0.2s, border-color 0.2s;
  font-family: 'Space Mono', monospace;
}
.modal-close:hover { color: var(--text); border-color: rgba(100,130,200,0.3); }

.modal-body { padding: 2.5rem; }
.modal-body h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.1rem; font-weight: 400; line-height: 1.15; margin-bottom: 1.5rem;
}
.article-text { font-size: 0.8rem; line-height: 2; color: var(--text-dim); }
.article-text p { margin-bottom: 1.5rem; }
.article-text h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem; font-weight: 400; color: var(--text); margin: 2rem 0 1rem;
}
.article-text blockquote {
  border-left: 2px solid var(--accent); padding: 0.5rem 1.5rem; margin: 1.5rem 0;
  font-family: 'Cormorant Garamond', serif; font-size: 1.15rem; font-style: italic;
  color: var(--text-dim); background: rgba(79,124,255,0.05); border-radius: 0 6px 6px 0;
}
.article-text img {
  max-width: 100%; border-radius: 8px; margin: 1.5rem 0;
  border: 1px solid var(--border); display: block;
}
.modal-actions {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 1.5rem; margin-top: 2rem; border-top: 1px solid var(--border);
}
.author-info { display: flex; align-items: center; gap: 0.75rem; }
.author-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #1e3a8a, var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif; font-size: 0.8rem; font-weight: 600;
}
.author-name { font-size: 0.68rem; color: var(--text-dim); }

/* ─── PROFILE PAGE ─── */
.profile-page { max-width: 900px; margin: 0 auto; padding: 3rem 2.5rem; }

.profile-header {
  display: flex; gap: 2.5rem; align-items: flex-start; padding: 2.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  margin-bottom: 2rem; position: relative; overflow: hidden;
}
.profile-header::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2), var(--gold));
}
.profile-avatar-large {
  width: 88px; height: 88px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif; font-size: 2.4rem; font-weight: 600; color: white;
  flex-shrink: 0; box-shadow: 0 0 30px rgba(79,124,255,0.28);
}
.profile-info h2 { font-family: 'Cormorant Garamond', serif; font-size: 1.9rem; font-weight: 400; margin-bottom: 0.25rem; }
.profile-handle { font-size: 0.7rem; color: var(--accent); margin-bottom: 0.75rem; }
.profile-bio { font-size: 0.75rem; line-height: 1.8; color: var(--text-dim); max-width: 480px; margin-bottom: 1.25rem; }
.profile-stats-row { display: flex; gap: 2rem; }
.profile-stat { text-align: center; }
.profile-stat-num { font-family: 'Cormorant Garamond', serif; font-size: 1.55rem; font-weight: 400; color: var(--text); display: block; }
.profile-stat-label { font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }

.profile-tabs { display: flex; gap: 0; margin-bottom: 2rem; border-bottom: 1px solid var(--border); }
.tab-btn {
  font-family: 'Space Mono', monospace; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.75rem 1.5rem; background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; color: var(--text-muted); transition: color 0.2s, border-color 0.2s; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.3s ease; }

.my-posts-list { display: flex; flex-direction: column; gap: 1rem; }
.my-post-item {
  display: flex; gap: 1.25rem; align-items: center; padding: 1.25rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: border-color 0.2s;
}
.my-post-item:hover { border-color: rgba(100,130,200,0.25); }
.my-post-thumb {
  width: 64px; height: 64px; border-radius: 8px; flex-shrink: 0; overflow: hidden;
  background: var(--bg3); display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif; font-size: 1.8rem; font-weight: 300; color: rgba(100,130,200,0.3);
}
.my-post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.my-post-info h4 { font-family: 'Cormorant Garamond', serif; font-size: 1.08rem; font-weight: 400; margin-bottom: 0.3rem; }
.my-post-info span { font-size: 0.65rem; color: var(--text-muted); }
.my-post-actions { margin-left: auto; display: flex; gap: 0.5rem; }
.icon-btn {
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.35rem 0.65rem;
  cursor: pointer; font-size: 0.72rem; color: var(--text-muted);
  transition: color 0.2s, background 0.2s; font-family: 'Space Mono', monospace;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,0.07); }
.icon-btn.danger:hover { color: var(--red); border-color: rgba(239,68,68,0.3); }

/* ─── FAVOURITES PAGE ─── */
.favourites-page { max-width: 1100px; margin: 0 auto; padding: 3rem 2.5rem 4rem; }
.page-heading { font-family: 'Cormorant Garamond', serif; font-size: 2.6rem; font-weight: 300; margin-bottom: 0.5rem; }
.page-subheading { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 2.5rem; }

/* ─── WRITE PAGE ─── */
.write-page { max-width: 740px; margin: 0 auto; padding: 3rem 2.5rem 4rem; }
.write-form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-field { display: flex; flex-direction: column; gap: 0.5rem; }
.form-label { font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }

.form-input {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.8rem 1rem;
  font-family: 'Space Mono', monospace; font-size: 0.78rem;
  color: var(--text); outline: none; transition: border-color 0.2s;
}
.form-input:focus { border-color: rgba(79,124,255,0.4); box-shadow: 0 0 0 3px rgba(79,124,255,0.05); }
.form-input::placeholder { color: var(--text-muted); }

.form-textarea {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 1rem; width: 100%;
  font-family: 'Cormorant Garamond', serif; font-size: 1.05rem; line-height: 1.9;
  color: var(--text); outline: none; resize: vertical; min-height: 340px;
  transition: border-color 0.2s;
}
.form-textarea:focus { border-color: rgba(79,124,255,0.4); box-shadow: 0 0 0 3px rgba(79,124,255,0.05); }
.form-textarea::placeholder { color: var(--text-muted); }

.category-select { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cat-option {
  font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.4rem 0.9rem; border-radius: 20px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer; transition: all 0.2s;
  font-family: 'Space Mono', monospace;
}
.cat-option:hover { border-color: rgba(79,124,255,0.3); color: var(--accent); }
.cat-option.selected { background: rgba(79,124,255,0.15); border-color: rgba(79,124,255,0.4); color: var(--accent); }

/* Image upload area */
.image-upload-area {
  border: 2px dashed var(--border); border-radius: 8px;
  padding: 2rem; text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s; position: relative;
  background: rgba(255,255,255,0.02);
}
.image-upload-area:hover { border-color: rgba(79,124,255,0.4); background: rgba(79,124,255,0.03); }
.image-upload-area.drag-over { border-color: var(--accent); background: rgba(79,124,255,0.07); }
.image-upload-area input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-label { font-size: 0.72rem; color: var(--text-muted); line-height: 1.8; }
.upload-label strong { color: var(--accent); }
.upload-preview {
  position: relative; display: inline-block; margin-top: 1rem;
}
.upload-preview img {
  max-height: 180px; max-width: 100%; border-radius: 6px;
  border: 1px solid var(--border); display: block;
}
.upload-preview-remove {
  position: absolute; top: -8px; right: -8px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 50%; width: 22px; height: 22px;
  font-size: 0.6rem; cursor: pointer; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: color 0.2s; font-family: 'Space Mono', monospace;
}
.upload-preview-remove:hover { color: var(--red); border-color: rgba(239,68,68,0.4); }

/* Word count row */
.write-meta-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.65rem; color: var(--text-muted);
}

.publish-bar {
  display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.publish-bar span { font-size: 0.68rem; color: var(--text-muted); }
.publish-bar-btns { display: flex; gap: 0.75rem; }

/* ─── SETTINGS FORM ─── */
.settings-grid { display: flex; flex-direction: column; gap: 1.25rem; padding-top: 0.5rem; }
.activity-list { display: flex; flex-direction: column; gap: 0.75rem; padding-top: 0.5rem; }
.activity-item {
  padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.75rem; color: var(--text-dim); line-height: 1.8;
}
.activity-item strong { color: var(--text); }

/* ─── TOAST ─── */
.toast {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 300;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.9rem 1.4rem; font-size: 0.72rem; color: var(--text);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  transform: translateY(20px); opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ─── FOOTER ─── */
footer {
  margin-top: auto; border-top: 1px solid var(--border);
  padding: 2rem 2.5rem; display: flex; align-items: center; justify-content: space-between;
  font-size: 0.65rem; color: var(--text-muted); letter-spacing: 0.08em;
}

/* ─── AUTH MODAL ─── */
.auth-modal-content {
  position: relative;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; padding: 2.5rem 2rem;
  width: 100%; max-width: 400px; margin: auto;
  animation: slideUp 0.35s cubic-bezier(0.16,1,0.3,1);
}
.auth-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem; font-weight: 300; letter-spacing: 0.25em;
  text-align: center; margin-bottom: 1.5rem; color: var(--text);
}
.auth-logo span { color: var(--accent); }
.auth-title { font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; font-weight: 400; text-align: center; margin-bottom: 0.4rem; }
.auth-subtitle { font-size: 0.68rem; color: var(--text-muted); text-align: center; margin-bottom: 1.5rem; line-height: 1.7; }
.auth-error { font-size: 0.68rem; color: var(--red); min-height: 1.2rem; margin-top: 0.6rem; text-align: center; }
.auth-switch { font-size: 0.68rem; color: var(--text-muted); text-align: center; margin-top: 1rem; }
.auth-link {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font-size: 0.68rem; font-family: 'Space Mono', monospace;
  text-decoration: underline; padding: 0;
}
.auth-link:hover { color: var(--accent2); }

/* ─── COMMENTI ─── */
.comments-section {
  margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border);
}
.comments-title {
  font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: 0.6rem;
}
.comments-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.comment-item {
  padding: 0.9rem 0; border-bottom: 1px solid var(--border);
}
.comment-item:last-child { border-bottom: none; }
.comment-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.35rem; }
.comment-author { font-size: 0.68rem; color: var(--accent); font-weight: 700; }
.comment-date { font-size: 0.6rem; color: var(--text-muted); }
.comment-body { font-size: 0.75rem; color: var(--text-dim); line-height: 1.8; }

.comment-form { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.25rem; }
.comment-input {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.75rem 1rem;
  font-family: 'Space Mono', monospace; font-size: 0.75rem;
  color: var(--text); outline: none; resize: vertical;
  transition: border-color 0.2s;
}
.comment-input:focus { border-color: rgba(79,124,255,0.4); box-shadow: 0 0 0 3px rgba(79,124,255,0.05); }
.comment-input::placeholder { color: var(--text-muted); }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100,130,200,0.25); }

/* ─── ADMIN PANEL ─── */
.admin-page { max-width: 900px; margin: 0 auto; padding: 3rem 2.5rem 4rem; }
.admin-tabs { display: flex; gap: 0; margin-bottom: 0; border-bottom: 1px solid var(--border); }

.admin-comment-item {
  padding: 1.25rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 0.85rem;
  animation: fadeIn 0.25s ease;
}

.admin-user-item {
  display: flex; gap: 1rem; align-items: center; padding: 1rem 1.25rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 0.75rem;
}

.admin-badge {
  display: inline-block; font-size: 0.55rem; letter-spacing: 0.12em;
  padding: 0.15rem 0.5rem; border-radius: 20px; margin-left: 0.5rem;
  background: rgba(201,168,76,0.15); border: 1px solid rgba(201,168,76,0.35);
  color: var(--gold); vertical-align: middle; font-family: 'Space Mono', monospace;
}

/* Inbox button in nav */
.inbox-btn {
  position: relative; width: 34px; height: 34px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; font-size: 0.85rem; display: flex; align-items: center;
  justify-content: center; color: var(--text-muted);
  transition: border-color 0.2s, color 0.2s;
}
.inbox-btn:hover { border-color: rgba(79,124,255,0.4); color: var(--text); }

.inbox-badge {
  position: absolute; top: -5px; right: -5px;
  background: var(--red); color: white;
  font-size: 0.52rem; font-family: 'Space Mono', monospace;
  width: 16px; height: 16px; border-radius: 50%;
  align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}

.badge-pill {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red); color: white; font-size: 0.55rem;
  min-width: 16px; height: 16px; border-radius: 10px;
  padding: 0 4px; margin-left: 0.35rem; font-family: 'Space Mono', monospace;
}

/* ─── TRENDING FEATURED POST ─── */
.trending-post-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface);
  border: 1px solid rgba(79,124,255,0.28);
  border-radius: 14px; overflow: hidden; cursor: pointer;
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
  margin-bottom: 0.5rem;
  position: relative;
  box-shadow: 0 0 40px rgba(79,124,255,0.07), inset 0 0 0 1px rgba(79,124,255,0.1);
}
.trending-post-card:hover {
  border-color: rgba(79,124,255,0.5);
  transform: translateY(-2px); box-shadow: 0 16px 40px rgba(0,0,0,0.4), 0 0 40px rgba(79,124,255,0.12);
}
.trending-post-card .tp-image {
  height: 280px; position: relative; overflow: hidden; background: var(--bg3);
}
.trending-post-card .tp-image img {
  width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s ease;
}
.trending-post-card:hover .tp-image img { transform: scale(1.03); }
.trending-post-card .tp-image-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #0a1628 0%, #0d0a1e 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 4rem; font-weight: 300; color: rgba(100,130,200,0.18);
}
.trending-post-card .tp-badge {
  position: absolute; top: 1rem; left: 1rem;
  font-size: 0.58rem; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 0.3rem 0.7rem; border-radius: 20px;
  background: rgba(79,124,255,0.25); color: #93b4ff;
  border: 1px solid rgba(79,124,255,0.4); backdrop-filter: blur(8px);
}
.trending-post-card .tp-fav {
  position: absolute; top: 1rem; right: 1rem;
  background: rgba(6,8,16,0.65); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.3rem 0.55rem;
  cursor: pointer; font-size: 0.75rem;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  backdrop-filter: blur(8px); color: var(--text-muted);
  font-family: 'Space Mono', monospace; line-height: 1;
}
.trending-post-card .tp-fav:hover { border-color: var(--gold); color: var(--gold); }
.trending-post-card .tp-fav.faved { color: var(--gold); border-color: rgba(201,168,76,0.4); background: rgba(201,168,76,0.1); }
.trending-post-card .tp-body {
  padding: 2rem 2.5rem; display: flex; flex-direction: column; justify-content: center;
}
.trending-post-card .tp-label {
  font-size: 0.58rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 0.75rem;
}
.trending-post-card .tp-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  font-weight: 400; line-height: 1.2; margin-bottom: 0.75rem;
}
.trending-post-card .tp-subtitle {
  font-size: 0.75rem; line-height: 1.8; color: var(--text-dim);
  margin-bottom: 1.5rem; max-width: 380px;
}
.trending-post-card .tp-meta {
  font-size: 0.62rem; color: var(--text-muted); letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.5rem;
}
.trending-post-card .tp-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); }
.trending-post-card .tp-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 1rem; border-top: 1px solid var(--border); margin-top: auto;
}

/* Profile avatar upload hint */
.profile-avatar-large:hover::after {
  content: 'Change';
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.6);
  font-size: 0.55rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: white; text-align: center; padding: 0.35rem 0;
  font-family: 'Space Mono', monospace;
}

/* Pending post admin item */
.admin-post-item {
  padding: 1.25rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 0.85rem; animation: fadeIn 0.25s ease;
}
.admin-post-item .ap-title {
  font-family: 'Cormorant Garamond', serif; font-size: 1.1rem; font-weight: 400;
  margin-bottom: 0.3rem;
}
.admin-post-item .ap-meta {
  font-size: 0.62rem; color: var(--text-muted); margin-bottom: 0.75rem;
}
.admin-post-item .ap-excerpt {
  font-size: 0.72rem; color: var(--text-dim); line-height: 1.7; margin-bottom: 0.9rem;
}

/* ─── RESPONSIVE TRENDING CARD ─── */
@media (max-width: 700px) {
  .trending-post-card { grid-template-columns: 1fr; }
  .trending-post-card .tp-image { height: 200px; }
  .trending-post-card .tp-body { padding: 1.5rem; }
}

@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  nav { padding: 0 1rem; }
  .search-bar { display: none; }
  .posts-grid { grid-template-columns: 1fr; }
  .profile-header { flex-direction: column; gap: 1.5rem; }
  .hero { padding: 3rem 1.5rem 2rem; }
  .main-layout, .posts-section, .profile-page, .favourites-page, .write-page { padding-left: 1.5rem; padding-right: 1.5rem; }
}