:root {
  --bg: #0b0d18;
  --bg-2: #11142a;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-solid: #151833;
  --border: rgba(255, 255, 255, 0.10);
  --text: #eef0ff;
  --muted: #a2a7c6;
  --accent: #6d5efc;
  --accent-2: #19c3b0;
  --danger: #f2555a;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --maxw: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(109, 94, 252, 0.22), transparent 55%),
    radial-gradient(900px 500px at 95% 0%, rgba(25, 195, 176, 0.18), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  backdrop-filter: blur(14px);
  background: rgba(11, 13, 24, 0.72);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 13px; letter-spacing: .5px;
}
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: var(--muted); font-size: 15px; }
.nav a:hover { color: var(--text); }

/* ---------- Layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 80px; }

section { padding: 56px 0; }

/* ---------- Hero ---------- */
.hero { padding-top: 72px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
  color: var(--accent-2);
  font-weight: 700;
  margin: 0 0 10px;
}
.hero h1 {
  font-size: clamp(34px, 6vw, 60px);
  line-height: 1.08;
  margin: 0 0 18px;
  background: linear-gradient(120deg, #ffffff 25%, #b9b4ff 70%, #8ef0e2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead { max-width: 620px; color: var(--muted); font-size: 18px; margin: 0 0 26px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.session-bar {
  display: flex; align-items: center; gap: 14px;
  margin-top: 22px; padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  font-size: 14px;
  width: fit-content;
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #8b7dff);
  color: #fff;
  box-shadow: 0 10px 26px rgba(109, 94, 252, 0.35);
}
.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }
.btn-danger { background: rgba(242, 85, 90, 0.16); color: #ffb3b6; border-color: rgba(242,85,90,.4); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.input {
  width: 100%;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109, 94, 252, 0.25); }
#search { max-width: 380px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
}
.tag.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.count { color: var(--muted); font-size: 14px; margin: 18px 0 12px; }

/* ---------- Grid & cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-3px); border-color: rgba(109, 94, 252, 0.55); }
.card-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.card-title { margin: 0; font-size: 19px; }
.card-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.card-author { margin: 0; color: var(--accent-2); font-size: 14px; font-weight: 600; }
.card-desc { margin: 0; color: var(--muted); font-size: 15px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: rgba(25,195,176,.12); color: #8ef0e2; border: 1px solid rgba(25,195,176,.25); }
.card-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 6px; }
.card-links a { font-size: 14px; color: #b9b4ff; border-bottom: 1px solid transparent; }
.card-links a:hover { border-color: #b9b4ff; }
.card-admin { display: none; padding-top: 6px; border-top: 1px solid var(--border); }
body.editing .card-admin { display: block; }

.empty { color: var(--muted); text-align: center; padding: 40px; border: 1px dashed var(--border); border-radius: var(--radius); }
.hidden { display: none !important; }

/* ---------- About / footer ---------- */
.about h2 { font-size: 28px; margin: 0 0 12px; }
.about p { color: var(--muted); max-width: 720px; }
.note { font-size: 13px; opacity: .8; }
.site-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px;
  max-width: var(--maxw); margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 40px);
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: 14px;
}

/* ---------- Dialogs ---------- */
.dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-solid);
  color: var(--text);
  padding: 26px;
  width: min(440px, 92vw);
  box-shadow: var(--shadow);
}
.dialog-wide { width: min(680px, 94vw); }
.dialog::backdrop { background: rgba(5, 6, 14, 0.68); backdrop-filter: blur(3px); }
.dialog h2 { margin: 0 0 6px; }
.muted { color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font-size: 14px; }
.field > span { color: var(--muted); }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field-full { grid-column: 1 / -1; }
.dialog-actions { display: flex; gap: 10px; margin-top: 22px; align-items: center; }
.spacer { flex: 1; }
.error { color: #ffb3b6; font-size: 14px; margin: 12px 0 0; }

@media (max-width: 620px) {
  .grid-form { grid-template-columns: 1fr; }
  .nav a { display: none; }
}
