/* Velotecla · Layout: header, rejilla de 3 columnas, anuncios, navegación y footer */

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1640px;
  margin: 0 auto;
  padding: 18px 24px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}
.logo__mark { width: 40px; height: 32px; overflow: visible; color: var(--text); }
.logo__name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.875rem;
  line-height: 1;
  letter-spacing: -.01em;
}
.logo__tagline {
  margin-left: 6px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.header-tools { display: flex; align-items: center; gap: 4px; font-size: 0.875rem; }
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, background-color .15s;
}
.tool-btn:hover { color: var(--text); background: var(--surface); }
.tool-btn[aria-pressed="true"] { color: var(--text); }
.tool-btn[aria-pressed="true"] .icon { color: var(--accent); }
.header-tools .select-wrap { padding: 6px 10px; border-radius: var(--radius-sm); }
.header-tools .select-wrap:hover { background: var(--surface); }
.header-sep { width: 1px; height: 18px; margin: 0 6px; background: var(--line); }
.lang-switch { display: flex; align-items: center; gap: 2px; font-size: 0.8125rem; font-weight: 600; letter-spacing: .06em; }
.lang-switch a {
  color: var(--muted);
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 4px;
}
.lang-switch a:hover { color: var(--text); }
.lang-switch a[aria-current="page"] { color: var(--text); }
.lang-switch span { color: var(--line); }

/* ---------- Rejilla principal ---------- */
.app-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 220px;
  gap: 48px;
  max-width: 1640px;
  margin: 0 auto;
  padding: 16px 24px 24px;
}
.app-grid__main { min-width: 0; }
.app-grid__ad .ad,
.app-grid__nav .side-nav { position: sticky; top: 24px; }

/* ---------- Anuncios (tamaño reservado → CLS = 0) ---------- */
.ad {
  width: var(--ad-w);
  max-width: 100%;
  height: var(--ad-h);
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.ad__placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--pending);
  background:
    repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--line) 45%, transparent) 7px 8px),
    var(--surface);
  border-radius: var(--radius-sm);
}
.ad--top { margin-bottom: 40px; }
.ad--bottom { margin: 56px auto 0; }

/* ---------- Navegación derecha ---------- */
.side-nav { font-size: 0.875rem; padding-top: 4px; }
.side-nav__title { margin: 28px 0 10px; }
.side-nav__title:first-child { margin-top: 0; }
.side-nav__title small { font-weight: 500; letter-spacing: .06em; color: var(--pending); }
.side-nav a,
.side-nav__disabled {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0 7px 12px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  transition: color .15s, border-color .15s;
}
.side-nav a:hover { color: var(--text); border-left-color: var(--muted); }
.side-nav a[aria-current="page"] { color: var(--text); border-left-color: var(--accent); }
.side-nav__disabled { color: var(--pending); }
.levels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.levels__item {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--pending);
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1640px;
  margin: 80px auto 0;
  padding: 24px;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--muted);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer p { margin: 0; }
.site-footer .logo__name { font-size: 1.25rem; color: var(--text); }

/* ---------- Responsivo ---------- */
@media (max-width: 1279px) {
  .app-grid { grid-template-columns: 160px minmax(0, 1fr); gap: 40px; }
  .app-grid__ad .ad { --ad-w: 160px !important; }
  .app-grid__nav { display: none; }
}
@media (max-width: 1023px) {
  .app-grid { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .app-grid__ad { display: none; }
  .logo__tagline { display: none; }
}
@media (max-width: 767px) {
  .site-header { padding: 14px 16px; }
  .header-tools .select-wrap, #keyboard-toggle, .header-sep { display: none; }
  .logo__name { font-size: 1.625rem; }
  .ad--top, .ad--bottom { --ad-h: 100px !important; --ad-w: 320px !important; }
  .site-footer { justify-content: center; text-align: center; }
}

/* ---------- Niveles de lecciones en la barra lateral ---------- */
a.levels__item { text-decoration: none; transition: color .15s, border-color .15s, background-color .15s; }
a.levels__item:hover { color: var(--text); border-color: var(--muted); }
a.levels__item[aria-current="page"] { color: var(--text); border-color: var(--accent); }
.levels__item.is-done {
  color: var(--bg);
  background: color-mix(in srgb, var(--accent) 80%, var(--surface));
  border-color: transparent;
}
.side-nav__title-link { color: inherit; text-decoration: none; }
.side-nav__title-link:hover { color: var(--text); }
.site-footer nav a { color: var(--muted); text-decoration: none; }
.site-footer nav a:hover { color: var(--text); }

/* Sin anuncio lateral: la práctica ocupa ese espacio (centrada) */
.app-grid--no-side-ad { grid-template-columns: minmax(0, 1fr) 220px; }
@media (max-width: 1279px) { .app-grid--no-side-ad { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Selector de tema: punto con el color del tema actual ---------- */
.theme-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
/* Sin el borde grueso del navegador al hacer clic; anillo suave solo al usar el teclado */
.header-tools .select-wrap select:focus { outline: none; }
.header-tools .select-wrap:has(select:focus-visible) {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 30%, transparent);
}
.header-tools .select-wrap select { cursor: pointer; }
.header-tools .select-wrap:hover select { color: var(--text); }

/* Tests largos en el menú: una fila con "Tests largos" y botoncitos 2 · 3 · 5 min */
.side-nav__long {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px 10px;
  padding: 7px 0 7px 12px;
  border-left: 2px solid var(--line);
  color: var(--muted);
}
.side-nav__long.is-current { color: var(--text); border-left-color: var(--accent); }
.side-nav__long-links { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px; }
.side-nav .side-nav__long-links a {
  min-block-size: 26px;
  justify-content: center;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.side-nav .side-nav__long-links a:hover { border-color: var(--muted); }
.side-nav .side-nav__long-links a[aria-current="page"] { color: var(--accent); border-color: var(--accent); }
