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

:root {
    --color-dark-bg: #32373b;
    --color-dark-text: #f4d6cc;
    --color-light-bg: #f4d6cc;
    --color-light-text: #32373b;
    --color-accent1: #4a5859;
    --color-accent2: #f4b860;
    --color-accent3: #c83e4d;
}

body {
    font-family: "Inter", sans-serif;
    background: var(--color-dark-bg);
    color: var(--color-dark-text);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    overflow-x: hidden;
    transition:
        background 0.3s ease,
        color 0.3s ease;
}

body.light-theme {
    background: var(--color-light-bg);
    color: var(--color-light-text);
}

.container {
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 40px;
    max-width: 90%;
    padding: 80px 0 20px;
}

.content-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 50px;
    flex-wrap: wrap;
    justify-content: center;
}

.social-links {
    display: flex;
    flex-direction: row;
    gap: 30px;
}

/* Estilos para los iconos */
.icon {
    font-size: 2.5rem; /* Tamaño más grande para los iconos */
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    transition:
        transform 0.3s ease-in-out,
        fill 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1em; /* Aseguramos que el contenedor tenga el mismo tamaño */
    height: 1em; /* Aseguramos que el contenedor tenga el mismo tamaño */
    line-height: 1; /* Eliminamos cualquier espacio adicional */
    fill: var(--color-accent2);
}

.icon:hover {
    transform: scale(1.2);
}


/* Iconos SVG como máscara (sin Font Awesome) */
.ico {
    display: inline-block;
    width: 1em;
    height: 1em;
    background-color: var(--color-accent2);
    -webkit-mask: var(--ico) center / contain no-repeat;
    mask: var(--ico) center / contain no-repeat;
    transition: background-color 0.3s ease;
}
.ico-bluesky { --ico: url('images/bluesky.svg'); }
.ico-github  { --ico: url('images/github.svg'); }
.ico-email   { --ico: url('images/email.svg'); }

body.light-theme .ico {
    background-color: var(--color-accent3);
}

.icon:focus-visible {
    outline: 2px solid var(--color-accent2);
    outline-offset: 6px;
    border-radius: 4px;
}

footer {
    width: 100%;
    text-align: center;
    padding: 20px;
    background: var(--color-dark-bg); /* Fondo oscuro por defecto */
    color: var(--color-dark-text); /* Texto oscuro por defecto */
    transition: background 0.3s ease, color 0.3s ease; /* Transición suave */
}

body.light-theme footer {
    background: var(--color-light-bg); /* Fondo claro en tema claro */
    color: var(--color-light-text); /* Texto claro en tema claro */
}

/* Barra superior: idiomas + toggle de Día/Noche */
.top-bar {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.lang-switch {
    display: flex;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.lang-switch a {
    color: inherit;
    opacity: 0.6;
    text-decoration: none;
}

.lang-switch a:hover,
.lang-switch a:focus-visible {
    opacity: 1;
    color: var(--color-accent2);
}

.lang-current {
    color: var(--color-accent2);
}

body.light-theme .lang-current,
body.light-theme .lang-switch a:hover,
body.light-theme .lang-switch a:focus-visible,
body.light-theme h2 {
    color: var(--color-accent3);
}
/* From Uiverse.io by satyamchaudharydev */
/* The switch - the box around the slider */
.switch {
  display: block;
  --width-of-switch: 3.5em;
  --height-of-switch: 2em;
  /* size of sliding icon -- sun and moon */
  --size-of-icon: 1.4em;
  /* it is like a inline-padding of switch */
  --slider-offset: 0.3em;
  position: relative;
  width: var(--width-of-switch);
  height: var(--height-of-switch);
}

/* Hide default HTML checkbox */
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #f4f4f5; /* Fondo claro por defecto (tema oscuro activo) */
  transition: .4s;
  border-radius: 30px;
}

.slider:before {
  position: absolute;
  content: "";
  height: var(--size-of-icon,1.4em);
  width: var(--size-of-icon,1.4em);
  border-radius: 20px;
  left: var(--slider-offset,0.3em);
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(40deg,#ff0080,#ff8c00 70%); /* Sol (tema claro) */
  transition: .4s;
}

input:checked + .slider {
  background-color: #303136; /* Fondo oscuro cuando está activado (tema claro activo) */
}

input:checked + .slider:before {
  left: calc(100% - (var(--size-of-icon,1.4em) + var(--slider-offset,0.3em)));
  background: #303136; /* Luna (tema oscuro) */
  box-shadow: inset -3px -2px 5px -2px #8983f7, inset -10px -4px 0 0 #a3dafb; /* Efecto de luna */
}

/* Nuevos estilos para h1 y h2 */
h1 {
    font-size: clamp(2.25rem, 10vw, 4rem);
    overflow-wrap: anywhere;
    margin: 0;
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.25rem, 5vw, 2rem);
    margin: 0;
    line-height: 1.2;
    color: var(--color-accent2);
}

@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
        gap: 20px;
    }

    .social-links {
        gap: 20px;
    }
}

/* Modal de contacto */
dialog {
    width: min(32rem, calc(100vw - 2rem));
    max-height: calc(100dvh - 2rem);
    padding: 24px;
    border: 0;
    border-radius: 12px;
    background: var(--color-dark-bg);
    color: var(--color-dark-text);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

body.light-theme dialog {
    background: var(--color-light-bg);
    color: var(--color-light-text);
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

dialog form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
}

.dialog-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dialog-head h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--color-accent2);
}

body.light-theme .dialog-head h3 {
    color: var(--color-accent3);
}

.dialog-close {
    background: none;
    border: 0;
    color: inherit;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

dialog label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

dialog input,
dialog textarea {
    width: 100%;
    font: inherit;
    font-weight: 400;
    padding: 10px 12px;
    border: 1px solid var(--color-accent1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
}

dialog textarea {
    resize: vertical;
}

dialog input:focus,
dialog textarea:focus {
    outline: 2px solid var(--color-accent2);
    outline-offset: 1px;
}

.btn-send {
    align-self: flex-end;
    font: inherit;
    font-weight: 600;
    padding: 10px 22px;
    border: 0;
    border-radius: 8px;
    background: var(--color-accent2);
    color: var(--color-dark-bg);
    cursor: pointer;
}

.btn-send:disabled {
    opacity: 0.6;
    cursor: wait;
}

.form-status {
    margin: 0;
    min-height: 1.2em;
    font-size: 0.9rem;
}

.form-status.is-ok { color: var(--color-accent2); }
.form-status.is-error { color: var(--color-accent3); }

.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Tooltips de los iconos */
.icon {
    position: relative;
}

.icon[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    transform: translate(-50%, -4px);
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--color-accent2);
    color: var(--color-dark-bg);
    font-family: "Inter", sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.icon[data-tip]:hover::after,
.icon[data-tip]:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

body.light-theme .icon[data-tip]::after {
    background: var(--color-accent3);
    color: var(--color-light-bg);
}

/* Sin transiciones durante la carga (evita el parpadeo al restaurar el tema) */
.no-anim,
.no-anim *,
.no-anim *::before,
.no-anim *::after {
    transition: none !important;
}
