/* -------------------------------------------------------- */
/* FUENTES */
/* -------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=DynaPuff:wght@400..700&display=swap');
@import url('https://fonts.cdnfonts.com/css/open-dyslexic');

/* -------------------------------------------------------- */
/* VARIABLES Y COLORES */
/* -------------------------------------------------------- */
:root {
  /* Fonts */
  --font: 'DynaPuff', sans-serif;
  --heading-font: 'Open-Dyslexic', sans-serif;
  --font-size: 14px;

  /* Layout */
  --margin: 10px;
  --padding: 20px;
  --border: 1px solid var(--text-color);
  --round-borders: 0px;
  --sidebar-width: 275px;
}

/* Light Mode Colors */
html.light-mode {
  --background-color: #e5b3b3;
  --content-background-color: #ffffffe8;
  --sidebar-background-color: #ffffffe8;
  --text-color: #594100;
  --sidebar-text-color: #594100;
  --link-color: #e58b8b;
  --link-color-hover: #e58b8b;
}

/* Dark Mode Colors */
html.dark-mode {
  --background-color: #121212;
  --content-background-color: #181818e7;
  --sidebar-background-color: #181818e7;
  --text-color: #fcbcda;
  --sidebar-text-color: #fcbcda;
  --link-color: #bb86fc;
  --link-color-hover: #96177a;
}

/* -------------------------------------------------------- */
/* BASICS */
/* -------------------------------------------------------- */
* { box-sizing: border-box; }

body {
  opacity: 0; /* elimina parpadeo */
  transition: opacity 0.4s ease-in-out, background-color 0.3s ease, color 0.3s ease;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  font-size: var(--font-size);
  margin: 0;
  padding: var(--margin);
  color: var(--text-color);
  font-family: var(--font);
  line-height: 1.2;
  background-color: var(--background-color);
  background-image: url("https://files.catbox.moe/7u8udi.jpg");
  background-size: 150px;
  background-repeat: repeat;
}

body.loaded { opacity: 1; }

/* -------------------------------------------------------- */
/* SKIP TO CONTENT (ACCESIBILIDAD, OCULTO) */
/* -------------------------------------------------------- */
#skip-to-content-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* -------------------------------------------------------- */
/* LAYOUT */
/* -------------------------------------------------------- */
.layout {
  width: min(1000px, 95vw);
  display: grid;
  grid-gap: 2%;
  grid-template:
    "header header" auto
    "leftSidebar main" 1fr
    "footer footer" auto
    / var(--sidebar-width) auto;
  margin: 0 auto;
  align-content: start;
}

/* Mantener proporción visual entre header, main y footer */
header,
main,
footer {
  border: none;
  outline: var(--border);
    outline-offset: -1px; /* mantiene el mismo tamaño visual */
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

header:first-child,
footer:last-child {
  margin-top: 0;
  margin-bottom: 0;
}

/* -------------------------------------------------------- */
/* HEADER */
/* -------------------------------------------------------- */
header {
  grid-area: header;
  height: 50px;
  display: flex;
  align-items: center;
  font-size: 1.2em;
  background-color: var(--content-background-color);
  border: var(--border);
  color: var(--text-color);
}

.header-content { padding: 5px 20px; }

.header-title {
  font-family: var(--heading-font);
  font-size: 1.5em;
  font-weight: bold;
}

/* -------------------------------------------------------- */
/* SIDEBARS */
/* -------------------------------------------------------- */
aside {
  border: none; /* ❌ elimina el borde que duplicaba outline */
  outline: var(--border); /* ✅ usa el mismo tipo de borde que el resto */
  outline-offset: -1px; /* mantiene la proporción visual */
  overflow: hidden;
  padding: var(--padding);
  background-color: var(--sidebar-background-color);
  color: var(--sidebar-text-color);
  transition: background-color 0.3s ease, color 0.3s ease, outline-color 0.3s ease;
}


.left-sidebar { grid-area: leftSidebar; }
.right-sidebar { grid-area: rightSidebar; }

.sidebar-title {
  font-weight: bold;
  font-size: 1.2em;
  font-family: var(--heading-font);
}

.sidebar-section:not(:last-child) { margin-bottom: 3em; }

.sidebar-section ul,
.sidebar-section ol { padding-left: 1.5em; }

.sidebar-section blockquote {
  background: rgba(0,0,0,0.1);
  padding: 15px;
  margin: 1em 0;
  border-radius: 10px;
  transition: background 0.3s ease;
}

/* -------------------------------------------------------- */
/* MAIN CONTENT */
/* -------------------------------------------------------- */
main {
  grid-area: main;
  padding: var(--padding);
  background-color: var(--content-background-color);
  color: var(--text-color);
  border: var(--border);
  height: auto; /* crece naturalmente */
  overflow: visible; /* deslizable con la página */
}

/* -------------------------------------------------------- */
/* FOOTER */
/* -------------------------------------------------------- */
footer {
  grid-area: footer;
  height: 30px;
  display: flex;
  align-items: center;
  border: var(--border);
  font-size: 0.75em;
  padding: 5px 15px;
  background-color: var(--content-background-color);
  justify-content: center;
  color: var(--text-color);
}

footer a { color: var(--link-color); }
footer a:hover { color: var(--link-color-hover); }

/* -------------------------------------------------------- */
/* NAVIGATION */
/* -------------------------------------------------------- */
nav { margin-bottom: 3em; }
nav .sidebar-title { margin-bottom: 0.5em; }
nav ul { margin: 0 -5px; padding: 0; list-style: none; user-select: none; }
nav ul li { margin-bottom: 0; }
nav > ul li > a,
nav > ul li > details summary,
nav > ul li > strong { display: inline-block; padding: 5px 10px; }
nav > ul li > a.active,
nav > ul li > details.active summary { font-weight: bold; }
nav ul summary { cursor: pointer; }
nav ul ul li > a { padding-left: 30px; }
nav a { color: var(--link-color); }
nav a:hover { color: var(--link-color-hover); }

/* -------------------------------------------------------- */
/* CONTENT STYLES */
/* -------------------------------------------------------- */
main p,
main ol, main ul, main blockquote,
main .image, main .full-width-image, main .two-columns { margin: 0.75em 0; }

main ol li, main ul li { margin-bottom: 0.2em; line-height: 1.3; }

main hr { border: 0; border-top: var(--border); margin: 1.5em 0; }
main a { color: var(--link-color); }
main a:hover { color: var(--link-color-hover); }

main h1, main h2, main h3, main h4, main h5, main h6 {
  font-family: var(--heading-font);
  margin-bottom: 0;
  line-height: 1.5;
}

main h1:first-child, main h2:first-child, main h3:first-child,
main h4:first-child, main h5:first-child, main h6:first-child { margin-top: 0; }

main h1 { font-size: 1.5em; }
main h2 { font-size: 1.4em; }
main h3 { font-size: 1.3em; }
main h4 { font-size: 1.2em; }
main h5 { font-size: 1.1em; }
main h6 { font-size: 1em; }

main p {
  text-align: justify;
  text-justify: inter-word; /* distribuye el espacio de forma más natural */
  margin: 0.75em 1em;
}

/* COLUMNS */
.two-columns { display: flex; }
.two-columns > * { flex: 1 1 0; margin: 0; }
.two-columns > *:first-child { padding-right: 0.75em; }
.two-columns > *:last-child { padding-left: 0.75em; }

/* IMAGES */
.image, .full-width-image { display: block; width: 100%; height: auto; }
.images { display: flex; margin: 0 -5px; }
.images img { width: 100%; padding: 5px; }

/* -------------------------------------------------------- */
/* MOBILE RESPONSIVE (AL FINAL) */
/* -------------------------------------------------------- */
@media (max-width: 800px) {
  body {
    font-size: 14px;
  }

  .layout {
    display: grid;
    width: 100%;
    grid-template-areas:
      "header"
      "leftSidebar"
      "main"
      "footer";
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-gap: 2vw;
  }

  header {
    grid-area: header;
    margin: 2vw 0;
    border-top: none;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  .left-sidebar {
    grid-area: leftSidebar;
    display: block;
    margin: 2vw 0;
    border-left: none;
    border-right: none;
    border-radius: 0;
    width: 100%;
  }

  main {
    grid-area: main;
    margin: 2vw 0;
    max-height: none;
    padding: 15px;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  footer {
    grid-area: footer;
    margin: 2vw 0;
    border-bottom: none;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  nav {
    padding: 0;
  }

  nav > ul {
    padding-top: 0.5em;
  }

  nav > ul li > a,
  nav > ul li > details summary,
  nav > ul li > strong {
    padding: 0.5em;
  }

  .images {
    flex-wrap: wrap;
  }

  .images img {
    width: 100%;
  }
}
