:root {
  --primary-color: rgb(46, 43, 226);
  --primary-hover: rgb(46, 33, 165);
  --bg-dark: #1e1e1e;
  --text-light: #fff;
  --text-muted: #ccc;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Roboto", sans-serif;
  margin: 0;
  padding: 0;
  background-color: #fff;
  color: #222;
}

h1 {
  font-size: 3.5em;
}
h2 {
  font-size: 2.7em;
}
p {
  font-size: 1.2em;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Header */
header {
  background-color: #f5f5f5;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 10;
}

header .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
}

.logo {
  font-weight: bold;
  color: var(--primary-color);
  font-size: 1.5em;
}

header nav a {
  margin-left: 20px;
  font-weight: bold;
  color: #333;
}

header nav a:hover {
  color: var(--primary-color);
}

#btn-darkmode {
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  margin-left: 20px;
  color: var(--primary-color);
  transition: color 0.3s ease;
}

#btn-darkmode:hover {
  color: var(--primary-hover);
}

/* Hero */
#hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100vh;
  background: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)),
    url("img/codeimg.jpg");
  background-size: cover;
  background-position: center;
  color: white;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

#hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 0;
}

#hero h1 {
  font-size: 3em;
  margin: 0;
  z-index: 1;
}

.subtitle {
  font-size: 1.2em;
  margin-top: 10px;
  color: #ddd;
  max-width: 600px;
  z-index: 1;
}

/* Botón */
.btn-primary {
  font-size: 1em;
  padding: 12px 28px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.3s ease;
  margin-top: 20px;
  z-index: 1;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

/* Container */
.container {
  max-width: 1200px;
  margin: auto;
  padding: 0 16px;
}

/* Sobre mí */
#sobre-mi {
  background-color: #ececf5;
  padding: 50px 20px;
}

#sobre-mi .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 100px 0;
}

.img-container {
  flex: 1;
  min-width: 280px;
  margin: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.img-container img {
  width: 60%;
  max-height: 100%;
  object-fit: cover;
  border-radius: 15px;
}

.texto {
  flex: 2;
  padding: 20px;
}

.color-acento {
  color: var(--primary-color);
}

/* Conocimientos */
#mis-conocimientos {
  background-color: #fafafa;
  padding: 100px 20px;
  text-align: center;
}

.grid-conocimientos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
  justify-items: center;
  margin-top: 40px;
}

.mini-carta {
  background-color: white;
  border: 2px solid var(--primary-color);
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 150px;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.mini-carta:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.mini-carta i {
  font-size: 2em;
  color: var(--primary-color);
  margin-bottom: 10px;
}

.mini-carta span {
  display: block;
  font-weight: bold;
  color: #333;
}

/* Redes sociales */
#redes-sociales {
  background-color: #ececf5;
  padding: 60px 20px;
  text-align: center;
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
}

.social-icons a {
  font-size: 1.5em;
  font-weight: bold;
  color: #333;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: color 0.3s ease;
}

.social-icons a i {
  font-size: 2em;
  color: var(--primary-color);
}

.social-icons a:hover {
  color: var(--primary-hover);
}

/* Footer */
footer {
  background-color: #fafafa;
  text-align: center;
  padding: 20px;
  font-size: 0.9em;
  color: #666;
}

/* Modo nocturno */
body.dark-mode {
  background-color: #121212;
  color: #e0e0e0;
}

body.dark-mode header {
  background-color: #1e1e1e;
}

body.dark-mode a,
body.dark-mode .logo,
body.dark-mode nav a {
  color: #bbbbbb;
}

body.dark-mode a:hover,
body.dark-mode nav a:hover {
  color: #fff;
}

body.dark-mode .btn-primary {
  background-color: #3333cc;
  color: #eee;
}

body.dark-mode #hero {
  background: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)),
    url("img/codeimg.jpg");
}

body.dark-mode .subtitle {
  color: #ccc;
}

body.dark-mode #sobre-mi {
  background-color: #2a2a40;
}

body.dark-mode #mis-conocimientos {
  background-color: #1e1e1e;
}

body.dark-mode #mis-conocimientos .mini-carta {
  background-color: #333;
  border-color: #5555ee;
}

body.dark-mode #mis-conocimientos .mini-carta i {
  color: #aabaff;
}

body.dark-mode #mis-conocimientos .mini-carta span {
  color: #eee;
}

body.dark-mode #redes-sociales {
  background-color: #2a2a40;
}

body.dark-mode #redes-sociales a,
body.dark-mode #redes-sociales a i {
  color: #bbb;
}

body.dark-mode #redes-sociales a:hover {
  color: #eee;
}

body.dark-mode footer {
  background-color: #1e1e1e;
  color: #ddd;
}

/* Responsive */
@media (max-width: 768px) {
  header .container {
    flex-direction: column;
    align-items: flex-start;
  }

  #sobre-mi .container {
    flex-direction: column;
  }

  .img-container {
    width: 10%;
    margin-bottom: 30px;
  }
}

@media (max-width: 480px) {
  .social-icons {
    flex-direction: column;
    gap: 20px;
  }
}
