/* Componentes: escena del hero, roadmap, fundamentos, laboratorio de árboles, comprobaciones. */

/* ---------- Escena del hero ---------- */
.scene-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem 1.2rem 1rem; box-shadow: var(--shadow); min-width: 0; }
.scene-svg { display: block; width: 100%; height: auto; }
.scene-svg text { text-anchor: middle; }
.sc-name { font: 700 13px var(--sans); fill: var(--ink); }
.sc-mono { font: 600 12px var(--mono); fill: var(--ink-soft); }
.sc-mono.sc-big { font-size: 17px; fill: var(--ink); }
.sc-small { font: 600 11px var(--mono); fill: var(--muted); }
.sc-tag { font: 800 11px var(--sans); fill: var(--accent); text-transform: uppercase; letter-spacing: .1em; }
.sc-tag.is-a { fill: var(--accent); }
.sc-tag.is-b { fill: var(--warm); }
.sc-swap { font: 700 30px var(--sans); fill: var(--muted); }
.sc-track { fill: var(--line); }
.sc-bar { fill: var(--edge); }
.sc-bar.is-parent { fill: var(--accent); }
.sc-box { fill: none; stroke-width: 2.5; stroke-dasharray: 7 5; }
.sc-box.is-a { stroke: var(--accent); }
.sc-box.is-b { stroke: var(--warm); }
.is-dim { opacity: .28; }
.sc-tree.is-parent .shape { stroke: var(--focus); stroke-width: 4.5; }
.sc-tree.is-solution .shape { stroke-width: 3; }
.scene-caption { min-height: 118px; padding: .4rem .2rem 0; }
.scene-step { margin: 0; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.scene-title { margin: .25rem 0 .3rem; font: 700 1.25rem/1.3 var(--display); letter-spacing: -.03em; }
.scene-text { margin: 0; color: var(--ink-soft); font-size: .88rem; line-height: 1.65; }
.scene-controls { display: flex; align-items: center; gap: .5rem; margin-top: .6rem; }
.ctl { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); cursor: pointer; font-size: .68rem; color: var(--navy); }
.ctl:hover { background: var(--accent-soft); }
.hero-dots { display: flex; gap: .45rem; margin-left: auto; }
.hero-dot { width: 13px; height: 13px; padding: 0; border: 2px solid var(--line-strong); border-radius: 50%; background: transparent; cursor: pointer; }
.hero-dot.is-active { background: var(--accent); border-color: var(--accent); }
.scene-note { margin: .8rem 0 0; color: var(--muted); font-size: .7rem; line-height: 1.5; }

/* ---------- Nodos de árbol (compartidos) ---------- */
.tnode .shape { fill: var(--n-op-fill); stroke: var(--n-op-stroke); stroke-width: 2.5; transition: stroke .2s, stroke-width .2s; }
.tnode.kind-fn .shape { fill: var(--n-fn-fill); stroke: var(--n-fn-stroke); }
.tnode.kind-var .shape { fill: var(--n-var-fill); stroke: var(--n-var-stroke); }
.tnode.kind-const .shape { fill: var(--n-const-fill); stroke: var(--n-const-stroke); }
.tlabel { font: 700 17px var(--mono); text-anchor: middle; dominant-baseline: central; fill: var(--n-op-ink); pointer-events: none; }
.kind-fn .tlabel { fill: var(--n-fn-ink); }
.kind-var .tlabel { fill: var(--n-var-ink); }
.kind-const .tlabel { fill: var(--n-const-ink); }
.tval { font: 700 12px var(--mono); text-anchor: start; fill: var(--accent); paint-order: stroke; stroke: var(--tint); stroke-width: 5px; stroke-linejoin: round; opacity: 0; transition: opacity .25s; pointer-events: none; }
.show-values .tval { opacity: 1; }
.tedge { fill: none; stroke: var(--edge); stroke-width: 2; transition: stroke .2s, opacity .4s; }
.tedge.in-subtree { stroke: var(--accent); stroke-width: 3.5; }
.tree-svg .tnode { cursor: pointer; outline: none; }
.tree-svg .tnode:hover .shape { stroke: var(--focus); }
.tnode:focus-visible .shape { stroke: var(--focus); stroke-width: 5; }
.tnode.in-subtree .shape { stroke: var(--accent); stroke-width: 4; }
.tnode.is-selected .shape { stroke: var(--focus); stroke-width: 6; }
.tnode .tn-in { transition: opacity .4s, transform .4s; transform-box: fill-box; transform-origin: center; }
.tnode.is-hidden { pointer-events: none; }
.tnode.is-hidden .tn-in { opacity: 0; transform: scale(.4); }
.tedge.is-hidden { opacity: 0; }

/* Etiqueta de tipo (leyenda y panel) */
.kind-chip { display: inline-flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 700; }
.kind-chip i { display: inline-block; width: 20px; height: 20px; border: 2.5px solid; background: var(--c-fill); border-color: var(--c-stroke); }
.kind-chip.kind-op { --c-fill: var(--n-op-fill); --c-stroke: var(--n-op-stroke); }
.kind-chip.kind-fn { --c-fill: var(--n-fn-fill); --c-stroke: var(--n-fn-stroke); }
.kind-chip.kind-var { --c-fill: var(--n-var-fill); --c-stroke: var(--n-var-stroke); }
.kind-chip.kind-const { --c-fill: var(--n-const-fill); --c-stroke: var(--n-const-stroke); }
.kind-chip.kind-op i { border-radius: 50%; }
.kind-chip.kind-fn i { transform: rotate(45deg) scale(.78); }
.kind-chip.kind-var i { border-radius: 8px; width: 24px; height: 18px; }
.kind-chip.kind-const i { clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); border-width: 0; background: var(--c-stroke); position: relative; }

/* ---------- Roadmap ---------- */
.roadmap { display: grid; gap: 1.5rem; }
.path-meter-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.path-meter { flex: 1 1 220px; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.path-meter-fill { height: 100%; width: 0; border-radius: 999px; background: var(--btn-bg); transition: width .4s; }
.path-meter-text { margin: 0; font-size: .8rem; font-weight: 700; color: var(--ink-soft); }
.timeline { display: grid; grid-template-columns: repeat(5, 1fr); margin: 0; padding: 0; list-style: none; }
.tl-item { position: relative; }
.tl-item:not(:last-child)::after { content: ""; position: absolute; top: 23px; left: calc(50% + 28px); right: calc(-50% + 28px); height: 3px; border-radius: 2px; background: var(--line-strong); }
.tl-item.is-done:not(:last-child)::after { background: var(--btn-bg); }
.tl-node { display: grid; justify-items: center; gap: .35rem; width: 100%; padding: .2rem .4rem .6rem; border: 0; background: none; cursor: pointer; text-align: center; }
.tl-dot { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); font: 800 1rem var(--display); color: var(--ink-soft); transition: background .2s, border-color .2s, color .2s; }
.tl-item.is-done .tl-dot { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-ink); }
.tl-node.is-current .tl-dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); color: var(--accent); }
.tl-item.is-done .tl-node.is-current .tl-dot { color: var(--btn-ink); }
.tl-week { font-size: .66rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tl-title { font: 700 .88rem/1.3 var(--display); color: var(--ink); letter-spacing: -.02em; }
.tl-node.is-current .tl-title { color: var(--accent); }
.wk-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: clamp(1.2rem, 3vw, 2rem); }
.wk-kicker { margin: 0; color: var(--accent); font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.wk-head h3 { margin: .2rem 0 1.4rem; font: 700 1.6rem/1.2 var(--display); letter-spacing: -.045em; }
.wk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); }
.wk-col { display: grid; align-content: start; gap: 1.4rem; min-width: 0; }
.wk-block h4 { margin: 0 0 .5rem; font: 800 .68rem var(--sans); letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.wk-block p { margin: 0 0 .6rem; color: var(--ink-soft); font-size: .88rem; line-height: 1.7; }
.wk-reflect ul { margin: 0; padding-left: 1.1rem; color: var(--ink-soft); font-size: .88rem; }
.wk-reflect li + li { margin-top: .4rem; }
.check-list { margin: 0; padding: 0; list-style: none; display: grid; gap: .35rem; }
.check-item { display: grid; grid-template-columns: 22px 1fr; gap: .65rem; align-items: start; padding: .5rem .65rem; border-radius: 8px; font-size: .86rem; color: var(--ink-soft); cursor: pointer; }
.check-item:hover { background: var(--surface-2); }
.check-item input { width: 18px; height: 18px; margin: .15rem 0 0; accent-color: var(--btn-bg); cursor: pointer; }
.check-item input:checked + span { color: var(--ink); text-decoration: line-through; text-decoration-color: var(--edge); }
.wk-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: .5rem; border-top: 1px solid var(--line); }
.wk-counter { margin: 0; font-size: .78rem; color: var(--muted); }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-list span { padding: .27rem .55rem; border-radius: 5px; background: var(--surface-2); color: var(--ink-soft); font-size: .72rem; font-weight: 700; }
.data-table { border-collapse: collapse; font: 600 .85rem var(--mono); }
.data-table th, .data-table td { padding: .35rem 1.2rem; text-align: center; border-bottom: 1px solid var(--line); }
.data-table thead th { color: var(--muted); font-weight: 700; }

/* ---------- Fundamentos ---------- */
.def-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.def-card, .cycle-card, .term-panel, .cmp-card, .side-card, .check { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.def-card { padding: clamp(1.3rem, 3vw, 2rem); }
.def-text { margin: 0 0 1.2rem; font: 500 clamp(1.15rem, 2vw, 1.45rem)/1.55 var(--display); letter-spacing: -.03em; }
.def-aside { margin: 0 0 .9rem; color: var(--ink-soft); font-size: .88rem; }
.def-aside.thread { padding: .8rem 1rem; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--ink); font-weight: 600; }
.cycle-card { padding: 1.3rem 1.4rem; }
.cycle-card h3, .block > h3 { margin: 0 0 .3rem; font: 700 1.2rem var(--display); letter-spacing: -.04em; }
.hint { margin: 0 0 1rem; color: var(--muted); font-size: .8rem; line-height: 1.6; }
.cycle-svg { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; }
.cy-arrow { fill: none; stroke: var(--edge); stroke-width: 2.5; }
.cy-arrowhead { fill: var(--edge); }
.cy-node { cursor: pointer; outline: none; }
.cy-circle { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 2.5; transition: fill .2s, stroke .2s; }
.cy-node:hover .cy-circle, .cy-node:focus-visible .cy-circle { stroke: var(--focus); }
.cy-node.is-active .cy-circle { fill: var(--btn-bg); stroke: var(--btn-bg); }
.cy-num { font: 800 16px var(--display); fill: var(--ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.cy-node.is-active .cy-num { fill: var(--btn-ink); }
.cy-label { font: 700 14px var(--display); fill: var(--ink); dominant-baseline: central; }
.cy-info { min-height: 96px; margin-top: .6rem; padding: .9rem 1rem; background: var(--surface-2); border-radius: 10px; }
.cy-info h4 { display: flex; align-items: center; gap: .6rem; margin: 0 0 .3rem; font: 700 1rem var(--display); }
.cy-badge { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--btn-bg); color: var(--btn-ink); font-size: .75rem; }
.cy-info p { margin: 0; color: var(--ink-soft); font-size: .86rem; }
.block { margin-top: clamp(2.5rem, 5vw, 4rem); }
.term-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.term-tab { padding: .5rem .9rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-size: .82rem; font-weight: 700; color: var(--ink-soft); cursor: pointer; }
.term-tab:hover { border-color: var(--accent); }
.term-tab.is-active { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-ink); }
.term-panel { padding: 1.3rem 1.5rem; }
.term-panel h4 { margin: 0 0 .4rem; font: 700 1.15rem var(--display); letter-spacing: -.03em; }
.term-panel p { margin: 0 0 .6rem; color: var(--ink-soft); font-size: .92rem; max-width: 760px; }
.term-example { padding: .7rem .9rem; background: var(--surface-2); border-radius: 8px; color: var(--ink); }
.term-example-label { margin-right: .5rem; color: var(--accent); font-size: .66rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.cmp-card { padding: 1.4rem; display: flex; flex-direction: column; }
.cmp-card h4 { margin: 0 0 .4rem; font: 700 1.1rem var(--display); letter-spacing: -.03em; }
.cmp-card > p { margin: 0 0 1rem; color: var(--ink-soft); font-size: .88rem; }
.cmp-visual { display: grid; place-items: center; flex: 1; min-height: 190px; margin-bottom: 1rem; background: var(--surface-2); border-radius: 10px; padding: 1rem; }
.cmp-card .cmp-ex { margin: auto 0 0; color: var(--ink); font-size: .82rem; font-weight: 600; }
.gene-row { display: flex; gap: .6rem; }
.gene { display: grid; justify-items: center; gap: .15rem; min-width: 64px; padding: .6rem .8rem; border: 2px solid var(--line-strong); border-radius: 10px; background: var(--surface); font-family: var(--mono); }
.gene small { color: var(--muted); font-size: .7rem; }
.gene b { font-size: 1.5rem; color: var(--ink); }
.cmp-tree { display: block; width: 100%; max-width: 280px; height: auto; }

/* ---------- Laboratorio de árboles ---------- */
.lab { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: clamp(1.2rem, 3vw, 2rem); align-items: start; }
.lab-main { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: clamp(1rem, 2.5vw, 1.6rem); min-width: 0; }
.field-label { display: block; margin-bottom: .45rem; color: var(--muted); font-size: .66rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.seg-group { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg { padding: .5rem .85rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font: 600 .82rem var(--mono); color: var(--ink-soft); cursor: pointer; }
.seg:hover { border-color: var(--accent); }
.seg.is-active { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-ink); }
.expr-out { margin: 1rem 0 0; padding: .7rem 1rem; border-radius: 8px; background: var(--surface-2); font: 700 1.05rem var(--mono); overflow-wrap: anywhere; }
.tree-stage { margin-top: 1rem; padding: 1rem .5rem; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--tint); min-height: 280px; display: grid; place-items: center; }
.tree-svg { display: block; width: 100%; height: auto; }
.build-bar { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.build-bar .button { min-height: 42px; }
.caption { min-height: 3.2em; margin: .8rem 0 0; color: var(--ink); font-size: .88rem; font-weight: 600; }
.values-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1rem; margin-top: .6rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.switch { display: inline-flex; align-items: center; gap: .6rem; font-size: .84rem; font-weight: 600; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--btn-bg); }
.values-bar input[type="range"] { flex: 1 1 140px; max-width: 220px; accent-color: var(--btn-bg); }
.xval { min-width: 2ch; font: 800 1rem var(--mono); }
.values-bar + .hint { margin-top: .6rem; }
.note { margin: .4rem 0 0; }
.lab-side { display: grid; gap: 1rem; position: sticky; top: 125px; }
.side-card { padding: 1.2rem 1.3rem; }
.side-card h3 { margin: 0 0 .8rem; font: 800 .68rem var(--sans); letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.panel-empty { margin: 0; color: var(--muted); font-size: .86rem; }
.node-panel .kind-text { margin: 0 0 .6rem; font-size: .86rem; color: var(--ink-soft); }
.node-panel .root-text { margin: 0 0 .6rem; padding: .5rem .7rem; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 6px 6px 0; font-size: .82rem; font-weight: 600; }
.fields, .stats { margin: 0; }
.fields > div, .stats > div { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .82rem; }
.fields dt, .stats dt { color: var(--muted); }
.fields dd, .stats dd { margin: 0; text-align: right; font-weight: 700; overflow-wrap: anywhere; }
.legend-group { margin: .4rem 0 .4rem; font-size: .76rem; font-weight: 700; color: var(--ink-soft); }
.legend { display: flex; flex-wrap: wrap; gap: .5rem 1.3rem; margin: 0 0 .8rem; padding: 0; list-style: none; }
.try { margin: 1.5rem 0 0; padding: .9rem 1.1rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); font-size: .88rem; color: var(--ink-soft); }

/* ---------- Reflexión y comprobaciones ---------- */
.reflect { margin-top: 1.5rem; padding: 1.1rem 1.3rem; border-left: 4px solid var(--warm); background: var(--surface); border-radius: 0 12px 12px 0; }
.reflect-label { margin: 0 0 .25rem; color: var(--warm); font-size: .66rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.reflect p:last-child { margin: 0; font-size: .95rem; }
.checks-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.check { margin-top: 1rem; padding: 1.3rem 1.4rem; }
.check-title { margin: 0 0 .6rem; color: var(--accent); font-size: .66rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.check-q { margin: 0 0 .9rem; font: 700 1rem/1.5 var(--display); letter-spacing: -.02em; }
.opt-list { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.opt { display: grid; grid-template-columns: 28px 1fr; gap: .7rem; align-items: start; width: 100%; padding: .65rem .8rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); text-align: left; font-size: .86rem; cursor: pointer; }
.opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.opt[aria-disabled="true"] { cursor: default; }
.opt[aria-disabled="true"]:hover { background: var(--surface); border-color: var(--line-strong); }
.opt-key { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); font-size: .72rem; font-weight: 800; color: var(--ink-soft); }
.opt.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.is-correct:hover { background: var(--ok-soft); border-color: var(--ok); }
.opt.is-wrong:hover { background: var(--bad-soft); border-color: var(--bad); }
.opt-why { margin: .35rem 0 .3rem 2.3rem; color: var(--ink-soft); font-size: .8rem; line-height: 1.6; }
.opt-why.is-correct { color: var(--ink); font-weight: 600; }
.check-fb { margin-top: .8rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.check-verdict { margin: 0; font-size: .86rem; font-weight: 800; }
.check-verdict.is-correct { color: var(--ok); }
.check-verdict.is-wrong { color: var(--bad); }
