/* ===== CSS Variables ===== */
:root {
  --color-bg: #ffffff;
  --color-text: #2d2d2d;
  --color-text-secondary: #5a5a5a;
  --color-text-light: #777777;
  --color-accent: #1B3A5C;
  --color-accent-light: #2a5580;
  --color-accent-hover: #143050;
  --color-sidebar-bg: #f5f6f8;
  --color-sidebar-border: #e2e4e8;
  --color-card-hover: #eaecf0;
  --color-card-active: #dde3ed;
  --color-border: #d8dbe0;
  --color-border-light: #eceef1;
  --color-code-bg: #f4f5f7;
  --color-header-bg: #1B3A5C;
  --color-header-text: #ffffff;
  --color-footer-bg: #f5f6f8;

  --sidebar-width: 250px;
  --header-height: 64px;
  --font-family: 'Georgia', 'Times New Roman', 'Noto Serif', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Courier New', monospace;

  --radius: 6px;
  --radius-sm: 3px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --transition: 0.2s ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--color-accent-light);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--color-header-bg);
  color: var(--color-header-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-info {
  display: flex;
  flex-direction: column;
}

.header-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
  font-family: var(--font-sans);
}

.header-title {
  font-size: 0.75rem;
  opacity: 0.7;
  font-weight: 400;
  line-height: 1.3;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-links {
  display: flex;
  gap: 12px;
  align-items: center;
}

.header-links a {
  color: var(--color-header-text);
  opacity: 0.7;
  transition: opacity var(--transition);
  display: flex;
  align-items: center;
}

.header-links a:hover {
  opacity: 1;
  text-decoration: none;
}

/* ===== Menu Toggle (Mobile) ===== */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-header-text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

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

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== Language Toggle ===== */
.lang-toggle {
  display: flex;
  background: rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 2px;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--color-header-text);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 18px;
  cursor: pointer;
  transition: all var(--transition);
  opacity: 0.55;
  font-family: var(--font-sans);
}

.lang-btn:hover {
  opacity: 0.8;
}

.lang-btn.active {
  background: rgba(255,255,255,0.2);
  opacity: 1;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-sidebar-border);
  overflow-y: auto;
  z-index: 90;
  padding: 16px 0;
  transition: transform 0.3s ease;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 89;
}

.nav-list {
  list-style: none;
  padding: 0 10px;
}

.nav-item {
  display: block;
  margin-bottom: 2px;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
  font-family: var(--font-sans);
}

.nav-item a:hover {
  background: var(--color-card-hover);
  text-decoration: none;
}

.nav-item a.active {
  background: var(--color-card-active);
  color: var(--color-accent);
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.5;
}

.nav-item a.active .nav-icon {
  opacity: 0.9;
}

/* ===== Main Content ===== */
.main {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
  padding: 0;
  display: flex;
  flex-direction: column;
}

.content-header {
  position: sticky;
  top: var(--header-height);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 40px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border-light);
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
}

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

.download-btn:active {
  transform: scale(0.97);
}

.download-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-light);
  font-size: 0.8rem;
  padding: 7px 12px;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.github-link:hover {
  background: var(--color-code-bg);
  text-decoration: none;
  color: var(--color-text);
}

/* ===== Loading ===== */
.loading {
  display: none;
  justify-content: center;
  align-items: center;
  padding: 80px 0;
}

.loading.active {
  display: flex;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================================
   RESUME CONTENT — PDF-style design
   ========================================= */

.resume-content {
  max-width: 860px;
  padding: 40px 44px;
  line-height: 1.65;
  font-size: 0.95rem;
}

.resume-content.hidden {
  display: none;
}

/* ===== Resume Header Block ===== */
.resume-header {
  margin-bottom: 0;
}

.resume-name {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--color-text);
  letter-spacing: 0.02em;
  line-height: 1.1;
  font-family: var(--font-sans);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.resume-role {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  font-family: var(--font-sans);
  margin-bottom: 8px;
}

.resume-contact {
  font-size: 0.85rem;
  color: var(--color-text-light);
  line-height: 1.6;
}

.resume-contact a {
  color: var(--color-text-light);
  border-bottom: none;
}

.resume-contact a:hover {
  color: var(--color-accent);
}

/* Header separator line */
hr.header-separator {
  border: none;
  height: 2px;
  background: var(--color-accent);
  margin: 16px 0 8px 0;
}

/* ===== Section Headers (H2) ===== */
.resume-content h2 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-top: 28px;
  margin-bottom: 12px;
  padding-bottom: 7px;
  border-bottom: 3px solid var(--color-accent);
  color: var(--color-accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--font-sans);
}

/* ===== Job Titles (H3) — with date layout ===== */
.resume-content h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 20px;
  margin-bottom: 6px;
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.4;
}

/* Job header container (generated by JS) */
.job-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-top: 20px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.job-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  font-family: var(--font-sans);
}

.job-dates {
  font-size: 0.88rem;
  font-style: italic;
  color: var(--color-text-light);
  white-space: nowrap;
  flex-shrink: 0;
}

/* H4 */
.resume-content h4 {
  font-size: 0.92rem;
  font-weight: 700;
  margin-top: 14px;
  margin-bottom: 4px;
  color: var(--color-text-secondary);
  font-family: var(--font-sans);
}

/* ===== Paragraphs ===== */
.resume-content p {
  margin-bottom: 8px;
  font-size: 0.93rem;
}

/* Job description paragraphs (after job header) */
.job-header + p {
  color: var(--color-text);
  font-size: 0.9rem;
  line-height: 1.65;
  margin-bottom: 8px;
}

/* Stack paragraphs — bold label (Stack:, Стек:) in accent color */
.resume-content p > strong:first-child {
  color: var(--color-accent);
  font-weight: 700;
  font-family: var(--font-sans);
}

/* ===== Lists ===== */
.resume-content ul,
.resume-content ol {
  margin-bottom: 10px;
  padding-left: 24px;
}

.resume-content li {
  margin-bottom: 3px;
  font-size: 0.93rem;
  line-height: 1.6;
}

.resume-content li::marker {
  color: var(--color-accent);
  font-weight: bold;
}

/* Tech expertise list — bold labels inline */
.resume-content h2 + ul {
  list-style: none;
  padding-left: 0;
}

.resume-content h2 + ul li {
  margin-bottom: 5px;
  padding: 1px 0;
  font-size: 0.9rem;
  line-height: 1.55;
}

/* ===== Strong / Bold ===== */
.resume-content strong {
  font-weight: 700;
  color: var(--color-text);
}

/* ===== Horizontal Rules ===== */
.resume-content hr {
  border: none;
  height: 1px;
  background: var(--color-border);
  margin: 24px 0;
}

/* ===== Code ===== */
.resume-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-code-bg);
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  color: var(--color-accent);
}

.resume-content pre {
  background: var(--color-code-bg);
  padding: 14px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 14px;
  border: 1px solid var(--color-border-light);
}

.resume-content pre code {
  background: none;
  padding: 0;
  color: var(--color-text);
}

/* ===== Links in Resume ===== */
.resume-content a {
  color: var(--color-accent-light);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all var(--transition);
}

.resume-content a:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent-light);
  text-decoration: none;
}

/* ===== Tables ===== */
.resume-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.resume-content th,
.resume-content td {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  text-align: left;
}

.resume-content th {
  background: var(--color-code-bg);
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

/* ===== Blockquotes ===== */
.resume-content blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 8px 16px;
  margin: 12px 0;
  background: var(--color-sidebar-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-text-secondary);
  font-style: italic;
}

/* ===== Footer ===== */
.footer {
  margin-left: var(--sidebar-width);
  padding: 18px 40px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-text-light);
  border-top: 1px solid var(--color-border-light);
  background: var(--color-footer-bg);
}

/* =========================================
   RESPONSIVE
   ========================================= */

/* Tablet */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 210px;
  }

  .resume-content {
    padding: 28px 28px;
  }
}

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

  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: var(--shadow-md);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main {
    margin-left: 0;
  }

  .footer {
    margin-left: 0;
  }

  .content-header {
    padding: 8px 16px;
  }

  .resume-content {
    padding: 24px 18px;
  }

  .resume-content h1 {
    font-size: 1.6rem;
  }

  .resume-content h2 {
    font-size: 1.05rem;
  }

  .job-header {
    flex-direction: column;
    gap: 2px;
  }

  .job-dates {
    font-size: 0.82rem;
  }

  .header-title {
    display: none;
  }

  .header-name {
    font-size: 1rem;
  }

  .header-links {
    display: none;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 0 12px;
  }

  .resume-content {
    padding: 18px 14px;
  }

  .resume-content h1 {
    font-size: 1.4rem;
  }

  .download-btn span {
    display: none;
  }

  .download-btn {
    padding: 7px 10px;
  }

  .github-link span {
    display: none;
  }
}

/* ===== Print Styles ===== */
@media print {
  .header,
  .sidebar,
  .sidebar-overlay,
  .content-header,
  .footer,
  .menu-toggle {
    display: none !important;
  }

  .main {
    margin-left: 0;
    margin-top: 0;
  }

  .resume-content {
    max-width: 100%;
    padding: 0;
    line-height: 1.35;
  }

  .resume-content h2 {
    border-bottom-color: var(--color-accent);
    color: var(--color-accent);
    margin-top: 12px;
    margin-bottom: 6px;
    padding-bottom: 3px;
    font-size: 0.95rem;
  }

  .resume-content h3,
  .job-header {
    margin-top: 10px;
    margin-bottom: 3px;
    font-size: 0.88rem;
  }

  .resume-content p {
    margin-bottom: 4px;
    font-size: 0.82rem;
  }

  .resume-content li {
    margin-bottom: 1px;
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .resume-content ul,
  .resume-content ol {
    margin-bottom: 4px;
    padding-left: 16px;
  }

  .resume-content hr {
    margin: 10px 0;
  }

  .resume-name {
    font-size: 1.6rem;
    margin-bottom: 2px;
  }

  .resume-role {
    font-size: 0.88rem;
    margin-bottom: 4px;
  }

  .resume-contact {
    font-size: 0.75rem;
  }

  hr.header-separator {
    margin: 8px 0 4px 0;
  }

  body {
    font-size: 9pt;
  }
}

/* ===== Page Break Control (PDF) ===== */
.resume-content h2 {
  page-break-after: avoid;
}

.resume-content h3,
.job-header {
  page-break-after: avoid;
}

.resume-content ul,
.resume-content ol {
  page-break-inside: avoid;
}

/* ===== Error state ===== */
.error {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-secondary);
}

.error-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.error-text {
  font-size: 1rem;
  margin-bottom: 8px;
}

.error-hint {
  font-size: 0.85rem;
  opacity: 0.7;
}
