/*===== VARIABLES CSS =====*/
:root {
  --header-height: 3rem;
  --font-semi: 600;

  /*===== Colores (Light Mode Defaults) =====*/
  --hue-color: 224;
  --first-color: hsl(var(--hue-color), 89%, 60%);
  --second-color: hsl(var(--hue-color), 56%, 12%);
  --body-color: #f9f9ff; /* Light background for sections like .blog-section */
  --container-color: #fff; /* White background for cards, forms, and header */
  --text-color: var(--second-color); /* Dark text color */
  --link-color-menu: #fff; /* White for menu links when mobile menu is open */
  --shadow-color: rgba(146, 161, 176, 0.15); /* Light shadow */


  /*===== Fuente y tipografia =====*/
  --body-font: "Poppins", sans-serif;
  --big-font-size: 2rem;
  --h2-font-size: 1.25rem;
  --normal-font-size: .938rem;
  --smaller-font-size: .75rem;

  /*===== Margenes =====*/
  --mb-2: 1rem;
  --mb-4: 2rem;
  --mb-5: 2.5rem;
  --mb-6: 3rem;

  /*===== z index =====*/
  --z-back: -10;
  --z-fixed: 100;
  --z-fixed-loading: 120;
}

/*===== DARK MODE IMPLEMENTATION =====*/
@media (prefers-color-scheme: dark) {
  :root {
    /* Dark Theme Colors */
    --first-color: hsl(var(--hue-color), 75%, 65%); /* Slightly brighter primary color for contrast */
    --second-color: hsl(var(--hue-color), 40%, 88%); /* Light text for dark background */
    --body-color: hsl(var(--hue-color), 18%, 15%); /* Darker background */
    --container-color: hsl(var(--hue-color), 20%, 20%); /* Slightly lighter dark background for cards/sections */
    --text-color: var(--second-color); /* Light text color */
    --link-color-menu: var(--second-color); /* Use light text color for mobile menu links (they are inside the dark nav__menu) */
    --shadow-color: rgba(0, 0, 0, 0.5); /* Darker shadow */
  }

  /* Specific element adjustments for Dark Mode */
  .l-header {
    background-color: var(--container-color);
    box-shadow: 0 1px 4px var(--shadow-color);
  }

  .nav__logo,
  .nav__toggle,
  .nav__link,
  .home__social-icon {
    color: var(--text-color);
  }

  /* Mobile menu background in dark mode */
  @media screen and (max-width: 767px) {
    .nav__menu {
      background-color: var(--body-color); /* Use the main body color for the slide-in menu */
    }
  }

  .nav__link {
    color: var(--link-color-menu); /* Ensure mobile links are visible */
  }

  .contact__form {
    background-color: var(--container-color);
  }

  .contact__input {
    background-color: var(--body-color);
    border-color: var(--body-color);
    color: var(--text-color);
  }

  .contact__input::placeholder {
    color: hsl(var(--hue-color), 10%, 65%);
  }

  .loader {
    background: var(--body-color);
  }

  .main_load {
    background:
      radial-gradient(var(--r1) var(--r2) at top, #0000 79.5%, var(--first-color) 80%),
      radial-gradient(var(--r1) var(--r2) at bottom, var(--first-color) 79.5%, #0000 80%),
      radial-gradient(var(--r1) var(--r2) at top, #0000 79.5%, var(--first-color) 80%),
      #666; /* Base color for loader */
  }
}
/*===== END DARK MODE IMPLEMENTATION =====*/


@media screen and (min-width: 968px) {
  :root {
    --big-font-size: 3.5rem;
    --h2-font-size: 2rem;
    --normal-font-size: 1rem;
    --smaller-font-size: .875rem;
  }
}

/*===== BASE =====*/
*,
::before,
::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: var(--header-height) 0 0 0;
  font-family: var(--body-font);
  font-size: var(--normal-font-size);
  color: var(--text-color); /* Updated to use new variable */
  background-color: var(--container-color); /* Set default background */
}

h1,
h2,
p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/*===== CLASS CSS ===== */
.section-title {
  position: relative;
  font-size: var(--h2-font-size);
  color: var(--first-color);
  margin-top: var(--mb-2);
  margin-bottom: var(--mb-4);
  text-align: center;
}

.section-title::after {
  position: absolute;
  content: "";
  width: 64px;
  height: 0.35rem;
  left: 0;
  right: 0;
  margin: auto;
  top: 2rem;
  border-radius: 12px;
  background-color: var(--first-color);
}

.section {
  padding-top: 3rem;
  padding-bottom: 2rem;
}

/*===== LAYOUT =====*/
.bd-grid {
  max-width: 1024px;
  display: grid;
  margin-left: var(--mb-2);
  margin-right: var(--mb-2);
}

.l-header {
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-fixed);
  background-color: var(--body-color); /* Updated to use new variable */
  box-shadow: 0 1px 4px var(--shadow-color); /* Updated to use new variable */
}

/*===== NAV =====*/
.nav {
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: var(--font-semi);
}

@media screen and (max-width: 767px) {
  .nav__menu {
    position: fixed;
    top: var(--header-height);
    right: -100%;
    width: 80%;
    height: 100%;
    padding: 2rem;
    background-color: var(--body-color); /* Retain for mobile menu color/contrast */
    transition: 0.5s;
  }
}

.nav__item {
  margin-bottom: var(--mb-4);
}

.nav__link {
  position: relative;
  color: var(--link-color-menu); /* Updated for better contrast in mobile menu */
}

.nav__link:hover {
  position: relative;
}

.nav__link:hover::after {
  position: absolute;
  content: "";
  width: 100%;
  height: 0.35rem;
  left: 0;
  top: 2rem;
  border-radius: 12px;
  background-color: var(--first-color);
}

.nav__logo {
  color: var(--text-color); /* Updated to use new variable */
}

.nav__toggle {
  color: var(--text-color); /* Updated to use new variable */
  font-size: 1.5rem;
  cursor: pointer;
}

/*Active menu*/
.active-link::after {
  position: absolute;
  content: "";
  width: 100%;
  height: 0.35rem;
  left: 0;
  top: 2rem;
  border-radius: 12px;
  background-color: var(--first-color);
}

/*=== Show menu ===*/
.show {
  right: 0;
}

/*===== HOME =====*/
.home {
  position: relative;
  row-gap: 5rem;
  padding: 4rem 0 5rem;
}

.home__data {
  align-self: center;
}

.home__title {
  font-size: var(--big-font-size);
  margin-bottom: var(--mb-5);
}

.home__title-color {
  color: var(--first-color);
}

.home__social {
  display: flex;
  flex-direction: column;
}

.home__social-icon {
  width: max-content;
  margin-bottom: var(--mb-2);
  font-size: 1.5rem;
  color: var(--text-color); /* Updated to use new variable */
}

.home__social-icon:hover {
  color: var(--first-color);
}

.home__img {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 260px;
}

.home__blob {
  fill: var(--first-color);
}

.home__blob-img {
  width: 360px;
}

/*BUTTONS*/
.button {
  display: inline-block;
  background-color: var(--first-color);
  color: #fff;
  padding: 0.75rem 2.5rem;
  font-weight: var(--font-semi);
  border-radius: 18px;
  transition: 0.3s;
  border: none;
  cursor: pointer;
  font-family: var(--body-font);
  font-size: var(--normal-font-size);
}

.button:hover {
  box-shadow: 0px 10px 36px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* ===== ABOUT =====*/
.about__container {
  row-gap: 2rem;
  text-align: center;
}

.about__subtitle {
  margin-bottom: var(--mb-2);
  font-size: var(--h2-font-size);
  color: var(--first-color);
}

.about__text {
  margin-bottom: var(--mb-2);
  line-height: 1.6;
}

.about__img {
  justify-self: center;
}

.about__img img {
  width: 200px;
  border-radius: 0.5rem;
  box-shadow: 0px 4px 25px var(--shadow-color); /* Updated to use new variable */
}
/* ===== Blogs =====*/
.blog__subtitle
{
  margin-bottom: var(--mb-2);
  font-size: var(--h2-font-size);
  color: var(--first-color);
  font-weight: var(--font-semi);
  text-align: center;
}

.blog_see
{
  width:220px;
  margin-top:25px;
  text-align:center;
  font-weight:800;
  color:var(--text-color); /* Updated to use new variable */
  margin-left:auto;
  margin-right: auto;
  cursor:pointer;
}
.blog-section {
      padding: 6rem 1rem;
      background-color: var(--body-color); /* Updated to use new variable */
      min-height: 100vh;
    }

    .blog-container {
      max-width: 1000px;
      margin: 0 auto;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
      gap: 2rem;
	  justify-items: center;
    }
	    .blog-card {
    background:var(--body-color); /* Updated to use new variable */
    border-radius: 1rem;
    box-shadow: 0 4px 20px var(--shadow-color); /* Updated to use new variable */
    overflow: hidden;
    max-width: 345px;
    max-height: 410px;
     padding: 8px;
}
    .blog-card:hover {
      transform: translateY(-6px);
      box-shadow: 0 6px 25px var(--shadow-color); /* Updated to use new variable */
    }

    .image-wrapper {
      position: relative;
      width: 100%;
      overflow: hidden;
      border-radius: 12px;
    }

    .blog-image {
      width: 100%;
	   height:200px;
      max-height: 232px;
      display: block;
      border-radius: 18px;
    }

    .new {
      position: absolute;
      top: -6px;
      left: 13px;
      background: #ff4757;
      color: white;
      padding: 4px 5px;
      font-size: 12px;
      font-weight: bold;
      border-radius: 6px;
      z-index: 5;
    }
    .blog-content
    {
      padding: 1rem 1rem 1rem 1.5rem;
    }
    .blog-title {
      font-size: 1.25rem;
      font-weight: 600;
      color: var(--text-color); /* Updated to use new variable */
    }
    .tags
    {
      margin-top: 8px;
      gap: 6px;
    }

    .blog-meta {
      font-size: 0.85rem;
      color: gray; /* Keep gray or use a softer color variable */
      margin-bottom: 0.75rem;
    }
    
    @media (prefers-color-scheme: dark) {
        .blog-meta {
            color: #b0b0b0; /* Light gray for dark mode */
        }
    }

    .blog-desc {
      font-size: 0.95rem;
      color: var(--text-color); /* Updated to use new variable */
      margin-bottom: 1rem;
      line-height: 1.5;
    }

/* ===== SKILLS =====*/
.skills {
  background-color: var(--container-color); /* Updated to use new variable */
}

.skills__container {
  row-gap: 2rem;
  text-align: center;
  padding: 0 1rem;
}

.skills__subtitle {
  margin-bottom: var(--mb-2);
  font-size: var(--h2-font-size);
  color: var(--first-color);
  font-weight: var(--font-semi);
  text-align: center;
}

.skills__text {
  margin-bottom: var(--mb-4);
  line-height: 1.6;
  text-align:center;
  color: var(--text-color); /* Updated to use new variable */
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== PIE CHARTS ===== */
.skills__charts {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  align-items: center;
  margin: 2rem auto;
  flex-wrap: wrap;
  max-width: 100%;
  padding: 0 1rem;
}

.pie-chart {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background-color: var(--container-color); /* Updated to use new variable */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 25px var(--shadow-color); /* Updated to use new variable */
  transition: all 0.3s ease;
}

.pie-chart .pie-label {
  position: absolute;
  bottom: 18px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 0.9rem;
  font-weight: var(--font-semi);
  color: var(--text-color); /* Updated to use new variable */
}

.pie-chart .pie-value {
  position: absolute;
  top: 38px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 1.5rem;
  color: var(--first-color);
  font-weight: bold;
}

.pie-chart:hover {
  box-shadow: 0 8px 36px var(--shadow-color); /* Updated to use new variable */
  transform: translateY(-5px);
}

.skills__img {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: 0.5rem;
  box-shadow: 0px 4px 25px var(--shadow-color); /* Updated to use new variable */
  margin: 2rem auto 0;
  display: block;
}

/* ===== CONTACT ===== */
.contact {
  background-color: var(--container-color); /* Updated to use new variable */
}

.contact__container {
  row-gap: 2rem;
  justify-items: center;
  padding: 0 1rem;
}

.contact__form {
  width: 100%;
  max-width: 500px;
  background-color: #f9f9f9; /* Retain for specific light-mode contrast or adjust */
  background-color: var(--body-color); /* Use body color for contrast */
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0px 4px 25px var(--shadow-color); /* Updated to use new variable */
}

.contact__input {
  width: 100%;
  font-size: var(--normal-font-size);
  font-weight: var(--font-semi);
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1.5px solid #e0e0e0;
  outline: none;
  margin-bottom: 1rem;
  font-family: var(--body-font);
  transition: border-color 0.3s ease;
  background-color: var(--container-color); /* Use container color */
  color: var(--text-color); /* Use text color */
}

.contact__input:focus {
  border-color: var(--first-color);
}

.contact__input::placeholder {
  color: #999;
}

textarea.contact__input {
  resize: vertical;
  min-height: 120px;
}

.contact__button {
  width: 100%;
  font-size: var(--normal-font-size);
  cursor: pointer;
}

/* ===== FOOTER ===== */
.footer {
  background-color: var(--body-color);
  color: #fff;
  text-align: center;
  font-weight: var(--font-semi);
  padding: 2rem 0;
}

.footer__title {
  font-size: 2rem;
  margin-bottom: var(--mb-4);
  color: #fff;
}

.footer__links {
  font-weight: var(--font-semi);
  text-align: center;
  margin-bottom: var(--mb-4);
}

.footer__links a {
  color: var(--first-color);
  text-decoration: none;
  margin: 0 0.5rem;
}

.footer__links a:hover {
  text-decoration: underline;
}

.footer__social {
  margin-bottom: var(--mb-4);
}

.footer__icon {
  font-size: 1.5rem;
  color: #fff;
  margin: 0 var(--mb-2);
  transition: color 0.3s ease;
}

.footer__icon:hover {
  color: var(--first-color);
}

.footer__copy {
  font-size: var(--smaller-font-size);
  color: #ccc;
}

/* ===== COOKIE BANNER ===== */
#cookie-banner {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#cookie-banner.hide {
  transform: translateY(100%);
  opacity: 0;
}

/* ===== LOADER ===== */
.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--container-color); /* Updated to use new variable */
  z-index: var(--z-fixed-loading);
}

.main_load {
  --r1: 154%;
  --r2: 68.5%;
  width: 60px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(var(--r1) var(--r2) at top, #0000 79.5%, var(--first-color) 80%), /* Updated color */
    radial-gradient(var(--r1) var(--r2) at bottom, var(--first-color) 79.5%, #0000 80%), /* Updated color */
    radial-gradient(var(--r1) var(--r2) at top, #0000 79.5%, var(--first-color) 80%), /* Updated color */
    #ccc; /* Base color for light mode */
  background-size: 50.5% 220%;
  background-position: -100% 0%, 0% 0%, 100% 0%;
  background-repeat: no-repeat;
  animation: l9 2s infinite linear;
}

@keyframes l9 {
  33% {
    background-position: 0% 33%, 100% 33%, 200% 33%;
  }
  66% {
    background-position: -100% 66%, 0% 66%, 100% 66%;
  }
  100% {
    background-position: 0% 100%, 100% 100%, 200% 100%;
  }
}

/* ===== MEDIA QUERIES ===== */

/* Extra small devices (phones, 320px and down) */
@media screen and (max-width: 320px) {
  .home {
    row-gap: 2rem;
  }

  .home__img {
    width: 200px;
  }

  .skills__charts {
    gap: 1rem;
    padding: 0 0.5rem;
  }

  .pie-chart {
    width: 100px;
    height: 100px;
  }

  .pie-chart .pie-value {
    font-size: 1.2rem;
    top: 30px;
  }

  .pie-chart .pie-label {
    font-size: 0.75rem;
    bottom: 15px;
  }

  .contact__form {
    padding: 1.5rem;
  }

  .contact__input {
    padding: 0.8rem;
  }
}

/* Small devices (landscape phones, 576px and up) */
@media screen and (min-width: 576px) {
  .home {
    padding: 4rem 0 2rem;
  }

  .home__social {
    padding-top: 0;
    padding-bottom: 2.5rem;
    flex-direction: row;
    align-self: flex-end;
  }

  .home__social-icon {
    margin-bottom: 0;
    margin-right: var(--mb-4);
  }

  .home__img {
    width: 300px;
    bottom: 25%;
  }

  .about__container {
    grid-template-columns: repeat(2, 1fr);
    align-items: center;
    text-align: initial;
  }

  .about__img img {
    width: 250px;
  }

  .skills__container {
    padding: 0 2rem;
  }

  .skills__charts {
    gap: 2rem;
  }

  .pie-chart {
    width: 130px;
    height: 130px;
  }

  .contact__form {
    width: 450px;
    padding: 2.5rem;
  }

  .contact__container {
    justify-items: center;
  }
}

/* Medium devices (tablets, 768px and up) */
@media screen and (min-width: 768px) {
  body {
    margin: 0;
  }

  .section {
    padding-top: 4rem;
    padding-bottom: 3rem;
  }

  .section-title {
    margin-bottom: var(--mb-6);
  }

  .section-title::after {
    width: 80px;
    top: 3rem;
  }

  .nav {
    height: calc(var(--header-height) + 1.5rem);
  }

  .nav__list {
    display: flex;
    padding-top: 0;
  }

  .nav__item {
    margin-left: var(--mb-6);
    margin-bottom: 0;
  }

  .nav__toggle {
    display: none;
  }

  .nav__link {
    color: var(--text-color); /* Ensure desktop links use the correct text color */
  }

  .home {
    padding: 8rem 0 2rem;
  }

  .home__img {
    width: 400px;
    bottom: 10%;
  }

  .about__container {
    padding-top: 2rem;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 3rem;
  }

  .about__img img {
    width: 300px;
  }

  .skills__container {
    display: grid;
    grid-template-columns: 1fr;
    text-align: center;
    padding: 0 3rem;
  }

  .skills__charts {
    gap: 2.5rem;
    margin: 2.5rem auto;
  }

  .pie-chart {
    width: 140px;
    height: 140px;
  }

  .pie-chart .pie-value {
    font-size: 1.6rem;
    top: 40px;
  }

  .pie-chart .pie-label {
    font-size: 1rem;
    bottom: 20px;
  }

  .skills__img {
    max-width: 500px;
    margin-top: 3rem;
  }

  .contact__form {
    width: 500px;
  }
}

/* Large devices (desktops, 992px and up) */
@media screen and (min-width: 992px) {
  .bd-grid {
    margin-left: auto;
    margin-right: auto;
  }

  .home {
    padding: 10rem 0 2rem;
  }

  .home__img {
    width: 450px;
  }

  .about__container {
    column-gap: 4rem;
  }

  .skills__container {
    padding: 0 4rem;
  }

  .skills__charts {
    gap: 3rem;
  }

  .pie-chart {
    width: 150px;
    height: 150px;
  }

  .pie-chart .pie-value {
    font-size: 1.8rem;
    top: 42px;
  }

  .pie-chart .pie-label {
    font-size: 1.05rem;
    bottom: 22px;
  }

  .skills__img {
    max-width: 550px;
  }

  .contact__form {
    width: 550px;
    padding: 3rem;
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media screen and (min-width: 1200px) {
  .bd-grid {
    max-width: 1140px;
  }

  .skills__charts {
    gap: 3.5rem;
  }

  .pie-chart {
    width: 160px;
    height: 160px;
  }

  .pie-chart .pie-value {
    font-size: 2rem;
    top: 45px;
  }

  .pie-chart .pie-label {
    font-size: 1.1rem;
    bottom: 24px;
  }
}