/* Level 0 · guías del cubo — same palette as the PDFs: logo red on white paper, black ink */
:root {
  --red: #E01018;
  --red-dark: #A80C12;
  --red-light: #FDE6E7;
  --ink: #121212;
  --muted: #4b5563;
  --line: #e2e8f0;
  --panel: #f3f6fa;
  --chip: #F2F2F5;
  --green: #128a00;
  --yellow: #8a7100;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font: 16px/1.6 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--red-dark); text-underline-offset: 2px; }
a:hover { color: var(--red); }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.wrap { max-width: 1040px; margin: 0 auto; padding-inline: 20px; }
main.wrap { padding-block: 20px 48px; }
h1, h2, h3 { font-family: "Archivo Black", Impact, sans-serif; font-weight: 400; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(28px, 5.4vw, 44px); text-transform: uppercase; }
h2 { font-size: clamp(21px, 3.4vw, 27px); margin: 40px 0 12px; }
h3 { font-size: 18px; }
p { margin: 0 0 14px; }
.mono, code { font-family: "JetBrains Mono", ui-monospace, monospace; }
.lead { color: var(--muted); font-size: 17px; max-width: 46em; }
.small { color: var(--muted); font-size: 14px; }

/* ---- header / footer ---- */
.top { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; }
.top-in { display: flex; align-items: center; gap: 18px; min-height: 60px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 400 18px/1 "Archivo Black", Impact, sans-serif; }
.brand em { font: 500 14px/1 Inter, sans-serif; font-style: normal; color: var(--muted); }
.langs { display: flex; gap: 2px; margin-left: auto; order: 3; }
.langs a { font: 700 13px/1 "JetBrains Mono", ui-monospace, monospace; color: var(--muted); text-decoration: none; padding: 7px 7px; border-radius: 6px; }
.langs a:hover { background: var(--panel); color: var(--ink); }
.langs a[aria-current] { color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.menu { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.menu a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; padding: 8px 11px; border-radius: 8px; white-space: nowrap; }
.menu a:hover { background: var(--panel); }
.menu a[aria-current] { background: var(--red); color: #fff; }
@media (max-width: 720px) {
  .brand em { display: none; }
  .menu { margin-left: 0; width: 100%; margin-inline: -4px; order: 4; }
}
.foot { border-top: 1px solid var(--line); background: var(--panel); padding-block: 28px calc(28px + env(safe-area-inset-bottom, 0px)); font-size: 14px; color: var(--muted); }
.foot-social, .foot-links { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-bottom: 14px; }
.foot-social a { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; text-decoration: none; }
.foot-social svg { width: 20px; height: 20px; color: var(--ink); }
.foot-links a { color: var(--muted); }
.fine { margin: 0; }

.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.crumbs span { margin-inline: 2px; }

/* ---- buttons ---- */
.btn { display: inline-block; text-align: center; padding: 12px 18px; border-radius: 10px; background: var(--red); color: #fff;
  font-weight: 700; text-decoration: none; border: 2px solid var(--red); }
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); border-color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 18px; }
.meta { font: 500 13px/1.2 "JetBrains Mono", ui-monospace, monospace; color: var(--muted); }

/* ---- page / case headers ---- */
.kicker { font: 700 14px/1.3 "JetBrains Mono", ui-monospace, monospace; color: var(--muted); margin: 0 0 8px; }
.kicker span { background: var(--red); color: #fff; padding: 3px 8px; border-radius: 6px; margin-right: 6px; }
.sub { color: var(--muted); font: 500 14px/1.4 "JetBrains Mono", ui-monospace, monospace; margin: 6px 0 0; }
.page-head { margin-bottom: 10px; }
.page-head .lead { margin-top: 12px; }
.meta-line { color: var(--muted); margin-top: 8px; }
.case-head { margin-bottom: 18px; }
.step-head { display: flex; gap: 18px; align-items: center; }
.step-head img { width: 120px; flex: none; }

/* ---- hero: picture, algorithm, video ---- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 0.8fr); gap: 24px; align-items: start; }
.block .hero { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); margin: 14px 0 6px; }
.hero-pic { display: grid; gap: 10px; }
.hero-pic img { width: 100%; }
.hero-pic.two img:first-child { max-width: 82%; margin-inline: auto; }
.label { font: 700 14px/1 "JetBrains Mono", ui-monospace, monospace; color: var(--red); margin: 4px 0 10px; text-transform: uppercase; }
@media (max-width: 860px) {
  .hero, .block .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-pic { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); max-width: 460px; }
  .hero-pic.two img:first-child { max-width: 100%; }
}

.alg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.chip { font: 700 19px/1 "JetBrains Mono", ui-monospace, monospace; background: var(--chip); border: 1px solid #8A8A8A;
  border-radius: 8px; padding: 8px 10px; min-width: 2.4em; text-align: center; }
.copy { font: 600 14px/1 Inter, sans-serif; background: #fff; color: var(--ink); border: 1px solid var(--ink); border-radius: 8px;
  padding: 9px 12px; cursor: pointer; margin-left: 4px; }
.copy:hover { background: var(--ink); color: #fff; }
.copy.ok { background: var(--green); border-color: var(--green); color: #fff; }
.alg-none { font-weight: 600; }

/* ---- video (click to load) ---- */
.video { width: 100%; max-width: 300px; }
.video .yt-play, .video iframe { display: block; width: 100%; aspect-ratio: 9 / 16; border: 0; border-radius: 14px; overflow: hidden;
  background: #000; position: relative; padding: 0; cursor: pointer; }
.video .yt-play img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .92; }
.video .yt-play:hover img { opacity: 1; }
.yt-icon { position: absolute; inset: 0; margin: auto; width: 68px; height: 48px; border-radius: 12px; background: #f00; }
.yt-icon::after { content: ""; position: absolute; left: 27px; top: 14px; border-style: solid; border-width: 10px 0 10px 17px;
  border-color: transparent transparent transparent #fff; }
.vnote { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.yt-link { display: inline-block; margin-top: 8px; font-size: 14px; }
.video-soon { border: 1px dashed #9aa3af; border-radius: 14px; padding: 18px; background: var(--panel); }
.video-soon p { color: var(--muted); }
.videos { display: flex; flex-wrap: wrap; gap: 20px; }
.videos .video { max-width: 240px; }
@media (max-width: 860px) { .hero > .video { max-width: 280px; } }

/* ---- step-by-step tiles ---- */
.tiles { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.tile .pic { position: relative; padding: 14px 8px 4px; }
.tile .pic img { display: block; width: 100%; }
.badge { position: absolute; top: 8px; left: 8px; font: 700 13px/1 "JetBrains Mono", ui-monospace, monospace; background: var(--ink);
  color: #fff; border-radius: 6px; padding: 4px 7px; text-transform: uppercase; }
.badge-red { background: var(--red); }
.badge-green { background: var(--green); }
.badge-yellow { background: #C9A600; }
.cap { background: var(--panel); padding: 10px; flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 1.35; }
.cap strong { font: 400 15px/1.2 "Archivo Black", Impact, sans-serif; }
.cap .done { color: var(--green); }
.tile-done .cap .done { font-size: 17px; }
.en { color: var(--muted); font: 500 12px/1.35 "JetBrains Mono", ui-monospace, monospace; display: block; }
.cap.move { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 8px; }
.note { font: 700 20px/1 "JetBrains Mono", ui-monospace, monospace; border: 2px solid var(--ink); border-radius: 8px; background: #fff;
  padding: 8px 6px; min-width: 46px; text-align: center; }
.cap .icon { width: 56px; justify-self: start; }
.mtxt { grid-column: 1 / -1; font-weight: 600; text-transform: lowercase; display: block; }
.mtxt::first-letter { text-transform: uppercase; }

/* ---- cards (indexes) ---- */
.cards { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.card { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; height: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink); text-decoration: none; background: #fff; align-content: start; }
.card:hover { border-color: var(--ink); color: var(--ink); }
.card img { grid-column: 1 / -1; width: 100%; max-width: 160px; margin: 0 auto 6px; }
.card .n { font: 700 18px/1.3 "JetBrains Mono", ui-monospace, monospace; color: var(--red); }
.card .t { font: 400 14px/1.3 "Archivo Black", Impact, sans-serif; align-self: center; grid-column: 1 / -1; }
.card .n + .t { grid-column: 2; }
.card .a { grid-column: 1 / -1; font: 500 13px/1.4 "JetBrains Mono", ui-monospace, monospace; color: var(--red-dark); margin-top: 4px; }
h2.fam { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; }
h2.fam > span { background: var(--red); color: #fff; border-radius: 8px; padding: 2px 10px; font-size: .8em; }
h2.fam small { font: 500 14px/1 "JetBrains Mono", ui-monospace, monospace; color: var(--muted); }
h2.big { margin-top: 56px; padding-top: 24px; border-top: 2px solid var(--ink); }
.hint { color: var(--muted); margin: 0 0 6px; }
.hint strong { color: var(--ink); }

/* ---- beginner's method ---- */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.step { display: grid; grid-template-columns: 96px auto 1fr; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line);
  border-radius: 12px; color: var(--ink); text-decoration: none; }
.step:hover { border-color: var(--ink); color: var(--ink); }
.step img { width: 96px; }
.sn { font: 400 40px/1 "Archivo Black", Impact, sans-serif; color: var(--red); }
.st { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.st strong { font: 400 18px/1.2 "Archivo Black", Impact, sans-serif; }
.st .a { font: 500 14px/1.35 "JetBrains Mono", ui-monospace, monospace; color: var(--red-dark); overflow-wrap: anywhere; }
@media (max-width: 520px) { .step { grid-template-columns: 72px auto 1fr; gap: 10px; } .step img { width: 72px; } .sn { font-size: 30px; } }
.intro { font-size: 17px; max-width: 48em; }
.block { margin-top: 36px; padding-top: 4px; }
.block > h2 { margin-top: 0; }
.figure { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; margin-top: 14px; }
.figure .video { margin-top: 10px; max-width: 220px; }
@media (max-width: 620px) { .figure { grid-template-columns: 1fr; } .figure > img { max-width: 220px; } }
.tip { background: var(--panel); border-left: 5px solid var(--red); border-radius: 10px; padding: 16px 18px; margin: 28px 0; }
.tip h3 { color: var(--red-dark); margin-bottom: 6px; font-size: 16px; }
.tip p { margin: 0; }
.rules { list-style: none; padding: 0; margin: 14px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.rule { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 14px; }
.rule h3 { color: var(--red); font: 700 15px/1 "JetBrains Mono", ui-monospace, monospace; margin-bottom: 8px; }
.pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 4px; }
.pair span { font-size: 24px; color: var(--red); font-weight: 700; }
.rule p { font-size: 14px; margin: 8px 0 0; }

/* ---- notation ---- */
.moves { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.mv { display: grid; grid-template-columns: auto 64px 1fr; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--panel); }
.mv img { width: 64px; }
.mv .mtxt { font-size: 14px; line-height: 1.3; }

/* ---- home ---- */
.home-head { text-align: center; padding-top: 10px; }
.home-head .logo { width: 170px; }
.home-head h1 { margin: 16px 0 10px; }
.home-head h1 span { color: var(--red); }
.home-head .lead { margin-inline: auto; }
.guides { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 18px; margin: 32px 0 10px; }
.guide { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; min-width: 0; }
.guide .art { display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--panel); border-bottom: 1px solid var(--line); }
.guide .art img { width: 62%; height: auto; }
.guide .body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.guide .body p { color: var(--muted); margin: 0; flex: 1; }
.guide h2 { margin: 0; font-size: 22px; }
.guide h2 a { color: var(--ink); text-decoration: none; }
.guide .meta { text-align: center; }
.tag { font: 700 13px/1 "JetBrains Mono", ui-monospace, monospace; color: var(--red); text-transform: uppercase; }
.start ol { padding-left: 22px; }
.start li { margin-bottom: 8px; }

/* ---- support ---- */
.support { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; margin: 48px 0 8px;
  padding: 20px 22px; border-radius: 14px; background: var(--red-light); }
.support h2 { margin: 0 0 6px; font-size: 21px; }
.support p { margin: 0; max-width: 40em; }
.donate { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 18px; margin-top: 20px; }
.pay { border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.pay h2 { margin-top: 0; }
.qr { display: block; width: 240px; max-width: 100%; margin: 6px 0 14px; border-radius: 12px; }
.qr-pending { aspect-ratio: 1; display: grid; place-items: center; text-align: center; border: 2px dashed #9aa3af; color: var(--muted); font-weight: 600; }
.copyline code { font-size: 15px; background: var(--panel); padding: 3px 6px; border-radius: 6px; }
.copyline .addr { display: inline-block; overflow-wrap: anywhere; margin-top: 4px; }
.pending { color: var(--red-dark); font-style: italic; }
.plain { padding-left: 22px; }

/* ---- legal ---- */
.legal { max-width: 46em; }
.legal h2 { font-size: 20px; margin: 30px 0 8px; }
.legal ul { padding-left: 22px; }

/* ---- prev / next ---- */
.prevnext { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.pn { display: flex; flex-direction: column; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink);
  text-decoration: none; font-weight: 700; min-width: 0; }
.pn span { font-size: 13px; font-weight: 500; color: var(--muted); }
.pn.next { text-align: right; margin-left: auto; }
.pn:hover { border-color: var(--ink); color: var(--ink); }

/* ---- printable guides: present but quiet ---- */
.print { margin: 36px 0 0; padding: 14px 16px; border: 1px dashed #c3cad5; border-radius: 12px; color: var(--muted); font-size: 15px; }
.print a { font-weight: 600; }
.print .meta { margin-left: 4px; }
.printables ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.printables li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.printables li > a { font-weight: 700; color: var(--ink); }
.printables .print { margin: 0; padding: 0; border: 0; font-size: 14px; }
.printables .print > span:first-child { display: none; }
