/* =========================================================================
   terminal.css — Terminal interactiva de "Sobre mí".
   Ventana GNU/Linux sobria: barra de título, pestañas (Terminal, Explorador,
   Comandos), accesos «$ comando», prompt Bash y barra de estado.
   Siempre oscura, en ambos temas del sitio.

   Organización: 1) introducción  2) ventana  3) barras  4) pantalla y
   entrada  5) salida  6) explorador  7) comandos  8) estados  9) adaptación
   por ancho de la terminal (container queries) y por dispositivo.
   ========================================================================= */

/* ------------------------------- 1. Introducción ------------------------------- */
.terminal-block {
    display: grid;
    gap: clamp(20px, 2.6vw, 30px);
    margin-top: clamp(64px, 8vw, 110px);
}

.terminal-intro {
    display: grid;
    gap: 12px 48px;
    align-items: end;
}

@media (min-width: 900px) {
    .terminal-intro { grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); }
}

.terminal-kicker {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--cyan);
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.terminal-intro h3 {
    margin-top: 12px;
    font-family: var(--display);
    font-size: clamp(1.45rem, 1.1rem + 1.3vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.1;
}

.terminal-intro h3 span { color: var(--blue-pale); }

.terminal-intro > p {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.only-touch { display: none; }

@media (hover: none) and (pointer: coarse) {
    .only-fine { display: none; }
    .only-touch { display: inline; }
}

kbd {
    display: inline-block;
    min-width: 1.6em;
    padding: 1px 6px;
    border: 1px solid var(--line-2);
    border-bottom-width: 2px;
    border-radius: 6px;
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-soft);
    font-family: var(--mono);
    font-size: 0.74rem;
    line-height: 1.5;
    text-align: center;
}

/* --------------------------------- 2. Ventana --------------------------------- */
.terminal {
    --t-bg: #0b1120;
    --t-bar: #0e1528;
    --t-raise: rgba(255, 255, 255, 0.025);
    --t-line: rgba(148, 163, 184, 0.12);
    --t-line-2: rgba(148, 163, 184, 0.2);
    --t-text: #e2e8f0;
    --t-dim: #8391aa;
    --t-blue: #60a5fa;
    --t-cyan: #7dd3fc;
    --t-green: #86efac;
    --t-yellow: #fcd34d;
    --t-red: #fca5a5;
    --t-purple: #c4b5fd;
    --t-orange: #fdba74;
    --t-focus: rgba(96, 165, 250, 0.55);

    container: term / inline-size;
    position: relative;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    height: clamp(600px, 76vh, 800px);
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(96, 165, 250, 0.22);
    border-radius: 16px;
    background:
        radial-gradient(120% 60% at 100% 0%, rgba(59, 130, 246, 0.07), transparent 60%),
        var(--t-bg);
    color: var(--t-text);
    font-family: var(--mono);
    font-size: 0.92rem;
    line-height: 1.65;
    box-shadow:
        0 40px 90px -40px rgba(0, 0, 0, 0.85),
        inset 0 1px rgba(255, 255, 255, 0.04),
        0 0 60px -30px rgba(59, 130, 246, 0.55);
    color-scheme: dark;
}

/* Integración con el tema claro: sombra neutra y borde definido */
[data-theme="light"] .terminal {
    border-color: rgba(20, 33, 57, 0.85);
    box-shadow: 0 30px 70px -36px rgba(20, 33, 57, 0.55), 0 2px 6px rgba(20, 33, 57, 0.12);
}

.terminal ::-webkit-scrollbar { width: 10px; height: 10px; }
.terminal ::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 10px; background: rgba(148, 163, 184, 0.28) padding-box; }
.terminal ::-webkit-scrollbar-thumb:hover { background-color: rgba(96, 165, 250, 0.55); }
.terminal ::-webkit-scrollbar-track { background: transparent; }

/* Filas fijas: al ocultar los accesos en otros modos el cuerpo conserva la fila flexible */
.term-titlebar { grid-row: 1; }
.term-bar { grid-row: 2; }
.term-dock { grid-row: 3; }
.term-body { grid-row: 4; }
.term-status { grid-row: 5; }

/* --------------------------------- 3. Barras --------------------------------- */
.term-titlebar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    min-height: 50px;
    padding: 0 10px 0 18px;
    border-bottom: 1px solid var(--t-line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent), var(--t-bar);
}

.term-lights { display: inline-flex; gap: 8px; }
.term-lights i { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); transition: filter var(--fast) ease; }
.term-lights i:nth-child(1) { background: #f87171; }
.term-lights i:nth-child(2) { background: #fbbf24; }
.term-lights i:nth-child(3) { background: #4ade80; }
.terminal:hover .term-lights i { filter: brightness(1.1); }

.term-title {
    max-width: 52vw;
    overflow: hidden;
    color: var(--t-dim);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.term-actions { display: flex; justify-self: end; gap: 4px; }

.term-btn {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 10px;
    color: var(--t-dim);
    transition: color var(--fast) ease, background-color var(--fast) ease, transform var(--mid) var(--ease);
}

.term-btn .i { transition: transform var(--mid) var(--ease); }
.term-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }
.term-btn:active { transform: scale(0.92); }
.term-btn[data-term-cmd="reset"]:hover .i { transform: rotate(-150deg); }
.term-btn[aria-pressed="true"] { color: var(--t-cyan); background: rgba(125, 211, 252, 0.1); }

.term-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--t-line);
    background: rgba(255, 255, 255, 0.012);
}

.term-tabs { display: flex; gap: 6px; }

.term-tabs button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--t-dim);
    font-family: var(--mono);
    font-size: 0.84rem;
    font-weight: 500;
    transition: color var(--fast) ease, background-color var(--fast) ease, border-color var(--fast) ease;
}

.term-tabs button .i { font-size: 0.88rem; }
.term-tabs button:hover { color: var(--t-text); background: rgba(255, 255, 255, 0.04); }

.term-tabs button[aria-selected="true"] {
    border-color: rgba(96, 165, 250, 0.4);
    background: rgba(96, 165, 250, 0.12);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 8px 20px -14px rgba(96, 165, 250, 0.9);
}

.term-tabs button[aria-selected="true"] .i { color: var(--t-cyan); }
.term-session { margin-left: auto; color: var(--t-dim); font-size: 0.74rem; letter-spacing: 0.04em; }

/* Accesos rápidos «$ comando» (solo en el modo Terminal) */
.term-dock {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--t-line);
}

.terminal:not([data-mode="terminal"]) .term-dock { display: none; }

.term-dock button {
    display: inline-flex;
    flex: none;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--t-line-2);
    border-radius: 9px;
    background: var(--t-raise);
    color: var(--t-text);
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 600;
    transition: border-color var(--fast) ease, background-color var(--fast) ease, transform var(--mid) var(--ease);
}

.dock-sign { margin-right: 7px; color: var(--t-dim); font-weight: 400; transition: color var(--fast) ease; }
.term-dock button:hover { border-color: rgba(96, 165, 250, 0.5); background: rgba(96, 165, 250, 0.08); transform: translateY(-1px); }
.term-dock button:hover .dock-sign { color: var(--t-blue); }
.term-dock button:active { transform: scale(0.97); }

/* Barra de estado */
.term-status {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 40px;
    padding: 0 18px;
    overflow: hidden;
    border-top: 1px solid var(--t-line);
    background: var(--t-bar);
    color: var(--t-dim);
    font-size: 0.74rem;
    white-space: nowrap;
}

.term-status kbd { padding: 0 4px; border-color: rgba(148, 163, 184, 0.25); border-width: 1px; background: rgba(255, 255, 255, 0.05); color: var(--t-dim); font-size: 0.66rem; line-height: 1.4; }
.ts-env { display: inline-flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; color: var(--t-text); text-overflow: ellipsis; }
.ts-env i { flex: none; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 8px rgba(74, 222, 128, 0.7); }
.ts-path { color: var(--t-cyan); }
.ts-help { margin-left: auto; }

.ts-clear {
    color: var(--t-text);
    font-family: var(--mono);
    font-size: 0.74rem;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(96, 165, 250, 0.6);
    text-underline-offset: 4px;
}

.ts-clear:hover { color: var(--t-blue); }

/* ----------------------------- 4. Pantalla y entrada ----------------------------- */
.term-body { position: relative; min-height: 0; }

.term-pane {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.term-pane[hidden] { display: none; }
.term-pane.is-entering { animation: term-pane-in 300ms var(--ease) both; }

@keyframes term-pane-in { from { opacity: 0; transform: translateY(6px); } }

.term-screen {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 24px 10px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

.term-screen:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--t-focus); }

/* Solo se parten palabras demasiado largas, nunca texto normal letra por letra */
.term-line {
    min-width: 0;
    min-height: 1.65em;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.term-line.is-new { animation: term-line-in 240ms var(--ease) both; }

@keyframes term-line-in { from { opacity: 0; transform: translateX(-4px); } }

.term-echo { margin-top: 16px; }
.term-echo:first-child { margin-top: 0; }

/* Prompt Bash: usuario@equipo:ruta$ */
.sh-prompt { display: inline-flex; align-items: center; margin-right: 10px; white-space: nowrap; }
.sh-user, .sh-host { color: var(--t-blue); font-weight: 700; }
.sh-at, .sh-sep { color: var(--t-dim); }
.sh-path { margin-left: 2px; padding: 0 6px; border-radius: 5px; background: rgba(96, 165, 250, 0.16); color: var(--t-cyan); font-weight: 700; }
.sh-dollar { margin-left: 6px; color: var(--t-text); font-weight: 700; }
.term-echo.is-error .sh-dollar { color: var(--t-red); }

/* Campo de escritura enmarcado con botón de ejecución */
.term-form {
    position: relative;
    display: flex;
    align-items: center;
    margin: 6px 18px 14px;
    padding: 8px 8px 8px 16px;
    border: 1px solid var(--t-line-2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    cursor: text;
    transition: border-color var(--fast) ease, box-shadow var(--fast) ease;
}

.term-form:focus-within { border-color: var(--t-focus); box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.12); }
.term-prompt { flex: none; display: inline-flex; cursor: text; }

.term-field {
    position: relative;
    flex: 1;
    min-width: 80px;
    height: 30px;
}

.term-input,
.term-ghost {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 0;
    border: 0;
    font: inherit;
    font-size: 0.95rem;
    line-height: 30px;
    white-space: pre;
}

/* El foco lo indica el marco del formulario: el campo no dibuja su propio contorno */
.term-input,
.term-input:focus,
.term-input:focus-visible {
    width: 100%;
    background: transparent;
    color: transparent;
    caret-color: transparent;
    outline: none;
}

.term-ghost { overflow: hidden; color: var(--t-text); pointer-events: none; }
.term-hint { color: rgba(131, 145, 170, 0.6); }

/* Cursor de bloque */
.term-ghost [data-term-typed]::after {
    content: "";
    display: inline-block;
    width: 0.6em;
    height: 1.2em;
    margin-left: 1px;
    vertical-align: -0.22em;
    border-radius: 2px;
    background: var(--t-cyan);
    opacity: 0.35;
}

.terminal:focus-within .term-ghost [data-term-typed]::after { opacity: 1; animation: term-blink 1.05s steps(1) infinite; }
.terminal.is-typing .term-ghost [data-term-typed]::after { opacity: 1; animation: none; }

@keyframes term-blink { 50% { opacity: 0; } }

.term-form.is-invalid .term-ghost [data-term-typed] { color: var(--t-red); }
.term-form.is-valid .term-ghost [data-term-typed] { color: var(--t-green); }

.term-send {
    flex: none;
    display: grid;
    width: 44px;
    height: 38px;
    margin-left: 10px;
    place-items: center;
    border: 1px solid rgba(96, 165, 250, 0.35);
    border-radius: 9px;
    background: rgba(96, 165, 250, 0.1);
    color: var(--t-blue);
    font-size: 1rem;
    transition: background-color var(--fast) ease, transform var(--mid) var(--ease);
}

.term-send:hover { background: rgba(96, 165, 250, 0.2); }
.term-send:active { transform: scale(0.94); }

/* Sugerencias */
.term-suggest {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    z-index: 6;
    display: grid;
    gap: 1px;
    width: min(440px, 100%);
    padding: 5px;
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 12px;
    background: rgba(14, 21, 40, 0.98);
    box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.9);
    animation: term-pane-in 180ms var(--ease) both;
}

.term-suggest[hidden] { display: none; }

.term-suggest button {
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-height: 34px;
    padding: 4px 10px;
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 0.8rem;
    text-align: left;
}

.term-suggest button b { color: var(--t-cyan); font-weight: 700; white-space: nowrap; }
.term-suggest button span { overflow: hidden; color: var(--t-dim); text-overflow: ellipsis; white-space: nowrap; }
.term-suggest button:hover,
.term-suggest button.is-active { background: rgba(96, 165, 250, 0.14); }
.term-suggest button.is-active b::before { content: "⇥ "; color: var(--t-dim); }

.term-keys { display: none; }

/* ------------------------------------ 5. Salida ------------------------------------ */
.t-dim { color: var(--t-dim); }
.t-accent { color: var(--t-cyan); font-weight: 700; }
.t-key { color: var(--t-blue); }
.t-head { color: #fff; font-weight: 700; }
.t-cmd { color: var(--t-text); font-weight: 600; }
.t-arg { color: var(--t-yellow); }
.t-str { color: var(--t-orange); }
.t-num { color: var(--t-purple); }
.t-ok { color: var(--t-green); }
.t-warn { color: var(--t-yellow); }
.t-err { color: var(--t-red); }
.t-dir { color: var(--t-blue); font-weight: 700; }
.t-file { color: var(--t-text); }
.t-art, .t-art2 { color: var(--t-blue); }
.t-art2 { letter-spacing: 0.1em; }

.t-badge {
    display: inline-block;
    padding: 0 7px;
    margin-right: 6px;
    border-radius: 5px;
    background: rgba(96, 165, 250, 0.14);
    color: var(--t-blue);
    font-size: 0.74rem;
}

.t-link,
.t-run {
    color: var(--t-cyan);
    font: inherit;
    text-align: left;
    text-decoration: underline;
    text-decoration-color: rgba(125, 211, 252, 0.35);
    text-underline-offset: 3px;
    cursor: pointer;
}

.t-run { color: var(--t-green); text-decoration-color: rgba(134, 239, 172, 0.35); }
.t-link:hover, .t-run:hover { text-decoration-color: currentColor; }

.t-swatch {
    display: inline-block;
    width: 26px;
    height: 12px;
    margin: 10px 5px 0 0;
    border-radius: 3px;
}

.t-rule { display: block; width: min(220px, 100%); height: 1px; margin: 6px 0 10px; background: rgba(148, 163, 184, 0.4); }

/* Tabla de dos columnas (help, contact, fastfetch) */
.t-table {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 3px 18px;
    white-space: normal;
}

.t-table > .term-line { min-height: 0; }

.t-cols {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0 16px;
    white-space: normal;
}

/* fastfetch: logotipo + información; se apila cuando la terminal es estrecha */
.t-fetch {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px 34px;
    align-items: start;
    margin: 10px 0 6px;
    white-space: normal;
}

.t-fetch-art { margin: 0; font: inherit; line-height: 1.5; white-space: pre; }
.t-fetch-info { min-width: 0; }
.t-fetch-info .term-line { min-height: 1.5em; }

/* ---------------------------------- 6. Explorador ---------------------------------- */
.fx-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--t-line);
    font-size: 0.8rem;
}

.fx-crumbs button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 8px;
    border-radius: 7px;
    color: var(--t-dim);
}

.fx-crumbs button:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.fx-crumbs button[aria-current="page"] { color: var(--t-cyan); font-weight: 700; }
.fx-crumbs .sep { color: rgba(131, 145, 170, 0.5); }

.fx-grid {
    display: grid;
    flex: 1;
    min-height: 0;
    grid-template-columns: minmax(240px, 0.36fr) minmax(0, 1fr);
}

.fx-list {
    min-height: 0;
    overflow-y: auto;
    padding: 10px;
    border-right: 1px solid var(--t-line);
    scrollbar-width: thin;
}

.fx-list button {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    text-align: left;
    transition: background-color var(--fast) ease, border-color var(--fast) ease;
}

.fx-list button:hover { background: var(--t-raise); border-color: var(--t-line); }
.fx-list button[aria-current="true"] { border-color: rgba(96, 165, 250, 0.4); background: rgba(96, 165, 250, 0.12); }

.fx-ico {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 8px;
    background: rgba(96, 165, 250, 0.12);
    color: var(--t-blue);
}

.fx-ico--file { background: rgba(134, 239, 172, 0.1); color: var(--t-green); }
.fx-ico--md { background: rgba(196, 181, 253, 0.12); color: var(--t-purple); }
.fx-ico--up { background: transparent; color: var(--t-dim); }

.fx-name { overflow: hidden; color: var(--t-text); font-size: 0.84rem; text-overflow: ellipsis; white-space: nowrap; }
.fx-meta { color: var(--t-dim); font-size: 0.68rem; }

.fx-preview {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 24px;
    font-size: 0.88rem;
    scrollbar-width: thin;
}

.fx-preview.is-entering { animation: term-pane-in 280ms var(--ease) both; }

.fx-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--t-line-2);
}

.fx-head b { color: #fff; font-size: 0.88rem; overflow-wrap: anywhere; }
.fx-head .fx-meta { flex: 1; min-width: 0; }

.fx-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid var(--t-line-2);
    border-radius: 8px;
    background: var(--t-raise);
    color: var(--t-text);
    font-family: var(--mono);
    font-size: 0.74rem;
}

.fx-action .i { color: var(--t-blue); }
.fx-action:hover { border-color: rgba(96, 165, 250, 0.5); background: rgba(96, 165, 250, 0.08); }

.fx-empty {
    display: grid;
    height: 100%;
    place-content: center;
    gap: 8px;
    color: var(--t-dim);
    text-align: center;
}

.fx-empty .i { margin: 0 auto; font-size: 1.8rem; color: rgba(96, 165, 250, 0.5); }

/* ----------------------------------- 7. Comandos ----------------------------------- */
/* Filas uniformes: «$ comando argumentos» · descripción · ejemplos ejecutables */
.term-pane--commands { overflow-y: auto; scrollbar-width: thin; }

.cmd-grid {
    display: grid;
    gap: 20px;
    padding: 16px 18px 20px;
}

.cmd-group { display: grid; gap: 6px; }

.cmd-group h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 2px 4px;
    color: var(--t-dim);
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.cmd-group h4 span { padding: 0 6px; border-radius: 5px; background: var(--t-raise); letter-spacing: 0; }
.cmd-group h4::after { content: ""; flex: 1; height: 1px; background: var(--t-line); }

.cmd-card {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 18px;
    min-height: 52px;
    padding: 8px 10px 8px 6px;
    border: 1px solid var(--t-line);
    border-radius: 11px;
    background: var(--t-raise);
    transition: border-color var(--fast) ease, background-color var(--fast) ease;
}

.cmd-card:hover { border-color: rgba(96, 165, 250, 0.38); background: rgba(96, 165, 250, 0.05); }

.cmd-run {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 8px;
    min-height: 36px;
    padding: 4px 10px;
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 0.86rem;
    text-align: left;
    align-content: center;
}

.cmd-run:hover { background: rgba(96, 165, 250, 0.1); }
.cmd-dollar { color: var(--t-dim); }
.cmd-name { color: var(--t-green); font-weight: 700; }
.cmd-usage { color: var(--t-yellow); font-size: 0.8rem; }
.cmd-desc { color: var(--t-dim); font-family: var(--font); font-size: 0.84rem; line-height: 1.45; }

.cmd-args {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
}

.cmd-args button {
    min-height: 30px;
    max-width: 100%;
    padding: 0 10px;
    border: 1px solid rgba(252, 211, 77, 0.28);
    border-radius: 7px;
    color: var(--t-yellow);
    font-family: var(--mono);
    font-size: 0.74rem;
    overflow-wrap: anywhere;
    transition: background-color var(--fast) ease, border-color var(--fast) ease;
}

.cmd-args button:hover { border-color: rgba(252, 211, 77, 0.55); background: rgba(252, 211, 77, 0.1); }

/* ------------------------------------ 8. Estados ------------------------------------ */
/* Enfoque por teclado: un solo anillo, dentro de la ventana */
.terminal button:focus-visible {
    outline: 2px solid var(--t-focus);
    outline-offset: 1px;
}

.terminal.is-expanded {
    position: fixed;
    inset: max(12px, env(safe-area-inset-top)) 12px 12px;
    z-index: 500;
    height: auto;
    animation: term-expand 360ms var(--ease) both;
    box-shadow: 0 0 0 100vmax rgba(2, 6, 16, 0.72), 0 40px 120px -20px rgba(0, 0, 0, 0.9);
}

.terminal.is-expanded .term-btn[data-term-expand] .i { transform: rotate(180deg); }

@keyframes term-expand { from { opacity: 0; transform: scale(0.98); } }

/* ------------------------ 9. Adaptación según el ancho de la terminal ------------------------ */
@container term (max-width: 820px) {
    .cmd-card { grid-template-columns: minmax(0, 1fr) auto; }
    .cmd-desc { grid-column: 1 / -1; grid-row: 2; padding: 0 10px 2px; }
    .cmd-args { grid-column: 2; grid-row: 1; }
}

@container term (max-width: 620px) {
    .t-fetch { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .t-fetch-art { font-size: 0.78em; line-height: 1.35; }
    .t-table { gap: 1px 12px; }
    .t-cols { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .fx-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 0.85fr) minmax(0, 1.15fr); }
    .fx-list { border-right: 0; border-bottom: 1px solid var(--t-line); }
    .fx-preview { padding: 14px 16px; }
    .cmd-card { grid-template-columns: minmax(0, 1fr); }
    .cmd-args { grid-column: 1; grid-row: 3; justify-content: flex-start; padding: 0 10px 4px; }
}

@container term (max-width: 380px) {
    .t-table { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .t-table > .term-line:nth-child(odd) { margin-top: 4px; }
}

/* ----------------------------- Adaptación por dispositivo ----------------------------- */
@media (max-width: 760px) {
    .terminal { height: min(660px, 84svh); border-radius: 14px; font-size: 0.82rem; }
    .terminal.is-expanded { inset: 0; border-radius: 0; }
    .term-titlebar { min-height: 46px; padding: 0 6px 0 14px; }
    .term-title { max-width: 44vw; font-size: 0.7rem; }
    .term-bar { padding: 8px 10px; }
    .term-session { display: none; }
    .term-tabs { flex: 1; gap: 4px; }
    .term-tabs button { flex: 1; justify-content: center; min-height: 40px; padding: 0 6px; font-size: 0.76rem; }
    .term-dock {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 8px 10px;
        scrollbar-width: none;
        -webkit-mask: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
        mask: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    }
    .term-dock::-webkit-scrollbar { display: none; }
    .term-dock button { min-height: 38px; padding: 0 12px; }
    .term-screen { padding: 12px 14px 6px; }
    .term-form { margin: 4px 10px 10px; padding: 5px 5px 5px 10px; }
    .term-input, .term-ghost { font-size: 16px; }   /* evita el zoom automático de iOS */
    .term-form .sh-user, .term-form .sh-at, .term-form .sh-host, .term-form .sh-sep { display: none; }
    .term-status { gap: 10px; padding: 0 12px; }
    .ts-help, .ts-info { display: none; }
    .ts-clear { margin-left: auto; }
    .cmd-grid { padding: 12px; }
}

@media (max-width: 420px) {
    .term-tabs button .i { display: none; }
}

/* Pantallas táctiles: teclas auxiliares y altura ajustada al teclado virtual */
@media (hover: none) and (pointer: coarse) {
    .terminal.is-input-focused { height: min(84svh, calc(var(--vvh, 100svh) - 24px)); }
    .terminal.is-input-focused .term-status,
    .terminal.is-input-focused .term-dock { display: none; }

    .terminal.is-input-focused .term-keys {
        display: flex;
        gap: 6px;
        padding: 0 10px 10px;
    }

    .term-keys button {
        min-width: 46px;
        min-height: 36px;
        padding: 0 10px;
        border: 1px solid var(--t-line-2);
        border-radius: 8px;
        background: var(--t-raise);
        color: var(--t-text);
        font-size: 0.78rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .term-line.is-new,
    .term-pane.is-entering,
    .fx-preview.is-entering,
    .terminal.is-expanded,
    .term-suggest { animation: none; }
}
