/* Guías de algoritmos (páginas estáticas): mismo aspecto que la app (estilo iOS, mismas letras y colores) */

:root {
  color-scheme: light;
  --bg: #f2f2f7; --bg2: #ffffff; --fg: #000000; --fg2: rgba(60,60,67,.78); --sep: rgba(60,60,67,.18); --fill: rgba(120,120,128,.12);
  --tint: #0064d2; --glass: rgba(242,242,247,.8);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --head: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --r: 22px; --r2: 14px;
}
@media (prefers-color-scheme: dark) { :root {
  color-scheme: dark;
  --bg: #000000; --bg2: #1c1c1e; --fg: #ffffff; --fg2: rgba(235,235,245,.6); --sep: rgba(84,84,88,.55); --fill: rgba(118,118,128,.24);
  --tint: #0a84ff; --glass: rgba(0,0,0,.72);
} }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 var(--font); }
a { color: var(--tint); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--tint); outline-offset: 2px; border-radius: 8px; }
code { font-family: var(--mono); }
h1, h2, h3 { font-family: var(--head); line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: clamp(30px, 6vw, 40px); margin: 8px 0 12px; font-weight: 700; }
h1 .sub { display: block; font-size: .5em; font-weight: 500; color: var(--fg2); margin-top: 6px; letter-spacing: 0; }
h2 { font-size: 22px; margin: 0 0 12px; font-weight: 700; }
h2.sec { margin: 32px 4px 12px; }
h3 { font-size: 18px; margin: 20px 0 6px; font-weight: 600; }
p { margin: 0 0 12px; }
.lead { font-size: 18px; color: var(--fg); max-width: 62ch; }
.meta { font-size: 14px; color: var(--fg2); margin: 6px 0 0; }
small { display: block; font-size: 14px; color: var(--fg2); }

.top { position: sticky; top: 0; z-index: 5; background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: .5px solid var(--sep); padding-top: env(safe-area-inset-top, 0px); }
.top .in { max-width: 880px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--fg); font-family: var(--head); font-weight: 700; font-size: 17px; min-height: 44px; margin-right: auto; }
.brand:hover { text-decoration: none; }
.langs { position: relative; font-size: 14px; font-weight: 600; }
.langs summary { list-style: none; cursor: pointer; min-width: 44px; min-height: 36px; padding: 0 10px; display: flex; align-items: center; justify-content: center; gap: 4px; border-radius: 10px; background: var(--fill); }
.langs summary::-webkit-details-marker { display: none; }
.langs summary::after { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .6; }
.langs ul { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; list-style: none; margin: 0; padding: 6px; min-width: 170px; background: var(--bg2); border-radius: var(--r2); box-shadow: 0 8px 30px rgba(0,0,0,.18); }
.langs li a, .langs li span { display: block; padding: 10px 12px; border-radius: 10px; color: var(--fg); font-weight: 500; }
.langs li a:hover { background: var(--fill); text-decoration: none; }
.langs li span { color: var(--tint); font-weight: 600; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 999px; background: var(--tint); color: #fff; font-weight: 600; font-size: 16px; white-space: nowrap; max-width: 100%; }
/* botones con texto largo: en pantallas estrechas pasan a dos líneas en vez de salirse */
@media (max-width: 600px) { main .btn { white-space: normal; text-align: center; line-height: 1.25; padding-top: 10px; padding-bottom: 10px; } }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn.wide { display: flex; width: 100%; margin-top: 16px; }
.top .btn { min-height: 36px; padding: 0 14px; font-size: 15px; }

.wrap { max-width: 880px; margin: 0 auto; padding: 12px 16px 48px; }
.crumbs ol { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: 14px; color: var(--fg2); }
.crumbs li + li::before { content: "›"; margin-right: 4px; }
.crumbs a { display: inline-block; padding: 4px 0; }

.card { background: var(--bg2); border-radius: var(--r); padding: 20px; margin: 16px 0; }
.card > :last-child { margin-bottom: 0; }
.cta { text-align: center; }
.cta p { color: var(--fg2); max-width: 52ch; margin: 0 auto 16px; }

.pasos { margin: 0; padding: 0; list-style: none; counter-reset: p; display: grid; gap: 12px; }
.pasos li { counter-increment: p; display: grid; grid-template-columns: 36px 1fr; column-gap: 12px; }
.pasos li::before { content: counter(p); grid-row: span 2; width: 36px; height: 36px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; font-family: var(--head); font-weight: 700; }
.pasos span { color: var(--fg2); }

.sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.setcard { display: flex; gap: 14px; align-items: center; background: var(--bg2); border-radius: var(--r2); padding: 14px; color: var(--fg); }
.setcard:hover { text-decoration: none; background: color-mix(in srgb, var(--bg2) 92%, var(--fg)); }
.setcard b { font-family: var(--head); font-size: 18px; }
.setcard .n { margin-top: 4px; color: var(--tint); font-weight: 600; }
.thumb { flex: none; width: 64px; height: 64px; display: grid; place-items: center; }
.thumb svg { width: 100%; height: 100%; }

.tips { margin: 0; padding-left: 20px; }
.tips li { margin-bottom: 8px; }

.grp h3 { margin: 24px 4px 2px; }
.grp > .meta { margin: 0 4px 10px; }
.cases { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.case { display: flex; gap: 12px; align-items: center; background: var(--bg2); border-radius: var(--r2); padding: 12px; color: var(--fg); height: 100%; }
a.case:hover { text-decoration: none; background: color-mix(in srgb, var(--bg2) 92%, var(--fg)); }
.case .txt { min-width: 0; display: grid; gap: 2px; }
.case b { font-weight: 600; }
.case code { font-size: 13px; color: var(--fg2); overflow-wrap: anywhere; }
.case code.alt { opacity: .8; }
.cases.mini { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.cases.mini .thumb { width: 48px; height: 48px; }

.caso { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; margin-top: 8px; }
@media (min-width: 720px) { .caso { grid-template-columns: 260px 1fr; } .caso .card { margin: 0; } }
.fig { margin: 0; background: var(--bg2); border-radius: var(--r); padding: 20px; text-align: center; }
.fig .pic { width: min(220px, 70vw); margin: 0 auto; }
.fig svg { width: 100%; height: auto; display: block; }
.fig figcaption { font-size: 13px; color: var(--fg2); margin-top: 12px; }

.alg { display: flex; align-items: flex-start; gap: 10px; background: var(--fill); border-radius: 12px; padding: 12px 12px 12px 14px; }
.alg code { flex: 1; font-size: 17px; line-height: 1.5; overflow-wrap: anywhere; user-select: all; }
.alg.big code { font-size: 22px; font-weight: 700; }
.copy { flex: none; min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--bg2); color: var(--tint); font: 600 14px var(--font); cursor: pointer; }
.algs { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }

.facts { margin: 0; display: grid; gap: 0; }
.facts > div { display: grid; grid-template-columns: minmax(110px, 30%) 1fr; gap: 12px; padding: 12px 0; border-top: .5px solid var(--sep); }
.facts > div:first-child { border-top: 0; padding-top: 0; }
.facts dt { color: var(--fg2); font-size: 15px; }
.facts dd { margin: 0; }
.facts dd small { margin-top: 2px; }

.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin: 24px 0; }
.pager a { display: block; padding: 10px 14px; border-radius: var(--r2); background: var(--bg2); font-weight: 600; min-height: 44px; }
.pager a[rel="next"] { text-align: right; }
.pager a.all { background: none; font-weight: 500; text-align: center; }
.pager small { font-weight: 400; }

table.nota { border-collapse: collapse; width: 100%; margin: 8px 0 4px; }
.nota th, .nota td { text-align: left; padding: 8px 0; border-top: .5px solid var(--sep); vertical-align: top; }
.nota tr:first-child th, .nota tr:first-child td { border-top: 0; }
.nota th { width: 110px; font-weight: 400; }
.nota code { font-size: 16px; font-weight: 700; }

.foot { border-top: .5px solid var(--sep); padding-bottom: env(safe-area-inset-bottom, 0px); }
.foot .in { max-width: 880px; margin: 0 auto; padding: 24px 16px 32px; font-size: 14px; color: var(--fg2); }
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 16px; }
.foot nav a { padding: 6px 0; }

@media (max-width: 520px) {
  .top .in { gap: 6px; }
  .brand span { display: none; }
  .pager { grid-template-columns: 1fr 1fr; }
  .pager .all { grid-column: 1 / -1; order: 3; }
}
/* dibujos de los casos como imágenes (archivos en /casos/) */
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.fig .pic img { width: 100%; height: auto; display: block; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--bg2); font-weight: 600; font-size: 15px; }
.card .chips a { background: var(--fill); }
.grp-guia { margin: -4px 4px 12px; }

/* guías de métodos */
.eyebrow { margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--fg2); } /* T-0100 (U1): «Paso 3» sin mayúsculas ni color de acento */
.toc ol { margin: 0; padding-left: 22px; columns: 2 220px; column-gap: 24px; }
.toc li { padding: 4px 0; break-inside: avoid; }
.paso { scroll-margin-top: 72px; }
.meta-fig { float: right; width: 140px; margin: 0 0 12px 16px; text-align: center; }
.meta-fig figcaption, .mini figcaption { font-size: 12px; color: var(--fg2); margin-top: 6px; }
.meta-fig svg, .mini svg { width: 100%; height: auto; display: block; }
.paso::after { content: ""; display: block; clear: both; }
.figs { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.mini { margin: 0; width: 120px; text-align: center; }
.demos { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.demos li { background: var(--fill); border-radius: 12px; padding: 12px 14px; }
.demos code { font-size: 15px; font-weight: 700; margin-left: 4px; }
.demos p { margin: 4px 0 0; font-size: 15px; color: var(--fg2); }
.paso-caso { display: grid; gap: 6px; align-content: start; }
.paso-caso .case { background: var(--fill); }
.paso-caso > .meta { margin: 0 4px; }
.paso .cases { clear: both; }
.mlist { list-style: none; margin: 0; padding: 0; }
.mlist a { display: block; padding: 10px 0; border-top: .5px solid var(--sep); }
.mlist li:first-child a { border-top: 0; }
.mlist small { margin-top: 2px; }
.thumb.inline { display: inline-grid; width: 36px; height: 36px; vertical-align: middle; margin-right: 10px; }
@media (max-width: 520px) { .meta-fig { width: 110px; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* patrones: dibujo en 3D y las seis caras, uno al lado del otro (uno encima de otro en el móvil) */
.patron { display: grid; gap: 10px; }
.pdib { display: flex; gap: 20px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 6px 0; }
.pdib .piso { width: 120px; } .pdib .pnet { width: 200px; max-width: 100%; }
.pdib svg { width: 100%; height: auto; display: block; }
