/* ============================================================================
   components.css — hero, terminal, módulos, badges, tarjetas, listados, post
   ========================================================================== */

/* ---------- HERO de portada (dos columnas) ---------- */
.home-hero { padding: 54px 0 30px; }
.home-hero__grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: .76rem; color: var(--text-dim); border: 1px solid var(--border); background: var(--bg-1); border-radius: 999px; padding: 5px 13px; }
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2.2s var(--ease) infinite; }
.wordmark { font-family: var(--font-display); font-weight: 700; font-size: clamp(4rem, 12vw, 8rem); line-height: .92; letter-spacing: -.03em; margin: 22px 0 0; display: inline-flex; align-items: flex-end; }
.wordmark .cursor-block { width: clamp(28px, 5vw, 52px); height: clamp(14px, 2.4vw, 24px); background: var(--red); margin-left: 10px; margin-bottom: clamp(8px, 1.6vw, 16px); border-radius: 3px; animation: blink 1.15s steps(1) infinite; }
.home-hero__lead { font-size: clamp(1.05rem, 1.8vw, 1.25rem); color: var(--text-faint); max-width: 46ch; margin: 22px 0 28px; }
.home-hero__lead b { color: var(--text); font-weight: 600; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: .85rem; padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent; transition: transform .2s var(--ease), background .2s, border-color .2s; }
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--red); color: #fff; }
.btn--primary:hover { background: var(--red-bright); }
.btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn--ghost:hover { border-color: var(--text-dim); background: var(--bg-1); }

/* ---------- terminal animada ---------- */
.terminal { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); }
.terminal__bar { display: flex; align-items: center; gap: 8px; padding: 11px 14px; background: color-mix(in srgb, var(--bg-3) 60%, var(--bg-2)); border-bottom: 1px solid var(--border); }
.terminal__dots { display: inline-flex; gap: 6px; }
.terminal__dots i { width: 11px; height: 11px; border-radius: 50%; }
.terminal__dots i:nth-child(1) { background: #ff5f56; } .terminal__dots i:nth-child(2) { background: #ffbd2e; } .terminal__dots i:nth-child(3) { background: #27c93f; }
.terminal__title { font-family: var(--font-mono); font-size: .76rem; color: var(--text-faint); margin-left: 6px; }
.terminal__body { padding: 18px 18px 22px; font-family: var(--font-mono); font-size: .84rem; line-height: 1.85; min-height: 220px; color: var(--green); }
.terminal__body .ln { white-space: pre-wrap; }
.terminal__body .prompt { color: var(--green); }
.terminal__body .cmd { color: #e6e6e6; }
.terminal__body .out { color: var(--green); opacity: .85; }
.terminal__body .ok { color: var(--green); }
.terminal__body .dir { color: var(--blue); }
.term-cursor { display: inline-block; width: 8px; height: 1.05em; background: var(--green); transform: translateY(2px); animation: blink 1.1s steps(1) infinite; }

/* ---------- cabecera de listado ---------- */
.list-head { padding: 26px 0 4px; }
.list-head .term-prompt { margin-bottom: 18px; }
.list-head h1 { font-size: clamp(2rem, 4.6vw, 2.9rem); font-weight: 700; margin: 0 0 12px; color: var(--red); }
.list-head__desc { color: var(--text-dim); max-width: 72ch; margin: 0; }

/* ---------- módulos (portada) ---------- */
.modules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 30px; }
.module { display: block; padding: 22px; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); transition: transform .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease); }
.module:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--k, var(--red)) 50%, var(--border)); box-shadow: 0 18px 40px -24px color-mix(in srgb, var(--k, var(--red)) 50%, transparent); }
.module__top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.icon-sq { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: color-mix(in srgb, var(--ic, var(--red)) 14%, transparent); color: var(--ic, var(--red)); border: 1px solid color-mix(in srgb, var(--ic, var(--red)) 32%, transparent); }
.icon-sq svg { width: 18px; height: 18px; }
.icon-sq--writeups { --ic: var(--t-writeups); } .icon-sq--guides { --ic: var(--t-guides); } .icon-sq--tools { --ic: var(--t-tools); }
.card__icon .icon-sq { width: 44px; height: 44px; }
.module__count { font-family: var(--font-mono); font-size: .76rem; color: var(--text-faint); }
.module__cmd { font-family: var(--font-mono); font-size: .8rem; color: var(--k, var(--red)); }
.module__title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; margin: 6px 0 8px; }
.module__desc { color: var(--text-dim); font-size: .92rem; margin: 0; }

/* ---------- sección destacados ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 74px 0 20px; }
.section-head__title { font-family: var(--font-mono); font-size: .95rem; color: var(--text); }
.section-head__title .path { color: var(--red); }
.section-head__hint { font-family: var(--font-mono); font-size: .78rem; color: var(--text-faint); }

/* ---------- badges de tipo (por color) ---------- */
.kind { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: .73rem; font-weight: 500; padding: 3px 9px; border-radius: 7px; border: 1px solid color-mix(in srgb, var(--k) 40%, transparent); background: color-mix(in srgb, var(--k) 12%, transparent); color: var(--k); }
.kind svg { width: 12px; height: 12px; }
.kind--writeups { --k: var(--t-writeups); } .kind--guides { --k: var(--t-guides); } .kind--tools { --k: var(--t-tools); }
.badge { display: inline-flex; align-items: center; font-family: var(--font-mono); font-size: .72rem; padding: 3px 9px; border-radius: 7px; border: 1px solid var(--border-strong); color: var(--text-dim); }
.badge--level { border-color: color-mix(in srgb, var(--green) 50%, transparent); color: var(--green); }
.badge--level.lvl-medium { border-color: color-mix(in srgb, var(--amber) 50%, transparent); color: var(--amber); }
.badge--level.lvl-hard { border-color: color-mix(in srgb, var(--red) 50%, transparent); color: var(--red); }
.badge--date { border: none; color: var(--text-faint); }

/* ---------- etiquetas / hashtags (filtros con color) ---------- */
.tag { font-family: var(--font-mono); font-size: .74rem; border-radius: 999px; padding: 3px 11px; white-space: nowrap; border: 1px solid var(--border-strong); color: var(--text-dim); background: var(--bg-1); transition: color .2s, border-color .2s, background .2s; }
button.tag { cursor: pointer; }
button.tag:hover { color: var(--text); border-color: var(--c, var(--red)); }
button.tag.is-on { background: var(--c, var(--red)); border-color: var(--c, var(--red)); color: #0b0b0b; font-weight: 600; }
/* matiz por etiqueta */
.tag[data-hue="0"] { --c: var(--red); color: color-mix(in srgb, var(--red) 80%, var(--text)); border-color: color-mix(in srgb, var(--red) 35%, var(--border)); }
.tag[data-hue="1"] { --c: var(--blue); color: color-mix(in srgb, var(--blue) 80%, var(--text)); border-color: color-mix(in srgb, var(--blue) 35%, var(--border)); }
.tag[data-hue="2"] { --c: var(--green); color: color-mix(in srgb, var(--green) 80%, var(--text)); border-color: color-mix(in srgb, var(--green) 35%, var(--border)); }
.tag[data-hue="3"] { --c: var(--purple); color: color-mix(in srgb, var(--purple) 80%, var(--text)); border-color: color-mix(in srgb, var(--purple) 35%, var(--border)); }
.tag[data-hue="4"] { --c: var(--amber); color: color-mix(in srgb, var(--amber) 80%, var(--text)); border-color: color-mix(in srgb, var(--amber) 35%, var(--border)); }
.tag[data-hue="5"] { --c: #38bdf8; color: color-mix(in srgb, #38bdf8 80%, var(--text)); border-color: color-mix(in srgb, #38bdf8 35%, var(--border)); }

/* ---------- listado: tabs + filtros ---------- */
.section-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 26px 0 18px; }
.list-search { display: flex; align-items: center; gap: 9px; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 13px; margin: 0 0 14px; max-width: 440px; transition: border-color .2s, box-shadow .2s; }
.list-search:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.list-search svg { width: 15px; height: 15px; color: var(--text-faint); flex: none; }
.list-search input { flex: 1; min-width: 0; background: none; border: none; outline: none; color: var(--text); font-family: var(--font-mono); font-size: .84rem; padding: 10px 0; }
.list-search input::placeholder { color: var(--text-faint); }
.section-tabs a { font-family: var(--font-mono); font-size: .85rem; color: var(--text-dim); padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .2s, border-color .2s; }
.section-tabs a:hover { color: var(--text); }
.section-tabs a.is-active { color: var(--text); border-bottom-color: var(--red); }
.section-tabs a .n { color: var(--text-faint); font-size: .85em; margin-left: 4px; }
.filterbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filterbar__label { font-family: var(--font-mono); font-size: .78rem; color: var(--text-faint); }
.result-count { font-family: var(--font-mono); font-size: .78rem; color: var(--text-faint); margin: 0 0 18px; }

/* ---------- tarjetas (listado horizontal) ---------- */
.cards { display: flex; flex-direction: column; gap: 14px; }
.card { display: flex; gap: 16px; padding: 18px; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease); }
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--k, var(--red)) 45%, var(--border)); box-shadow: 0 16px 34px -24px rgba(0,0,0,.6); }
.card__icon { flex: none; }
.card__body { flex: 1; min-width: 0; }
.card__badges { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 9px; }
.card__title { font-family: var(--font-display); font-size: 1.28rem; font-weight: 700; margin: 0 0 7px; line-height: 1.25; }
.card__summary { color: var(--text-dim); font-size: .92rem; margin: 0 0 13px; }
.card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card__tags { display: flex; gap: 7px; flex-wrap: wrap; }
.card__tags .tag { font-size: .7rem; padding: 2px 8px; }
.card__date { font-family: var(--font-mono); font-size: .74rem; color: var(--text-faint); flex: none; }
.empty { padding: 50px 20px; text-align: center; color: var(--text-faint); font-family: var(--font-mono); font-size: .9rem; }

/* compactas en destacados (portada) */
.cards--grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cards--grid .card { flex-direction: column; gap: 12px; }

/* ============================================================================
   PÁGINA DE ENTRADA
   ========================================================================== */
.post-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 48px; align-items: start; padding-top: 26px; }
.post-head { margin-bottom: 30px; }
.post-head .back-btn { margin-bottom: 18px; }
.post-head__badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.post-head h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); font-weight: 700; margin: 0 0 16px; color: var(--red); }
.post-head__lead { color: var(--text-dim); font-size: 1.1rem; max-width: 64ch; margin: 0 0 16px; }
.post-head__tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.post-head__intro { font-size: .96rem; color: var(--text-dim); padding: 14px 16px; background: var(--bg-1); border: 1px solid var(--border); border-left: 3px solid var(--red); border-radius: var(--radius-sm); }
.post-head__intro strong { color: var(--text); }
.post-head__intro code { font-family: var(--font-mono); font-size: .86em; background: var(--bg-2); border: 1px solid var(--border); border-radius: 5px; padding: .1em .4em; color: var(--red-bright); }

/* contenido renderizado */
.post-content { font-size: 1.02rem; }
.post-content > *:first-child { margin-top: 0; }
.post-content h1 { font-size: 1.85rem; margin: 2.3em 0 .7em; }
.post-content h2 { font-size: 1.5rem; margin: 1.9em 0 .6em; }
.post-content h3 { font-size: 1.2rem; margin: 1.5em 0 .5em; }
.post-content h1::before, .post-content h2::before { content: "# "; color: var(--red); font-family: var(--font-mono); font-weight: 400; }
.post-content h3::before { content: "## "; color: var(--text-faint); font-family: var(--font-mono); font-weight: 400; font-size: .85em; }
.post-content p { margin: 1em 0; }
.post-content a { color: var(--red-bright); border-bottom: 1px solid color-mix(in srgb, var(--red) 35%, transparent); }
.post-content a:hover { border-bottom-color: var(--red); }
.post-content strong { color: var(--text); font-weight: 700; }
.post-content .md-list { margin: 1em 0; padding-left: 1.4em; }
.post-content .md-list li { margin: .4em 0; }
.post-content .md-list li::marker { color: var(--red); }
.post-content img { border-radius: var(--radius-sm); border: 1px solid var(--border); margin: 1.4em 0; }
.post-content hr.rule { border: none; height: 1px; background: linear-gradient(90deg, var(--border-strong), transparent); margin: 2.2em 0; }
.inline-code { font-family: var(--font-mono); font-size: .86em; background: var(--bg-2); border: 1px solid var(--border); border-radius: 5px; padding: .12em .42em; color: var(--red-bright); }

/* bloque de código */
.codeblock { margin: 1.4em 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-2); }
.codeblock__bar { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: color-mix(in srgb, var(--bg-3) 55%, var(--bg-2)); border-bottom: 1px solid var(--border); }
.codeblock__dots { display: inline-flex; gap: 6px; }
.codeblock__dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); opacity: .4; }
.codeblock__lang { font-family: var(--font-mono); font-size: .74rem; color: var(--text-dim); }
.codeblock__lang .dollar { color: var(--green); }
.codeblock__copy { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: .72rem; color: var(--text-dim); background: none; border: 1px solid var(--border); border-radius: 6px; padding: 4px 9px; transition: .2s; }
.codeblock__copy svg { width: 12px; height: 12px; }
.codeblock__copy:hover { color: var(--text); border-color: var(--border-strong); }
.codeblock__copy.copied { color: var(--green); border-color: var(--green); }
.codeblock pre { margin: 0; padding: 16px; overflow-x: auto; }
.codeblock code { font-family: var(--font-mono); font-size: .85rem; line-height: 1.7; color: var(--text); }
.tok-kw { color: var(--tok-kw); } .tok-str { color: var(--tok-str); } .tok-com { color: var(--tok-com); font-style: italic; }
.tok-num { color: var(--tok-num); } .tok-flag { color: var(--tok-flag); }

/* callouts */
.callout { --c: var(--c-note); margin: 1.5em 0; border-radius: var(--radius); overflow: hidden; background: color-mix(in srgb, var(--c) 8%, var(--bg-1)); border: 1px solid color-mix(in srgb, var(--c) 28%, var(--border)); border-left: 3px solid var(--c); }
.callout--note { --c: var(--c-note); } .callout--info { --c: var(--c-info); } .callout--tip { --c: var(--c-tip); }
.callout--success { --c: var(--c-success); } .callout--example { --c: var(--c-example); } .callout--question { --c: var(--c-question); }
.callout--warning { --c: var(--c-warning); } .callout--danger { --c: var(--c-danger); } .callout--quote { --c: var(--c-quote); }
.callout__title { display: flex; align-items: center; gap: 9px; padding: 11px 16px; font-family: var(--font-display); font-weight: 600; font-size: .98rem; color: color-mix(in srgb, var(--c) 75%, var(--text)); }
.callout__icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: .78rem; background: color-mix(in srgb, var(--c) 20%, transparent); color: var(--c); }
.callout__body { padding: 0 16px 4px; }
.callout__body > *:first-child { margin-top: 0; }
.callout__body > *:last-child { margin-bottom: 12px; }
.callout .callout { margin: 1em 0; }
.post-content blockquote.quote { margin: 1.4em 0; padding: 4px 18px; border-left: 3px solid var(--border-strong); color: var(--text-dim); }

/* tablas */
.table-wrap { overflow-x: auto; margin: 1.4em 0; }
.md-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.md-table th, .md-table td { text-align: left; padding: 9px 14px; border: 1px solid var(--border); }
.md-table th { background: var(--bg-2); font-family: var(--font-mono); font-size: .8rem; color: var(--text-dim); }
.md-table tr:nth-child(even) td { background: var(--bg-2); }

/* imagen pendiente */
.img-pending { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 1.4em 0; padding: 38px 20px; text-align: center; background: repeating-linear-gradient(45deg, var(--bg-1), var(--bg-1) 11px, var(--bg-2) 11px, var(--bg-2) 22px); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.img-pending__icon { color: var(--text-faint); }
.img-pending__name { font-family: var(--font-mono); font-size: .82rem; color: var(--text-dim); }

/* TOC */
.toc { position: sticky; top: calc(var(--header-h) + 26px); align-self: start; }
.toc__head { font-family: var(--font-mono); font-size: .76rem; letter-spacing: .1em; color: var(--text-faint); padding: 0 0 12px 14px; display: flex; align-items: center; gap: 7px; }
.toc__head::before { content: "›"; color: var(--red); }
.toc__list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc__list a { display: block; padding: 6px 14px; font-size: .86rem; color: var(--text-faint); border-left: 2px solid transparent; margin-left: -1px; transition: color .2s, border-color .2s; line-height: 1.45; }
.toc__list a:hover { color: var(--text-dim); }
.toc__list a.lvl-3 { padding-left: 26px; font-size: .82rem; }
.toc__list a.is-active { color: var(--red); border-left-color: var(--red); }
.toc-mobile { display: none; }

@media (max-width: 980px) {
  .post-layout { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
  .toc-mobile { display: block; margin: 0 0 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-1); }
  .toc-mobile summary { font-family: var(--font-mono); font-size: .82rem; color: var(--text-dim); padding: 13px 16px; cursor: pointer; list-style: none; }
  .toc-mobile summary::before { content: "› "; color: var(--red); }
  .toc-mobile .toc__list { border: none; padding: 0 12px 12px; }
}
@media (max-width: 860px) {
  .home-hero__grid { grid-template-columns: 1fr; gap: 32px; }
  .modules, .cards--grid { grid-template-columns: 1fr; }
}
