:root {
  /* Custom portfolio colors */
  --portfolio-bg: #011627;
  --portfolio-bg-gradient: linear-gradient(
    135deg,
    #011627 0%,
    #014361 50%,
    #01a9b4 100%
  );
  --portfolio-text: #e5e9f0;
  --portfolio-accent: #43d9ad;
  --portfolio-muted: #607b96;
  --portfolio-orange: #fea55f;
  --portfolio-border: #1e2d3d;
  --portfolio-card-bg: #011221;
}

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

body {
  font-family: "Fira Code", "Courier New", monospace;
  background: url("../imgs/fondo.jpg") no-repeat center center / cover;
  color: var(--portfolio-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Navigation */
nav {
  display: flex;
  align-items: center;
  padding: 0;
  background: transparent;
  border-bottom: 1px solid var(--portfolio-border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 1rem;
}

.hamburger {
  display: block;
  position: relative;
  width: 24px;
  height: 2px;
  background: var(--portfolio-text);
  transition: transform 0.3s ease;
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--portfolio-text);
  transition: transform 0.3s ease, top 0.3s ease;
}

.hamburger::before {
  top: -8px;
}

.hamburger::after {
  top: 8px;
}

.nav-open .hamburger {
  transform: rotate(45deg);
}

.nav-open .hamburger::before {
  top: 0;
  transform: rotate(90deg);
}

.nav-open .hamburger::after {
  top: 0;
}

.nav-brand {
  padding: 1rem 1.5rem;
  font-weight: 600;
  color: var(--portfolio-accent);
  border-right: 1px solid var(--portfolio-border);
  text-decoration: none;
  transition: color 0.3s;
}

.nav-links {
  display: flex;
  flex: 1;
  list-style: none;
}

.nav-links li {
  position: relative;
}

.nav-links a {
  display: block;
  padding: 1rem 1.5rem;
  color: var(--portfolio-muted);
  text-decoration: none;
  border-right: 1px solid var(--portfolio-border);
  transition: all 0.3s;
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--portfolio-text);
  background: rgba(67, 217, 173, 0.05);
}

.nav-links a.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--portfolio-orange);
  animation: slideIn 0.3s ease;
}

.nav-contact {
  margin-left: auto;
  padding: 1rem 1.5rem;
  color: var(--portfolio-muted);
  text-decoration: none;
  border-left: 1px solid var(--portfolio-border);
  border-right: 1px solid var(--portfolio-border);
  transition: all 0.3s;
  position: relative;
}

.nav-contact:hover,
.nav-contact.active {
  color: var(--portfolio-text);
  background: rgba(67, 217, 173, 0.05);
}

.nav-contact.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 2px;
  background: var(--portfolio-orange);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* Main Content */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.page-content {
  display: none;
  flex: 1;
}

.page-content.active {
  display: flex;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hello Page */
.hello-page {
  justify-content: flex-start;
  align-items: center;
  padding: 2rem 2rem 2rem 11rem;
  text-align: left;
  background: url("../imgs/fondo.jpg") no-repeat center center / cover;
}

.hello-content h2 {
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--portfolio-text);
  margin-bottom: 0.5rem;
}

.hello-content h1 {
  font-size: 3.5rem;
  font-weight: 600;
  color: var(--portfolio-text);
  margin-bottom: 1rem;
}

.hello-content .subtitle {
  font-size: 1.5rem;
  color: var(--portfolio-accent);
  margin-bottom: 4rem;
  display: inline-block;
}

.hello-content .subtitle.typing::after {
  content: "|";
  animation: blink 1s step-end infinite;
  color: var(--portfolio-accent);
  font-weight: 200;
}

@keyframes blink {
  from,
  to {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.code-block {
  text-align: left;
  max-width: 600px;
  margin: 0 auto;
  background: transparent;
  padding: 0;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  line-height: 1.8;
}

.code-comment {
  color: #8892b0;
  font-style: italic;
  opacity: 0.9;
}

.code-keyword {
  color: #c792ea;
}

.code-variable {
  color: var(--portfolio-accent);
}

.code-string {
  color: var(--portfolio-orange);
}

.code-number {
  color: #f78c6c;
}

/* About Page */
.about-page {
  flex-direction: row;
  height: calc(100vh - 120px);
  background-color: var(--portfolio-bg);
}

.sidebar {
  width: 280px;
  background: rgba(1, 22, 39, 0.6);
  border-right: 1px solid var(--portfolio-border);
  overflow-y: auto;
  padding: 0.5rem 0;
}

.sidebar-section {
  border-bottom: 1px solid var(--portfolio-border);
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-header {
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--portfolio-text);
  font-weight: 500;
  transition: background 0.2s;
  border-bottom: 1px solid var(--portfolio-border);
}

.sidebar-header:hover {
  background: rgba(67, 217, 173, 0.05);
}

.sidebar-header .icon {
  font-size: 0.75rem;
  transition: transform 0.3s;
  flex-shrink: 0;
}

.sidebar-header .icon.collapsed {
  transform: rotate(-90deg);
}

.sidebar-items {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.4s ease-in-out;
}

.sidebar-items.collapsed {
  max-height: 0;
}

.sidebar-item {
  padding: 0.5rem 1rem 0.5rem 1.5rem;
  color: var(--portfolio-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.sidebar-item:hover {
  color: var(--portfolio-text);
  background: rgba(67, 217, 173, 0.05);
}

.sidebar-item.nested-header {
  padding-left: 1.5rem;
}

.sidebar-item.nested-header .icon {
  font-size: 0.75rem;
  transition: transform 0.3s;
  flex-shrink: 0;
}

.sidebar-item.nested-header .icon.collapsed {
  transform: rotate(-90deg);
}

.sidebar-item.final-item {
  padding-left: 2.5rem;
  color: var(--portfolio-muted);
}

.sidebar-item.final-item.active {
  background: rgba(67, 217, 173, 0.08);
  color: var(--portfolio-text);
  border-left: 2px solid var(--portfolio-accent);
}

.sidebar-item.final-item:hover {
  color: var(--portfolio-text);
}

/* Íconos de carpeta y archivo */
.folder-icon,
.file-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.folder-icon.bio-color {
  color: #e99287;
}

.folder-icon.interests-color {
  color: var(--portfolio-accent);
}

.folder-icon.education-color {
  color: #3a9dff;
}

.file-icon {
  color: var(--portfolio-muted);
}

.final-item:hover .file-icon {
  color: var(--portfolio-text);
}

/* Items de contacto */
.contact-item {
  padding: 0.5rem 1rem 0.5rem 1.5rem;
  color: var(--portfolio-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.contact-item:hover {
  color: var(--portfolio-text);
  background: rgba(67, 217, 173, 0.05);
}

.contact-item svg {
  width: 16px;
  height: 16px;
  color: var(--portfolio-accent);
  flex-shrink: 0;
}

.content-area {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.line-numbers {
  display: flex;
  flex-direction: column;
  padding: 2.2rem 0.5rem;
  color: var(--portfolio-muted);
  font-size: 0.9rem;
  line-height: 1.8;
  user-select: none;
  background: rgba(1, 18, 33, 0.4);
  border-right: 1px solid var(--portfolio-border);
}

.line-numbers > div {
  padding: 0.2px 0.2rem;
}

.code-content {
  flex: 1;
  padding: 2rem;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--portfolio-muted);
  overflow-y: auto;
}

.code-content-panel {
  display: none;
}

.code-content-panel.active {
  display: block;
}

.code-content p {
  margin: 0;
}

.bracket-text {
  color: #ff5454;
}

.right-sidebar {
  width: 380px;
  background: rgba(1, 22, 39, 0.6);
  border-left: 1px solid var(--portfolio-border);
  padding: 2rem 1.5rem;
  overflow-y: auto;
}

.right-sidebar h3 {
  color: var(--portfolio-muted);
  font-size: 0.9rem;
  font-weight: 400;
  margin-bottom: 1rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.sidebar-card {
  background: var(--portfolio-card-bg);
  border: 1px solid var(--portfolio-border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 2rem;
}

.card-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--portfolio-border);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--portfolio-accent);
  color: var(--portfolio-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.username {
  color: var(--portfolio-text);
  font-size: 0.9rem;
  word-break: break-word;
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.tech-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--portfolio-muted);
  font-size: 0.9rem;
}

.tech-item.learned {
  color: var(--portfolio-text);
}

.tech-item .check {
  color: var(--portfolio-accent);
  flex-shrink: 0;
}

.tech-item .uncheck {
  color: var(--portfolio-muted);
  opacity: 0.3;
  flex-shrink: 0;
}

.tech-item .tech-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.languages-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.language-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  color: var(--portfolio-text);
  font-size: 0.85rem;
}

.language-item .flag {
  font-size: 1.5rem;
}

/* Projects Page */
.projects-page {
  flex-direction: row;
  height: calc(100vh - 120px);
  background-color: var(--portfolio-bg);
}

.projects-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  background: rgba(1, 18, 33, 0.3);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 1200px;
}

.project-card {
  background: var(--portfolio-card-bg);
  border: 1px solid var(--portfolio-border);
  border-radius: 8px;
  padding: 1.5rem;
  min-height: 250px;
  transition: all 0.3s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  border-color: var(--portfolio-accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(67, 217, 173, 0.1);
}

.project-card h3 {
  color: var(--portfolio-accent);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.project-card .project-name {
  color: var(--portfolio-text);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

/* Footer */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
  background: transparent;
  border-top: 1px solid var(--portfolio-border);
  font-size: 0.9rem;
}

.footer-left {
  display: flex;
  align-items: center;
  color: var(--portfolio-muted);
  border-right: 1px solid var(--portfolio-border);
}

.footer-left > span {
  padding: 0.75rem 1.5rem;
  border-right: 1px solid var(--portfolio-border);
}

.social-links {
  display: flex;
}

.social-links a {
  color: var(--portfolio-muted);
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  transition: color 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--portfolio-border);
}

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

.social-links svg {
  width: 20px;
  height: 20px;
}

.footer-right {
  color: var(--portfolio-muted);
  padding: 0.75rem 1.5rem;
  border-left: 1px solid var(--portfolio-border);
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
    margin-left: auto;
    order: 2;
  }

  .hello-page {
    padding: 2rem 2rem 2rem 2rem;
  }

  .nav-contact {
    display: none;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--portfolio-bg);
    flex-direction: column;
    align-items: center;
    border-top: 1px solid var(--portfolio-border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
  }

  .nav-open .nav-links {
    max-height: 500px;
  }

  .nav-links a {
    padding: 1rem;
    font-size: 1rem;
    border-right: none;
    border-bottom: 1px solid var(--portfolio-border);
    width: 100%;
    text-align: center;
  }

  .nav-links li {
    width: 100%;
  }

  .hello-content h1 {
    font-size: 2.5rem;
  }

  .hello-content .subtitle {
    font-size: 1.25rem;
  }

  .about-page,
  .projects-page {
    flex-direction: column;
    height: auto;
  }

  .sidebar,
  .right-sidebar {
    width: 100%;
    max-height: 300px;
  }

  .content-area {
    flex-direction: column;
  }

  .line-numbers {
    display: none;
  }

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

  footer {
    flex-wrap: wrap;
  }

  .footer-left {
    flex-wrap: wrap;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--portfolio-border);
  }

  .footer-left > span {
    border-right: none;
    border-bottom: 1px solid var(--portfolio-border);
  }

  .social-links {
    flex-wrap: wrap;
  }

  .social-links a {
    border-right: none;
    border-bottom: 1px solid var(--portfolio-border);
  }

  .footer-right {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--portfolio-border);
  }
}

@media (max-width: 480px) {
  .nav-brand {
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
  }

  .hello-content h1 {
    font-size: 2rem;
  }

  .code-block {
    padding: 1rem;
    font-size: 0.85rem;
  }

  footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

nav.solid-background,
footer.solid-background {
  /* Usamos el color de fondo de la UI pero con transparencia 
    para mantener el efecto blur (glassmorphism) 
  */
  background-color: rgba(1, 22, 39, 0.8); /* 80% opacidad de --portfolio-bg */
  backdrop-filter: blur(10px);
}
