:root {
    --principal:        #2E1A4A;
    --principal-deep:   #142441;
    --principal-tint:   #243a59;
    --secondary:        #7A5AE0;
    --secondary-soft:   color-mix(in srgb, #7A5AE0 55%, white);
    --ink:         #1A1A1A;
    --ink-soft:    #3a3a3a;
    --muted:       #6b7280;
    --rule:        #e4e7ee;
    --page:        #ffffff;
    --paper:       #fbfbfd;

    --page-w: 210mm;
    --page-h: 297mm;
    --side-w:  65mm; /* 1/4 of A4 width */
    --side-pad-x: 8mm;
    --main-pad-x: 12mm;
    --density: 1;
  }

  * { box-sizing: border-box; }

  html, body {
    margin: 0;
    padding: 0;
    background: #d9dde4;
    font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  /* Screen wrapper: centers the A4 page and gives it a subtle shadow */
  .screen {
    min-height: 100vh;
    padding: 32px 16px 64px;
    display: flex;
    justify-content: center;
  }

  .page {
    width: var(--page-w);
    height: var(--page-h);
    background: var(--page);
    display: grid;
    grid-template-columns: var(--side-w) 1fr;
    position: relative;
    overflow: hidden;
    box-shadow: 0 22px 60px -20px rgba(20, 36, 65, 0.45),
                0 4px 14px rgba(20, 36, 65, 0.12);
  }

  /* ==================== LEFT SIDEBAR ==================== */
  .side {
    background: var(--principal);
    color: #eef2f8;
    padding: 5mm var(--side-pad-x) 12mm;
    position: relative;
    overflow: hidden;
  }

  /* Decorative accent: secondary rule + corner mark */
  .side::before {
    content: "";
    position: absolute;
    left: var(--side-pad-x);
    right: var(--side-pad-x);
    top: 96mm;
    height: 1px;
    background: linear-gradient(to right, transparent, #ffffff22, transparent);
  }
  .side::after {
    content: "";
    position: absolute;
    bottom: -40mm;
    right: -40mm;
    width: 90mm;
    height: 90mm;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(42, 122, 226, 0.18), transparent 60%);
    pointer-events: none;
  }

  .photo-wrap {
    width: min(38mm, calc(var(--side-w) - 2 * var(--side-pad-x) - 4mm));
    aspect-ratio: 1 / 1;
    height: auto;
    margin: 0 auto 7mm;
    border-radius: 50%;
    background: #ffffff10;
    padding: 3px;
    box-shadow: 0 0 0 1px #ffffff22, 0 0 0 6px rgba(122, 90, 224, 0.18);
    position: relative;
  }
  .photo-wrap image-slot {
    width: 100%;
    height: 100%;
    display: block;
    --slot-bg: #243a59;
    --slot-border: rgba(255,255,255,0.18);
    --slot-color: #cdd6e3;
  }

  .name {
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
    font-size: clamp(22px, 4.2vw, 28px);
    line-height: 1.05;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #ffffff;
    margin: 0 0 4px;
    text-align: center;
  }
  .name .accent { color: var(--secondary-soft); }

  .role {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--secondary-soft);
    margin: 0 0 14px;
  }

  .tagline {
    font-size: 9.5px;
    line-height: 1.5;
    color: #cfd6e2;
    margin: 0 0 14px;
    text-align: justify;
    hyphens: auto;
  }
  .tagline strong { color: #ffffff; font-weight: 600; }

  .side h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--secondary-soft);
    margin: 14px 0 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.14);
    position: relative;
  }
  .side h2::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 18px;
    height: 2px;
    background: var(--secondary);
  }

  .contact {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 9.5px;
    line-height: 1.35;
    color: #dbe1ec;
  }
  .contact li {
    display: grid;
    grid-template-columns: 14px 1fr;
    gap: 8px;
    align-items: start;
  }
  .contact svg {
    width: 12px;
    height: 12px;
    color: var(--secondary-soft);
    flex-shrink: 0;
    margin-top: 2px;
  }
  .contact a {
    color: #dbe1ec;
    text-decoration: none;
    word-break: break-word;
  }
  .contact a:hover { color: var(--secondary-soft); }

  .links {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .links a {
    display: grid;
    grid-template-columns: 14px 1fr 10px;
    gap: 8px;
    align-items: center;
    color: #dbe1ec;
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    transition: color 0.15s;
  }
  .links a:last-child { border-bottom: none; }
  .links a:hover { color: var(--secondary-soft); }
  .links svg.icon { width: 13px; height: 13px; color: var(--secondary-soft); }
  .links .chev { justify-self: end; color: rgba(255,255,255,0.3); font-size: 12px; }

  .quote {
    margin-top: 10mm;
    padding: 10px 0 0;
    border-top: 1px solid rgba(255,255,255,0.14);
    font-size: 9.5px;
    line-height: 1.5;
    color: #aab4c4;
    font-style: italic;
  }

  /* Sidebar skills */
  .side-skills {
    display: flex;
    flex-direction: column;
    gap: 7px;
  }
  .skill-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }
  .skill-group .label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--secondary-soft);
  }
  .skill-group .items {
    font-size: 9.5px;
    line-height: 1.4;
    color: #cfd6e2;
  }
  .skill-group .items .sep {
    color: rgba(255,255,255,0.3);
    margin: 0 3px;
  }

  /* Sidebar languages */
  .side-langs { display: flex; flex-direction: column; gap: 7px; }
  .side-lang {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
  }
  .side-lang .ln { color: #ffffff; font-weight: 600; font-size: 10px; }
  .side-lang .lv { color: #aab4c4; font-size: 9px; font-variant-numeric: tabular-nums; }

  /* Sidebar interests */
  .side-interests {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 5px;
  }
  .side-interests span {
    font-size: 8.5px;
    padding: 2px 7px;
    border-radius: 100px;
    background: rgba(255,255,255,0.06);
    color: #dbe1ec;
    border: 1px solid rgba(255,255,255,0.12);
    letter-spacing: 0.01em;
  }
  .skill-group .items .sep {
    color: rgba(255,255,255,0.3);
    margin: 0 3px;
  }

  /* ==================== RIGHT CONTENT ==================== */
  .main {
    padding: 10mm var(--main-pad-x);
    background: var(--page);
    color: var(--ink);
    font-size: 9.5px;
    line-height: 1.45;
  }

  .section {
    margin-bottom: 5mm;
  }
  .section:last-child { margin-bottom: 0; }

  .section-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 5mm;
  }
  .section-head h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--principal);
    margin: 0;
    white-space: nowrap;
  }
  .section-head .rule {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--secondary), var(--rule) 40%, var(--rule));
  }
  .section-head .num {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: var(--secondary);
    letter-spacing: 0.1em;
  }

  /* Skills */
  .skills {
    display: grid;
    grid-template-columns: 36mm 1fr;
    gap: 7px 14px;
    align-items: baseline;
  }
  .skills dt {
    font-weight: 700;
    color: var(--principal);
    font-size: 9.5px;
  }
  .skills dd {
    margin: 0;
    color: var(--ink-soft);
    font-size: 9.5px;
  }
  .skills dd .chip-sep { color: var(--secondary); margin: 0 5px; font-weight: 600; }

  /* Projects */
  .project {
    display: grid;
    grid-template-columns: 4px 1fr;
    gap: 10px;
    margin-bottom: 3mm;
    padding-bottom: 3mm;
    border-bottom: 1px solid var(--rule);
  }
  .project:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
  .project .marker {
    background: var(--secondary);
    border-radius: 2px;
    align-self: stretch;
    width: 3px;
  }
  .project h3 {
    margin: 0 0 3px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--principal);
  }
  .project .stack {
    font-size: 9.5px;
    color: var(--muted);
    margin-bottom: 4px;
    font-style: italic;
  }
  .project p {
    margin: 0 0 4px;
    color: var(--ink-soft);
    font-size: 9.5px;
    line-height: 1.4;
  }
  .project .repo {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--secondary);
    text-decoration: none;
  }
  .project .repo:hover { text-decoration: underline; }

  /* Experience */
  .exp {
    margin-bottom: 4mm;
    position: relative;
    padding-left: 14px;
  }
  .exp::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--secondary);
    box-shadow: 0 0 0 3px rgba(42, 122, 226, 0.15);
  }
  .exp::after {
    content: "";
    position: absolute;
    left: 2.5px;
    top: 18px;
    bottom: -2mm;
    width: 1px;
    background: var(--rule);
  }
  .exp:last-child::after { display: none; }
  .exp-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 1px;
  }
  .exp h3 {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--principal);
  }
  .exp .dates {
    font-size: 10px;
    font-weight: 600;
    color: var(--secondary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  .exp .meta {
    font-size: 10px;
    color: var(--muted);
    margin: 0 0 4px;
  }
  .exp .meta .company { color: var(--ink-soft); font-weight: 600; }
  .exp .note {
    font-size: 9.5px;
    color: var(--muted);
    font-style: italic;
    margin: 0 0 4px;
  }
  .exp ul {
    margin: 3px 0 0;
    padding: 0;
    list-style: none;
  }
  .exp ul li {
    position: relative;
    padding-left: 12px;
    margin-bottom: 1.5px;
    color: var(--ink-soft);
    font-size: 9.5px;
    line-height: 1.4;
  }
  .exp ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 7px;
    width: 4px;
    height: 1.5px;
    background: var(--secondary);
  }

  /* Education */
  .edu {
    margin-bottom: 3mm;
  }
  .edu:last-child { margin-bottom: 0; }
  .edu-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
  }
  .edu h3 {
    margin: 0 0 2px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--principal);
  }
  .edu .dates {
    font-size: 10px;
    font-weight: 600;
    color: var(--secondary);
    white-space: nowrap;
  }
  .edu .meta {
    font-size: 10px;
    color: var(--muted);
    margin: 0;
  }

  /* Languages & Interests */
  .bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6mm;
  }
  .mini h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--principal);
    margin: 0 0 6px;
  }
  .lang-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 10.5px;
  }
  .lang-row .lang-name { color: var(--principal); font-weight: 600; }
  .lang-row .lang-level { color: var(--muted); font-size: 9.5px; }
  .lang-bar {
    margin-top: 3px;
    height: 3px;
    background: var(--rule);
    border-radius: 2px;
    overflow: hidden;
  }
  .lang-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(to right, var(--secondary), var(--principal));
    border-radius: 2px;
  }

  .interests {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }
  .interests span {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 100px;
    background: #f1f5fb;
    color: var(--principal);
    border: 1px solid #e4ecf7;
  }

  /* ==================== MOBILE RESPONSIVE ==================== */
  @media (max-width: 768px) {
    :root {
      --page-w: 100%;
      --page-h: auto;
      --side-w: 100%;
      --side-pad-x: 6mm;
      --main-pad-x: 6mm;
    }

    .screen {
      padding: 16px 8px 32px;
    }

    .page {
      width: 100%;
      height: auto;
      display: flex;
      flex-direction: column;
      grid-template-columns: none;
      box-shadow: 0 4px 12px rgba(20, 36, 65, 0.2);
    }

    .side {
      padding: 4mm var(--side-pad-x) 8mm;
      order: -1;
    }

    .side::before {
      display: none;
    }

    .side::after {
      display: none;
    }

    .photo-wrap {
      width: min(32mm, calc(100% - 2 * var(--side-pad-x)));
    }

    .name {
      font-size: clamp(18px, 5vw, 24px);
    }

    .tagline {
      font-size: 9px;
      text-align: left;
    }

    .side h2 {
      font-size: 9px;
      margin: 12px 0 7px;
    }

    .contact {
      font-size: 9.5px;
      gap: 7px;
    }

    .links {
      gap: 6px;
    }

    .links a {
      font-size: 10px;
      padding: 6px 0;
    }

    .side-skills {
      gap: 5px;
    }

    .skill-group .label {
      font-size: 7px;
    }

    .skill-group .items {
      font-size: 9px;
    }

    .side-langs {
      gap: 5px;
    }

    .side-lang .ln {
      font-size: 9px;
    }

    .side-lang .lv {
      font-size: 8px;
    }

    .side-interests {
      gap: 3px 4px;
    }

    .side-interests span {
      font-size: 8px;
      padding: 2px 6px;
    }

    .main {
      padding: 8mm var(--main-pad-x);
      font-size: 10px;
    }

    .section {
      margin-bottom: 6mm;
    }

    .section-head {
      gap: 8px;
      margin: 0 0 4mm;
      flex-wrap: wrap;
    }

    .section-head h2 {
      font-size: 11px;
      flex-basis: 100%;
    }

    .section-head .rule {
      display: none;
    }

    .section-head .num {
      font-size: 9px;
    }

    .project {
      grid-template-columns: 3px 1fr;
      gap: 8px;
      margin-bottom: 3mm;
      padding-bottom: 3mm;
    }

    .project h3 {
      font-size: 11px;
    }

    .project .stack {
      font-size: 8.5px;
    }

    .project p {
      font-size: 9.5px;
    }

    .project .repo {
      font-size: 9px;
    }

    .exp {
      margin-bottom: 4mm;
      padding-left: 10px;
    }

    .exp::before {
      width: 5px;
      height: 5px;
      top: 5px;
    }

    .exp::after {
      left: 1.5px;
      bottom: -1.5mm;
    }

    .exp-head {
      flex-direction: column;
      align-items: flex-start;
      gap: 2px;
      margin-bottom: 0;
    }

    .exp h3 {
      font-size: 11px;
    }

    .exp .dates {
      font-size: 9px;
    }

    .exp .meta {
      font-size: 9px;
      margin: 0 0 3px;
    }

    .exp .note {
      font-size: 8.5px;
      margin: 0 0 3px;
    }

    .exp ul li {
      font-size: 9.5px;
      padding-left: 10px;
      margin-bottom: 1px;
    }

    .edu {
      margin-bottom: 2.5mm;
    }

    .edu-head {
      flex-direction: column;
      align-items: flex-start;
      gap: 2px;
    }

    .edu h3 {
      font-size: 10.5px;
    }

    .edu .dates {
      font-size: 9px;
    }

    .edu .meta {
      font-size: 9px;
    }

    .bottom-grid {
      grid-template-columns: 1fr;
      gap: 4mm;
    }

    .mini h3 {
      font-size: 9px;
    }
  }

  /* ==================== PRINT ==================== */
  @page {
    size: A4;
    margin: 0;
  }
  html, body {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  @media print {
    html, body { background: #fff !important; }
    .screen { padding: 0 !important; min-height: 0 !important; }
    .page {
      width: 210mm !important;
      min-height: 297mm !important;
      height: 297mm !important;
      box-shadow: none !important;
      overflow: hidden !important;
      page-break-after: avoid;
      break-after: avoid;
    }
    .side, .main { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    .exp, .project, .edu, .skill-group { break-inside: avoid; }
    a { color: inherit; text-decoration: none; }
    .twk-panel, #tweaks-root { display: none !important; }
  }
.profile-photo { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }

