:root {
  --bg: #0f1117;
  --bg-alt: #151924;
  --surface: #1c2130;
  --border: #2a3142;
  --text: #e6e8ee;
  --muted: #9aa3b5;
  --accent: #6c8cff;
  --accent-hover: #8aa3ff;
  --error: #ff6b6b;
  --success: #4cd4a0;
  --radius: 12px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.container--narrow {
  max-width: 640px;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
}

.logo span {
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 28px;
}

.nav a {
  color: var(--muted);
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav a:hover,
.nav a.active {
  color: var(--text);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.menu-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s, opacity 0.2s;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn--primary {
  background: var(--accent);
  color: #0b0d14;
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--ghost {
  border-color: var(--border);
  color: var(--text);
}

.btn--ghost:hover {
  border-color: var(--accent);
}

.btn--full {
  width: 100%;
}

/* Hero */
.hero {
  padding: 120px 0 100px;
  background: radial-gradient(ellipse at top, rgba(108, 140, 255, 0.15), transparent 60%);
}

.hero__tag {
  display: inline-block;
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.hero__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.15;
  max-width: 760px;
  margin-bottom: 20px;
}

.hero__title span {
  color: var(--accent);
}

.hero__text {
  color: var(--muted);
  max-width: 600px;
  font-size: 1.1rem;
  margin-bottom: 32px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Sections */
.section {
  padding: 90px 0;
}

.section--alt {
  background: var(--bg-alt);
}

.section__title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin-bottom: 8px;
}

.section__subtitle {
  color: var(--muted);
  margin-bottom: 40px;
}

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.card__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(108, 140, 255, 0.12);
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 16px;
}

.card h3 {
  margin-bottom: 8px;
}

.card p {
  color: var(--muted);
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 28px;
}

.toolbar .input {
  flex: 1 1 260px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.filter:hover {
  color: var(--text);
}

.filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0d14;
}

/* Posts */
.posts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.post {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.post:hover,
.post:focus-visible {
  transform: translateY(-4px);
  border-color: var(--accent);
  outline: none;
}

.post__tag {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 10px;
}

.post h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.post p {
  color: var(--muted);
  font-size: 0.95rem;
  flex: 1;
}

.post__meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 16px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

/* Form */
.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form__group label {
  font-size: 0.9rem;
  font-weight: 500;
}

.input {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
}

.input.invalid {
  border-color: var(--error);
}

textarea.input {
  resize: vertical;
}

.form__error {
  color: var(--error);
  font-size: 0.8rem;
  min-height: 1em;
}

.form__success {
  color: var(--success);
  text-align: center;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal__content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
}

.modal__content h2 {
  font-size: 1.6rem;
  line-height: 1.25;
  padding-right: 24px;
}

.modal__body {
  margin-top: 20px;
  color: #cdd2dd;
}

.modal__body p + p {
  margin-top: 14px;
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.modal__close:hover {
  color: var(--text);
}

body.no-scroll {
  overflow: hidden;
}

/* Mobile */
@media (max-width: 720px) {
  .menu-toggle {
    display: flex;
  }

  .nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: none;
  }

  .nav.open {
    display: flex;
  }

  .nav a {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
  }

  .menu-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .menu-toggle.open span:nth-child(2) {
    opacity: 0;
  }

  .menu-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .hero {
    padding: 80px 0 70px;
  }

  .section {
    padding: 64px 0;
  }

  .modal__content {
    padding: 28px 20px;
  }
}
