* { box-sizing: border-box; }

:root {
  --bg: #14161f;
  --surface: #1c1f2b;
  --surface-2: #23283a;
  --line: #323848;
  --text: #e8eaf0;
  --muted: #a7adc2;
  --html: #ff8a3d;
  --css: #4fa3ff;
  --lime: #c8ff00;
  --pink: #ff6b9d;
  --radius: 14px;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'SN Pro', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(rgba(58, 64, 84, 0.45) 1px, var(--bg) 1px);
  background-size: 22px 22px;
  line-height: 1.6;
}

code, pre { font-family: 'JetBrains Mono', Menlo, monospace; }

main, .hero, .footer, .modal { width: min(1040px, 92%); margin-left: auto; margin-right: auto; }

/* ---------- герой ---------- */
.hero { padding: 58px 0 30px; text-align: center; }
.hero__badge {
  display: inline-block; padding: 8px 20px; border-radius: 999px;
  font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 15px;
  background: var(--surface); border: 1px solid var(--line); color: var(--lime);
  animation: float 3.4s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.hero__title { margin: 20px 0 0; font-size: clamp(30px, 5.5vw, 54px); line-height: 1.15; letter-spacing: -1px; }
.hero__lead { max-width: 680px; margin: 18px auto 0; color: var(--muted); font-size: 17px; }
.hero__lead b { color: var(--text); }
.hero__nav { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }
.hero__link {
  text-decoration: none; font-size: 14.5px; font-weight: 700;
  padding: 10px 18px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.hero__link:hover { transform: translateY(-3px); border-color: var(--lime); box-shadow: 0 8px 20px rgba(200, 255, 0, .14); }
.accent-html-bg { background: rgba(255, 138, 61, .14); border-color: rgba(255, 138, 61, .45); color: var(--html); }
.accent-css-bg { background: rgba(79, 163, 255, .14); border-color: rgba(79, 163, 255, .45); color: var(--css); }
.accent-html { color: var(--html); text-shadow: 0 0 30px rgba(255, 138, 61, .35); }
.accent-css { color: var(--css); text-shadow: 0 0 30px rgba(79, 163, 255, .35); }

/* ---------- секции ---------- */
section.info, section.tags { padding: 34px 0; scroll-margin-top: 16px; border-radius: 12px; transition: background .4s, box-shadow .4s; }
section.is-flash { background: rgba(200, 255, 0, .06); box-shadow: 0 0 0 2px rgba(200, 255, 0, .45); }
.section-title {
  margin: 0 0 8px; font-size: clamp(22px, 3.4vw, 30px);
  display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-lead { margin: 0 0 22px; color: var(--muted); max-width: 760px; }
.section-lead b { color: var(--text); }

/* ---------- карточки-объяснения ---------- */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  transition: transform .2s, border-color .2s;
}
.card:hover { transform: translateY(-4px); border-color: #48506a; }
.card__title { margin: 0 0 8px; font-size: 17px; }
.card__title::before { content: "◆ "; color: var(--lime); font-size: 12px; vertical-align: 2px; }
.card__text { margin: 0; font-size: 14.5px; color: var(--muted); }
.card__text code, .section-lead code {
  padding: 1px 6px; border-radius: 6px; font-size: .92em;
  background: #10121a; border: 1px solid var(--line); color: var(--lime);
}
pre.code {
  display: block; margin: 12px 0 0; padding: 10px 12px;
  background: #10121a; border: 1px solid var(--line); border-radius: 10px;
  font-size: 12.5px; line-height: 1.5; color: #b9f6a2;
  white-space: pre-wrap; word-break: break-word; overflow-x: auto;
}

/* ---------- поиск и фильтры ---------- */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.search {
  flex: 1 1 240px; padding: 11px 18px; font-size: 15px; font-family: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); outline: none; transition: border-color .2s, box-shadow .2s;
}
.search:focus { border-color: var(--lime); box-shadow: 0 0 0 4px rgba(200, 255, 0, .12); }
.search::placeholder { color: #7c melhor; color: #767d95; }
.filters { gap: 8px !important; }
.filt {
  padding: 9px 15px; font-size: 13.5px; font-family: inherit; cursor: pointer;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; transition: .18s;
}
.filt:hover { color: var(--text); border-color: #48506a; }
.filt.is-active { background: var(--lime); color: #171a10; border-color: var(--lime); font-weight: 700; }
.empty { color: var(--muted); font-size: 14px; min-height: 20px; margin: 12px 0 0; }

/* ---------- кнопки-теги ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font-family: 'JetBrains Mono', Menlo, monospace; font-size: 15px; font-weight: 600;
  color: var(--text); cursor: pointer;
  padding: 10px 18px; border-radius: 12px;
  background: linear-gradient(180deg, #262c3e, #1e2333);
  border: 1px solid #3b4360; border-bottom-width: 3px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.chip::before { content: "<"; color: var(--html); opacity: .85; margin-right: 2px; }
.chip::after { content: ">"; color: var(--css); opacity: .85; margin-left: 2px; }
.chip:hover { transform: translateY(-3px); border-color: var(--lime); box-shadow: 0 8px 20px rgba(200, 255, 0, .13); }
.chip:active { transform: translateY(1px); border-bottom-width: 1px; }
.chip.is-hidden { display: none; }
.chip--css::before { content: none; }
.chip--css { font-family: 'SN Pro', sans-serif; font-weight: 700; }
.chip--css::after { content: ": …;"; color: var(--css); font-family: 'JetBrains Mono', monospace; font-weight: 400; opacity: .7; }

/* ---------- модалка ---------- */
.modal { position: fixed; inset: 0; z-index: 100; width: auto; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(8, 9, 14, .75); backdrop-filter: blur(4px); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal__card {
  position: relative; width: min(660px, 100%); max-height: 88vh; overflow: auto;
  background: var(--surface); border: 1px solid #414a66; border-radius: 18px;
  padding: 26px; animation: pop .25s cubic-bezier(.2, 1.4, .5, 1);
}
@keyframes pop { from { opacity: 0; transform: translateY(22px) scale(.94); } }
.modal__close {
  position: absolute; top: 14px; right: 14px; width: 36px; height: 36px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font-size: 17px; cursor: pointer; transition: .18s;
}
.modal__close:hover { background: var(--pink); border-color: var(--pink); transform: rotate(90deg); }
.modal__cat { font-size: 12.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.modal__title { margin: 6px 44px 4px 0; font-family: 'JetBrains Mono', monospace; font-size: clamp(24px, 5vw, 34px); word-break: break-all; }
.modal__title .lt { color: var(--html); }
.modal__desc { margin: 14px 0; font-size: 16px; }
.modal__lbl { margin: 18px 0 6px; font-size: 12.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--lime); }
.modal__lbl::before { content: "▸ "; }
.modal__attrs { font-size: 14.5px; color: var(--muted); }
.modal pre {
  margin: 0; padding: 14px 16px; background: #10121a; border: 1px solid var(--line);
  border-radius: 12px; font-size: 13.5px; line-height: 1.55; color: #b9f6a2;
  white-space: pre-wrap; word-break: break-word; overflow-x: auto;
}
.demo-stage {
  padding: 16px; border: 2px dashed #414a66; border-radius: 12px;
  background: rgba(16, 18, 26, .75); font-size: 15px; color: var(--text);
  overflow: auto; min-height: 64px;
}
.d-live { font-size: 15px; }
.d-canvas { display: block; background: #10121a; border-radius: 8px; max-width: 100%; }

/* ---------- демо-стили внутри модалки ---------- */
.d-box { padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.d-hd { padding: 10px 12px; background: linear-gradient(90deg, rgba(255, 138, 61, .2), transparent); border-left: 4px solid var(--html); border-radius: 6px; font-weight: 700; }
.d-ft { padding: 10px 12px; background: linear-gradient(90deg, rgba(79, 163, 255, .2), transparent); border-left: 4px solid var(--css); border-radius: 6px; }
.d-nav { display: flex; gap: 14px; flex-wrap: wrap; }
.d-nav a, .d-link { color: var(--css); font-weight: 600; }
.d-code { display: block; padding: 10px 12px; background: #10121a; border: 1px solid var(--line); border-radius: 8px; color: #b9f6a2; font-family: 'JetBrains Mono', monospace; font-size: 13px; white-space: pre-wrap; }
code.d-code { display: inline; padding: 2px 6px; white-space: normal; }
.d-img { padding: 14px; text-align: center; background: var(--surface-2); border: 1px dashed #48506a; border-radius: 10px; font-size: 13.5px; color: var(--muted); }
.d-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.d-form input, .d-input, .d-select {
  padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); font-size: 14px; font-family: inherit;
}
.d-btn {
  padding: 8px 18px; background: var(--lime); color: #171a10; font-weight: 700;
  font-family: inherit; border: none; border-radius: 8px; cursor: pointer; transition: .15s;
}
.d-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(200, 255, 0, .3); }
.d-label { font-size: 14px; color: var(--muted); }
.d-area { width: 100%; min-height: 64px; padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-size: 14px; font-family: inherit; }
.d-table { border-collapse: collapse; font-size: 14px; width: 100%; }
.d-table th, .d-table td { border: 1px solid var(--line); padding: 7px 12px; text-align: left; }
.d-table th { background: var(--surface-2); color: var(--lime); }
.d-details { font-size: 14.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.d-list { margin: 4px 0; padding-left: 22px; }
.d-list li { margin: 3px 0; }
.d-quote { margin: 0; padding: 8px 14px; border-left: 4px solid var(--pink); background: rgba(255, 107, 157, .08); border-radius: 0 8px 8px 0; font-style: italic; }
.d-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--lime); color: #171a10; font-weight: 700; font-size: 14px;
  padding: 10px 20px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: .3s; z-index: 200;
}
.d-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- подвал ---------- */
.footer {
  border-top: 1px solid var(--line); margin-top: 34px; padding: 24px 0 44px;
  text-align: center; color: var(--muted); font-size: 14.5px;
}

@media (max-width: 560px) {
  .hero__nav a { padding: 9px 14px; font-size: 13.5px; }
  .modal__card { padding: 20px; }
}
