/* ============================================
   MITZone.org — Main Stylesheet
   Tech Minimalism / Developer-Friendly Dark Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- CSS Variables --- */
:root {
  --color-bg: #0F172A;
  --color-surface: #1E293B;
  --color-border: #334155;
  --color-text: #E2E8F0;
  --color-muted: #94A3B8;
  --color-blue: #2563EB;
  --color-blue-lt: #3B82F6;
  --color-green: #10B981;
  --color-yellow: #F59E0B;
  --color-red: #EF4444;
  --color-code-bg: #0D1117;

  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
}

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

html {
  scroll-behavior: smooth;
}

/* --- Base --- */
body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-main {
  flex: 1;
  padding: 2.5rem 1.25rem;
}

/* --- Typography --- */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: #fff;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
}

h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.1rem;
}

p {
  color: var(--color-muted);
  margin-bottom: 1rem;
  line-height: 1.8;
}

a {
  color: var(--color-blue-lt);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #fff;
}

strong {
  color: var(--color-text);
}

/* --- Code --- */
code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875em;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  color: #93C5FD;
}

pre {
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-blue);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.875rem;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-text);
  font-size: inherit;
}

/* --- Header / Navbar --- */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
  gap: 1.5rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.nav-logo:hover {
  color: var(--color-blue-lt);
}

.nav-logo-icon {
  font-size: 1.25rem;
}

.text-blue {
  color: var(--color-blue-lt);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  flex: 1;
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-muted);
  text-decoration: none;
  transition: color 0.2s;
  padding-bottom: 0.2rem;
  white-space: nowrap;
}

.nav-link:hover {
  color: #fff;
}

.nav-link--active {
  color: var(--color-blue-lt);
  border-bottom: 2px solid var(--color-blue-lt);
}

/* Language Selector */
.language-selector {
  display: flex;
  align-items: center;
}

.language-selector select {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
  font-family: 'Inter', system-ui, sans-serif;
}

.language-selector select:hover {
  border-color: var(--color-blue-lt);
}

.language-selector select:focus {
  outline: none;
  border-color: var(--color-blue-lt);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-lg {
  font-size: 1rem;
  padding: 0.8rem 1.75rem;
  border-radius: var(--radius-lg);
}

.btn-primary {
  background: var(--color-blue);
  color: #fff;
}

.btn-primary:hover {
  background: #1D4ED8;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.45);
  color: #fff;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: #293548;
  color: #fff;
  border-color: var(--color-blue-lt);
}

.btn-success {
  background: var(--color-green);
  color: #fff;
}

.btn-success:hover {
  background: #059669;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
  color: #fff;
}

/* --- Cards --- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-link {
  display: block;
  text-decoration: none;
  cursor: pointer;
}

.card-link:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  border-color: rgba(59, 130, 246, 0.45);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-bottom: 0;
}

.card-date {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-top: 0.75rem;
}

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 4rem 0 3rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.3);
  color: var(--color-blue-lt);
  font-size: 0.875rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.75rem);
  color: #fff;
  margin-bottom: 1.25rem;
  line-height: 1.2;
}

.hero-desc {
  font-size: 1.15rem;
  color: var(--color-muted);
  max-width: 42rem;
  margin: 0 auto 2.5rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

/* --- Stats Bar --- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.stat-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-blue-lt);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--color-muted);
}

/* --- Generator Section --- */
.generator-section {
  margin: 0;
}

.generator-title {
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
}

.generator-desc {
  color: var(--color-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.generator-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* --- Forms --- */
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #CBD5E1;
}

input,
select,
textarea {
  width: 100%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  color: var(--color-text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

th {
  background: var(--color-surface);
  color: #fff;
  font-weight: 600;
  text-align: left;
  padding: 0.875rem 1rem;
  border-bottom: 2px solid var(--color-border);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-muted);
  vertical-align: middle;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* --- Tags / Badges --- */
.tag {
  display: inline-flex;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.tag:hover {
  border-color: rgba(59, 130, 246, 0.5);
  color: #fff;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid;
}

.badge-blue {
  background: rgba(37, 99, 235, 0.15);
  color: #60A5FA;
  border-color: rgba(37, 99, 235, 0.3);
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border-color: rgba(16, 185, 129, 0.3);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.badge-yellow {
  background: rgba(245, 158, 11, 0.15);
  color: #FCD34D;
  border-color: rgba(245, 158, 11, 0.3);
}

/* --- Article Page --- */
.article {
  max-width: 48rem;
  margin: 0 auto;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: 1.5rem;
}

.breadcrumb a {
  color: var(--color-muted);
}

.breadcrumb a:hover {
  color: #fff;
}

.breadcrumb-sep {
  opacity: 0.4;
}

.article-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.article-desc {
  font-size: 1.1rem;
  color: var(--color-muted);
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.article-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.article-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.article-content ul,
.article-content ol {
  color: var(--color-muted);
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.article-content li {
  margin-bottom: 0.375rem;
}

.article-content blockquote {
  border-left: 4px solid var(--color-blue);
  padding: 0.75rem 1.25rem;
  background: rgba(37, 99, 235, 0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.5rem 0;
}

.article-content blockquote p {
  color: var(--color-text);
  margin: 0;
}

.article-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2rem 0;
}

/* --- List Page --- */
.list-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.list-desc {
  font-size: 1.05rem;
  margin-top: 0.5rem;
}

.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.products-page .list-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.products-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.products-filters {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.products-search,
.products-sort {
  min-width: 220px;
  background: rgba(15, 23, 42, 0.75);
}

.view-switcher {
  display: inline-flex;
  align-self: flex-start;
  gap: 0.5rem;
  padding: 0.35rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}

.view-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: transparent;
  color: var(--color-muted);
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, transform 0.2s;
}

.view-switcher-btn:hover {
  color: #fff;
  background: rgba(59, 130, 246, 0.12);
}

.view-switcher-btn.is-active {
  color: #fff;
  background: var(--color-blue);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
}

.view-switcher-icon {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
}

.view-switcher-icon svg {
  width: 100%;
  height: 100%;
}

.products-view {
  display: grid;
  gap: 1.25rem;
}

.products-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.products-summary {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin: 0;
}

.products-page[data-products-view-state="grid"] [data-products-view-panel="grid"] {
  display: grid;
}

.products-page[data-products-view-state="grid"] [data-products-view-panel="table"] {
  display: none;
}

.products-page[data-products-view-state="table"] [data-products-view-panel="grid"] {
  display: none;
}

.products-page[data-products-view-state="table"] [data-products-view-panel="table"] {
  display: block;
}

.product-card {
  min-height: 100%;
}

.product-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.product-badge {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #93C5FD;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  font-size: 0.82rem;
  color: var(--color-muted);
}

.products-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
}

.products-table {
  margin: 0;
  min-width: 760px;
}

.products-table th,
.products-table td {
  padding: 1rem 1rem;
}

.products-table td {
  color: var(--color-muted);
}

.products-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.product-table-link {
  color: #fff;
  font-weight: 600;
}

.product-table-link:hover {
  color: var(--color-blue-lt);
}

.products-empty {
  padding: 1.25rem 1.5rem;
  background: rgba(37, 99, 235, 0.08);
  border: 1px dashed rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-lg);
  color: var(--color-muted);
}

.products-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  margin-top: 0.25rem;
}

.products-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.products-page-btn:hover:not(:disabled) {
  color: #fff;
  border-color: rgba(59, 130, 246, 0.45);
}

.products-page-btn.is-active {
  color: #fff;
  background: var(--color-blue);
  border-color: transparent;
}

.products-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Footer --- */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  margin-top: 5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  padding: 2.5rem 0;
}

.footer-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.75rem;
}

.footer-heading {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-desc {
  font-size: 0.875rem;
  color: var(--color-muted);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--color-muted);
  transition: color 0.2s;
}

.footer-links a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding: 1.25rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  text-align: center;
}

.footer-bottom p {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin: 0;
}

/* --- HTMX indicator --- */
.htmx-indicator {
  display: none;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.htmx-request .htmx-indicator {
  display: inline-flex;
  animation: pulse 1s infinite;
}

.htmx-request.htmx-indicator {
  display: inline-flex;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* --- Utility --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.text-center {
  text-align: center;
}

.text-blue {
  color: var(--color-blue-lt);
}

.text-green {
  color: var(--color-green);
}

.text-red {
  color: var(--color-red);
}

.text-muted {
  color: var(--color-muted);
}

.mt-4 {
  margin-top: 1rem;
}

.mt-6 {
  margin-top: 1.5rem;
}

.mt-8 {
  margin-top: 2rem;
}

.mt-16 {
  margin-top: 4rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mb-8 {
  margin-bottom: 2rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-menu {
    display: none;
  }

  .hero {
    padding: 2.5rem 0 2rem;
  }

  .stats-bar {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
  }

  .products-toolbar {
    align-items: stretch;
  }

  .products-filters {
    width: 100%;
  }

  .products-search,
  .products-sort {
    width: 100%;
    min-width: 0;
  }

  .view-switcher {
    width: 100%;
    justify-content: stretch;
    border-radius: var(--radius-lg);
  }

  .view-switcher-btn {
    flex: 1;
    justify-content: center;
  }

  .product-card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .product-meta {
    gap: 0.5rem 0.75rem;
  }

  .products-meta-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* --- Contact Form --- */
.contact-section {
  margin-top: 1.5rem;
}

.contact-card {
  max-width: 40rem;
  margin: 0 auto;
}

.contact-title {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.contact-desc {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-bottom: 1.25rem;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Honeypot — скрытое поле от ботов */
.contact-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Turnstile виджет */
.contact-form .cf-turnstile {
  margin-top: 1rem;
}

/* Результат отправки */
#contact-result .badge {
  display: inline-flex;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
}
