/* E's guide (/e-guide/, /es/guia-de-e/): his circle, frames, glitch and a terminal look. Loaded after guide.css. */
.e-guide { --eg-v: #a78bfa; --eg-v2: #c4b5fd; --eg-warn: #ffb86b; --eg-bg: #07070a; }

/* ---------- hero ---------- */
.eg-hero { position: relative; overflow: hidden; padding: clamp(7.5rem, 13vw, 10rem) 0 clamp(3rem, 6vw, 5rem);
    background: radial-gradient(ellipse 60% 70% at 78% 40%, rgba(124, 92, 240, 0.24), transparent 70%), radial-gradient(ellipse 50% 40% at 0% 100%, rgba(80, 40, 140, 0.16), transparent 70%), var(--eg-bg); }
.eg-hero::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.4; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 3px); }
.eg-hero-in { position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.eg-title { position: relative; margin: 0.4rem 0 1.4rem; font-family: var(--font-display); font-weight: 300; font-size: clamp(3.2rem, 8vw, 6.4rem); line-height: 0.95; letter-spacing: -0.05em; color: #fff; }
.eg-title em { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: #e3dbff; text-shadow: 0 0 28px rgba(167, 139, 250, 0.55); }
.eg-title::before, .eg-title::after { content: attr(data-text); position: absolute; inset: 0; pointer-events: none; opacity: 0; font: inherit; }
.eg-title.is-glitch::before { opacity: 0.8; color: #ff5c8a; transform: translate(-4px, 1px); clip-path: inset(12% 0 58% 0); mix-blend-mode: screen; }
.eg-title.is-glitch::after { opacity: 0.8; color: #5ee7ff; transform: translate(4px, -1px); clip-path: inset(55% 0 15% 0); mix-blend-mode: screen; }
.eg-lede { max-width: 34rem; font-size: 1.06rem; line-height: 1.75; color: var(--muted); margin: 0 0 2rem; }
.eg-meta { margin: 1.4rem 0 0.4rem; font-family: var(--font-mono); font-size: 0.7rem; line-height: 1.9; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }

.eg-hero-orb { position: relative; justify-self: center; width: min(380px, 80vw); aspect-ratio: 1; }
.eg-orb { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; background: #070107;
    box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.4), 0 0 90px rgba(124, 92, 240, 0.4), inset 0 0 60px rgba(0, 0, 0, 0.8); }
.eg-orb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.eg-orb-g { opacity: 0; mix-blend-mode: screen; }
.eg-orb::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 42%, transparent 52%, rgba(6, 5, 10, 0.7) 72%, #06050a 100%); }
.eg-orb-scan { position: absolute; inset: 0; z-index: 1; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.2) 0 1px, transparent 1px 3px); mix-blend-mode: multiply; }
.eg-orb.is-glitch .eg-orb-f { animation: egSlice 0.24s steps(2) 1; }
.eg-orb.is-glitch .eg-orb-g { opacity: 0.75; filter: hue-rotate(160deg) saturate(2.4); animation: egSplit 0.24s steps(3) 1; }
@keyframes egSlice { 33% { clip-path: inset(18% 0 58% 0); transform: translateX(-7px); } 66% { clip-path: inset(56% 0 14% 0); transform: translateX(6px); } }
@keyframes egSplit { 0% { transform: translate(6px, -1px); } 50% { transform: translate(-7px, 2px); } 100% { transform: translate(2px, 0); } }
.eg-orb-ring { position: absolute; inset: -14px; border-radius: 50%; border: 1px solid rgba(167, 139, 250, 0.28); animation: egBreath 4.5s ease-in-out infinite; }
.eg-orb-ring--2 { inset: -34px; border-style: dashed; border-color: rgba(167, 139, 250, 0.14); animation: egSpin 60s linear infinite; }
@keyframes egBreath { 50% { transform: scale(1.04); opacity: 0.5; } }
@keyframes egSpin { to { transform: rotate(360deg); } }
.eg-orb-name { position: absolute; right: -6px; bottom: 6%; font: italic 400 4.2rem/1 var(--font-serif); color: #f3f0ff; text-shadow: 0 0 30px rgba(167, 139, 250, 0.8); }

/* ---------- layout + terminal table of contents ---------- */
.eg-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: clamp(2rem, 4vw, 4rem); align-items: start; padding-top: 3rem; padding-bottom: 5rem; }
.eg-toc { position: sticky; top: 96px; border-radius: 16px; overflow: hidden; background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.16); font-family: var(--font-mono); }
.eg-toc-bar { padding: 0.75rem 1rem; font-size: 0.74rem; color: var(--silver); border-bottom: 1px solid rgba(167, 139, 250, 0.14); background: rgba(124, 92, 240, 0.08); }
.eg-toc-p { color: var(--eg-v); }
.eg-toc ol { list-style: none; margin: 0; padding: 0.5rem; }
.eg-toc a { display: flex; gap: 0.75rem; padding: 0.5rem 0.6rem; border-radius: 8px; font-size: 0.76rem; line-height: 1.45; color: var(--muted); text-decoration: none; transition: background 0.2s ease, color 0.2s ease; }
.eg-toc a span { flex: none; color: rgba(167, 139, 250, 0.7); }
.eg-toc a:hover, .eg-toc a.is-on { background: rgba(124, 92, 240, 0.14); color: #fff; }

/* ---------- chapters ---------- */
.eg-ch { padding: 0 0 3.5rem; margin: 0 0 3.5rem; border-bottom: 1px solid var(--line); scroll-margin-top: 90px; }
.eg-ch-head { display: grid; grid-template-columns: 56px auto 1fr auto; align-items: center; gap: 0 1rem; margin-bottom: 1.2rem; }
.eg-ch-orb { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: #070107; box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.45), 0 0 22px rgba(124, 92, 240, 0.3); }
.eg-ch-orb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.eg-num { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.12em; color: var(--eg-v); }
.eg-ch h2 { margin: 0; font-family: var(--font-display); font-weight: 300; font-size: clamp(1.6rem, 2.8vw, 2.2rem); letter-spacing: -0.03em; line-height: 1.15; color: #fff; }
.eg-dl { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.7rem; border-radius: 999px; font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.08em; color: var(--muted); text-decoration: none; box-shadow: inset 0 0 0 1px var(--line-2); }
.eg-dl:hover { color: #fff; box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.5); }
.eg-intro { font-size: 1.04rem; line-height: 1.75; color: var(--silver); margin: 0 0 1.6rem; max-width: 46rem; }
.eg-p { line-height: 1.75; color: var(--muted); margin: 1.4rem 0 1rem; max-width: 46rem; }
.eg-tips { list-style: none; padding: 0; margin: 1.2rem 0; display: grid; gap: 0.7rem; max-width: 46rem; }
.eg-tips li { position: relative; padding-left: 1.6rem; line-height: 1.7; color: var(--muted); }
.eg-tips li::before { content: '>'; position: absolute; left: 0; top: 0; font-family: var(--font-mono); color: var(--eg-v); }

.eg-code { margin: 1.2rem 0; border-radius: 14px; overflow: hidden; background: #0a0910; box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.18), 0 18px 50px -20px rgba(0, 0, 0, 0.7); }
.eg-code figcaption { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.6rem 0.55rem 0.9rem; border-bottom: 1px solid rgba(167, 139, 250, 0.12); background: rgba(124, 92, 240, 0.07); font-family: var(--font-mono); font-size: 0.7rem; }
.eg-where { display: inline-flex; align-items: center; gap: 0.35rem; flex: none; padding: 0.2rem 0.55rem; border-radius: 999px; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.6rem; color: var(--eg-v2); background: rgba(167, 139, 250, 0.12); }
.eg-code--vm .eg-where { color: #6ff0c4; background: rgba(46, 230, 166, 0.1); }
.eg-cap { flex: 1; min-width: 0; color: var(--silver); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eg-copy { display: inline-flex; align-items: center; gap: 0.35rem; flex: none; border: 0; border-radius: 8px; padding: 0.35rem 0.6rem; background: rgba(255, 255, 255, 0.05); color: var(--muted); font: inherit; cursor: pointer; transition: background 0.2s ease, color 0.2s ease; }
.eg-copy:hover { background: rgba(167, 139, 250, 0.18); color: #fff; }
.eg-copy.is-done { color: #6ff0c4; }
.eg-code pre { margin: 0; padding: 1rem 1.1rem 1.1rem; overflow-x: auto; font: 400 0.8rem/1.75 var(--font-mono); color: #d9d4ee; tab-size: 2; scrollbar-width: thin; scrollbar-color: rgba(167, 139, 250, 0.3) transparent; }
.eg-code pre .p { color: var(--eg-v); user-select: none; }
.eg-code pre .k { color: #f3f0ff; }
.eg-code pre .o { color: #8d8f9c; }
.eg-code pre .c { color: #6c6880; font-style: italic; }

.eg-expect { margin: 1.2rem 0; padding: 1rem 1.1rem; border-radius: 14px; background: rgba(46, 230, 166, 0.04); box-shadow: inset 0 0 0 1px rgba(46, 230, 166, 0.16); }
.eg-label { display: block; margin-bottom: 0.6rem; font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.16em; text-transform: uppercase; color: #6ff0c4; }
.eg-expect ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.eg-expect li { display: grid; grid-template-columns: minmax(150px, 0.35fr) 1fr; gap: 1rem; font-size: 0.9rem; line-height: 1.55; }
.eg-ex-k { display: inline-flex; align-items: baseline; gap: 0.45rem; font-family: var(--font-mono); font-size: 0.76rem; color: #fff; }
.eg-ex-k svg { color: #6ff0c4; flex: none; transform: translateY(1px); }
.eg-ex-v { color: var(--muted); }

.eg-warn { display: flex; gap: 0.8rem; margin: 1.3rem 0; padding: 0.95rem 1.1rem; border-radius: 14px; background: rgba(255, 184, 107, 0.06); box-shadow: inset 0 0 0 1px rgba(255, 184, 107, 0.22); }
.eg-warn svg { flex: none; color: var(--eg-warn); margin-top: 2px; }
.eg-warn p { margin: 0; line-height: 1.65; color: #e9dcc8; font-size: 0.94rem; }

.eg-e { display: flex; align-items: center; gap: 1rem; margin: 1.8rem 0 0.4rem; padding: 0.9rem 1.1rem 0.9rem 0.9rem; border-radius: 999px 18px 18px 999px; background: linear-gradient(90deg, rgba(124, 92, 240, 0.16), rgba(124, 92, 240, 0.02)); max-width: 46rem; }
.eg-e-av { flex: none; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.5), 0 0 18px rgba(124, 92, 240, 0.4); }
.eg-e-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.eg-e p { margin: 0; font-family: var(--font-mono); font-size: 0.84rem; line-height: 1.65; color: #ddd6f6; }
.eg-e p b { font: italic 400 1.25rem/1 var(--font-serif); color: #fff; margin-right: 0.6rem; text-shadow: 0 0 14px rgba(167, 139, 250, 0.7); }

.eg-note { padding: 1.4rem 1.5rem; border-radius: 18px; background: rgba(255, 255, 255, 0.025); box-shadow: inset 0 0 0 1px var(--line-2); }
.eg-note p { margin: 0 0 0.8rem; line-height: 1.7; color: var(--silver); }
.eg-disclaimer { font-size: 0.82rem; color: var(--faint) !important; margin: 0 !important; }
.eg-cover { display: none; }

@media (max-width: 960px) {
    .eg-hero-in { grid-template-columns: 1fr; }
    .eg-hero-orb { order: -1; width: min(260px, 64vw); margin-bottom: 1rem; }
    .eg-orb-name { font-size: 3rem; }
    .eg-layout { grid-template-columns: 1fr; }
    .eg-toc { position: static; }
}
@media (max-width: 600px) {
    .eg-ch-head { grid-template-columns: 44px 1fr auto; }
    .eg-ch-orb { width: 44px; height: 44px; }
    .eg-num { display: none; }
    .eg-expect li { grid-template-columns: 1fr; gap: 0.15rem; }
    .eg-cap { display: none; }
    .eg-code pre { font-size: 0.74rem; }
}
@media (prefers-reduced-motion: reduce) { .eg-orb-ring, .eg-orb-ring--2 { animation: none; } }

/* ---------- print / PDF: dark, branded, a chapter per page ---------- */
@media print {
    .sko-launch, .sko-col, .sko-tease, .eg-hero, .eg-toc, .eg-dl, .eg-copy, .gd-alllink { display: none !important; }
    .eg-cover { display: flex !important; flex-direction: column; height: 297mm; width: 210mm; padding: 20mm 20mm 18mm; box-sizing: border-box; break-after: page; position: relative; overflow: hidden;
        background: radial-gradient(ellipse 70% 50% at 70% 34%, rgba(124, 92, 240, 0.5), transparent 65%), radial-gradient(ellipse 70% 40% at 0% 100%, rgba(80, 40, 140, 0.3), transparent 60%), #07070a !important; color: #fff !important; }
    .eg-cover::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 0.4mm, transparent 0.4mm 1.2mm); }
    .eg-cover-top { position: relative; display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 8pt; letter-spacing: 0.22em; color: #c9b8ff; }
    .eg-cover-top span:first-child { font-family: var(--font-display); font-size: 14pt; letter-spacing: 0.08em; color: #fff; }
    .eg-cover-orb { position: relative; align-self: center; width: 112mm; height: 112mm; margin: 14mm 0 12mm; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 0.5mm rgba(167, 139, 250, 0.6), 0 0 30mm rgba(124, 92, 240, 0.55); }
    .eg-cover-orb img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .eg-cover-orb::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 42%, transparent 55%, rgba(7, 7, 10, 0.8) 100%); }
    .eg-cover-body { position: relative; }
    .eg-cover-kicker { display: block; font-family: var(--font-mono); font-size: 8pt; letter-spacing: 0.2em; text-transform: uppercase; color: #c9b8ff; margin-bottom: 5mm; }
    .eg-cover h1 { font-family: var(--font-display); font-weight: 300; font-size: 50pt; line-height: 1; letter-spacing: -0.045em; margin: 0 0 7mm; color: #fff; }
    .eg-cover h1 em { font-family: var(--font-serif); font-style: italic; color: #e3dbff; }
    .eg-cover p { font-size: 10.5pt; line-height: 1.65; color: #d9dbe3; max-width: 150mm; margin: 0; }
    .eg-cover-foot { position: relative; margin-top: auto; display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 7.5pt; letter-spacing: 0.1em; color: #a7a3c0; }

    .eg-layout { display: block !important; padding: 0 !important; max-width: none !important; margin: 0 !important; }
    .eg-ch { break-before: page; border: 0 !important; padding: 16mm 17mm 8mm !important; margin: 0 !important; -webkit-box-decoration-break: clone; box-decoration-break: clone;
        background: radial-gradient(ellipse 70% 26% at 100% 0%, rgba(124, 92, 240, 0.16), transparent 70%), #0b0a12 !important; box-sizing: border-box; }
    .eg-ch-head { grid-template-columns: 15mm auto 1fr; border-bottom: 0.6pt solid rgba(167, 139, 250, 0.45); padding-bottom: 4mm; margin-bottom: 6mm; }
    .eg-ch-orb { width: 15mm; height: 15mm; }
    .eg-ch h2 { font-size: 21pt; }
    .eg-intro { font-size: 10.5pt; color: #c9cbd6 !important; }
    .eg-p, .eg-tips li { font-size: 9.5pt; color: #a9abb8 !important; }
    .eg-code, .eg-expect, .eg-warn, .eg-e { break-inside: avoid; }
    .eg-code { box-shadow: 0 0 0 0.4pt rgba(167, 139, 250, 0.35) !important; }
    .eg-code pre { font-size: 7.6pt; white-space: pre-wrap; overflow-wrap: anywhere; overflow: visible; }
    .eg-expect li, .eg-warn p, .eg-e p { font-size: 8.8pt; }
    .eg-note { margin: 0 17mm 10mm !important; }
    .e-guide .main-footer { display: none !important; }
    .eg-single .eg-cover, .eg-single .eg-note, .eg-single .eg-ch:not(.is-only) { display: none !important; }
    .eg-single .eg-ch.is-only { break-before: auto !important; }
}

/* E's mark (three glitched bars) */
.eg-mark { display: block; width: 56px; height: auto; margin-bottom: 1.2rem; filter: drop-shadow(0 0 14px rgba(167, 139, 250, 0.6)); }
img.eg-orb-name { width: 92px; height: auto; right: -14px; bottom: 4%; filter: drop-shadow(0 0 24px rgba(167, 139, 250, 0.8)); font: inherit; }
.eg-cover .eg-mark { width: 72px; margin-bottom: 1rem; }
.eg-e-mark { display: inline-block; width: 26px; height: auto; margin-right: 0.7rem; vertical-align: -0.25em; filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.6)); }
@media (max-width: 760px) { img.eg-orb-name { width: 64px; } }
