/* Iron & Fang, página de la Prealfa 0.1.1.
   Tokens de godot/scripts/ui/ui_theme.gd (los mismos de web/style.css, el HUD original en CSS): lo que cambia
   respecto del juego es solo el cuerpo de texto, que acá va a 16 px porque es una página para leer. */

:root {
  color-scheme: dark;

  --bg: #120f0b;
  --panel: #1d1813;
  --panel-2: #29221a;
  --panel-3: #342b21;
  --panel-end: #17130f;
  --topbar-top: #262019;
  --line: #4a3d2c;
  --line-faint: rgba(74, 61, 44, 0.45);
  --text: #f2ead8;
  --muted: #b9ab90;
  --accent: #e0a944;
  --accent-bg: #4a3a1c;
  --end-hover: #45382a;
  --danger: #ef6a5a;
  --ok: #7bc96f;
  --warn: #e8c547;
  --enemy: #ff8a7d;

  --blue: #2f6fdb;
  --blue-light: #8fb8ff;
  --red: #cf3a30;
  --red-light: #ff9b8f;

  --r: 6px;
  --r-sm: 4px;
  --r-card: 10px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);

  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;

  --gutter: 16px;
  --max: 1120px;
  --top-h: 56px;
}

* { box-sizing: border-box; }

html {
  scroll-padding-top: calc(var(--top-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}

img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--text); }
h1, h2, h3, h4, h5, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: 16px; top: -64px; z-index: 100;
  padding: 8px 16px; border-radius: var(--r);
  background: var(--accent-bg); border: 2px solid var(--accent); color: var(--text); text-decoration: none; font-weight: 600;
}
.skip:focus { top: 8px; }

.wrap { width: 100%; max-width: calc(var(--max) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

/* ------------------------------------------------------------------ botones (.cmd del HUD, nivel elegido) */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel-2); color: var(--text);
  font-size: 14px; font-weight: 600; line-height: 1.25; text-decoration: none; cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out;
}
.btn:hover { background: var(--panel-3); border-color: var(--accent); color: var(--text); }
.btn svg { flex: none; width: 20px; height: 20px; }

.btn--main { border-width: 2px; border-color: var(--accent); background: var(--accent-bg); }
.btn--main:hover { background: var(--end-hover); }

.btn--big { min-height: 56px; padding: 8px 16px; font-size: 20px; font-weight: 700; }
.btn--big small { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--muted); }
.btn--big .lbl { text-align: left; }

.btn--sm { min-height: 36px; padding: 4px 16px; }

/* ------------------------------------------------------------------ barra superior (la del HUD, a 56 px) */

.top {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(var(--topbar-top), var(--panel));
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 16px; min-height: var(--top-h); }

.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; color: var(--text); text-decoration: none; font-weight: 700; }
.brand:hover { color: var(--text); }
.brand img { width: 32px; height: 32px; border-radius: 50%; }
.brand span { font-size: 16px; white-space: nowrap; }
.brand em {
  font-style: normal; font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap;
  padding: 2px 8px; border: 1px solid rgba(224, 169, 68, 0.55); border-radius: var(--r-sm);
}

.nav { display: none; gap: 4px; }
.nav a {
  padding: 8px 12px; border-radius: var(--r); color: var(--muted);
  font-size: 14px; font-weight: 600; text-decoration: none;
}
.nav a:hover { color: var(--text); background: var(--panel-2); }

/* Selector de idioma: dos celdas pegadas, la del idioma actual con el relleno y el borde del botón principal. */
.lang { display: inline-flex; flex: none; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); }
.lang a {
  display: grid; place-items: center; min-width: 36px; min-height: 34px; padding: 0 8px;
  color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-decoration: none;
}
.lang a + a { border-left: 1px solid var(--line); }
.lang a:hover { background: var(--panel-3); color: var(--text); }
.lang a:focus-visible { outline-offset: -2px; }
.lang a[aria-current] { background: var(--accent-bg); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }

/* ------------------------------------------------------------------ portada */

.hero {
  padding: 32px 0 48px;
  background: radial-gradient(circle at 50% 42%, #2c2319 0%, #18130e 55%, #0b0907 100%);
  border-bottom: 1px solid var(--line);
}
.hero-title { display: flex; align-items: center; justify-content: center; gap: 16px; }
.hero-title img { flex: none; width: 72px; height: 72px; border-radius: 50%; }
.hero-title h1 { font-size: 40px; line-height: 1.1; font-weight: 700; letter-spacing: 0; }
.stage {
  display: inline-block; margin-top: 8px; padding: 2px 12px;
  border: 1px solid rgba(224, 169, 68, 0.55); border-radius: var(--r);
  color: var(--accent); font-size: 14px; font-weight: 700; line-height: 1.5;
}
.rule { width: 132px; height: 2px; margin: 16px auto 0; background: rgba(224, 169, 68, 0.55); }

.cta { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 32px; }
.cta .btn--big { width: 100%; max-width: 420px; }
.cta p { font-size: 14px; color: var(--muted); text-align: center; }

.hero .shot { margin: 32px calc(var(--gutter) * -1) 0; border-radius: 0; border-inline: 0; }
.hero .shot img { aspect-ratio: 4 / 3; object-fit: cover; object-position: 62% 50%; width: 100%; }

/* ------------------------------------------------------------------ secciones */

.sec { padding: 48px 0; border-bottom: 1px solid var(--line); }
.sec:last-of-type { border-bottom: 0; }
.sec-head { margin-bottom: 32px; }
.sec-head h2 { font-size: 24px; line-height: 1.25; font-weight: 700; }
.sec-head .rule { margin: 12px 0 0; }
.sec-head p { margin-top: 16px; max-width: 68ch; color: var(--muted); }

.pitch { max-width: 820px; }
.pitch p { font-size: 20px; line-height: 1.5; }
.pitch p + p { margin-top: 16px; color: var(--muted); }

/* tira de datos, con el aspecto de la barra de recursos del HUD */
.facts {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin-top: 32px;
  border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; background: var(--line);
}
.facts li { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--panel); }
.facts b { display: flex; align-items: center; gap: 8px; font-size: 24px; line-height: 1.2; font-weight: 700; }
.facts b img { width: 24px; height: 24px; }
.facts span { font-size: 12px; line-height: 1.4; color: var(--muted); }

/* ------------------------------------------------------------------ capturas (marco del panel) */

.shot { overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--panel); box-shadow: var(--shadow); }
.shot img { width: 100%; }
.shot figcaption { padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.5; color: var(--muted); }
.frame { position: relative; }

img.gif { background-color: var(--panel-end); background-size: cover; background-position: center; }

/* Recorte por CSS de una captura, sin tocar sus píxeles: la pantalla de facciones es una zona chica en medio de la ventana. */
.crop { position: relative; overflow: hidden; aspect-ratio: 4 / 3; background: var(--panel-end); }
.shot .crop img { position: absolute; max-width: none; height: auto; }
.crop--fac img { width: 257.03%; left: -78.45%; top: -46.79%; }

.gif-toggle {
  position: absolute; right: 8px; bottom: 8px; display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r); background: rgba(29, 24, 19, 0.92); color: var(--text);
}
.gif-toggle:hover { border-color: var(--accent); background: var(--panel-3); }
.gif-toggle svg { width: 16px; height: 16px; fill: currentColor; }
.gif-toggle .i-play { display: none; }
.gif-toggle[aria-pressed="true"] .i-play { display: block; }
.gif-toggle[aria-pressed="true"] .i-pause { display: none; }

/* ------------------------------------------------------------------ facciones */

.factions { display: grid; gap: 24px; margin-top: 32px; }

.faction {
  padding: 24px 16px; border: 1px solid var(--line); border-radius: var(--r-card);
  background: rgba(41, 34, 26, 0.92);
}
.faction > header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.faction h3 { font-size: 24px; line-height: 1.2; font-weight: 700; }
.faction .side { margin-top: 4px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.faction .side i { width: 12px; height: 12px; border-radius: 3px; }
.faction .side .b { background: var(--blue); }
.faction .side .r { background: var(--red); }
.faction h4 {
  margin: 24px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
}

.portrait {
  flex: none; display: grid; place-items: center; width: 64px; height: 64px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: radial-gradient(circle at 50% 40%, #3b4a2c, #1d2416);
}
.portrait.enemy { background: radial-gradient(circle at 50% 40%, #4a2c2a, #241615); }
.portrait img { width: 56px; height: 56px; }
.portrait.lg { width: 80px; height: 80px; }
.portrait.lg img { width: 72px; height: 72px; }

.units { display: grid; gap: 16px; }
.unit { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; align-items: start; }
.u-body { display: grid; gap: 4px; min-width: 0; }
.unit h5 { font-size: 16px; line-height: 1.25; font-weight: 700; }
.unit .note { font-size: 12px; line-height: 1.5; color: var(--muted); }

.stats { display: flex; flex-wrap: wrap; gap: 0 16px; font-size: 12px; line-height: 1.5; }
.stats div { display: flex; gap: 4px; }
.stats dt { color: var(--muted); }
.stats dd { font-weight: 600; }

.cost { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; font-weight: 600; }
.cost span { display: inline-flex; align-items: center; gap: 4px; }
.cost img { width: 16px; height: 16px; }

.blds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bld {
  display: flex; flex-direction: column; gap: 4px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
}
.bld > img { width: 64px; height: 64px; }
.bld h5 { font-size: 14px; line-height: 1.25; font-weight: 700; }
.bld .note { font-size: 12px; line-height: 1.4; color: var(--muted); }

.shot.wide img { aspect-ratio: 2 / 1; object-fit: cover; }

/* ------------------------------------------------------------------ "ya está en el juego" */

.feature { display: grid; gap: 16px; padding: 32px 0; border-top: 1px solid var(--line); }
.feature:first-of-type { padding-top: 0; border-top: 0; }
.feature .copy { display: grid; gap: 24px; align-content: center; }
.feature h3 { font-size: 20px; line-height: 1.25; font-weight: 700; }
.feature p { margin-top: 8px; max-width: 62ch; color: var(--muted); }

.also { display: grid; gap: 16px; margin-top: 16px; }
.also .card p { font-size: 14px; line-height: 1.5; }
.sub-head { margin: 48px 0 16px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

.card {
  padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2);
}
.card h3, .card h4 { font-size: 16px; line-height: 1.25; font-weight: 700; }
.card p { margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* ------------------------------------------------------------------ galería */

.gallery { display: grid; gap: 16px; }
.tile { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--panel); }
.tile a { display: block; flex: 1 1 auto; position: relative; min-height: 0; }
.tile img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform 200ms ease-out; }
.tile a:hover img { transform: scale(1.02); }
.tile a::after { content: ""; position: absolute; inset: 0; border: 2px solid transparent; border-radius: 0; pointer-events: none; transition: border-color 160ms ease-out; }
.tile a:hover::after, .tile a:focus-visible::after { border-color: var(--accent); }
.tile a:focus-visible { outline-offset: -2px; }
.tile figcaption { padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.5; color: var(--muted); }

/* ------------------------------------------------------------------ lo que viene */

.tablist { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.tab {
  min-width: 104px; min-height: 40px; padding: 4px 16px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); color: var(--muted);
  font-size: 15px; font-weight: 600;
  transition: background-color 160ms ease-out, border-color 160ms ease-out;
}
.tab:hover { background: var(--panel-3); border-color: var(--accent); color: var(--text); }
.tab[aria-selected="true"] { border-width: 2px; border-color: var(--accent); background: var(--accent-bg); color: var(--text); padding: 3px 15px; }
.tab small { margin-left: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tab[aria-selected="true"] small { color: var(--accent); }

.group + .group { margin-top: 48px; }
#viene-grupos.on .group + .group { margin-top: 0; }
.group > h3 { margin-bottom: 16px; font-size: 20px; font-weight: 700; }
.cards { display: grid; gap: 16px; }

/* ------------------------------------------------------------------ descarga */

.get {
  display: grid; gap: 32px; padding: 24px 16px;
  border: 1px solid var(--line); border-radius: var(--r-card);
  background: linear-gradient(var(--panel), var(--panel-end)); box-shadow: var(--shadow);
}
.get h3 { margin-bottom: 12px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.get .btn--big { width: 100%; }
.get .warn { margin-top: 16px; font-size: 14px; line-height: 1.5; }
.get .warn b { color: var(--warn); font-weight: 600; }
.get .stage-note { margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--muted); }

.reqs li { position: relative; padding: 8px 0 8px 16px; border-bottom: 1px solid var(--line-faint); font-size: 14px; line-height: 1.5; }
.reqs li:last-child { border-bottom: 0; }
.reqs li::before { content: ""; position: absolute; left: 0; top: 16px; width: 6px; height: 6px; border-radius: 1px; background: var(--accent); }

.sums { display: grid; gap: 16px; padding-top: 24px; border-top: 1px solid var(--line); }
.sum dt { font-size: 12px; font-weight: 600; color: var(--muted); }
.sum dd { margin-top: 4px; display: flex; align-items: flex-start; gap: 8px; }
.sum code {
  flex: 1; min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.3); font: 12px/1.5 var(--mono); overflow-wrap: anywhere; user-select: all;
}
.copy-btn { flex: none; min-height: 36px; padding: 4px 12px; font-size: 12px; }

details.more { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); }
details.more + details.more { margin-top: 8px; }
details.more summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 44px; padding: 8px 16px; cursor: pointer; list-style: none; font-size: 14px; font-weight: 600;
}
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "+"; font-size: 20px; line-height: 1; color: var(--accent); }
details.more[open] summary::after { content: "\2212"; }
details.more summary:hover { background: var(--panel-3); }
details.more .body { padding: 8px 16px 16px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.5; }
.moremore { margin-top: 24px; }

.keys { display: grid; gap: 8px 24px; margin-top: 8px; }
.keys div { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 12px; align-items: baseline; }
.keys dt { display: flex; flex-wrap: wrap; gap: 4px; }
.keys dd { color: var(--muted); }
kbd {
  display: inline-block; min-width: 24px; padding: 0 6px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel-2); color: var(--text); font: 600 12px/20px var(--font); text-align: center;
}
.path { display: inline-block; margin-top: 8px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: rgba(0, 0, 0, 0.3); font: 12px/1.5 var(--mono); overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ créditos */

.credits { display: grid; gap: 16px; }
.credits div { padding-top: 12px; border-top: 1px solid var(--line); }
.credits dt { font-size: 14px; font-weight: 700; }
.credits dd { margin-top: 4px; font-size: 14px; line-height: 1.5; color: var(--muted); }

.foot { padding: 24px 0 48px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.foot .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.foot img { width: 24px; height: 24px; border-radius: 50%; }

/* ------------------------------------------------------------------ visor de la galería */

dialog.viewer {
  width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0;
  background: transparent; color: var(--text);
}
dialog.viewer::backdrop { background: rgba(11, 9, 7, 0.92); }
dialog.viewer .stage-box { display: grid; grid-template-rows: minmax(0, 1fr) auto; width: 100%; height: 100%; padding: 56px 16px 16px; gap: 12px; }
dialog.viewer img { align-self: center; justify-self: center; max-width: 100%; max-height: 100%; width: auto; height: auto; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
dialog.viewer p { max-width: 80ch; margin: 0 auto; text-align: center; font-size: 14px; line-height: 1.5; color: var(--muted); }
dialog.viewer button {
  position: absolute; top: 8px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); color: var(--text); font-size: 20px; line-height: 1;
}
dialog.viewer button:hover { border-color: var(--accent); background: var(--panel-3); }
dialog.viewer .v-close { right: 8px; }
dialog.viewer .v-prev { left: 8px; }
dialog.viewer .v-next { left: 60px; }

/* ------------------------------------------------------------------ tablet y escritorio */

@media (min-width: 720px) {
  :root { --gutter: 24px; }
  .sec { padding: 64px 0; }
  .sec-head h2 { font-size: 32px; }
  .hero { padding: 48px 0 64px; }
  .hero-title { gap: 24px; }
  .hero-title img { width: 112px; height: 112px; }
  .hero-title h1 { font-size: 54px; }
  .rule { margin-top: 16px; }
  .hero .shot { margin: 48px 0 0; border-radius: var(--r-card); border-inline: 1px solid var(--line); }
  .hero .shot img { aspect-ratio: auto; object-fit: initial; }
  .cta { flex-direction: row; justify-content: center; gap: 24px; margin-top: 48px; }
  .cta .btn--big { width: auto; padding: 8px 32px; }
  .facts { grid-template-columns: repeat(3, 1fr); }
  .shot.wide img { aspect-ratio: 21 / 9; }
  .factions { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .faction { padding: 24px; }
  .blds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .also { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .get { padding: 32px; }
  .sums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .credits { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 32px; }
  .keys { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  .nav { display: flex; }
  .feature { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 48px; padding: 48px 0; align-items: center; }
  .feature:first-of-type { padding-top: 0; }
  .feature.flip { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .feature.flip .shot-col { order: 2; }
  .feature h3 { font-size: 24px; }
  .blds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .get { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; }
  .get .sums, .get .moremore { grid-column: 1 / -1; }
  .facts { grid-template-columns: repeat(6, 1fr); }
}

@media (min-width: 1152px) {
  .blds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* A 320 px el ícono, el nombre, la etapa y el botón no entran en una fila: la etapa ya está en la portada. */
@media (max-width: 359px) {
  .brand em { display: none; }
}

/* Con el selector de idioma la barra no entra en una fila: en pantallas chicas se achica el selector y se quita primero la
   etapa y después el nombre (los dos están en la portada); entre 900 y 1039 px se quita la etapa para que entre el menú. */
@media (max-width: 479px) {
  .top .wrap { gap: 12px; }
  .brand em { display: none; }
  .lang a { min-width: 32px; padding: 0 6px; }
}
@media (max-width: 359px) {
  .brand span { display: none; }
}
@media (min-width: 900px) and (max-width: 1039px) {
  .brand em { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .tile a:hover img { transform: none; }
}
