/* ========================================
   GLOBAL VARIABLES
======================================== */
:root {
  --accent-color: #ffed00;
  --bg-color: #ffffff;          /* Fondo claro por defecto */
  --panel-color: #f3f3f3;       /* Color de panel en modo claro */
  --text-color: #000000;        /* Texto oscuro en modo claro */
}

/* Dark mode */
body.dark-mode {
  --bg-color: #1b1c23;
  --panel-color: #272833;
  --text-color: #ffffff;
}

/* ========================================
   GLOBAL STYLES
======================================== */
body {
  font-family: "Kanit", sans-serif;
  background-color: var(--bg-color);
  overflow-x: hidden;
  color: var(--text-color);
  transition: background-color 0.4s ease, color 0.4s ease;
}

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

h1, h2 {
  font-family: "Kanit", sans-serif;
  font-weight: 500;
}

h1 { line-height: 40px; }
h2 { margin-bottom: 0.3em; }
p { line-height: 30px; }

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

/* Typography Utilities */
.text-primary {
  font-weight: 600;
  font-size: 1.2em;
}

.text-secondary {
  color: #adadad;
}

.logo {
  width: 3em;
  margin-bottom: 0.5em;
}

/* ========================================
   GRID LAYOUT
======================================== */
.grid {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

.grid-panels {
  padding: 1.5em;
  display: grid;
  gap: 1.2em;
  transition: 300ms;
  /* Global: 4 equal columns by default */
  grid-template-columns: repeat(4, 1fr);
}

.panel {
  background-color: var(--panel-color);
  border-radius: 12px;
  padding: 1.5em;
  transition: transform 0.3s ease, background-color 0.4s ease, color 0.4s ease;
  color: var(--text-color);
}

.panel:hover {
  transform: translateY(-2px);
}

/* Base alignment for specific panels */
.panel:nth-child(3),
.panel:nth-child(4),
.panel:nth-child(5),
.panel:nth-child(6) {
  display: flex;
  justify-content: center;
  align-items: center;
}

.panel:nth-child(7),
.panel:nth-child(8) {
  display: flex;
  align-items: flex-end;
}

/* ========================================
   PANEL STYLES
======================================== */
.brand, .travel {
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  gap: 1em;
}

/* Tighter line-height for brand description text */
.panel.brand .text-secondary {
  line-height: 1.3;
}

.social {
  display: flex;
  gap: 1.5em;
}

.social a {
  color: var(--text-color);
  font-size: 2em;
  transition: color 0.3s;
}

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

/* Smooth shadow transition on icons */
.social a i { transition: filter 0.25s ease; }

/* Light mode only: dark shadow on hover while icon stays yellow */
body:not(.dark-mode) .social a:hover i {
  filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.55));
}

/* Dark mode: yellow glow on hover */
body.dark-mode .social a:hover i {
  filter: drop-shadow(0 0 10px var(--accent-color));
}

.title {
  background: radial-gradient(at bottom, var(--accent-color), var(--accent-color));
  text-align: center;
}

.title, .title h1, .title i {
  color: #000; /* texto e icono siempre negros sobre amarillo */
}

.title i {
  font-size: 2em;
  margin-top: 1em;
}

.travel i { font-size: 3em; }

/* ========================================
   PANEL 4: EXPERIENCE (+ in yellow, 16 larger)
======================================== */
.grid-panels .panel:nth-child(4) h1 {
  display: inline-flex;
  align-items: baseline;
  gap: 0.05em;
}

.grid-panels .panel:nth-child(4) .plus {
  color: var(--accent-color);
  font-weight: 600;
  font-size: 1.5em; /* match Projects/Skills/Last Visit icon size */
}

.grid-panels .panel:nth-child(4) .years {
  font-size: 1.5em;
  line-height: 1;
}

/* Light mode: add dark shadow to the + sign in +19 */
body:not(.dark-mode) .grid-panels .panel:nth-child(4) .plus {
  text-shadow: 0 0 8px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.35);
}

/* ========================================
   EARTH ANIMATION
======================================== */
.earth-container {
  width: calc(12.2em - 1px);
  height: calc(12.2em - 1px);
  position: absolute;
  top: 12em;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  background-color: var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: 600ms ease-in-out;
  z-index: 1;
}

.earth {
  position: relative;
  background-image: url(./assets/img/earth.jpg);
  width: 80%;
  height: 80%;
  border-radius: inherit;
  box-shadow:
    0 0 18px #63cbff,
    inset -2em -2em 2em #000;
  background-repeat: repeat;
  background-size: 200% 100%;
  animation: rotate 100s linear infinite;
}

.clouds {
  background-repeat: repeat;
  background-size: 200% 100%;
  background-image: url(./assets/img/clouds.jpg);

/* ========================================
   PANEL 8: PROJECTS (icono abajo, amarillo y grande)
======================================== */
.grid-panels .panel:nth-child(8),
.projects-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* alinear a la izquierda como Habilidades */
  text-align: left;
  padding-bottom: 3.2em; /* espacio para el título absoluto */
}

/* Reordenar hijos directos del panel 8 */
.grid-panels .panel:nth-child(8) > div, /* contenedor del h2 */
.projects-panel > div {
  order: 1;
}

.grid-panels .panel:nth-child(8) > p#projects-desc,
.projects-panel > p#projects-desc {
  order: 2;
  margin-top: 0.6em;
}

.grid-panels .panel:nth-child(8) > i,
.projects-panel > i {
  /* ocultamos el <i> y usaremos ::before del h2 como en Skills */
  display: none;
}

/* TÃ­tulo de Projects alineado como Skills (abajo-izquierda con icono) */
.grid-panels .panel:nth-child(8) h2,
.projects-panel h2 {
  position: absolute;
  bottom: 0.5em;
  left: 1em;
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-size: 1.5em;
  font-weight: 600;
  color: var(--text-color);
}

.grid-panels .panel:nth-child(8) h2::before,
.projects-panel h2::before {
  content: "\f1ad"; /* fa-building */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 1em;
  color: var(--accent-color);
}

/* Ensure panels 7 (skills) and 8 (experience) have identical inner width */
@media screen and (min-width: 1000px) {
  .panel.skills-panel,
  .panel.projects-panel {
    padding-left: 1.5em !important;
    padding-right: 1.5em !important;
  }
  /* Pixel-level correction to center seam differences (rounding) */
  .panel.skills-panel { margin-right: -2px; }
  .panel.projects-panel { margin-left: -2px; }
}

/* Reduce inner side padding for Experience panel to align with Skills */
@media screen and (min-width: 1000px) {
  .grid-panels .panel.projects-panel { padding-left: 0.8em !important; padding-right: 0.8em !important; }
}

@media screen and (max-width: 1000px) and (min-width: 600px) {
  .grid-panels .panel.projects-panel { padding-left: 0.8em !important; padding-right: 0.8em !important; }
}

/* ========================================
   PANEL 8: PROJECTS - AcordeÃ³n y tooltips
======================================== */
.projects-accordion {
  width: 100%;
  margin-top: 0.6em;
  display: flex;
  flex-direction: column;
  gap: 0.6em;
  flex: 1;              /* take remaining height in panel */
  min-height: 0;        /* enable proper flex scroll */
  overflow: auto;       /* internal scroll only for the list */
}

/* Year accordion (div-based) */
.year-item {
  background: var(--panel-color);
  border-radius: 10px;
  overflow: hidden;
}
.year-header {
  padding: 0.75em 1em;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.year-header::after {
  content: "â–¾";
  opacity: 0.7;
}
.year-item.open .year-header { color: var(--accent-color); }
.year-item.open .year-header::after { transform: rotate(180deg); display: inline-block; }
.year-content { display: none; padding: 0.9em 1em; }
.year-item.open .year-content { display: block; }

/* Simple colored rows inside Projects panel */

/* (reverted) keep default panel flow */

/* Projects v2 header and subtitle */
.projects-panel .projects-header { width: 100%; display: flex; flex-direction: column; align-items: flex-start; }
.projects-panel .projects-subtitle {
  color: #a0a0a0;
  font-size: 0.95em;
  margin: 0.4em 0 1em 0;
}

/* Projects v2 filters */
.projects-filters { width: 100%; display: flex; justify-content: flex-end; margin-bottom: 0.6em; }
/* Ensure right alignment specifically inside panel 8 */
.grid-panels .panel.projects-panel .projects-filters { justify-content: flex-end; }
.projects-filters select#proj-filter {
  background-color: var(--panel-color);
  color: var(--text-color);
  border: 1px solid var(--accent-color);
  border-radius: 10px;
  padding: 0.6em 2.2em 0.6em 2.4em; /* room for left folder + right chevron */
  font-size: 0.9em;
  cursor: pointer;
  outline: none;
  transition: 0.3s ease;
}
.projects-filters select#proj-filter:hover {
  background-color: var(--accent-color);
  color: #000;
}

/* Icons for the dropdown (folder left, chevron right) */
.projects-filters { position: relative; }
.projects-filters::before {
  content: '';
  position: absolute;
  right: 0.9em; top: 50%; transform: translateY(-50%);
  width: 12px; height: 12px;
  /* CSS chevron to avoid new assets */
  border-right: 2px solid var(--text-color);
  border-bottom: 2px solid var(--text-color);
  transform: translateY(-50%) rotate(45deg);
  pointer-events: none;
}
.projects-filters::after {
  content: '';
  position: absolute;
  left: 0.8em; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px;
  background-image: url('assets/icons/project.svg');
  background-size: contain; background-repeat: no-repeat; background-position: center;
  pointer-events: none;
}

/* Hide Projects dropdown as requested */
/* Left building icon and right chevron on the filter */
/* remove decorative icons on select (reverted) */

/* Ensure visual order: title (1) -> filters (2) -> accordion (3) */
/* reverted: do not force explicit order */

.proj-year {
  background: var(--panel-color);
  border-radius: 10px;
  overflow: hidden;
}

.proj-year summary {
  list-style: none;
  cursor: pointer;
  padding: 0.7em 0.9em;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Add simple arrow indicator */
.proj-year summary::after { content: "\25BC"; font-size: 0.8em; opacity: 0.7; }
.proj-year[open] summary::after { transform: rotate(180deg); display: inline-block; }

.proj-year[open] summary { color: var(--accent-color); }

.proj-list {
  padding: 0.4em 0.9em 0.8em;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}
.proj-list .proj-item + .proj-item { }

.proj-item {
  display: flex;
  align-items: center;
  gap: 0.6em;
  position: relative;
}


.proj-flag {
  font-size: 1.1em;
  line-height: 1;
}

.proj-badge {
  font-size: 0.75em;
  padding: 0.15em 0.55em;
  border-radius: 999px;
  background: rgba(0,0,0,0.15);
}

.proj-title { font-weight: 600; }

.proj-tooltip {
  position: absolute;
  left: 0;
  bottom: 120%;
  background: var(--panel-color);
  color: var(--text-color);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
  padding: 0.6em;
  display: none;
  z-index: 20;
  min-width: 200px;
}

.proj-tooltip.open { display: block; }

.proj-tooltip .thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4em;
}

.proj-tooltip img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
}

  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: inherit;
  opacity: 0.5;
  box-shadow: inherit;
  animation: rotate 100s linear infinite;
}

.earth-container:hover {
  transform: translateX(50%) scale(2);
}

.earth-container:hover + .grid-panels {
  opacity: 0.5;
}

@keyframes rotate {
  to { background-position: 200% 0; }
}

/* ========================================
   BUTTONS
======================================== */
.btn {
  background: var(--accent-color);
  color: #000;
  padding: 0.8em 2em;
  border-radius: 1em;
  font-size: 1.2em;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  /* Match software icon glow: use accent yellow */
  box-shadow: 0 0 8px var(--accent-color);
  transition: all 0.3s ease;
}

.btn:hover {
  box-shadow: 0 0 25px var(--accent-color);
}

/* CV: larger size */
#cv-btn {
  font-size: 1.35em;
  padding: 0.9em 2.2em;
}

/* CV (light mode): no shadow when not hovered */
body:not(.dark-mode) #cv-btn {
  /* Same shape as dark CV button */
  background-color: var(--accent-color) !important;
  color: #000 !important;
  border-radius: 1em;
  letter-spacing: 2px;
  text-transform: uppercase;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.35) !important; /* subtle rest shadow in light mode */
}

/* CV button keeps original style, add contextual shadows on hover */
body:not(.dark-mode) #cv-btn:hover {
  /* strong yellow glow on hover in light mode */
  box-shadow: 0 0 65px 14px var(--accent-color) !important;
}

body.dark-mode #cv-btn:hover {
  box-shadow: 0 0 25px var(--accent-color); /* yellow glow on dark mode */
}

/* ========================================
   PANEL 3: DARK MODE + LANGUAGE
======================================== */
.panel-3 {
  display: flex;
  flex-direction: row; /* una sola fila: dark mode | idiomas */
  justify-content: center;
  align-items: center;
  gap: 1em;
  padding: 1em;
}

.subpanel {
  width: auto;              /* ancho segÃºn contenido */
  display: flex;
  justify-content: center;
  align-items: center;
}

.subpanel.top {
  height: auto;
  justify-content: center;
}

.subpanel.bottom {
  height: auto;
  align-items: center;
}

/* Separador vertical entre dark mode y EN/ES */
.panel-3 .subpanel.top::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 1.8em;
  background: currentColor;
  opacity: 0.25;
  margin: 0 0.8em;
}

/* === DARK MODE BUTTON === */
.darkmode-btn {
  background-color: #000000; /* botÃ³n negro en modo claro */
  color: #000;               /* no afecta a los SVG de fondo */
  border: 2px solid var(--accent-color);
  border-radius: 50%;
  width: 2.8em;
  height: 2.8em;
  font-size: 1.3em;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.darkmode-btn:hover {
  transform: rotate(15deg);
}

.darkmode-btn .moon { display: none; }

/* Use external SVG files for sun/moon icons */
.darkmode-btn i {
  display: inline-block;
  width: 1.6rem;   /* bigger icon */
  height: 1.6rem;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  font-style: normal;
  font-size: 1.1rem; /* balance sizing context */
  line-height: 1;
  text-indent: -9999px; /* hide text if any */
  overflow: hidden;
}

/* remove any previous pseudo glyphs */
.darkmode-btn i::before { content: none !important; }

.darkmode-btn .sun { background-image: url('assets/icons/sun.svg'); }
.darkmode-btn .moon { background-image: url('assets/icons/moon.svg'); }

/* toggle between sun and moon */
body.dark-mode .darkmode-btn .sun { display: none; }
body.dark-mode .darkmode-btn .moon { display: inline-block; }

body.dark-mode .darkmode-btn {
  background-color: var(--accent-color);
  color: #000; /* iconos negros en modo oscuro tambiÃ©n */
}

/* Asegurar contraste de los SVG de fondo */
.darkmode-btn i { filter: invert(1); }         /* iconos blancos sobre botÃ³n negro */
body.dark-mode .darkmode-btn i { filter: none; } /* iconos negros sobre botÃ³n amarillo */

body.dark-mode .darkmode-btn .sun { display: none; }
body.dark-mode .darkmode-btn .moon { display: inline; }

/* === LANGUAGE SWITCHER === */
.language-switcher {
  display: flex;
  justify-content: center;
  gap: 0.8em;
  width: 100%;
}

.lang-btn {
  padding: 0.45em 1.4em;
  border: none;
  border-radius: 1em; /* same shape as CV */
  font-weight: 600;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: var(--panel-color);
  color: var(--text-color);
  box-shadow: 0 0 8px rgba(0,0,0,0.2);
  letter-spacing: 2px; /* match CV */
  text-transform: uppercase; /* match CV */
}

/* Increase size of language buttons in Panel 3 only */
.panel-3 .lang-btn {
  font-size: 1.1em;
  padding: 0.6em 1.8em;
}

.lang-btn.active {
  background-color: var(--accent-color);
  color: #000;
  box-shadow: 0 0 15px rgba(255, 237, 0, 0.45);
}

.lang-btn:hover {
  transform: translateY(-2px);
  /* Apply same yellow glow as CV button */
  box-shadow: 0 0 15px rgba(255, 237, 0, 0.45);
}

/* ========================================
   PANEL 9: LAST VISIT
======================================== */
.panel.bg {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #f0f0f0;
  background-image: url(./assets/img/backroundrender.jpg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  overflow: hidden;
}

/* Last Visit icon: match Projects/Skills icon size and yellow color */
.panel.bg > i {
  color: var(--accent-color);
  font-size: 1.5em;
}

.panel.bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  z-index: 0;
}

.panel.bg * {
  position: relative;
  z-index: 1;
}

/* ========================================
   RESPONSIVE GRID
======================================== */

/* Medium screens (iPad): 4 equal columns like desktop */
@media screen and (max-width: 1000px) and (min-width: 600px) {
  .grid-panels {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr); /* same row sizing as desktop */
    height: 100vh;
    min-height: 40em;
  }
  /* pixel-level seam correction for medium screens */
  .panel.skills-panel { margin-right: -2px; }
  .panel.projects-panel { margin-left: -2px; }

  /* reset generic spanning and ordering */
  .panel { min-height: unset; grid-column: auto; }
  .panel:nth-child(1),
  .panel:nth-child(2),
  .panel:nth-child(3),
  .panel:nth-child(4),
  .panel:nth-child(5),
  .panel:nth-child(6),
  .panel:nth-child(7),
  .panel:nth-child(8),
  .panel:nth-child(9) { order: 0; }

  /* mirror desktop placements */
  .panel:nth-child(1) { grid-column: 1 / 2; grid-row: 1 / 3; }
  .panel:nth-child(2) { grid-column: 2 / 4; grid-row: 1 / 3; }
  .panel:nth-child(3) { grid-column: 4 / 5; grid-row: 1 / 2; }
  .panel:nth-child(4) { grid-column: 4 / 5; grid-row: 2 / 3; }
  .panel:nth-child(5) { grid-column: 1 / 2; grid-row: 3 / 4; }
  .panel:nth-child(6) { grid-column: 1 / 2; grid-row: 4 / 5; }
  .panel:nth-child(7) { grid-column: 2 / 3; grid-row: 3 / 5; }
  .panel:nth-child(8) { grid-column: 3 / 4; grid-row: 3 / 5; }
  .panel:nth-child(9) { grid-column: 4 / 5; grid-row: 3 / 5; }

  /* iPad adjustments retained */
  .panel-3 { flex-direction: column; gap: 0.8em; }
  .panel-3 .subpanel.top::after { display: none; }
  .skills-grid { grid-template-columns: repeat(3, 1fr); }
  .skill { width: 37px; height: 37px; }

  /* iPad: place section titles at the top */
  .skills-panel { flex-direction: column !important; align-items: flex-start !important; padding-bottom: 1.2em; }
  .skills-panel h2 {
    position: static !important;
    left: auto; bottom: auto;
    display: flex; align-items: center; gap: 0.4em;
    margin: 0 0 0.8em 0;
    text-align: left;
  }

  .grid-panels .panel:nth-child(8) { align-items: flex-start !important; flex-direction: column; }
  .grid-panels .panel:nth-child(8) > div:first-child { display: flex; justify-content: flex-end; width: 100%; }
  .grid-panels .panel:nth-child(8) h2 {
    position: static !important;
    left: auto; bottom: auto;
    display: flex; align-items: center; gap: 0.4em;
    justify-content: flex-end; /* align to the right on iPad */
    width: 100%;
    margin: 0 0 0.8em 0;
    text-align: right;
  }
}

/* Small screens */
@media screen and (max-width: 600px) {
  .grid-panels {
    grid-template-columns: 1fr;     /* una sola columna */
    grid-auto-rows: auto;           /* filas con altura por contenido */
  }
  .panel {
    grid-column: auto;              /* ocupar su columna naturalmente */
    height: auto;                   /* altura determinada por su contenido */
    min-height: unset;              /* sin altura mÃ­nima fija */
  }
  /* Panel 3 primero en mÃ³vil */
  .panel.panel-3 { order: -10; }
  
  /* Panel amarillo (tÃ­tulo): texto e icono en negro en mÃ³vil */
  .panel.title, 
  .panel.title h1, 
  .panel.title i { 
    color: #000 !important; 
  }

  /* Skills: tÃ­tulo arriba dentro del panel (no abajo) */
  .skills-panel { flex-direction: column !important; padding-bottom: 1.2em; }
  .skills-panel h2 {
    position: static !important;
    left: auto; bottom: auto;
    align-self: center; /* centrar tÃ­tulo */
    display: flex; align-items: center; gap: 0.4em;
    margin: 0 0 0.8em 0;
    text-align: center;
  }

  /* Projects: tÃ­tulo arriba alineado a la derecha dentro del panel */
  .grid-panels .panel:nth-child(8) { align-items: flex-start; flex-direction: column; }
  .grid-panels .panel:nth-child(8) > div { align-self: stretch; width: 100%; }
  .grid-panels .panel:nth-child(8) h2 {
    position: static !important;
    left: auto; bottom: auto;
    display: flex; align-items: center; gap: 0.4em;
    justify-content: flex-start;
    width: 100%;
    margin: 0 0 0.8em 0;
    text-align: left;
  }
  /* Ocultar el planeta en mÃ³vil */
  .earth-container {
    display: none !important;
  }
}

/* Large screens */
@media screen and (min-width: 1000px) {
  h1 { font-size: 2.5em; }

  .earth-container {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .earth-container:hover {
    transform: translate(-50%, -50%) scale(2);
  }

  .grid-panels {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    height: 100vh;
    min-height: 40em;
  }

  .panel:nth-child(1) { grid-column: 1 / 2; grid-row: 1 / 3; }
  .panel:nth-child(2) { grid-column: 2 / 4; grid-row: 1 / 3; }
  .panel:nth-child(3) { grid-column: 4 / 5; grid-row: 1 / 2; }
  .panel:nth-child(4) { grid-column: 4 / 5; grid-row: 2 / 3; }
  .panel:nth-child(5) { grid-column: 1 / 2; grid-row: 3 / 4; }
  .panel:nth-child(6) { grid-column: 1 / 2; grid-row: 4 / 5; }
  .panel:nth-child(7) { grid-column: 2 / 3; grid-row: 3 / 5; }
  .panel:nth-child(8) { grid-column: 3 / 4; grid-row: 3 / 5; }
  .panel:nth-child(9) { grid-column: 4 / 5; grid-row: 3 / 5; }

  /* Desktop layout adjustments */
  .panel-3 { flex-direction: column; gap: 0.8em; }
  .panel-3 .subpanel.top::after { display: none; }
  .skills-grid { grid-template-columns: repeat(3, 1fr); }
  .skill { width: 37px; height: 37px; }
  .panel.skills-panel { overflow: hidden !important; }

  /* Desktop: place section titles at the top */
  .skills-panel { flex-direction: column !important; align-items: flex-start !important; padding-bottom: 1.2em; }
  .skills-panel h2 {
    position: static !important;
    left: auto; bottom: auto;
    display: flex; align-items: center; gap: 0.4em;
    margin: 0 0 0.8em 0;
    text-align: left;
  }

  .grid-panels .panel:nth-child(8) { align-items: flex-start !important; flex-direction: column; }
  .grid-panels .panel:nth-child(8) > div:first-child { display: flex; justify-content: flex-end; width: 100%; }
  .grid-panels .panel:nth-child(8) h2 {
    position: static !important;
    left: auto; bottom: auto;
    display: flex; align-items: center; gap: 0.4em;
    justify-content: flex-end;
    width: 100%;
    margin: 0 0 0.8em 0;
    text-align: right;
  }
}

/* ========================================
   MODAL CV
======================================== */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background-color: var(--panel-color);
  padding: 1.5em;
  border-radius: 12px;
  width: 80%;
  max-width: 900px;
  color: var(--text-color);
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.5);
}

.cv-content iframe {
  width: 100%;
  height: 80vh;
  border-radius: 8px;
  border: none;
}

.close {
  position: absolute;
  top: 10px;
  right: 20px;
  color: var(--text-color);
  font-size: 1.8em;
  cursor: pointer;
  transition: transform 0.3s ease, color 0.3s ease;
}

.close:hover {
  transform: scale(1.2);
  color: var(--accent-color);
}

/* ========================================
   ANIMATIONS
======================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ========================================
   TEMP: CENTER VERTICAL GUIDE (on top of all)
======================================== */
#center-guide {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-1px);
  width: 2px;
  height: 100vh;
  background: var(--accent-color);
  opacity: 0.9;
  pointer-events: none;
  z-index: 100000; /* above everything */
}


/* ========================================
   PANEL 7: TECHNOLOGIES & TOOLS (FINAL ORDEN Y ESPACIADO)
======================================== */
.skills-panel {
  position: relative;
  display: flex;
  flex-direction: column-reverse; /* ordena de abajo hacia arriba */
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  padding: 1.5em;
  padding-bottom: 3.5em; /* espacio inferior para el tÃ­tulo */
  overflow: visible;
  z-index: 2; /* debajo del planeta */
}

/* === TÃTULO ABAJO A LA IZQUIERDA === */
.skills-panel h2 {
  position: absolute;
  bottom: 0.5em; /* visible sobre el borde inferior */
  left: 1em;
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-size: 1.5em; /* igual que otros h2 */
  font-weight: 600;
  color: var(--text-color);
}

.skills-panel h2::before {
  content: "\f121"; /* Ã­cono de cÃ³digo */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 1em;
  color: var(--accent-color);
}

/* Projects title style to match Skills across viewports */
#projects {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-weight: 600;
  color: var(--text-color);
}

#projects::before {
  content: "\f1ad"; /* fa-building */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 1em;
  color: var(--accent-color);
}

/* Light mode: add dark shadow to section icons (Skills and Experience) */
body:not(.dark-mode) .skills-panel h2::before,
body:not(.dark-mode) #projects::before,
body:not(.dark-mode) .projects-panel h2::before {
  text-shadow: 0 0 8px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.35);
}

/* ========================================
   PANEL 8: EXPERIENCE LIST (within projects panel)
   Scope styles so only panel 8 is affected
======================================== */
.projects-panel .experience-list {
  width: 100%;
  margin-top: 0.6em;
  display: flex;
  flex-direction: column;
  gap: 0.8em;
  flex: 1;
  min-height: 0;
  overflow-y: auto; /* mantiene el scroll interno */
  /* Oculta la barra para que no reste ancho visual */
  scrollbar-width: none;           /* Firefox */
  -ms-overflow-style: none;        /* IE/Edge legacy */
}
.projects-panel .experience-list::-webkit-scrollbar { display: none; width: 0; height: 0; } /* WebKit */

.projects-panel .experience-item {
  /* Match general background in both themes */
  background: var(--bg-color);
  border-radius: 12px;
  /* Reserve space at bottom for the toggle */
  /* Tighter horizontal padding to align visual width with Skills */
  padding: 0.1em 0.1em 1em;
  box-shadow: none; /* remove card shadows inside Experience */
  position: relative;
  cursor: pointer; /* make whole card feel clickable */

  margin-left: -0.2em;
  margin-right: -0.2em;
}

.projects-panel .experience-header {
  /* Flag moved next to country inside .location; simplify grid */
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  grid-template-areas:
    "text"
    "date";
  align-items: start;
  gap: 0.12em 0.6em;
  cursor: pointer;
}

.projects-panel .experience-header h3 {
  margin: 0;
  font-size: 1.05em;
  /* Change from accent yellow to white */
  color: var(--text-color);
}

.projects-panel .location,
.projects-panel .date { color: #a0a0a0; font-size: 0.9em; }

.projects-panel .flag { font-size: 1.1em; }
.projects-panel .location .flag { margin-right: 0.35em; }
.projects-panel .text-group { grid-area: text; min-width: 220px; }
.projects-panel .date { grid-area: date; }

.projects-panel .toggle-btn {
  position: absolute;
  right: 0.6em;
  bottom: 0.5em; /* bottom sector of the card */
  background: none;
  border: none;
  font-size: 0.9em; /* smaller size */
  line-height: 1;
  color: var(--accent-color); /* yellow */
  cursor: pointer;
}

.projects-panel .experience-content {
  margin-top: 0.6em;
  font-size: 0.95em;
  color: #cfcfcf;
  line-height: 1;
  display: block;
}

.projects-panel .experience-item:not(.active) .experience-content { display: none; }

/* === GRID DE ICONOS === */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2em 1.6em; /* aumenta el espacio vertical (entre filas) */
  justify-items: center;
  align-items: end; /* Ã­conos se apilan desde abajo */
  width: 100%;
  overflow: visible;
  margin-top: calc(0.5em + 2px); /* baja 2px extra los iconos respecto al tÃ­tulo */
  margin-bottom: 0.5em; /* deja aire sobre el tÃ­tulo */
}

/* === ICONOS === */
.skill {
  position: relative;
  width: 43px;
  height: 43px;
  display: flex;
  justify-content: center;
  align-items: center;
  filter: grayscale(100%) brightness(0.7);
  transition: all 0.4s ease;
  cursor: pointer;
  z-index: 3;
}

.skill img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

/* Hover */
.skill:hover {
  transform: scale(1.1);
  filter: grayscale(0%) brightness(1);
}

/* Inactive state after mobile tap timeout */
.skill.inactive {
  filter: grayscale(100%) brightness(0.6) !important;
  opacity: 0.6;
  transform: none !important;
  pointer-events: none;
}

/* === TOOLTIP (mÃ¡s visible y sin cortar) === */
.skill::after {
  content: attr(data-name);
  position: absolute;
  top: calc(100% + 2px); /* mÃ¡s pegado al icono */
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--panel-color);
  color: var(--text-color);
  font-size: 0.7em;
  padding: 0.3em 0.6em;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  white-space: nowrap;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.25);
  z-index: 20;
}

.skill:hover::after {
  opacity: 1;
}

/* === EFECTO BRILLO EN MODO OSCURO === */
body.dark-mode .skill:hover img {
  filter: drop-shadow(0 0 6px var(--accent-color));
}

/* Light mode: dark shadow on hover for software icons */
body:not(.dark-mode) .skill:hover img {
  filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.55));
}

/* ========================================
   FIX: PLANETA POR ENCIMA DEL PANEL
======================================== */
.earth-container {
  position: absolute;
  z-index: 50 !important; /* planeta visible sobre todo */
}

.panel {
  position: relative;
  z-index: 1;
}

.panel.skills-panel {
  z-index: 2;
  overflow: visible;
}

.skills-grid,
.skill {
  position: relative;
  z-index: 3;
  overflow: visible;
}
/* Light mode: dark shadow for software icons as well */
body:not(.dark-mode) .skill img {
  filter: drop-shadow(0 0 8px rgba(0,0,0,0.35));
}
/* Tighter line-height for role paragraphs inside Experience */
.projects-panel .experience-content p { line-height: 1.17em; margin: 0.25em 0; }

/* Light mode: experience paragraph color normal */
body:not(.dark-mode) .projects-panel .experience-content p { color: #0b0b0b; font-weight: 400; }
