:root {
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

[data-theme='dark'] {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1c2128;
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #f97316;
  --accent-light: #fb923c;
  --accent-teal: #14b8a6;
  --border: rgba(240, 246, 252, 0.1);
}

[data-theme='light'] {
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-card: #ffffff;
  --text-primary: #1f2328;
  --text-secondary: #57606a;
  --text-muted: #8c959f;
  --accent: #ea580c;
  --accent-light: #f97316;
  --accent-teal: #0d9488;
  --border: rgba(31, 35, 40, 0.15);
}

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

body {
  font-family: var(--font-primary);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
}

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

a:hover {
  color: var(--accent-light);
}

.cv-toolbar {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  z-index: 100;
}

.cv-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.875rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.cv-toolbar-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--accent);
}

[data-theme='dark'] .sun-icon {
  display: block;
}
[data-theme='dark'] .moon-icon {
  display: none;
}
[data-theme='light'] .sun-icon {
  display: none;
}
[data-theme='light'] .moon-icon {
  display: block;
}

.cv-page {
  min-height: 100vh;
  padding: 2rem;
}

.cv-container {
  max-width: 1000px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.cv-header {
  background: linear-gradient(135deg, var(--accent) 0%, #c2410c 100%);
  padding: 2.5rem;
  text-align: center;
  color: white;
}

.cv-name {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: -0.5px;
}

.cv-title {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 1.25rem;
}

.cv-contact-row {
  display: grid;
  align-items: center;
  gap: 0.5rem;
  max-width: 42rem;
  margin: 0 auto;
  justify-items: center;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.08);
}

.cv-contact-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.cv-contact-group--phones {
  padding-inline: 0;
  border-radius: 0;
}

.cv-contact-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.85rem;
  line-height: 1.3;
  text-align: center;
  transition: color 0.2s;
}

.cv-contact-item:hover {
  color: white;
}

.cv-contact-item svg {
  opacity: 0.8;
}

.cv-contact-label {
  display: inline-block;
}

.cv-contact-divider {
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}

.cv-contact-whatsapp-group {
  justify-content: center;
}

.cv-contact-whatsapp-rows {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.cv-contact-whatsapp-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  line-height: 1.2;
}

.cv-contact-whatsapp-row-icons {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
  opacity: 0.9;
}

.cv-contact-whatsapp-glyph {
  width: 0.78rem;
  height: 0.78rem;
}

.cv-contact-phone-glyph {
  width: 0.72rem;
  height: 0.72rem;
}

.cv-contact-whatsapp-flag {
  position: relative;
  width: 0.95rem;
  height: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
}

.cv-contact-whatsapp-flag--sweden::before,
.cv-contact-whatsapp-flag--sweden::after,
.cv-contact-whatsapp-flag--brazil::before,
.cv-contact-whatsapp-flag--brazil::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.82);
}

.cv-contact-whatsapp-flag--sweden::before {
  top: 0;
  bottom: 0;
  left: 32%;
  width: 0.12rem;
}

.cv-contact-whatsapp-flag--sweden::after {
  left: 0;
  right: 0;
  top: 50%;
  height: 0.12rem;
  transform: translateY(-50%);
}

.cv-contact-whatsapp-flag--brazil::before {
  width: 0.48rem;
  height: 0.48rem;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 1px;
}

.cv-contact-whatsapp-flag--brazil::after {
  width: 0.2rem;
  height: 0.2rem;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
}

.cv-contact-whatsapp-entry {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: inherit;
  line-height: 1.2;
  white-space: nowrap;
}

.cv-contact-whatsapp-entry:hover {
  color: white;
}

.cv-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
}

.cv-main {
  padding: 2rem;
  border-right: 1px solid var(--border);
}

.cv-sidebar {
  padding: 2rem;
  background: var(--bg-secondary);
}

.cv-section {
  margin-bottom: 2rem;
}

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

@media screen and (min-width: 801px) {
  .cv-grid {
    align-items: stretch;
  }

  .cv-sidebar {
    display: block;
    height: auto;
  }

  .cv-sidebar > .cv-section {
    display: block;
    margin-bottom: 0;
    min-height: auto;
  }

  .cv-sidebar > .cv-section + .cv-section {
    margin-top: 1.1rem;
  }

  .cv-sidebar > .cv-section:nth-child(4) {
    margin-top: 1.65rem;
  }

  .cv-sidebar > .cv-section:nth-child(5) {
    margin-top: 2.2rem;
  }
}

.cv-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
}

.cv-entry {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

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

.cv-entry-compact {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
}

.cv-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.cv-entry-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.cv-entry-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.cv-via {
  color: var(--text-muted);
  font-weight: 400;
}

.cv-entry-meta {
  text-align: right;
  flex-shrink: 0;
}

.cv-entry-date {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  font-family: var(--font-mono);
}

.cv-entry-location {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cv-entry-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.cv-entry-list {
  list-style: none;
  margin: 0.5rem 0;
}

.cv-entry-list li {
  position: relative;
  padding-left: 1rem;
  margin-bottom: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.cv-entry-list li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

.cv-entry-tech {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 0.5rem;
}

.cv-skill-category {
  margin-bottom: 1rem;
}

.cv-skill-category:last-child {
  margin-bottom: 0;
}

.cv-skill-category-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.cv-skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.cv-skill-tag {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.cv-sidebar-entry {
  margin-bottom: 1rem;
}

.cv-certification-entry {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.cv-certification-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--accent);
}

.cv-certification-logo__mask {
  display: block;
  width: 15px;
  height: 15px;
  background: currentColor;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.cv-certification-logo__mask--anthropic {
  -webkit-mask-image: url('/images/icons/anthropic.svg');
  mask-image: url('/images/icons/anthropic.svg');
}

.cv-certification-logo__mask--databricks {
  -webkit-mask-image: url('/images/icons/databricks.svg');
  mask-image: url('/images/icons/databricks.svg');
}

.cv-certification-logo__lettermark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}

.cv-certification-logo__lettermark--cambridge {
  letter-spacing: -0.08em;
}

.cv-certification-content {
  min-width: 0;
}

.cv-sidebar-entry:last-child {
  margin-bottom: 0;
}

.cv-sidebar-entry-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.cv-sidebar-entry-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.cv-sidebar-entry-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cv-languages {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cv-language {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cv-language-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.cv-language-level {
  font-size: 0.75rem;
  color: var(--text-muted);
}

@media (max-width: 800px) {
  .cv-header {
    padding: 2rem 1.5rem;
  }

  .cv-contact-row {
    gap: 0.55rem;
    max-width: 22rem;
    padding: 0.75rem;
  }

  .cv-contact-item {
    max-width: 100%;
  }

  .cv-contact-whatsapp-group {
    width: 100%;
  }

  .cv-contact-group {
    width: 100%;
    justify-content: center;
  }

  .cv-contact-divider {
    display: none;
  }

  .cv-contact-whatsapp-entry,
  .cv-contact-label {
    white-space: normal;
  }

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

  .cv-main {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .cv-toolbar {
    position: static;
    justify-content: center;
    margin-bottom: 1rem;
    padding: 0 1rem;
  }

  .cv-page {
    padding: 1rem;
  }

  .cv-entry-header {
    flex-direction: column;
    gap: 0.25rem;
  }

  .cv-entry-meta {
    text-align: left;
  }
}

@media print {
  .no-print,
  .cv-toolbar {
    display: none !important;
  }

  html,
  body {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .cv-page {
    padding: 12mm !important;
    min-height: 0 !important;
    background: var(--bg-primary) !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .cv-container {
    width: 100% !important;
    max-width: 1000px !important;
    margin: 0 !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    background: var(--bg-card) !important;
    overflow: hidden !important;
    box-shadow: none !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .cv-header {
    background: linear-gradient(135deg, var(--accent) 0%, #c2410c 100%) !important;
    padding: 16px 20px !important;
    text-align: center !important;
    color: white !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .cv-name {
    font-size: 24px !important;
    font-weight: bold !important;
    margin-bottom: 2px !important;
    color: white !important;
  }

  .cv-title {
    font-size: 13px !important;
    margin-bottom: 8px !important;
    color: rgba(255, 255, 255, 0.9) !important;
  }

  .cv-contact-row {
    display: grid !important;
    align-items: center !important;
    gap: 3px !important;
    max-width: 400px !important;
    margin: 0 auto !important;
    justify-items: center !important;
    padding: 5px 9px !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 9px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .cv-contact-group {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 3px !important;
  }

  .cv-contact-item {
    font-size: 9.5px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    line-height: 1.25 !important;
    margin: 0 !important;
    text-align: center !important;
    white-space: nowrap !important;
  }

  .cv-contact-item svg {
    width: 12px !important;
    height: 12px !important;
    flex-shrink: 0 !important;
    vertical-align: text-bottom !important;
    margin-right: 0 !important;
  }

  .cv-contact-divider {
    width: 3px !important;
    height: 3px !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.45) !important;
    flex-shrink: 0 !important;
  }

  .cv-contact-whatsapp-rows {
    align-items: center !important;
    gap: 2px !important;
  }

  .cv-contact-whatsapp-row {
    gap: 4px !important;
  }

  .cv-contact-whatsapp-number {
    letter-spacing: -0.1px !important;
  }

  .cv-header a,
  .cv-header .cv-contact-whatsapp-entry {
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none !important;
  }

  .cv-contact-whatsapp-label {
    display: none !important;
  }

  .cv-contact-whatsapp-flag {
    width: 1.05rem !important;
    height: 0.72rem !important;
    border: 1px solid rgba(15, 23, 42, 0.45) !important;
    border-radius: 2px !important;
    background: #005293 !important;
    box-shadow: 0 0 0 0.35px rgba(255, 255, 255, 0.25) !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .cv-contact-whatsapp-flag--sweden::before,
  .cv-contact-whatsapp-flag--sweden::after,
  .cv-contact-whatsapp-flag--brazil::before,
  .cv-contact-whatsapp-flag--brazil::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .cv-contact-whatsapp-flag--sweden::before,
  .cv-contact-whatsapp-flag--sweden::after {
    background: #fecc02 !important;
  }

  .cv-contact-whatsapp-flag--sweden::before {
    left: 30% !important;
    width: 0.15rem !important;
  }

  .cv-contact-whatsapp-flag--sweden::after {
    height: 0.15rem !important;
  }

  .cv-contact-whatsapp-flag--brazil {
    background: #009b3a !important;
  }

  .cv-contact-whatsapp-flag--brazil::before {
    width: 0.56rem !important;
    height: 0.56rem !important;
    border-radius: 1px !important;
    background: #ffdf00 !important;
  }

  .cv-contact-whatsapp-flag--brazil::after {
    width: 0.24rem !important;
    height: 0.24rem !important;
    background: #002776 !important;
    box-shadow: 0 0 0 0.35px rgba(255, 255, 255, 0.85) !important;
  }

  .cv-grid {
    display: grid !important;
    grid-template-columns: 1fr 320px !important;
    gap: 0 !important;
    width: 100% !important;
  }

  .cv-main {
    display: block !important;
    width: auto !important;
    padding: 14px 18px !important;
    border-right: 1px solid var(--border) !important;
    background: var(--bg-card) !important;
  }

  .cv-sidebar {
    display: block !important;
    width: auto !important;
    padding: 14px 18px !important;
    border-top: none !important;
    background: var(--bg-secondary) !important;
  }

  .cv-section {
    margin-bottom: 10px !important;
    break-inside: auto;
    page-break-inside: auto;
  }

  .cv-section-lead {
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  .cv-section-lead > .cv-entry {
    margin-bottom: 9px !important;
  }

  .cv-main > .cv-section:nth-of-type(2) {
    break-before: page;
    page-break-before: always;
  }

  .cv-section-title {
    font-size: 11px !important;
    font-weight: bold !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    color: var(--accent) !important;
    border-bottom: 2px solid var(--accent) !important;
    padding-bottom: 3px !important;
    margin-bottom: 8px !important;
  }

  .cv-entry {
    margin-bottom: 9px !important;
    padding-bottom: 9px !important;
    border-bottom: 1px solid var(--border) !important;
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  .cv-entry:last-child {
    border-bottom: none !important;
  }

  .cv-entry-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    margin-bottom: 4px !important;
  }

  .cv-entry-title {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
  }

  .cv-entry-subtitle {
    font-size: 11px !important;
    color: var(--text-secondary) !important;
  }

  .cv-via {
    color: var(--text-muted) !important;
  }

  .cv-entry-date {
    font-size: 10px !important;
    color: var(--accent) !important;
    font-weight: 500 !important;
  }

  .cv-entry-location {
    font-size: 9px !important;
    color: var(--text-muted) !important;
  }

  .cv-entry-description {
    font-size: 10px !important;
    color: var(--text-secondary) !important;
    margin-bottom: 3px !important;
  }

  .cv-entry-list {
    margin: 4px 0 !important;
    padding-left: 0 !important;
    list-style: none !important;
  }

  .cv-entry-list li {
    font-size: 10px !important;
    color: var(--text-secondary) !important;
    margin-bottom: 2px !important;
    padding-left: 12px !important;
    position: relative !important;
  }

  .cv-entry-list li::before {
    content: '›' !important;
    position: absolute !important;
    left: 0 !important;
    color: var(--accent) !important;
  }

  .cv-entry-tech {
    font-size: 9px !important;
    color: var(--text-muted) !important;
    font-family: var(--font-mono) !important;
  }

  .cv-entry-compact {
    margin-bottom: 7px !important;
    padding-bottom: 7px !important;
  }

  .cv-skill-category {
    margin-bottom: 8px !important;
  }

  .cv-skill-category-title {
    font-size: 9px !important;
    font-weight: 600 !important;
    color: var(--text-muted) !important;
    text-transform: uppercase !important;
    margin-bottom: 4px !important;
  }

  .cv-skill-tags {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
  }

  .cv-skill-tag {
    font-size: 9px !important;
    padding: 2px 6px !important;
    border: 1px solid var(--border) !important;
    border-radius: 3px !important;
    background: var(--bg-card) !important;
    color: var(--text-secondary) !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .cv-sidebar-entry {
    margin-bottom: 8px !important;
  }

  .cv-certification-entry {
    display: flex !important;
    align-items: flex-start !important;
    gap: 5px !important;
  }

  .cv-certification-logo {
    flex: 0 0 22px !important;
    width: 22px !important;
    height: 22px !important;
    border: 1px solid var(--border) !important;
    border-radius: 6px !important;
    background: var(--bg-card) !important;
    color: var(--accent) !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .cv-certification-logo__mask {
    width: 12px !important;
    height: 12px !important;
    background: currentColor !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .cv-certification-logo__lettermark {
    min-width: 12px !important;
    height: 12px !important;
    font-size: 7px !important;
  }

  .cv-sidebar-entry-title {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
  }

  .cv-sidebar-entry-subtitle {
    font-size: 10px !important;
    color: var(--text-secondary) !important;
  }

  .cv-sidebar-entry-meta {
    font-size: 9px !important;
    color: var(--text-muted) !important;
  }

  .cv-languages {
    display: block !important;
  }

  .cv-language {
    display: flex !important;
    justify-content: space-between !important;
    margin-bottom: 4px !important;
  }

  .cv-language-name {
    font-size: 10px !important;
    font-weight: 500 !important;
    color: var(--text-primary) !important;
  }

  .cv-language-level {
    font-size: 9px !important;
    color: var(--text-muted) !important;
  }

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

  @page {
    margin: 0;
    size: A4;
  }
}
