html, body {
  overflow-x: hidden;
  width: 100%;
}

/* ---------------------------------------------------------------- CV Header */
.cv-top {
  text-align: center;
  padding: 20px 10px 20px;
  margin-top: 40px;
  margin-bottom: 40px;
}
.cv-name {
  font-size: 2.2rem;
  font-weight: 500;
  letter-spacing: 0.6px;
  font-family: Saira, sans-serif;
  color: #aa642e;
}
.cv-pronouns { color: #d3d3d3; }
.cv-sub { font-size: 1rem; opacity: 0.85; margin-top: 6px; }
.cv-summary {
  max-width: 900px;
  margin: 14px auto 0;
  font-size: 1.02rem;
  line-height: 1.5;
}
.cv-updated { margin-top: 8px; font-size: 0.9rem; color: #666; }

/* ---------------------------------------------------------------- Pastilles */
.circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  font-family: Saira;
  color: #fff;
  font-size: 1rem;
  margin: 2px;
}
.circle.postdoc { background-color: #7de2d5; }
.circle.doctorate { background-color: #459da0; }
.circle.undergrad { background-color: #c7d8d1; }
.circle.secondment { background-color: #d3d3d3; }
.circle.volunteer { background-color: #dea17f; }
.circle.leadership { background-color: #aa642e; }

/* ---------------------------------------------------------- Print CV Button */
.cv-print-btn {
  margin-top: 16px;
  background: #459da0;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s;
}
.cv-print-btn:hover { background: #aa642e; }

/* -------------------------------------------------------- General Polishing */
.cv-wrap {display: flex; gap: 20px; padding: 5px; box-sizing: border-box;}
.cv-left { width: 15%; min-width: 110px; display: flex; justify-content: flex-end; align-items: flex-start; position: relative;}
.cv-center { width: 70%; }
.cv-right { width: 15%; min-width: 130px; }
.cv-institution-name { font-style: italic; }
.cv-date { font-weight: 400; color: #459da0; }
.sidenote-label { font-family: Saira; font-weight: 400; color: #aa642e; }
.cv-template {font-family: Quicksand, Arial, sans-serif;color: #222;}


/* ---------------------------------------------------------------- Education */
.cv-content-education {
  display: grid;
  grid-template-columns: 31.5% 31.5% 31.5%;
  gap: 2rem;
}
.cv-edu-element { text-align: center; }
.cv-institution-logo {
  width: 200px;
  margin: auto;
  margin-bottom: 1rem;
  background-color: white;
  border-radius: 20px;
  box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
  border: 15px solid white;
}

/* ------------------------------------------------------------ Presentations */
.cv-presentations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.2rem;
}
.cv-presentation {
  background: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cv-presentation strong {
  font-size: 1rem;
  color: #aa642e;
}
.cv-presentation strong:hover { color: #459da0; }
.cv-presentation-title {
  font-style: italic;
  margin: 4px 0 6px;
}
.cv-date .fa-door-open { color: #dea17f !important; }
.cv-date .fa-chalkboard-teacher { color: #c7d8d1 !important; }
.cv-date .fa-comments { color: #7de2d5 !important; }

/* ------------------------------------------------------------------- Awards */
.cv-awards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.award-item {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  padding: 10px 10px 0px 10px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.award-item.institutional { background-color: #fff; } 
.award-item.state { background-color: #D3D3D3; } 
.award-item.national { background-color: #C7D8D1; } 
.award-item.multinational { background-color: #EFD1C0; }
.white-text {color: #fff !important;}

.award-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.cv-presentation:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.award-header {
  align-items: center;
  text-align: right !important;
  flex-wrap: wrap;
  gap: 6px;
  display: flex;
  justify-content: flex-end;
  color: black;
  margin-right: 10px;
  margin-bottom: 20px;
}

.award-title { font-weight: 600; flex: 1 1 auto; color: #459da0; }
.award-year { color: #777; font-style: italic; margin-left: auto; }
.award-icon { color: #d3d3d3; font-size: 20px; }
.award-desc { color: #555; margin-top: 6px; line-height: 1.4; }

/* ------------------------------------------------------------------ Legends */
.cv-conference-legend {
  font-size: 0.9rem;
  line-height: 1.4;
  color: #333;
}
.cv-conference-legend i {
  width: 18px;
  text-align: center;
  margin-right: 6px;
}

/* ----------------------------------------------------------------- Research */
.cv-research-list { display: flex; flex-direction: column; }
.cv-research-item, .cv-research-subitem {
  background: rgba(255,255,255,0.7);
  border-radius: 12px;
  padding: 5px 10px;
}
.cv-research-subitem { padding: 0 30px 0 30px; }
.cv-research-title {
  font-size: 1rem;
  margin-bottom: 4px;
}
.cv-research-title strong { color: #aa642e !important; font-family: Saira; }
.cv-research-desc { font-size: 1rem; margin-bottom: 6px; color: #555; }
.cv-research-meta { color: black; display: inline-block; }


/* --------------------------------------------------------------- Membership */
.cv-memberships-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.membership-item {
  align-items: center;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  padding: 16px;
  padding-bottom: 7px;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cv-video-box:hover, .membership-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

.membership-logo {
  width: 200px;
  object-fit: cover;
  margin-bottom: 5px;
  background-color: #fff;
}

.membership-name {
  font-weight: 600;
  font-size: 1rem;
  color: #aa642e;
  margin-bottom: 4px;
}

.membership-dates {
  font-size: 0.9rem;
  color: #459da0;
}

/* ---------------------------------------------------------------- Languages */
.cv-languages-section { 
    display: grid; 
    grid-template-columns: 47.5% 47.5%; 
    grid-template-areas: 
      "ling coding" 
      "packs coding";
    align-items: start; 
    gap: 5%;
}

.language-category:nth-child(1),
.language-category:nth-child(2) {
  grid-column: 1;
}

.language-category:nth-child(3) {
  grid-column: 2;
  grid-row: 1;
}

.language-category:nth-child(1) { grid-area: ling; } 
.language-category:nth-child(2) { grid-area: packs; } 
.language-category:nth-child(3) { grid-area: coding; }

.language-category {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.08);
  padding: 16px;
  max-width: 100%;
}

.language-category h3 {
  color: #459da0;
  font-family: Saira;
  font-weight: 400;
  font-size: 1.05rem;
  margin-bottom: 12px;
  text-align: center;
}

.language-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.language-name {
  font-weight: 400;
  font-family: Quicksand;
  color: #333;
  text-align: right;
  width: 30%;
}

.language-rating {
  display: flex;
  gap: 4px;
  width: 65%;
}

.language-rating span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background-color: transparent;
  border: 1px solid #ccc;
}

.language-rating.filled span {
  background-color: #aa642e;
  border-color: #aa642e;
}

/* ------------------------------------------------------ Scientific Packages */
.package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  justify-items: center;
}

.package-item img {
  width: 100%;
  object-fit: contain;
  border-radius: 10px;
  background-color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  padding: 4px;
  transition: transform 0.2s ease;
}

.package-item img:hover {
  transform: scale(1.05);
}

.package-fallback span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border-radius: 10px;
  background-color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  color: #aa642e;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
}

/* --- Responsive: Stack everything on mobile --- */
@media (max-width: 900px) {
  .cv-languages-section {
    grid-template-columns: 100
  }
  .language-category {
    width: 100%;
  }
.language-category:nth-child(3) {
  grid-column: 1;
  grid-row: auto;
  height: auto;
  margin-bottom: 4rem;
}

}

/* Responsive stacking on mobile */
@media (max-width: 900px) {
  .cv-languages-section {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------- Journalism */
.cv-journalism-item {
  margin-bottom: 5px;
  font-size: 0.9rem;
}

.cv-video-title { font-weight:600; color:#459da0; text-align: center; font-size: 1rem; }

.cv-video-box {
  box-sizing: border-box;
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  padding: 0.5rem;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cv-video-box iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: 8px;
}

.cv-video-views {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #7DE2D5;
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Stack vertically on mobile */
@media (max-width: 900px) {
  .cv-video-box {
    flex: 1 1 100%;
    max-width: 100%;
  }
  .cv-journalism-item {
  margin-bottom: 10px;
  }
}


/* -------------------------------------------------------------------- Notes */
.cv-note {
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  transition: opacity 0.2s ease;
  max-width: 95%;
}
.cv-note.note-hidden { display: none; }
.cv-note-thumb:hover { opacity: 0.85; transition: opacity 0.2s; }
#cv-note-popup { cursor: zoom-out; }


/* ----------------------------------------------------------------- Teaching */
.teaching-item, .professional-item { padding-left: 20px; }


/* --- Mobile Brick-Wall Navigation Tabs --- */
.cv-tab-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 1.2rem 0;
  padding: 0 10px;
}
.cv-tab {
  background-color: #aa642e;
  color: #fff !important;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.85rem;
  font-family: Saira;
  text-align: center;
  flex: 0 0 auto;
  width: auto;
  min-width: 110px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.cv-tab:hover,
.cv-tab.active {
  background-color: #459da0;
  transform: translateY(-2px);
}
.cv-tab:focus { outline: none; }

/* ------------------------------------------------------------ To-Top Button */
#cv-top-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background-color: #aa642e;
  color: white !important;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 999;
}
#cv-top-btn.visible { opacity: 1; visibility: visible; }
#cv-top-btn.spin { animation: spinOnce 0.6s ease; color: white !important; }
@keyframes spinOnce {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* --- Desktop: Sidebar Tabs --- */
@media (min-width: 900px) {
  .cv-tab-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 0;
    padding: 0;
  }
  .cv-tab {
    flex: none;
    width: auto;
    text-align: right;
    align-self: flex-end;
  }
  #cv-top-btn { display: none; }
}

/* --- Layout Sections --- */
.cv-tabs {
  position: sticky;
  top: 120px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cv-section {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 22px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.cv-section h2 {
  margin-top: 0;
  font-size: 1.1rem;
  letter-spacing: 0.6px;
  color: #459da0;
}

/* --- Notes Column --- */
.cv-notes { position: relative; top: 120px; }
.cv-note .arrow { position: absolute; left: -18px; top: 18px; width: 28px; height: 28px; transform: rotate(20deg); }
.cv-note:before {
  content: '';
  position: absolute;
  left: -12px;
  top: 22px;
  width: 12px;
  height: 12px;
  background: #fff;
  transform: rotate(45deg);
  box-shadow: 0 3px 6px rgba(0,0,0,0.06);
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .cv-wrap { flex-direction: column; align-items: center; }
  .cv-left { width: 100%; order: 1; }
  .cv-left .cv-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 6px 10px;
}

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

.cv-tab {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
    font-size: 1rem !important;
}

  .cv-center { width: 100%; order: 2; }
  .cv-right { display: none; }
  .cv-top { padding: 20px 8px; }
  .cv-awards-grid, .cv-content-education { grid-template-columns: 1fr; }
}