/* === 1. ПЕРЕМЕННЫЕ (Тёмная тема по умолчанию) === */
:root {
  --bg-color: #0f172a;         /* Тёмный фон страницы */
  --container-bg: #1e293b;     /* Чуть светлее для карточки */
  --text-color: #e2e8f0;       /* Светлый текст */
  --heading-color: #f8fafc;    /* Заголовки */
  --accent-color: #38bdf8;     /* Голубой акцент (вместо синего) */
  --border-color: #334155;     /* Границы */
  --tag-bg: #334155;           /* Фон тегов */
  --tag-text: #e2e8f0;         /* Текст тегов */
  --detail-label: #94a3b8;     /* Подписи (Масштаб, Стек и т.д.) */
  --shadow-color: rgba(0, 0, 0, 0.5);
}

/* === 2. ПЕРЕКЛЮЧЕНИЕ НА СВЕТЛУЮ ТЕМУ === */
[data-theme="light"] {
  --bg-color: #f8fafc;
  --container-bg: #ffffff;
  --text-color: #1e293b;
  --heading-color: #0f172a;
  --accent-color: #2563eb;     /* Возвращаем яркий синий */
  --border-color: #e2e8f0;
  --tag-bg: #f1f5f9;
  --tag-text: #334155;
  --detail-label: #0f172a;
  --shadow-color: rgba(0, 0, 0, 0.08);
}

/* === 3. БАЗОВЫЕ СТИЛИ (используют переменные) === */
* { box-sizing: border-box; }

body {
  font-family: 'Tahoma', 'Verdana', sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
  font-size: 13px;
  padding: 20px;
  margin: 0;
  transition: background 0.3s ease, color 0.3s ease; /* Плавный переход */
}

.container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--container-bg);
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow-color);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--heading-color);
  margin: 0 0 4px 0;
}

.subtitle {
  font-size: 15px;
  color: var(--accent-color);
  font-weight: 600;
  margin-bottom: 12px;
}

.contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--detail-label);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.contacts a { color: var(--accent-color); text-decoration: none; }
.contacts a:hover { text-decoration: underline; }

h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--heading-color);
  margin-top: 20px;
  margin-bottom: 10px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--accent-color);
  display: inline-block;
}

.section { margin-bottom: 16px; }

.job {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border-color);
}

.job:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.job-title { font-size: 14px; font-weight: 700; color: var(--heading-color); }
.job-company { font-size: 14px; font-weight: 700; color: var(--accent-color); }
.job-date { font-size: 12px; color: var(--detail-label); font-weight: 600; }

.project { margin-top: 10px; margin-bottom: 14px; }
.project-title { font-size: 13px; font-weight: 700; color: var(--text-color); margin-bottom: 6px; opacity: 0.9; }

.detail-row { margin-bottom: 4px; }
.detail-label { font-weight: 700; color: var(--detail-label); font-size: 12px; }
.detail-text { color: var(--text-color); font-size: 12.5px; }

.stack { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }

.tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
}

ul { padding-left: 18px; margin-top: 4px; margin-bottom: 6px; }
li { margin-bottom: 3px; color: var(--text-color); font-size: 12.5px; line-height: 1.4; }

.skills-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.skill-category { margin-bottom: 8px; }
.skill-category-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-color);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.about-text { font-size: 12.5px; line-height: 1.5; color: var(--text-color); }

/* === 4. ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ (TOGGLE) === */
.theme-toggle-wrapper {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.theme-toggle {
  appearance: none;
  width: 52px;
  height: 28px;
  background: var(--border-color);
  border-radius: 50px;
  position: relative;
  cursor: pointer;
  outline: none;
  transition: background 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* Кружок переключателя */
.theme-toggle::after {
  content: '🌙'; /* Луна по умолчанию (тёмная тема) */
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Состояние: включено (Светлая тема) */
.theme-toggle:checked {
  background: var(--accent-color);
}

.theme-toggle:checked::after {
  content: '☀️'; /* Солнце при включении */
  transform: translateX(24px);
}

/* === 5. КНОПКА PDF === */
.pdf-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--accent-color);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 14px 24px;
  font-family: 'Tahoma', 'Verdana', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  z-index: 1000;
}

.pdf-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

/* === 6. НАСТРОЙКИ ДЛЯ ПЕЧАТИ (Всегда светлая!) === */
@media print {
  /* Принудительно сбрасываем переменные на светлые для экономии чернил */
  :root, [data-theme="light"], [data-theme="dark"] {
    --bg-color: #ffffff !important;
    --container-bg: #ffffff !important;
    --text-color: #0f172a !important;
    --heading-color: #0f172a !important;
    --accent-color: #2563eb !important;
    --border-color: #e2e8f0 !important;
    --tag-bg: #f1f5f9 !important;
    --tag-text: #334155 !important;
    --detail-label: #0f172a !important;
    --shadow-color: transparent !important;
  }

  body { background: var(--bg-color); color: var(--text-color); padding: 0; }
  .container { box-shadow: none; padding: 10px 15px; max-width: 100%; margin: 0; }
  a { text-decoration: none; color: #0f172a !important; }
  
  .job, .project { break-inside: auto !important; page-break-inside: auto !important; }
  .job-header, .project-title, .detail-row, .skill-category, li { break-inside: avoid !important; page-break-inside: avoid !important; }
  h2, .job-company, .project-title { break-after: avoid; page-break-after: avoid; }

  /* Скрываем переключатель и кнопку PDF при печати */
  .no-print { display: none !important; }
}

@media (max-width: 480px) {
  body { padding: 10px; }
  .container { padding: 20px; }
  .theme-toggle-wrapper { top: 10px; right: 10px; }
  .pdf-btn { bottom: 20px; right: 20px; padding: 12px 18px; font-size: 13px; }
}
