/* ══════════════════════════════════════════════════
   CV / LEBENSLAUF — Grid Timeline System
   Easy to add entries: just add a .timeline-entry
   at the TOP of each .timeline-section list
   ══════════════════════════════════════════════════ */

body {
  font-family: var(--font-body, 'Inter', sans-serif);
  background-color: var(--bg-deepest, #060810);
  color: var(--text-primary, #e8eaf0);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* ── CV Main Layout ──────────────────────────────── */
#cv-main {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  padding-top: 72px;
  max-width: 1200px;
  margin: 0 auto;
  gap: 0;
}

/* ── Left Sidebar ─────────────────────────────────── */
#cv-sidebar {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 32px 20px 100px 24px;
  background: rgba(11, 15, 26, 0.7);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Portrait */
.cv-portrait-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.cv-portrait {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid transparent;
  background: linear-gradient(var(--bg-dark, #0b0f1a), var(--bg-dark, #0b0f1a)) padding-box,
              linear-gradient(135deg, rgba(255,255,255,0.4), rgba(255,255,255,0.1)) border-box;
}

.cv-name {
  font-family: var(--font-film, 'Cinzel Decorative', serif);
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary, #e8eaf0);
}

.cv-role-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}

.cv-role-tag {
  font-family: var(--font-mono, monospace);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid;
}

.cv-role-tag.code, .cv-role-tag.math, .cv-role-tag.film { 
  color: #ffffff; 
  border-color: rgba(255,255,255,0.2); 
  background: rgba(255,255,255,0.05); 
}

/* Sidebar divider */
.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 0 -4px;
}

/* Personal info block */
.sidebar-section-label {
  font-family: var(--font-mono, monospace);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted, #6b7280);
  margin-bottom: 10px;
}

.cv-personal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary, #9ca3af);
}

.cv-personal-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.cv-personal-row .icon {
  font-size: 0.75rem;
  flex-shrink: 0;
  opacity: 0.6;
  margin-top: 1px;
}

.cv-personal-row a {
  color: var(--text-primary, #e8eaf0);
  font-size: 0.78rem;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.2);
}

/* Sidebar nav links */
.cv-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cv-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary, #9ca3af);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.cv-nav-link:hover {
  color: var(--text-primary, #e8eaf0);
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}

.cv-nav-icon { font-size: 0.9rem; }

/* ── Right Content ────────────────────────────────── */
#cv-content {
  padding: 32px clamp(20px, 4vw, 56px) 120px;
  overflow-x: hidden;
}

/* Page header */
.cv-page-title {
  font-family: var(--font-film, 'Cinzel Decorative', serif);
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--text-primary, #e8eaf0);
  margin-bottom: 4px;
}

.cv-page-sub {
  font-family: var(--font-mono, monospace);
  font-size: 0.75rem;
  color: var(--text-muted, #6b7280);
  letter-spacing: 2px;
  margin-bottom: 36px;
}

/* ── Section Blocks ───────────────────────────────── */
.cv-section {
  margin-bottom: 48px;
  scroll-margin-top: 90px;
}

.cv-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.cv-section-icon {
  font-size: 1.1rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.cv-section-title {
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  font-weight: 700;
  color: var(--text-primary, #e8eaf0);
}

/* ══ TIMELINE — THE GRID SYSTEM ══════════════════════
   To add a new entry: copy a .timeline-entry block
   and paste it at the TOP of the .timeline-list.
   The year column auto-aligns to the right.
   ══════════════════════════════════════════════════ */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

/* Vertical spine line */
.timeline-list::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 88px;
  width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.1) 10%, rgba(255,255,255,0.1) 90%, transparent);
}

.timeline-entry {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 0 20px;
  padding: 16px 0;
  position: relative;
  transition: background 0.15s;
}

.timeline-entry:hover .tl-body {
  background: rgba(255,255,255,0.02);
  border-color: rgba(255,255,255,0.1);
}

/* Year/date column */
.tl-year {
  text-align: right;
  padding-top: 2px;
  padding-right: 0;
}

.tl-year-text {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted, #6b7280);
  display: block;
  line-height: 1.4;
}

/* Dot on the spine */
.tl-dot {
  position: absolute;
  left: 84px;
  top: 20px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--bg-deepest, #060810);
  background: var(--math-blue, #60a5fa);
  z-index: 1;
}

.tl-dot.film, .tl-dot.math, .tl-dot.code, .tl-dot.lang { background: #ffffff; }

/* Body column */
.tl-body {
  padding: 12px 16px;
  background: rgba(17, 24, 39, 0.4);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  transition: background 0.15s, border-color 0.15s;
  margin-left: 8px;
}

.tl-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary, #e8eaf0);
  margin-bottom: 4px;
  line-height: 1.3;
}

.tl-org {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: var(--text-muted, #6b7280);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.tl-org a {
  color: var(--text-primary, #e8eaf0);
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.2);
}

.tl-details {
  font-size: 0.82rem;
  color: var(--text-secondary, #9ca3af);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tl-details li::before {
  content: '— ';
  color: var(--text-muted, #6b7280);
}

/* Domain badge in timeline */
.tl-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono, monospace);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.tl-badge.code, .tl-badge.film, .tl-badge.math, .tl-badge.edu { 
  background: rgba(255,255,255,0.05); 
  color: #ffffff; 
  border: 1px solid rgba(255,255,255,0.2); 
}

/* ── Languages grid ───────────────────────────────── */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.lang-card {
  padding: 14px 16px;
  background: rgba(17,24,39,0.4);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
}

.lang-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-primary, #e8eaf0);
  margin-bottom: 4px;
}

.lang-level {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: var(--text-muted, #6b7280);
}

/* ── ICT Skill bars (CV compact) ─────────────────── */
.cv-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cv-bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 36px;
  align-items: center;
  gap: 12px;
}

.cv-bar-label {
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary, #9ca3af);
}

.cv-bar-track {
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
}

.cv-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.4), rgba(255,255,255,0.8));
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cv-bar-pct {
  font-family: var(--font-mono, monospace);
  font-size: 0.65rem;
  color: var(--text-muted, #6b7280);
  text-align: right;
}

/* ── Hobbies/References ───────────────────────────── */
.hobbies-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hobby-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(17,24,39,0.5);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary, #9ca3af);
}

/* Footer */
.cv-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: var(--text-muted, #6b7280);
  text-align: center;
}

/* ── Responsive ──────────────────────────────────── */
@media screen and (max-width: 900px) {
  #cv-main {
    grid-template-columns: 1fr;
  }

  #cv-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 20px;
    padding: 20px 16px 16px;
  }

  .cv-portrait-wrap { flex-direction: row; align-items: center; }
  .cv-role-tags { justify-content: flex-start; }

  .cv-sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .cv-nav-link { padding: 6px 10px; font-size: 0.75rem; }
  .cv-personal-list { font-size: 0.75rem; }
}

@media screen and (max-width: 600px) {
  #cv-content { padding: 20px 14px 100px; }

  .timeline-list::before { left: 64px; }
  .tl-dot { left: 60px; }

  .timeline-entry {
    grid-template-columns: 56px 1fr;
    gap: 0 14px;
  }

  .tl-year-text { font-size: 0.65rem; }

  .cv-bar-row { grid-template-columns: 90px 1fr 32px; }

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

/* ── Print Configuration (A3 PDF) ─────────────────── */
@media print {
  @page { 
    size: A3 portrait; 
    margin: 20mm; 
  }
  
  body {
    background-color: var(--bg-deepest, #060810) !important;
    color: var(--text-primary, #e8eaf0) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    font-size: 16px; /* Ensure readability on A3 */
  }

  #cv-main {
    display: flex;
    flex-direction: column;
    padding-top: 0;
    max-width: 100%;
  }

  #cv-sidebar {
    position: static;
    height: auto;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.2) !important;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 40px;
    padding: 0 0 30px 0;
    margin-bottom: 40px;
  }

  .cv-portrait-wrap { flex-direction: row; align-items: center; gap: 20px; }
  .cv-portrait { width: 140px; height: 140px; }
  .cv-name { font-size: 1.6rem; text-align: left; }
  .cv-role-tags { justify-content: flex-start; }

  /* Hide unneeded elements for print */
  #header-homepage, #footer-container, footer, .cv-footer, .cv-page-sub, .cv-sidebar-nav {
    display: none !important;
  }

  /* Pagination constraints */
  .cv-section { 
    break-inside: auto; 
    margin-bottom: 50px;
  }
  
  .timeline-entry { 
    break-inside: avoid; 
  }
  
  /* Force sections to push to new pages to hit exactly 4 pages */
  #experience { break-after: page; }
  #education { break-after: page; }
  
  /* Make content legible on A3 */
  .cv-section-title { font-size: 1.4rem; }
  .tl-title { font-size: 1.1rem; }
  .tl-details { font-size: 1rem; }
  .tl-year-text { font-size: 0.9rem; }
  .cv-bar-row { grid-template-columns: 140px 1fr 50px; }
  .cv-bar-label { font-size: 1rem; }
}