/* Retro DOS terminal used for the homepage growth model and the AI Productivity
   page. Colours reuse the original homepage diagram (.diagram-content in
   style.css). Needs the CSS variables from style.css. */

.hv2-terminal {
    display: block;
    width: 100%;
    max-width: 420px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background-color: #1e1e1e;
    color: #00ff00;
    text-align: left;
    font: inherit;
    overflow: hidden;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
    container-type: inline-size;
}

button.hv2-terminal {
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button.hv2-terminal:hover,
button.hv2-terminal:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 22px 44px rgba(0, 0, 0, 0.26);
}

button.hv2-terminal:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
}

.hv2-terminal-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    background: var(--background-dark);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hv2-terminal-bar > span:not(.hv2-terminal-title) {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.hv2-terminal-title {
    flex: 1;
    text-align: center;
    margin-right: 36px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.6);
}

.hv2-terminal-screen {
    margin: 0;
    padding: 14px 16px 6px;
    background: none;
    color: #00ff00;
    font-family: 'Courier New', Courier, monospace;
    /* 40 columns of 0.6em fill the card width */
    font-size: clamp(8px, calc((100cqi - 32px) / 24.4), 16px);
    line-height: 1.3;
    white-space: pre;
    overflow: hidden;
    border: 0;
    box-shadow: none;
}

/* Arrows and bullets always take exactly one column. */
.hv2-terminal-screen .ch {
    display: inline-block;
    width: 1ch;
    text-align: center;
}

.hv2-terminal-hint {
    display: block;
    padding: 0 16px 12px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

.hv2-terminal-dialog {
    width: min(800px, 94vw);
    max-width: none;
    margin: auto;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
}

.hv2-terminal-dialog::backdrop {
    background: rgba(0, 0, 0, 0.72);
}

.hv2-terminal--full {
    max-width: none;
}

.hv2-terminal--full .hv2-terminal-title {
    margin-right: 0;
}

.hv2-terminal--full .hv2-terminal-screen {
    padding: 24px 24px 22px;
    /* 72 columns of 0.6em fill the window */
    font-size: clamp(6px, calc((100cqi - 48px) / 43.6), 17px);
    overflow-x: auto;
}

.hv2-terminal-rotate {
    display: none;
    margin: 0;
    padding: 0 16px 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

/* Phones (portrait or landscape): the pop-up fills the screen, diagram centred between title bar and hint. */
@media (max-width: 767px), (max-height: 520px) {
    .hv2-terminal-dialog {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-width: none;
        max-height: none;
        margin: 0;
    }

    .hv2-terminal-dialog[open] {
        display: flex;
    }

    .hv2-terminal--full {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .hv2-terminal--full .hv2-terminal-screen {
        margin: auto 0;
        padding: 16px;
        /* Fit both the width (72 columns) and the height (about 20 lines). */
        font-size: clamp(6px, min(calc((100cqi - 32px) / 43.6), calc((100dvh - 96px) / 26)), 17px);
    }
}

@media (max-width: 767px) and (orientation: portrait) {
    .hv2-terminal-rotate {
        display: block;
    }
}

.hv2-terminal-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: rgba(255, 255, 255, 0.75);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.hv2-terminal-close:hover,
.hv2-terminal-close:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    color: var(--white);
}

/* Visually hidden text for screen readers (also defined in home.css). */
.hv2-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
