/* ==========================================================================
   Jeepedia — hoja de estilos retro/GeoCities sobre base responsive y accesible.
   "Retro por fuera, moderno por dentro": grid/flex + a11y por debajo, piel 90s
   por arriba. <table> real solo para fichas técnicas.
   ========================================================================== */

:root {
  --paper:    #f3e9d2;   /* pergamino / crema */
  --paper-2:  #e9dcbe;
  --ink:      #241c10;   /* marrón casi negro, alto contraste sobre paper */
  --olive:    #556b2f;
  --olive-d:  #3a4a1f;
  --rust:     #a8420d;
  --rust-d:   #7c2f08;
  --amber:    #e6a817;
  --slate:    #2b3220;   /* fondo tileado */
  --line:     #8a7a55;
  --link:     #9c3b0a;
  --link-vis: #6d3a86;

  --wrap: 980px;
  --font-body: Verdana, Geneva, "DejaVu Sans", Tahoma, sans-serif;
  --font-head: "Arial Black", "Helvetica Neue", Impact, system-ui, sans-serif;
  --font-mono: "Courier New", Courier, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 1.2rem 0.8rem 2.5rem;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--slate);
  background-image: url("/assets/img/bg-tile.svg");
}

/* Columna central: la "hoja" de pergamino con marco biselado retro. */
.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  background: var(--paper);
  border: 3px solid var(--olive-d);
  box-shadow: 0 0 0 3px var(--amber), 0 6px 22px rgba(0,0,0,0.55);
}

.wrap > * { padding-left: clamp(0.9rem, 3vw, 2rem); padding-right: clamp(0.9rem, 3vw, 2rem); }

/* --- Tipografía --------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: 1.15;
  color: var(--olive-d);
  letter-spacing: 0.02em;
}
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); text-transform: uppercase; }
h2 {
  font-size: clamp(1.25rem, 3.5vw, 1.6rem);
  border-bottom: 3px double var(--rust);
  padding-bottom: 0.2rem;
  margin-top: 2rem;
}
h3 { font-size: 1.15rem; color: var(--rust-d); }
p { margin: 0.7rem 0; }

a { color: var(--link); text-decoration: underline; }
a:visited { color: var(--link-vis); }
a:hover, a:focus { color: #fff; background: var(--rust); text-decoration: none; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* --- Encabezado del sitio ---------------------------------------------- */
.site-header {
  background: var(--olive-d);
  color: var(--paper);
  text-align: center;
  padding-top: 1.1rem !important;
  padding-bottom: 0.4rem !important;
  border-bottom: 4px solid var(--amber);
}
.site-header .brand {
  font-family: var(--font-head);
  font-size: clamp(2.2rem, 8vw, 3.6rem);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--amber);
  text-shadow: 3px 3px 0 var(--rust-d), 5px 5px 0 rgba(0,0,0,0.35);
  margin: 0;
  display: inline-block;
}
.site-header .tagline {
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 0.95rem;
  margin: 0.2rem 0 0.6rem;
  font-style: italic;
}

/* Cinta de navegación de familias + selector de idioma. */
.topbar {
  background: var(--olive);
  border-top: 2px solid var(--amber);
  border-bottom: 2px solid var(--olive-d);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: center;
  padding-top: 0.45rem !important;
  padding-bottom: 0.45rem !important;
}
.topbar nav { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; }
.topbar a.navbtn {
  font-family: var(--font-head);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--paper-2);
  padding: 0.25rem 0.7rem;
  border: 2px outset var(--paper);
  text-decoration: none;
}
.topbar a.navbtn:hover, .topbar a.navbtn:focus { background: var(--amber); border-style: inset; }

.lang-switch { display: flex; gap: 0.3rem; align-items: center; margin-left: auto; }
.lang-switch .flag {
  font-family: var(--font-mono);
  font-weight: bold;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border: 2px solid var(--olive-d);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}
.lang-switch .flag.current { background: var(--rust); color: #fff; border-color: var(--amber); }

/* --- Divisor de huella ------------------------------------------------- */
.divider {
  height: 16px;
  background: url("/assets/img/divider.svg") repeat-x center;
  margin: 1.4rem 0;
  border: 0;
  padding: 0 !important;
}

/* --- Grilla de modelos (índice) ---------------------------------------- */
.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}
.model-card {
  background: var(--paper-2);
  border: 3px ridge var(--olive);
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}
.model-card a.card-link { text-decoration: none; color: inherit; display: block; }
.model-card .thumb {
  aspect-ratio: 16 / 10;
  background: var(--slate);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border-bottom: 2px solid var(--olive-d);
}
.model-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.model-card .thumb .noimg { color: var(--paper); font-family: var(--font-mono); font-size: 0.8rem; opacity: 0.7; }
.model-card .card-body { padding: 0.6rem 0.8rem 0.9rem; }
.model-card h3 { margin: 0.2rem 0; color: var(--olive-d); }
.model-card .gen { font-family: var(--font-mono); font-weight: bold; color: var(--rust); }
.model-card .stub-flag {
  display: inline-block;
  background: repeating-linear-gradient(45deg, #d9a400, #d9a400 8px, #1a1a1a 8px, #1a1a1a 16px);
  color: #fff;
  font-size: 0.7rem;
  font-family: var(--font-head);
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  text-shadow: 1px 1px 1px #000;
}

/* --- Ficha técnica: <table> real --------------------------------------- */
.specs { padding-top: 0.4rem; padding-bottom: 0.4rem; overflow-x: auto; }
table.specs-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
  background: #fff;
  border: 2px solid var(--olive-d);
}
table.specs-table caption {
  font-family: var(--font-head);
  text-align: left;
  color: var(--rust-d);
  padding: 0.3rem 0;
}
table.specs-table th, table.specs-table td {
  border: 1px solid var(--line);
  padding: 0.35rem 0.55rem;
  text-align: left;
  vertical-align: top;
}
table.specs-table thead th { background: var(--olive); color: var(--paper); }
table.specs-table th[scope="row"] { background: var(--paper-2); white-space: nowrap; }
table.specs-table:not(.fit-table):not(.gear-chart) tbody tr:nth-child(even) td { background: #f6f1e4; }

/* --- Figuras + créditos de imagen -------------------------------------- */
figure.photo { margin: 1rem 0; border: 3px solid var(--olive-d); background: #fff; padding: 0 !important; }
figure.photo img { display: block; width: 100%; height: auto; }
figure.photo figcaption {
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
  background: var(--paper-2);
  border-top: 2px solid var(--olive-d);
  color: #4a3d24;
}
figure.photo figcaption .lic { font-family: var(--font-mono); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.8rem; }
.gallery figure.photo { margin: 0; }

/* Figura intercalada en el cuerpo del artículo: flota a un costado y el texto la rodea. */
figure.photo.inline { max-width: 42%; }
figure.photo.inline.right { float: right; margin: 0.2rem 0 0.7rem 1.1rem; }
figure.photo.inline.left  { float: left;  margin: 0.2rem 1.1rem 0.7rem 0; }
/* Separador: fuerza que lo que sigue arranque debajo de las fotos flotantes previas.
   Se intercala entre dos fotos de la misma sección para que no se pisen ni aplasten el texto. */
.content .clear-floats { clear: both; height: 0; margin: 0; }
/* Cada sección nueva y cada tabla arrancan por debajo de las fotos flotantes. */
.content h2, .content div.specs { clear: both; }
@media (max-width: 620px) {
  figure.photo.inline, figure.photo.inline.right, figure.photo.inline.left {
    float: none; max-width: 100%; margin: 1rem 0;
  }
}

/* --- Cajita de contenido / prosa --------------------------------------- */
.content { padding-top: 1rem; padding-bottom: 1rem; }
.lead { font-size: 1.05rem; background: var(--paper-2); border-left: 6px solid var(--rust); padding: 0.7rem 1rem !important; }

/* --- Links a mecánica relacionada -------------------------------------- */
.related-tech {
  background: var(--paper-2);
  border: 2px dashed var(--olive);
  padding: 0.6rem 0.9rem !important;
  margin: 1.1rem 0;
  font-size: 0.95rem;
}
.related-tech strong {
  display: block;
  color: var(--rust-d);
  text-transform: uppercase;
  font-family: var(--font-head);
  font-size: 0.82rem;
  margin-bottom: 0.2rem;
}
.related-tech a { display: inline-block; margin: 0.1rem 0.15rem; }

/* Links de vuelta a los modelos desde una pagina de mecanica. */
.tech-usedin { background: var(--paper-2); border-left: 6px solid var(--olive); padding: 0.6rem 1rem !important; margin: 1rem 0; }
p a.inlink { font-weight: bold; }

/* --- Chart de gear ratio / rodado -------------------------------------- */
table.gear-chart { font-size: 0.7rem; }
table.gear-chart caption { font-size: 0.9rem; }
table.gear-chart th, table.gear-chart td { padding: 0.12rem 0.28rem; text-align: center; white-space: nowrap; }
table.gear-chart thead th { background: var(--olive); color: var(--paper); }
td.g-eco { background: #f2e02c; color: #000; font-weight: bold; }
td.g-ideal { background: #4fa23e; color: #fff; font-weight: bold; }
td.g-high { background: #c0392b; color: #fff; font-weight: bold; }
.chart-legend { font-size: 0.85rem; margin-top: 0.5rem; }
.chart-legend span { display: inline-block; width: 1.5rem; border: 1px solid #000; vertical-align: middle; }
.chart-legend .g-eco { background: #f2e02c; }
.chart-legend .g-ideal { background: #4fa23e; }
.chart-legend .g-high { background: #c0392b; }

/* --- Tabla de fitment rodado / altura de lift -------------------------- */
table.fit-table td { text-align: center; font-weight: bold; }
td.fit-ok { background: #4fa23e; color: #fff; }
td.fit-trim { background: #f2e02c; color: #000; }
td.fit-major { background: #e08a1e; color: #000; }
td.fit-no { background: #c0392b; color: #fff; }
.fit-legend { font-size: 0.85rem; margin-top: 0.5rem; }
.fit-legend span { display: inline-block; min-width: 1.4rem; padding: 0 0.3rem; text-align: center; border: 1px solid #000; font-weight: bold; margin-right: 0.15rem; }
.fit-legend .fit-ok { background: #4fa23e; color: #fff; }
.fit-legend .fit-trim { background: #f2e02c; color: #000; }
.fit-legend .fit-major { background: #e08a1e; color: #000; }
.fit-legend .fit-no { background: #c0392b; color: #fff; }

/* --- Marquesina retro (respeta reduced-motion) ------------------------- */
.marquee {
  overflow: hidden; white-space: nowrap; background: var(--olive-d); color: var(--amber);
  font-family: var(--font-mono); font-size: 0.85rem; border-top: 2px solid var(--amber); border-bottom: 2px solid var(--amber);
  padding: 0.25rem 0 !important;
}
.marquee span { display: inline-block; padding-left: 100%; animation: scroll-left 22s linear infinite; }
@keyframes scroll-left { to { transform: translateX(-100%); } }

/* --- "En construcción" ------------------------------------------------- */
.under-construction {
  text-align: center;
  background: repeating-linear-gradient(45deg, #d9a400, #d9a400 14px, #1a1a1a 14px, #1a1a1a 28px);
  color: #fff; font-family: var(--font-head); text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.5rem !important; text-shadow: 1px 1px 2px #000; border: 2px solid #000;
}
.soon-box { text-align: center; padding: 2rem 1rem; }

/* --- Footer ------------------------------------------------------------ */
.site-footer {
  background: var(--olive-d); color: var(--paper);
  border-top: 4px solid var(--amber);
  font-size: 0.82rem; text-align: center;
  padding-top: 1rem !important; padding-bottom: 1.2rem !important;
}
.site-footer a { color: var(--amber); }
.site-footer a:hover { color: #fff; }
.buttons88 { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 0.6rem 0; }
.buttons88 .b88 { width: 88px; height: 31px; display: block; border: 0; padding: 0; }
.webring { margin-top: 0.5rem; font-family: var(--font-mono); }
.webring a { padding: 0 0.3rem; }

/* --- Responsive -------------------------------------------------------- */
@media (max-width: 560px) {
  body { padding: 0.4rem 0.3rem 2rem; }
  .lang-switch { margin-left: 0; width: 100%; justify-content: center; }
  .topbar { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .marquee span { animation: none; padding-left: 0; }
  * { scroll-behavior: auto !important; }
}

/* --- Árbol de mecánica (home): ramas plegables tipo catálogo ----------- */
.tech-tree { padding-top: 0.4rem; padding-bottom: 0.8rem; display: grid; gap: 0.5rem; }
.tech-branch { border: 3px ridge var(--olive); background: var(--paper-2); }
.tech-branch > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.95rem;
  color: var(--paper);
  background: var(--olive-d);
  padding: 0.5rem 0.8rem;
}
.tech-branch > summary::-webkit-details-marker { display: none; }
.tech-branch > summary::before { content: "\25B8"; color: var(--amber); font-size: 0.9em; }
.tech-branch[open] > summary::before { content: "\25BE"; }
.tech-branch > summary:hover, .tech-branch > summary:focus { background: var(--rust); }
.branch-name { flex: 1; }
.branch-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink);
  background: var(--amber);
  border: 1px solid var(--olive-d);
  padding: 0 0.4rem;
}
.branch-list { list-style: none; margin: 0; padding: 0.4rem 0.5rem 0.5rem; display: grid; gap: 0.3rem; }
.branch-list li { margin: 0; }
.branch-list a {
  display: block;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--rust);
  padding: 0.35rem 0.6rem;
}
.branch-list a:hover, .branch-list a:focus { background: var(--amber); border-left-color: var(--olive-d); color: var(--ink); }
.branch-list a b { display: block; color: var(--rust-d); }
.branch-list a:hover b, .branch-list a:focus b { color: var(--ink); }

/* ==========================================================================
   VIDA VISUAL — emblema, mascota, íconos por grupo, blinkies y animaciones.
   Todo el movimiento se frena en el bloque prefers-reduced-motion del final.
   ========================================================================== */

:root {
  --accent:   #2a9d8f;   /* turquesa noventoso: acento puntual, no invade la paleta tierra */
  --accent-d: #1c6f66;
}

/* Pixel art nítido: para tus GIFs/PNG dibujados chico y escalados. Los SVG no lo necesitan. */
img.pixel { image-rendering: pixelated; }

/* --- Marca: emblema de parrilla + mascota ------------------------------ */
.site-header { position: relative; }
.site-header .brand { display: inline-flex; align-items: center; gap: 0.5rem; }
.brand-emblem { height: 0.9em; width: auto; flex: none; filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.35)); }
.header-mascot { position: absolute; right: 0.9rem; bottom: 0.3rem; width: 56px; height: 56px; }
@media (max-width: 640px) { .header-mascot { display: none; } }

/* --- Franja de blinkies (footer) --------------------------------------- */
.blinkies { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 0.5rem 0 0.2rem; }
.blinkies img { width: 150px; height: 20px; display: block; border: 1px solid #000; }
.blinky { animation: blinky-pulse 1.1s steps(1) infinite alternate; }
@keyframes blinky-pulse { from { opacity: 1; } to { opacity: 0.5; } }

/* --- Color por grupo de mecánica (una sola fuente de verdad) ------------ */
[data-kind="motor"]    { --k: #a8420d; }
[data-kind="caja"]     { --k: #c98a00; }
[data-kind="transfer"] { --k: #2a7d8c; }
[data-kind="eje"]      { --k: #5a6b7a; }
[data-kind="guia"]     { --k: #6d3a86; }

/* Ícono + barra de color en cada rama del árbol (home). */
.branch-icon { width: 22px; height: 22px; flex: none; }
.tech-branch > summary { box-shadow: inset 5px 0 0 var(--k, var(--amber)); }

/* Cabecera de cada ficha de mecánica: glyph grande + barra de color. */
.tech-head { display: flex; align-items: center; gap: 0.6rem; margin: 0.2rem 0 0.4rem; }
.tech-head img { width: 40px; height: 40px; flex: none; }
.tech-head h1 { margin: 0; border-left: 6px solid var(--k, var(--amber)); padding-left: 0.55rem; }

/* --- Marcador de sección (solo fichas: <article class="content">) ------- */
article.content h2::before {
  content: "";
  display: inline-block; vertical-align: -0.08em;
  width: 0.75em; height: 0.75em; margin-right: 0.4rem;
  background: url("/assets/img/deco/glyph-caja.svg") no-repeat center / contain;
}

/* --- Divisores temáticos (variantes del <hr class="divider">) ----------- */
.divider.convoy { height: 20px; background: url("/assets/img/deco/divider-convoy.svg") repeat-x center; }
.divider.gears  { height: 20px; background: url("/assets/img/deco/divider-gears.svg") repeat-x center; }
.divider.flames { height: 22px; background: url("/assets/img/deco/flames.gif") repeat-x center; }

/* --- Jeep que cruza, bajo la marquesina (home) ------------------------- */
.jeep-run { position: relative; height: 28px; overflow: hidden; background: var(--olive-d); border-bottom: 2px solid var(--amber); }
.jeep-run::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 4px; height: 2px;
  background: repeating-linear-gradient(90deg, #8a7a55 0 6px, transparent 6px 12px); opacity: 0.5;
}
.jeep-run img { position: absolute; bottom: 3px; left: -60px; width: 48px; height: 24px; animation: jeep-cross 13s linear infinite; animation-delay: -5s; }
@keyframes jeep-cross { to { transform: translateX(calc(100vw + 60px)); } }

/* --- Badge "NEW!" para modelos recién sumados/ampliados ---------------- */
.model-card .thumb { position: relative; }
.badge-new {
  display: inline-block; background: var(--accent); color: #06231f;
  font-family: var(--font-head); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 0.08rem 0.34rem; border: 2px solid #06231f; transform: rotate(-7deg);
  box-shadow: 1px 1px 0 rgba(0,0,0,0.45); animation: badge-pulse 1.3s ease-in-out infinite;
}
.thumb .badge-new { position: absolute; top: 5px; left: 5px; z-index: 2; }
@keyframes badge-pulse { 50% { transform: rotate(-7deg) scale(1.14); } }

/* --- Frenar TODO lo animado nuevo si el usuario pide menos movimiento --- */
@media (prefers-reduced-motion: reduce) {
  .jeep-run img { animation: none; left: 10px; transform: none; }
  .blinky { animation: none; }
  .badge-new { animation: none; transform: rotate(-7deg); }
}
.branch-list a span { font-size: 0.85rem; color: #4a3d24; }
