/* Wiki UI Moderna - Sin frameworks
   =================================
   - Variables CSS personalizables
   - Diseño responsive y accesible
   - Animaciones suaves y transiciones
   - Tema claro/oscuro automático
*/

:root {
  /* Espaciado y layout */
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 20px;
  --gap: 20px;
  --max-width: 1200px;
  
  /* Sombras modernas */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.16);
  --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.24);
  
  /* Tipografía */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  
  /* Transiciones */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset y base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* Enlaces */
a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  opacity: 0.8;
}

/* Imágenes */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Tipografía */
p {
  line-height: 1.7;
  margin: 0.75rem 0;
}

strong {
  font-weight: 600;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin: 0.5em 0;
}

/* Accesibilidad */
.skip {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip:focus {
  left: 12px;
  top: 12px;
  width: auto;
  height: auto;
  z-index: 9999;
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Layout principal */
.app {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* Sidebar */
.sidebar {
  width: 320px;
  min-width: 280px;
  padding: 24px 20px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: var(--transition);
  z-index: 30;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Brand */
.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.brand__logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  padding: 8px;
}

.brand__meta {
  min-width: 0;
  flex: 1;
}

.brand__name {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand__tagline {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.4;
}

/* Search */
.sidebar__search {
  margin: 20px 0 16px;
}

.sidebar__search input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9375rem;
  outline: none;
  transition: var(--transition);
}

.sidebar__search input::placeholder {
  color: var(--muted);
}

.sidebar__search input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 59, 130, 246), 0.1);
}

.sidebar__hint {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.4;
}

/* Navegación */
.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav__section {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  margin: 16px 12px 8px;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  margin: 2px 0;
  border: 1.5px solid transparent;
  font-size: 0.9375rem;
  transition: var(--transition);
  position: relative;
}

.nav__item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  transform: translateX(2px);
}

.nav__item.is-active {
  background: linear-gradient(135deg, rgba(var(--primary-rgb, 59, 130, 246), 0.15), rgba(var(--primary-rgb, 59, 130, 246), 0.08));
  border-color: rgba(var(--primary-rgb, 59, 130, 246), 0.3);
  font-weight: 500;
}

.nav__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: var(--transition);
  box-shadow: 0 0 0 2px transparent;
}

.nav__item.is-active .nav__dot {
  background: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 59, 130, 246), 0.2);
}

/* Sidebar footer */
.sidebar__footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.small {
  font-size: 0.875rem;
}

.muted {
  color: var(--muted);
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.topbar__title {
  min-width: 0;
  flex: 1;
}

.kicker {
  font-size: 0.8125rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 2px;
}

.h1 {
  font-size: 1.5rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
}

.topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: var(--transition);
}

.icon-btn:hover {
  background: var(--surface);
  border-color: var(--primary);
  transform: scale(1.05);
}

.icon-btn:active {
  transform: scale(0.95);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.pill:hover {
  background: var(--surface);
  border-color: var(--primary);
}

.pill__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 59, 130, 246), 0.2);
}

/* Main content */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  padding: 32px 24px 48px;
}

.content > * {
  max-width: var(--max-width);
  margin: 0 auto;
}

/* Hero section */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  gap: var(--gap);
  align-items: start;
  margin-top: 8px;
}

.hero h2 {
  margin: 0.5rem 0 0.75rem;
  font-size: 2.25rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
  font-weight: 800;
}

.lead {
  font-size: 1.125rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0.5rem 0 1.5rem;
}

.hero__side .mini {
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 100px;
}

.mini__title {
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 1rem;
}

.mini__list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
  list-style: none;
}

.mini__list li {
  position: relative;
  padding-left: 8px;
  margin: 8px 0;
}

.mini__list li::before {
  content: '→';
  position: absolute;
  left: -18px;
  color: var(--primary);
}

/* Cards grid */
.grid.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
  margin-top: 24px;
}

.card {
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card--click {
  cursor: pointer;
}

.card--click:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.card__title {
  font-weight: 700;
  font-size: 1.125rem;
  margin-bottom: 8px;
}

.card__desc {
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.6;
}

.card__meta {
  color: var(--primary);
  margin-top: 12px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Blocks */
.page-head {
  margin: 16px auto 24px;
}

.block {
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  margin: 20px auto;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.block:hover {
  box-shadow: var(--shadow);
}

.block h3 {
  margin: 0 0 16px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.steps {
  margin: 16px 0 0;
  padding-left: 24px;
  list-style: decimal;
}

.steps li {
  margin: 10px 0;
  line-height: 1.7;
  padding-left: 8px;
}

/* Callouts */
.callout {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid;
  background: rgba(255, 255, 255, 0.03);
  transition: var(--transition);
}

.callout:hover {
  transform: translateX(4px);
}

.callout__title {
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 0.9375rem;
}

.callout__body {
  line-height: 1.6;
  font-size: 0.9375rem;
}

.callout.info {
  border-color: rgba(var(--info-rgb, 59, 130, 246), 0.4);
  background: var(--info-bg, rgba(59, 130, 246, 0.1));
}

.callout.success {
  border-color: rgba(var(--success-rgb, 16, 185, 129), 0.4);
  background: var(--success-bg, rgba(16, 185, 129, 0.1));
}

.callout.warning {
  border-color: rgba(var(--warning-rgb, 245, 158, 11), 0.4);
  background: var(--warning-bg, rgba(245, 158, 11, 0.1));
}

.callout.danger {
  border-color: rgba(var(--danger-rgb, 239, 68, 68), 0.4);
  background: var(--danger-bg, rgba(239, 68, 68, 0.1));
}

/* Screenshots grid */
.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.shot {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.shot:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.shot img {
  width: 100%;
  height: auto;
  display: block;
}

.shot figcaption {
  padding: 12px 16px;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
  background: var(--surface);
}

/* FAQ */
.faq {
  margin-top: 16px;
}

.faq__item {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: var(--surface);
  margin: 12px 0;
  transition: var(--transition);
}

.faq__item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.faq__item summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 4px 0;
  list-style: none;
  position: relative;
  padding-right: 24px;
}

.faq__item summary::-webkit-details-marker {
  display: none;
}

.faq__item summary::after {
  content: '+';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  color: var(--primary);
  transition: var(--transition);
}

.faq__item[open] summary::after {
  content: '−';
}

.faq__body {
  color: var(--muted);
  margin-top: 12px;
  line-height: 1.7;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Footer */
.footer {
  padding: 32px 0 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
  }
  
  .hero__side .mini {
    position: relative;
    top: 0;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    width: 320px;
    max-width: 85vw;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    box-shadow: var(--shadow-xl);
  }
  
  .sidebar.is-open {
    left: 0;
  }
  
  .content {
    padding: 24px 16px 32px;
  }
  
  .topbar {
    padding: 12px 16px;
  }
  
  .grid.cards {
    grid-template-columns: 1fr;
  }
  
  .shots {
    grid-template-columns: 1fr;
  }
  
  .hero h2 {
    font-size: 1.75rem;
  }
}

/* Overlay para mobile */
@media (max-width: 768px) {
  .sidebar.is-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    animation: fadeIn 0.3s ease;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Tema claro - Colores optimizados para WCAG AA/AAA */
:root[data-theme="light"] {
  /* Fondos claros */
  --bg: #ffffff;
  --surface: #f8fafc;        /* Slate 50 - Superficie principal */
  --surface-elevated: #f1f5f9; /* Slate 100 - Superficies elevadas */
  
  /* Texto oscuro para buen contraste */
  --text: #0f172a;           /* Slate 900 - Texto principal (contraste 15.8:1) */
  --muted: #475569;          /* Slate 600 - Texto secundario (contraste 7.1:1) */
  --muted-light: #64748b;    /* Slate 500 - Texto terciario */
  
  /* Bordes sutiles */
  --border: rgba(15, 23, 42, 0.12);
  --border-light: rgba(15, 23, 42, 0.16);
  
  /* Fondos de callouts más sutiles en modo claro */
  --success-bg: rgba(16, 185, 129, 0.08);
  --warning-bg: rgba(245, 158, 11, 0.08);
  --danger-bg: rgba(239, 68, 68, 0.08);
  --info-bg: rgba(59, 130, 246, 0.08);
}

:root[data-theme="light"] body {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.02) 0%, rgba(16, 185, 129, 0.02) 100%);
}

:root[data-theme="light"] .brand__logo {
  background: rgba(15, 23, 42, 0.03);
}

:root[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.98);
  border-right-color: rgba(15, 23, 42, 0.08);
}

:root[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.98);
  border-bottom-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

:root[data-theme="light"] .card,
:root[data-theme="light"] .block,
:root[data-theme="light"] .faq__item {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

:root[data-theme="light"] .callout {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.12);
}

:root[data-theme="light"] .nav__item:hover {
  background: rgba(15, 23, 42, 0.04);
}

:root[data-theme="light"] .nav__item.is-active {
  background: linear-gradient(135deg, rgba(var(--primary-rgb, 59, 130, 246), 0.12), rgba(var(--primary-rgb, 59, 130, 246), 0.06));
  border-color: rgba(var(--primary-rgb, 59, 130, 246), 0.25);
}

:root[data-theme="light"] .icon-btn:hover,
:root[data-theme="light"] .pill:hover {
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.15);
}

:root[data-theme="light"] .sidebar__search input {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.12);
}

:root[data-theme="light"] .sidebar__search input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 59, 130, 246), 0.1);
}
