/* =========================================================
   main.css — reset, переменные, типографика, layout
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; line-height: 1.5; -webkit-font-smoothing: antialiased; }
img, picture, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font: inherit; color: inherit; }
ul, ol { list-style: none; }

:root {
  --bg:        #f8fafc;
  --bg-elev:   #ffffff;
  --bg-soft:   #f1f5f9;
  --border:    #e2e8f0;

  --text:       #0f172a;
  --text-muted: #64748b;

  --primary:       #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft:  #dbeafe;

  --success: #16a34a;
  --warning: #d97706;
  --danger:  #dc2626;

  --radius:    10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow:    0 4px 12px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .14);

  --transition: 160ms ease;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --container: 1200px;
  --header-h: 64px;
}

[data-theme="dark"] {
  --bg:        #0f172a;
  --bg-elev:   #1e293b;
  --bg-soft:   #1e293b;
  --border:    #334155;

  --text:       #f1f5f9;
  --text-muted: #94a3b8;

  --primary:       #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft:  #1e3a8a;

  --success: #22c55e;
  --warning: #f59e0b;
  --danger:  #ef4444;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow:    0 4px 12px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  transition: background-color var(--transition), color var(--transition);
}

h1 { font-size: clamp(24px, 4vw, 36px); line-height: 1.2; font-weight: 800; }
h2 { font-size: clamp(20px, 3vw, 28px); line-height: 1.3; font-weight: 700; }
h3 { font-size: 18px; line-height: 1.4; font-weight: 700; }
p  { line-height: 1.6; }

a { color: var(--primary); transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

.muted { color: var(--text-muted); }
.hidden { display: none !important; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.app-main {
  min-height: calc(100vh - var(--header-h) - 80px);
  padding-bottom: var(--space-6);
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-4);
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.app-header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
}

.logo-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-weight: 800;
}

.app-header__nav {
  display: none;
  gap: var(--space-4);
  margin-left: var(--space-5);
}
.app-header__nav a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.app-header__nav a:hover,
.app-header__nav a.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 18px;
  transition: background-color var(--transition);
}
.theme-toggle:hover { background: var(--bg-soft); }

@media (min-width: 768px) {
  .app-header { padding: 0 var(--space-5); }
  .app-header__nav { display: flex; }
}

/* Footer */
.app-footer {
  padding: var(--space-5) 0;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}
.app-footer p { margin: 4px 0; }

/* Utility */
.text-center { text-align: center; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* Section */
.section { margin-bottom: var(--space-6); }
.section__title { margin-bottom: var(--space-4); }

/* Grid */
.grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(3, 1fr); } }