/* =============================================================================
   CSS VARIABLES — Two-column CV design, red/dark-red accent
   ============================================================================= */

:root {
  /* Brand colors */
  --color-accent:         #7B3A10;   /* brown — headings, icons, borders */
  --color-accent-light:   #9a4d1a;   /* hover state */
  --color-accent-bg:      #f5ede6;   /* very light brown tint for section headers */

  /* Sidebar */
  --color-sidebar-bg:     #ffffff;
  --color-sidebar-border: #e0e0e0;

  /* Main content */
  --color-main-bg:        #ffffff;

  /* Page background */
  --color-page-bg:        #f0f0f0;

  /* Text */
  --color-text:           #222222;
  --color-text-muted:     #555555;
  --color-text-light:     #888888;

  /* Misc */
  --color-border:         #dddddd;
  --color-surface:        #ffffff;

  /* Typography */
  --font-family-base:     "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto,
                          "Helvetica Neue", Arial, sans-serif;
  --font-size-base:       0.875rem;   /* 14px */
  --font-size-sm:         0.8125rem;  /* 13px */
  --font-size-xs:         0.75rem;    /* 12px */
  --font-size-lg:         1rem;       /* 16px */
  --font-size-xl:         1.125rem;   /* 18px */
  --font-size-2xl:        1.375rem;   /* 22px */
  --line-height-base:     1.55;

  /* Spacing */
  --space-xs:   0.25rem;
  --space-sm:   0.5rem;
  --space-md:   0.875rem;
  --space-lg:   1.25rem;
  --space-xl:   1.75rem;

  /* Layout */
  --sidebar-width:        240px;
  --cv-max-width:         860px;
  --border-radius:        4px;
  --shadow:               0 2px 16px rgba(0,0,0,0.13);
}

/* =============================================================================
   RESET & BASE
   ============================================================================= */

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

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-page-bg);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

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

ul {
  list-style: none;
  padding-left: 0;
}

li {
  margin-bottom: var(--space-xs);
}

/* =============================================================================
   TOP MENU BAR — outside the CV frame
   ============================================================================= */

.top-menu {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #ffffff;
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.top-menu-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--cv-max-width);
  margin: 0 auto;
  padding: 0.5rem var(--space-lg);
  gap: var(--space-md);
}

.top-menu-social {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.top-menu-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius);
  color: var(--color-text-muted);
  transition: color 0.2s, background-color 0.2s;
  text-decoration: none;
}

.top-menu-social-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.top-menu-social-link:hover,
.top-menu-social-link:focus {
  color: var(--color-accent);
  background-color: var(--color-accent-bg);
  text-decoration: none;
}

.top-menu-controls {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.top-menu-divider {
  width: 1px;
  height: 1.25rem;
  background-color: var(--color-border);
  flex-shrink: 0;
}

/* =============================================================================
   CV WRAPPER — Two-column layout
   ============================================================================= */

.cv-wrapper {
  display: flex;
  max-width: var(--cv-max-width);
  margin: var(--space-xl) auto;
  box-shadow: var(--shadow);
  background: var(--color-surface);
  border-radius: var(--border-radius);
  overflow: hidden;
  min-height: 100vh;
}

/* =============================================================================
   SIDEBAR (LEFT COLUMN)
   ============================================================================= */

.cv-sidebar {
  flex: 10;
  min-width: 0;
  background-color: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-sidebar-border);
  padding: 0 0 var(--space-xl);
}

/* --- Photo area --- */

.sidebar-photo-wrap {
  background-color: #f7f7f7;
  border-bottom: 1px solid var(--color-sidebar-border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) var(--space-md) var(--space-sm);
}

.sidebar-photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-border);
  display: block;
}

.sidebar-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  width: 200px;
  height: 200px;
  border: 2px dashed #cccccc;
  border-radius: 50%;
  background-color: #eeeeee;
}

.sidebar-photo-placeholder svg {
  width: 32px;
  height: 32px;
  color: #aaaaaa;
}

.sidebar-photo-placeholder span {
  font-size: 0.625rem;   /* 10px */
  color: var(--color-text-light);
  text-align: center;
  line-height: 1.2;
  padding: 0 6px;
}

/* --- Contact info --- */

.sidebar-contact {
  padding: var(--space-md) var(--space-md) var(--space-sm);
  border-bottom: 1px solid var(--color-sidebar-border);
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  word-break: break-word;
}

.contact-icon {
  flex-shrink: 0;
  font-size: var(--font-size-base);
  line-height: 1.4;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.contact-icon svg {
  display: block;
  color: var(--color-accent);
}

.contact-icon img {
  display: block;
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.contact-item a {
  color: var(--color-text);
  /* Keep links on a single line — no wrapping, no truncation */
  white-space: nowrap;
}

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

/* --- Sidebar sections --- */

.sidebar-section {
  padding: var(--space-md) var(--space-md) var(--space-sm);
  border-bottom: 1px solid var(--color-sidebar-border);
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-sm);
}

.sidebar-section-icon {
  font-size: var(--font-size-lg);
  line-height: 1;
}

/* --- Skills --- */

.sidebar-skill {
  margin-bottom: var(--space-sm);
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

.sidebar-skill strong {
  display: block;
  color: var(--color-text);
  font-weight: 700;
  margin-bottom: 1px;
}

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

/* --- Education (sidebar) --- */

.sidebar-education-entry {
  margin-bottom: var(--space-sm);
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

.sidebar-edu-institution {
  display: block;
  color: var(--color-text);
  font-weight: 700;
}

.sidebar-edu-degree {
  display: block;
  color: var(--color-text-muted);
}

.sidebar-edu-period {
  display: block;
  color: var(--color-accent);
  font-size: var(--font-size-xs);
  font-style: italic;
}

.sidebar-edu-desc {
  display: block;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  margin-top: 2px;
}

/* --- References --- */

.sidebar-reference {
  margin-bottom: var(--space-sm);
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

.sidebar-reference strong {
  display: block;
  color: var(--color-text);
  font-weight: 700;
}

.sidebar-reference span {
  display: block;
  color: var(--color-text-muted);
}

/* --- Hobbies --- */

.sidebar-hobby {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  font-size: var(--font-size-sm);
}

.hobby-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

/* --- Other info --- */

.sidebar-other-info {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  word-break: break-word;
}

/* =============================================================================
   MAIN CONTENT (RIGHT COLUMN)
   ============================================================================= */

.cv-main {
  flex: 17;
  padding: var(--space-lg) var(--space-xl) var(--space-xl);
  min-width: 0;
}

/* --- Toolbar (language switcher + action buttons) --- */

.cv-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.language-switcher {
  display: flex;
  gap: var(--space-xs);
}

.language-switcher button {
  background-color: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 2px var(--space-sm);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.language-switcher button:hover,
.language-switcher button:focus {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.language-switcher button.active {
  background-color: var(--color-accent);
  color: #ffffff;
  border-color: var(--color-accent);
}

.cv-actions {
  display: flex;
  gap: var(--space-sm);
}

.btn-print,
.btn-export {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--space-md);
  font-size: var(--font-size-xs);
  font-family: var(--font-family-base);
  font-weight: 600;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-print {
  background-color: #27ae60;
  color: #ffffff;
}

.btn-print:hover {
  background-color: #1e8449;
}

.btn-export {
  background-color: var(--color-accent);
  color: #ffffff;
}

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

.btn-export:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* --- Profile header --- */

.main-profile-header {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.main-name {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: var(--space-xs);
  line-height: 1.2;
}

.main-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-md);
}

.main-summary {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  line-height: 1.65;
}

/* --- Main sections --- */

.main-section {
  margin-bottom: var(--space-lg);
}

.main-section-title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: #c0392b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background-color: #f2b8b8;
  padding: var(--space-xs) var(--space-md);
  margin-bottom: var(--space-md);
  border-radius: var(--border-radius);
}

.section-icon {
  font-size: var(--font-size-xl);
  line-height: 1;
}

/* --- CV Entry --- */

.cv-entry {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid #f0f0f0;
}

.cv-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.entry-header-left {
  flex: 1;
  min-width: 0;
}

.entry-company,
.entry-institution {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--color-text);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.entry-company a {
  color: var(--color-text);
}

.entry-company a:hover {
  color: var(--color-accent);
}

.entry-title-role {
  font-size: var(--font-size-sm);
  color: #c0392b;
  font-style: italic;
  margin-bottom: var(--space-xs);
}

.entry-degree {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}

.entry-period {
  font-size: var(--font-size-xs);
  color: #c0392b;
  font-style: italic;
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 2px;
}

.entry-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

/* --- Entry lists --- */

.entry-list {
  margin-top: var(--space-xs);
  padding-left: 0;
}

.entry-list li {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  padding-left: var(--space-md);
  position: relative;
  margin-bottom: 3px;
  line-height: 1.5;
}

.entry-list li::before {
  content: "-";
  position: absolute;
  left: 0;
  color: var(--color-text-muted);
}

.entry-group-title {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--color-text);
  margin-top: var(--space-sm);
  margin-bottom: 2px;
}

.entry-achievements-label {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--color-text);
  margin-top: var(--space-sm);
  margin-bottom: 2px;
}

/* --- Projects section (if used) --- */

.tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: var(--space-xs) 0;
}

.tech-list li {
  background-color: var(--color-accent-bg);
  color: var(--color-accent);
  border: 1px solid #d4a0a8;
  border-radius: var(--border-radius);
  padding: 1px var(--space-sm);
  font-size: var(--font-size-xs);
  font-weight: 500;
  margin-bottom: 0;
}

.project-links {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

.project-links a {
  font-size: var(--font-size-xs);
  padding: 2px var(--space-sm);
  background-color: var(--color-accent);
  color: #ffffff;
  border-radius: var(--border-radius);
  transition: background-color 0.2s;
}

.project-links a:hover {
  background-color: var(--color-accent-light);
  text-decoration: none;
  color: #ffffff;
}

/* =============================================================================
   RESPONSIVE — TABLET / MOBILE (<768px)
   ============================================================================= */

@media (max-width: 767px) {
  .cv-wrapper {
    flex-direction: column;
    margin: 0;
    border-radius: 0;
    min-height: unset;
  }

  .cv-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 2px solid var(--color-accent);
  }

  .cv-main {
    padding: var(--space-md);
  }

  .cv-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .entry-period {
    padding-top: 0;
  }

  .top-menu-inner {
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
  }

  .top-menu-social-link {
    width: 28px;
    height: 28px;
  }

  .top-menu-social-link svg {
    width: 16px;
    height: 16px;
  }

  .top-menu-divider {
    display: none;
  }

  .top-menu-controls {
    gap: var(--space-sm);
  }
}/* =============================================================================
   CHINESE LANGUAGE — Official document fonts (宋体/黑体 style via Google Fonts)
   Applied when lang="zh" is set on <html> or <body>
   ============================================================================= */

:lang(zh) body,
[lang="zh"] body,
.lang-zh body,
.lang-zh {
  /* Noto Serif SC ≈ 宋体 (Song Ti) — standard for Chinese official documents */
  font-family: "Noto Serif SC", "SimSun", "STSong", serif;
}

/* Headings use 黑体 (Hei Ti) style — Noto Sans SC */
.lang-zh .main-name,
.lang-zh .main-title,
.lang-zh .main-section-title,
.lang-zh .sidebar-section-title,
.lang-zh .entry-company,
.lang-zh .entry-institution,
.lang-zh .sidebar-edu-institution {
  font-family: "Noto Sans SC", "SimHei", "STHeiti", sans-serif;
}

/* Slightly larger line-height for CJK readability */
.lang-zh .entry-list li,
.lang-zh .main-summary,
.lang-zh .sidebar-skill,
.lang-zh .sidebar-education-entry,
.lang-zh .contact-item {
  line-height: 1.75;
}

/* =============================================================================
   PRINT STYLESHEET
   ============================================================================= */

@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  /* Hide toolbar */
  .no-print,
  .top-menu,
  .cv-toolbar,
  .language-switcher,
  .cv-actions,
  .btn-print,
  .btn-export {
    display: none !important;
  }

  body {
    background: #ffffff;
    font-size: 10pt;
    line-height: 1.4;
  }

  .cv-wrapper {
    display: flex;
    flex-direction: row;
    max-width: 100%;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    min-height: unset;
  }

  .cv-sidebar {
    flex: 11;
    min-width: 0;
    border-right: 1pt solid #cccccc;
    padding: 0 0 12pt;
  }

  .cv-main {
    flex: 16;
    padding: 8pt 12pt 12pt;
  }

  /* Reset backgrounds */
  *,
  *::before,
  *::after {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .main-section-title {
    background-color: #f2b8b8 !important;
    border-left: none !important;
    color: #c0392b !important;
  }

  .sidebar-section-title {
    color: #7B3A10 !important;
  }

  .main-name,
  .main-title {
    color: #7B3A10 !important;
  }

  /* Avoid page breaks inside entries */
  .cv-entry {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Do NOT expand hyperlinks — contact links must stay on one line */
  a[href]::after {
    content: none !important;
  }

  .sidebar-photo-wrap {
    padding: var(--space-sm);
  }

  .sidebar-photo {
    width: 90pt;
    height: 90pt;
  }

  .sidebar-photo-placeholder {
    width: 90pt;
    height: 90pt;
  }

  .sidebar-photo-placeholder svg {
    width: 28pt;
    height: 28pt;
  }
}
