:root{
  --bg: #0b0c10;
  --card: #15161a;
  --card2: #121317;
  --text: #e9ecf1;
  --muted: #aab2c0;
  --line: rgba(255,255,255,.08);
  --shadow: 0 14px 40px rgba(0,0,0,.45);
  --radius: 18px;
  --max: 1100px;
  --accent: #f4c542;
  --accent2: #ffdf85;
  --accentRgb: 244, 197, 66;
  --action: #3c8527;
  --actionRgb: 60, 133, 39;
  --btn: #e9ecf1;
  --btnText: #0b0c10;
  --focus: rgba(var(--accentRgb),.42);
  --headerBg: rgba(11,12,16,.75);
  --indicator: rgba(var(--accentRgb), 0.14);
}

@font-face {
  font-family: 'Minecrafter';
  src: url('src/fonts/minecrafter/Minecrafter.Reg.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: 'Minecrafter Alt';
  src: url('src/fonts/minecrafter/Minecrafter.Alt.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@media (prefers-color-scheme: light) {
  :root{
    --bg: #0b0c10;
    --card: #15161a;
    --card2: #121317;
    --text: #e9ecf1;
    --muted: #aab2c0;
    --line: rgba(255,255,255,.08);
    --shadow: 0 14px 40px rgba(0,0,0,.45);
    --btn: #e9ecf1;
    --btnText: #0b0c10;
    --focus: rgba(var(--accentRgb),.42);
    --headerBg: rgba(11,12,16,.75);
    --indicator: rgba(var(--accentRgb), 0.14);
  }
}

[data-theme="dark"]{
  --bg: #0b0c10;
  --card: #15161a;
  --card2: #121317;
  --text: #e9ecf1;
  --muted: #aab2c0;
  --line: rgba(255,255,255,.08);
  --shadow: 0 14px 40px rgba(0,0,0,.45);
  --btn: #e9ecf1;
  --btnText: #0b0c10;
  --focus: rgba(var(--accentRgb),.42);
  --headerBg: rgba(11,12,16,.75);
  --indicator: rgba(var(--accentRgb), 0.14);
}
[data-theme="light"]{
  --bg: #0b0c10;
  --card: #15161a;
  --card2: #121317;
  --text: #e9ecf1;
  --muted: #aab2c0;
  --line: rgba(255,255,255,.08);
  --shadow: 0 14px 40px rgba(0,0,0,.45);
  --btn: #e9ecf1;
  --btnText: #0b0c10;
  --focus: rgba(var(--accentRgb),.42);
  --headerBg: rgba(11,12,16,.75);
  --indicator: rgba(var(--accentRgb), 0.14);
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background-color: var(--bg);
  background-image: linear-gradient(to top, rgba(var(--accentRgb), 0.1) 0%, transparent 40%); /* Solo gradiente sutil abajo */
  color: var(--text);
  line-height: 1.6;
  padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
}

#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

h1, h2, h3, h4, h5, h6, .about-title, .contact-title, .dash-title, .kicker, .link-card__title, .theme-btn {
  font-family: 'Minecrafter', 'Minecrafter Alt', ui-sans-serif, system-ui, cursive;
  letter-spacing: 0.02em;
  font-weight: normal;
  text-transform: lowercase;
}

body[data-page="portfolio"],
body[data-page="skills"]{
  overflow: hidden;
}

/* Custom Scrollbar for Projects and Skills Page Container */
body[data-page="portfolio"] .page,
body[data-page="skills"] .page {
  height: 100vh;
  overflow-y: auto;
  padding-bottom: 120px; /* Space for bottom nav */
}

body[data-page="portfolio"] .page::-webkit-scrollbar,
body[data-page="skills"] .page::-webkit-scrollbar {
  width: 8px;
}
body[data-page="portfolio"] .page::-webkit-scrollbar-track,
body[data-page="skills"] .page::-webkit-scrollbar-track {
  background: transparent;
}
body[data-page="portfolio"] .page::-webkit-scrollbar-thumb,
body[data-page="skills"] .page::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
body[data-page="portfolio"] .page::-webkit-scrollbar-thumb:hover,
body[data-page="skills"] .page::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.page {
  opacity: 1;
  transition: opacity 0.4s ease-in-out;
  /* Allow sections to handle their own layout */
  display: flex;
  flex-direction: column;
}

.page-section {
  display: none;
  width: 100%;
}

.page-section.active {
  display: block;
  animation: fadeInUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

a{ color: inherit; }
:focus-visible{
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.section{
  max-width: var(--max);
  margin: 0 auto;
  padding: 64px 18px;
}
body[data-page="about"] .section {
  padding-top: 140px;
}
.section--wide{
  max-width: 1600px;
}
.muted{ color: var(--muted); }
.small{ font-size: .92rem; }
.lead{ font-size: 1.05rem; }
p{
  text-align: justify;
  text-justify: inter-word;
}
.project__body .muted{
  text-align: justify;
  text-justify: inter-word;
}
.kicker{
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: .8rem;
  margin: 0 0 10px;
}

.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-weight: 600;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  gap: 8px;
}
.btn:hover{
  background: rgba(255,255,255,0.1);
  transform: translateY(-1px);
}
.btn--ghost{
  background: transparent;
  border-color: transparent;
}
.btn--ghost:hover{
  background: rgba(255,255,255,0.08);
}
.btn--primary{
  background: var(--action);
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  box-shadow: 0 4px 14px rgba(var(--actionRgb),0.28);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.btn--primary:hover{
  box-shadow: 0 6px 20px rgba(var(--actionRgb),0.35);
  background: linear-gradient(180deg, #479e2e 0%, #347022 100%);
  border-color: rgba(255,255,255,0.2);
}
.btn--secondary{
  background: rgba(255,255,255,0.05);
  border: 1px solid transparent;
  color: var(--text);
}
.btn--secondary:hover{
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.15);
}

.grid{
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(12, 1fr);
}
.grid--layout > *{
  grid-column: span 12;
}
.card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.header{
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: transparent;
  border-bottom: none;
  pointer-events: none;
}
.header__inner{
  width: 100%;
  padding: 24px 60px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  pointer-events: auto;
}
.header__actions{
  display: flex;
  gap: 10px;
  align-items: center;
}
.theme-btn{
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 800;
}
.theme-btn:hover{
  background: rgba(255,255,255,.06);
}

.theme-switch{
  display: inline-flex;
  gap: 10px;
  align-items: center;
}
.theme-icon-btn{
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--muted);
  cursor: pointer;
}
.theme-icon-btn:hover{
  background: rgba(255,255,255,.08);
  color: var(--text);
}
.theme-icon-btn.is-active{
  background: rgba(var(--accentRgb),.16);
  border-color: rgba(var(--accentRgb),.32);
  color: var(--text);
}

.bottom-nav{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  pointer-events: none;
}
.bottom-nav__inner{
  pointer-events: auto;
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  position: relative;
}
.nav-indicator {
  position: absolute;
  top: 0;
  left: 0;
  background: var(--indicator);
  border-radius: 999px;
  z-index: 1;
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bottom-nav__inner a{
  position: relative;
  z-index: 2;
  text-decoration: none;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 24px;
  border-radius: 999px;
  transition: color 0.3s;
  border: 1px solid transparent;
  font-size: 0.95rem;
}
.bottom-nav__inner a:hover{
  color: #f8fafc;
  background: transparent;
  border-color: transparent;
}
.bottom-nav__inner a.is-active{
  color: #ffffff;
  background: transparent;
  border-color: transparent;
  font-weight: 700;
}

.hero__grid{
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 40px;
  align-items: center;
}
.hero__left{
  display: grid;
  gap: 16px;
}
.hero__right{
  position: relative;
}
.dashboard-grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.dash-card{
  background: var(--card);
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.dash-card:hover{
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.2);
  border-color: rgba(var(--accentRgb),0.32);
}
.dash-icon{
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(var(--accentRgb),0.14);
  color: var(--accent);
}
.dash-title{
  margin: 0;
  font-size: 1rem;
  font-weight: normal;
  color: var(--text);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.8);
}
.dash-text{
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}
.about-hero{
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 8px;
}
.about-hero__avatar{
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid transparent;
  box-shadow: 0 0 20px rgba(var(--accentRgb),0.22);
  flex: 0 0 auto;
  position: relative;
}
.about-hero__avatar img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.about-title{
  margin: 0;
  font-size: clamp(2.5rem, 5vw, 3.8rem);
  line-height: 1.1;
  font-weight: 800;
  /* background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%); */
  color: var(--accent);
  text-shadow: 0 4px 24px rgba(var(--accentRgb), 0.25);
  letter-spacing: -0.02em;
}

@media (max-width: 980px){
  .header__inner{ padding: 24px 18px; }
  .hero__grid{ grid-template-columns: 1fr; gap: 32px; }
  .hero__stats{ grid-template-columns: 1fr; }
  .dashboard-grid{ grid-template-columns: 1fr; }
  .about-hero{ flex-direction: column; align-items: flex-start; gap: 12px; }
  .about-title{ font-size: 3rem; }
  .project{ grid-column: span 12; }
  .contact-card{ grid-column: span 12; }
  .link-card{ grid-column: span 12; }
  .card--wide{ grid-column: span 12; }
  .about-cards{ grid-template-columns: 1fr; }
  body[data-page="about"],
  body[data-page="contact"]{
    overflow: auto;
  }
  /* Restore scroll on mobile for all pages if needed, or keep hidden/auto specific logic */
  body { overflow: auto; }
}

@media (min-width: 981px){
  .grid--layout > *{ grid-column: span 4; }
  body[data-page="skills"] .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.project{
  grid-column: span 4;
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100%;
}
.project__media{
  position: relative;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, rgba(var(--accentRgb),.12), rgba(var(--accent2Rgb),.10));
  border-bottom: 1px solid transparent;
}
.project__media img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.01);
  filter: saturate(1.05) contrast(1.02);
}
.project__body{
  padding: 16px 18px 18px;
  display: grid;
  gap: 10px;
  align-content: start;
}
.project__link{
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  text-decoration: none;
  color: inherit;
}
.project__link:hover .project__media img{
  transform: scale(1.04);
  transition: transform .25s ease;
}
.project h3{
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--text);
  font-weight: normal;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.8);
}
.project:hover h3{
  text-decoration: underline;
}
.tags{
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  padding-bottom: 2px; /* Espacio para scrollbar invisible */
}
.tags::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Opera */
}
.tag{
  flex: 0 0 auto;
  font-size: .85rem;
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.03);
  font-weight: 800;
  white-space: nowrap;
}

.contact-layout{
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 60px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
}

.contact-title{
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 30px;
  color: var(--text);
}

.contact-links{
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-link-item{
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 1rem;
  transition: color 0.2s;
}

.contact-btn-reset{
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.contact-link-item:hover{
  color: var(--text);
}

.contact-icon{
  display: grid;
  place-items: center;
  color: inherit;
}

.contact-form-wrapper{
  background: transparent;
}

.contact-form{
  display: grid;
  gap: 20px;
}

.form-group{
  display: grid;
  gap: 8px;
}

.form-group label{
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-left: 4px;
}

.form-group input,
.form-group textarea{
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s;
  outline: none;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus{
  border-color: rgba(var(--accentRgb),0.55);
  background: rgba(255,255,255,0.05);
  box-shadow: 0 0 0 4px rgba(var(--accentRgb),0.12);
}

.btn--block{
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  font-size: 1rem;
}

@media (max-width: 800px){
  .contact-layout{
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

.footer{
  border-top: 1px solid var(--line);
  padding: 26px 18px;
  text-align: center;
}

.page{
  min-height: 100vh;
}
.page__head{
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.page__head h1{
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.4rem);
  letter-spacing: -0.03em;
}

.page-links{
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}
.link-card{
  grid-column: span 6;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px;
  background: rgba(255,255,255,.03);
}
.link-card:hover{
  background: rgba(255,255,255,.06);
}
.link-card__title{
  font-weight: 1000;
  letter-spacing: -0.01em;
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.h2{
  margin: 0 0 10px;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.card--wide{
  grid-column: span 8;
}

.skill-list{
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.skill-list li{
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  padding: 10px 12px;
  border-radius: 999px;
  font-weight: 900;
  color: var(--muted);
}

.skills-text-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skills-text-list li {
  position: relative;
  padding-left: 20px;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
}

.skills-text-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Base animation for staggered entrance */
body:not(.is-transitioning) .hero__left > *,
body:not(.is-transitioning) .hero__right,
body:not(.is-transitioning) .dash-card,
body:not(.is-transitioning) .project,
body:not(.is-transitioning) .contact-info,
body:not(.is-transitioning) .contact-form-wrapper,
body:not(.is-transitioning) .page__head,
body:not(.is-transitioning) .skill-list > li {
  animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

/* Stagger delays */
body:not(.is-transitioning) .hero__left > *:nth-child(1) { animation-delay: 0.1s; }
body:not(.is-transitioning) .hero__left > *:nth-child(2) { animation-delay: 0.2s; }
body:not(.is-transitioning) .hero__left > *:nth-child(3) { animation-delay: 0.3s; }
body:not(.is-transitioning) .hero__left > *:nth-child(4) { animation-delay: 0.4s; }

body:not(.is-transitioning) .hero__right { animation-delay: 0.4s; }

/* Dashboard cards stagger */
body:not(.is-transitioning) .dash-card:nth-child(1) { animation-delay: 0.1s; }
body:not(.is-transitioning) .dash-card:nth-child(2) { animation-delay: 0.2s; }
body:not(.is-transitioning) .dash-card:nth-child(3) { animation-delay: 0.3s; }
body:not(.is-transitioning) .dash-card:nth-child(4) { animation-delay: 0.4s; }
body:not(.is-transitioning) .dash-card:nth-child(5) { animation-delay: 0.5s; }
body:not(.is-transitioning) .dash-card:nth-child(6) { animation-delay: 0.6s; }
body:not(.is-transitioning) .dash-card:nth-child(7) { animation-delay: 0.7s; }
body:not(.is-transitioning) .dash-card:nth-child(8) { animation-delay: 0.8s; }
body:not(.is-transitioning) .dash-card:nth-child(9) { animation-delay: 0.9s; }
body:not(.is-transitioning) .dash-card:nth-child(10) { animation-delay: 1.0s; }
body:not(.is-transitioning) .dash-card:nth-child(11) { animation-delay: 1.1s; }
body:not(.is-transitioning) .dash-card:nth-child(12) { animation-delay: 1.2s; }

/* Skills list stagger */
body:not(.is-transitioning) .skill-list > li:nth-child(1) { animation-delay: 0.1s; }
body:not(.is-transitioning) .skill-list > li:nth-child(2) { animation-delay: 0.15s; }
body:not(.is-transitioning) .skill-list > li:nth-child(3) { animation-delay: 0.2s; }
body:not(.is-transitioning) .skill-list > li:nth-child(4) { animation-delay: 0.25s; }
body:not(.is-transitioning) .skill-list > li:nth-child(5) { animation-delay: 0.3s; }
body:not(.is-transitioning) .skill-list > li:nth-child(6) { animation-delay: 0.35s; }

/* Contact page stagger */
body:not(.is-transitioning) .contact-info { animation-delay: 0.2s; }
body:not(.is-transitioning) .contact-form-wrapper { animation-delay: 0.4s; }

/* Page head */
body:not(.is-transitioning) .page__head { animation-delay: 0.1s; }

.nav a.is-active{
  color: var(--text);
  background: var(--indicator);
}
