@import url("https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700&family=Rubik+Mono+One&display=swap");

:root {
  color-scheme: light;
  --navy: #073b4c;
  --navy-deep: #042d3b;
  --coral: #ff6b6b;
  --gold: #ffd166;
  --mint: #06d6a0;
  --sky: #53b3cb;
  --paper: #f7f7f2;
  --surface: #ffffff;
  --ink: #13262d;
  --muted: #607277;
  --line: #d7dedb;
  --shadow: 0 18px 52px rgba(4, 45, 59, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 8% 2%, rgba(255, 209, 102, 0.13), transparent 28rem),
    var(--paper);
  color: var(--ink);
  font-family: "Rubik", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--navy);
  text-decoration-color: rgba(255, 107, 107, 0.55);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  color: #c94f4f;
}

.skip-link {
  position: fixed;
  z-index: 1100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--navy);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 1000;
  top: 0;
  min-height: 76px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(7, 59, 76, 0.96);
  color: var(--surface);
  backdrop-filter: blur(16px);
}

.header-inner {
  width: min(1440px, calc(100% - 48px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--surface);
  font-family: "Rubik Mono One", "Rubik", sans-serif;
  font-size: 18px;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--coral);
  content: "";
}

.brand-mark::before {
  transform: translate(-5px, 4px);
}

.brand-mark::after {
  transform: translate(5px, -4px);
}

.brand-mark span {
  width: 12px;
  height: 1px;
  background: var(--surface);
  transform: rotate(-37deg);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.site-nav a,
.mobile-nav-links a {
  text-decoration: none;
}

.site-nav a {
  padding: 9px 12px;
  color: rgba(255, 255, 255, 0.82);
  font-family: "Rubik Mono One", "Rubik", sans-serif;
  font-size: 12px;
  transition: background 160ms ease, color 160ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--surface);
}

.site-nav a[aria-current="page"],
.mobile-nav-links a[aria-current="page"] {
  color: var(--gold);
}

.mobile-nav {
  display: none;
  position: relative;
}

.mobile-nav summary {
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  color: var(--surface);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.mobile-nav summary::-webkit-details-marker {
  display: none;
}

.mobile-nav-links {
  position: absolute;
  top: 48px;
  right: 0;
  width: 210px;
  padding: 10px;
  display: grid;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: var(--navy-deep);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

.mobile-nav-links a {
  padding: 11px 12px;
  border-radius: 7px;
  color: var(--surface);
}

.mobile-nav-links a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--surface);
}

.container {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}

main {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 64px;
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

aside {
  position: sticky;
  top: 96px;
  width: 278px;
  max-height: calc(100vh - 120px);
  flex: 0 0 278px;
  overflow: auto;
}

article {
  min-width: 0;
  flex: 1 1 auto;
}

.card {
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

aside .card {
  padding: 18px;
  box-shadow: none;
}

h1,
h2,
h3 {
  color: var(--navy);
  line-height: 1.2;
}

h1 {
  margin: 0 0 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 400;
  letter-spacing: -0.045em;
}

h2 {
  margin: 32px 0 10px;
  font-size: 1.45rem;
}

h3 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.toc {
  display: grid;
  gap: 3px;
}

.toc a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}

.toc a:hover {
  background: rgba(83, 179, 203, 0.1);
  color: var(--navy);
}

.toc a.active {
  background: var(--navy);
  color: var(--surface);
}

.search {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfcfa;
  color: var(--ink);
  font: inherit;
  outline: 0;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(6, 214, 160, 0.14);
}

.list {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.list > .card {
  display: block;
  padding: 17px;
  border-radius: 13px;
  background: #fbfcfa;
  color: var(--navy);
  box-shadow: none;
  text-decoration: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.list > .card:hover {
  border-color: rgba(83, 179, 203, 0.65);
  color: var(--navy);
  box-shadow: 0 10px 28px rgba(4, 45, 59, 0.09);
  transform: translateY(-2px);
}

.topic {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.topic > h2,
.topic .tag h2 {
  margin: 0;
  line-height: 1.35;
}

.topic > h2 {
  color: var(--navy);
  font-size: 15px;
  font-weight: 600;
}

.tag {
  min-width: 30px;
  min-height: 30px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 107, 107, 0.32);
  border-radius: 50%;
  background: rgba(255, 107, 107, 0.09);
}

.topic .tag h2 {
  color: #c94f4f;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.env {
  margin: 20px 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--coral);
  border-radius: 11px;
  background: #fbfcfa;
}

.env.ejercicios {
  border-left-color: var(--mint);
  background: rgba(6, 214, 160, 0.05);
}

.env-title {
  margin-bottom: 7px;
  color: var(--navy);
  font-weight: 700;
}

.center {
  text-align: center;
}

kbd {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
}

.nextprev {
  margin-top: 38px;
  padding-top: 22px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--line);
}

.nextprev a {
  color: #c94f4f;
  font-weight: 600;
  text-decoration: none;
}

hr {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

footer {
  padding: 28px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--navy-deep);
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  text-align: center;
}

footer .container {
  padding: 0;
}

@media (max-width: 960px) {
  .header-inner {
    width: min(100% - 28px, 720px);
  }

  .site-nav {
    display: none;
  }

  .mobile-nav {
    display: block;
  }

  main {
    flex-direction: column;
  }

  aside {
    position: static;
    width: 100%;
    max-height: none;
    flex: none;
  }
}

@media (max-width: 560px) {
  .container,
  main {
    width: calc(100% - 24px);
  }

  .site-header,
  .header-inner {
    min-height: 64px;
  }

  .brand {
    font-size: 14px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  main {
    padding-top: 24px;
  }

  .card {
    padding: 20px;
    border-radius: 14px;
  }

  .list {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
