/* Variables */
:root {
  --bg: #1e222b;           
  --surface: #282c34;      
  --surface2: #353b45;     
  --border: #3e4451;       
  --accent: #4d78cc;       
  --accent2: #d19a66;      
  --text: #abb2bf;         
  --text-muted: #7f848e;   
  --green: #98c379;        
  --radius: 10px;
  --font-mono: 'Courier New', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
  padding-bottom: 3rem;
}

/* Header */
header {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
  background: linear-gradient(135deg, #646566 0%, #1e222b 100%);
  border-bottom: 2px solid var(--border);
}

header h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  color: #e5e7eb; 
  letter-spacing: -0.5px;
  margin-bottom: .4rem;
}

header p {
  color: var(--text-muted);
  font-size: .95rem;
}

/* Main / Scroll */
main {
  padding: 2rem 1rem;
  overflow-x: auto;
}

/* Table */
.tabla-custom {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  margin-bottom: 2.5rem; 
}
.tabla-custom thead tr {
  background: linear-gradient(90deg, #474b55 0%, #21252b 100%);
  border-bottom: 2px solid var(--accent);
}

.tabla-custom th {
  padding: .9rem 1rem;
  text-align: left;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent); 
  font-weight: 700;
}

.tabla-custom tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .2s;
}

.tabla-custom tbody tr:last-child { border-bottom: none; }

.tabla-custom tbody tr:hover { background: var(--surface2); }

.tabla-custom td {
  padding: .9rem 1rem;
  font-size: .88rem;
  vertical-align: middle;
  color: var(--text);
}

td.num {
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent2); 
  width: 40px;
}

/* Code */
code {
  font-family: var(--font-mono);
  font-size: .8rem;
  background: #1e222b;
  color: #61afef; 
  padding: .25rem .5rem;
  border-radius: 5px;
  border: 1px solid var(--border);
  display: inline-block;
  white-space: nowrap;
}

/* Demo area */
.demo-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}

/* Buttons */
button {
  background: var(--accent);
  color: #1e222b; 
  font-weight: 600;
  border: none;
  border-radius: 6px;
  padding: .45rem 1rem;
  font-size: .78rem;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  white-space: nowrap;
}

button:hover { opacity: 0.9; transform: translateY(-1px); }
button:active { transform: translateY(0); }

/* Demo boxes */
.caja {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .3rem .7rem;
  font-size: .82rem;
  min-width: 60px;
  text-align: center;
  transition: all .3s;
}

.fade-box { background: #3e4451; color: var(--text); border-color: var(--border); }

.resaltado {
  background: var(--accent2) !important;
  color: #1e222b !important;
  font-weight: 600;
  border-color: var(--accent2) !important;
}

.hover-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .25s;
  padding: .4rem .9rem;
  border-radius: 8px;
}

/* Tags / badges */
.tag {
  background: var(--green);
  color: #1e222b;
  font-weight: 600;
  border-radius: 4px;
  padding: .2rem .55rem;
  font-size: .8rem;
  display: inline-block;
}

/* Result text */
.resultado {
  font-size: .82rem;
  color: var(--accent2);
  min-width: 80px;
}

/* Panel (slide) */
.panel {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .5rem .8rem;
  font-size: .82rem;
  color: #61afef;
  width: 100%;
  max-width: 200px;
}

/* Input */
input[type="text"] {
  background: #1e222b;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .35rem .6rem;
  color: var(--text);
  font-size: .82rem;
  width: 130px;
  outline: none;
  transition: border .2s;
}

input[type="text"]:focus { border-color: var(--accent); }

/* List */
.lista {
  list-style: none;
  padding: 0;
  margin: 0;
}

.lista li {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .2rem .55rem;
  font-size: .78rem;
  margin-bottom: .2rem;
  animation: fadeIn .3s ease;
}

/* Animate position */
.anim-area { position: relative; min-height: 50px; }
.mover { position: relative; }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Row entrance */
.tabla-custom tbody tr {
  animation: rowIn .35s ease both;
}

@keyframes rowIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Stagger rows */
.tabla-custom tbody tr:nth-child(1)  { animation-delay: .04s; }
.tabla-custom tbody tr:nth-child(2)  { animation-delay: .07s; }
.tabla-custom tbody tr:nth-child(3)  { animation-delay: .10s; }
.tabla-custom tbody tr:nth-child(4)  { animation-delay: .13s; }
.tabla-custom tbody tr:nth-child(5)  { animation-delay: .16s; }
.tabla-custom tbody tr:nth-child(6)  { animation-delay: .19s; }
.tabla-custom tbody tr:nth-child(7)  { animation-delay: .22s; }
.tabla-custom tbody tr:nth-child(8)  { animation-delay: .25s; }
.tabla-custom tbody tr:nth-child(9)  { animation-delay: .28s; }
.tabla-custom tbody tr:nth-child(10) { animation-delay: .31s; }
.tabla-custom tbody tr:nth-child(11) { animation-delay: .34s; }
.tabla-custom tbody tr:nth-child(12) { animation-delay: .37s; }
.tabla-custom tbody tr:nth-child(13) { animation-delay: .40s; }
.tabla-custom tbody tr:nth-child(14) { animation-delay: .43s; }
.tabla-custom tbody tr:nth-child(15) { animation-delay: .46s; }

/* Estructura semántica adicional */

/* nav */
nav[aria-label] {
  background: #21252b;
  border-bottom: 1px solid var(--border);
  padding: .6rem 1.5rem;
}

nav[aria-label] ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
}

nav[aria-label] a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: .85rem;
  transition: color .2s;
}

nav[aria-label] a:hover { color: var(--accent); }

/* section */
main > section {
  margin-bottom: 3.5rem;
}

main > section > h2 {
  font-size: 1.2rem;
  color: #e5e7eb;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 1.2rem;
  padding-left: .5rem;
  border-left: 4px solid var(--accent);
}

/* #intro */
#intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}

#intro h2 { font-size: 1.1rem; margin-bottom: .5rem; border-left: none; padding-left: 0; }

#intro p {
  font-size: .9rem;
  color: var(--text);
  line-height: 1.6;
}

/* article wraps table */
article[aria-label] {
  overflow-x: auto;
}

/* caption */
caption {
  caption-side: top;
  text-align: left;
  font-size: .82rem;
  color: var(--text-muted);
  padding: .4rem 0 .6rem .2rem;
  font-style: italic;
}

/* footer */
footer[role="contentinfo"] {
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--text-muted);
  background: #21252b;
}