/* CLIX's own pieces, on top of the shared styles.css (the same base the
   Marquee and Episodarr sites use, so the sites look like one family). */

:root {
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
    --term: #0f1014;
}

/* ── Logo ────────────────────────────────────────────────────── */
/* The logo's square is the same dark colour as the page, so give it a thin
   light edge and a soft shadow to lift it off the background. */
.brand__mark,
.flow__logo img.is-rounded,
.family__card img {
    border-radius: 22%;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .14), 0 6px 16px rgba(0, 0, 0, .35);
}

/* ── Grids ───────────────────────────────────────────────────── */
/* Three across, then straight to one per row, so no box is ever paired with a
   neighbour whose text wraps differently. */
.grid--3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.grid--features {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Four sibling apps: two by two. */
.grid--2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.grid--3 .step,
.grid--3 .card {
    height: 100%;
}

.card__text,
.step__text,
.flow__text,
.note__text {
    text-wrap: pretty;
}

a.card:hover {
    text-decoration: none;
}

code,
kbd,
.mono {
    font-family: var(--mono);
}

/* Inline code in running text. */
.section__sub code,
.faq__a code,
.step__text code,
.card__text code,
.note__text code {
    padding: 1px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-deep);
    color: var(--ink);
    font-size: .88em;
}

/* ── Hero terminal ──────────────────────────────────────────── */
/* Let the terminal shrink to the screen: its long lines are cut off with
   "..." rather than pushing the page wider than a phone. */
.hero__media {
    min-width: 0;
}

/* A pretend terminal running CLIX. The colours are fzf's defaults, which is
   what the real CLIX menus look like in a dark terminal. */
.term {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #000;
    box-shadow: var(--shadow-lg);
}

.term:focus-within {
    border-color: rgba(229, 160, 13, .55);
}

.term__chrome {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 11px 14px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.term__title {
    margin-left: 10px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 12.5px;
}

.term__screen {
    position: relative;
    height: 372px;
    padding: 12px 14px 10px 0;
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.6;
    color: #d0d0d0;
    outline: none;
    cursor: text;
    overflow: hidden;
}

.term__prompt {
    padding-left: 14px;
    white-space: pre;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Plain output wraps onto the next line, the way a real terminal does. */
.term__out {
    padding-left: 14px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.term__prompt {
    display: flex;
}

.term__prompt-label {
    color: #87afd7;
    font-weight: 700;
}

.term__query,
.term__typed {
    color: #e4e4e4;
}

.term__cursor {
    display: inline-block;
    width: .62em;
    height: 1.2em;
    margin-left: 1px;
    transform: translateY(.18em);
    background: #bcbcbc;
    animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
    50% {
        background: transparent;
    }
}

.term__count {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: calc(14px + 2ch);
    color: #afaf87;
}

.term__count::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #4e4e4e;
}

.term__header {
    padding-left: calc(14px + 2ch);
    color: #87afaf;
    white-space: pre;
    overflow: hidden;
    text-overflow: ellipsis;
}

.term__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Each row has fzf's grey gutter on the left; the highlighted row gets the
   pink bar, bold text and a grey background behind its words. */
.term__item {
    position: relative;
    padding-left: calc(14px + 2ch);
    white-space: pre;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.term__item::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    width: 1ch;
    background: #303030;
}

.term__item.is-active {
    color: #e4e4e4;
    font-weight: 700;
}

.term__item.is-active::before {
    background: #d7005f;
}

.term__item.is-active span {
    background: #303030;
}

.term__item mark {
    background: none;
    color: #87af87;
}

.term__item.is-active mark {
    color: #afd7af;
}

.term__text.is-pager .term__out {
    color: #d0d0d0;
}

.term__pager {
    position: absolute;
    left: 14px;
    bottom: 10px;
    color: #d0d0d0;
}

.term__hint {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    min-height: 44px;
    padding: 9px 14px;
    border-top: 1px solid #22242a;
    border-radius: 0 0 var(--radius) var(--radius);
    background: #0b0c0f;
    color: var(--muted);
    font-size: 13px;
}

.term__key {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

/* Phones and tablets have no keyboard here (tapping the terminal doesn't open
   one), so don't offer typing to search on touch screens. */
@media (hover: none) and (pointer: coarse) {
    .term__key--type {
        display: none;
    }
}

button.term__key:hover kbd {
    border-color: var(--accent);
}

.term__key b {
    color: var(--ink);
    font-weight: 600;
}

/* ── The mpv window ───────────────────────────────────────────── */
/* mpv opens its own window for the video, so it floats over the terminal's
   corner the way it would on a desktop. */
.mpv {
    position: absolute;
    right: -22px;
    bottom: 8px;
    width: 50%;
    border: 1px solid #3a3d44;
    border-radius: 10px;
    background: #000;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .65);
    overflow: hidden;
    animation: mpv-in .35s ease-out;
}

@keyframes mpv-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.97);
    }
}

.mpv__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #2a2c31;
    color: #c9c9c9;
    font-size: 12px;
}

.mpv__title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.mpv__close {
    color: #8a8f99;
    font-size: 15px;
    line-height: 1;
}

.mpv__video {
    position: relative;
    aspect-ratio: 16 / 9;
}

/* A made-up frame of the show: a lighthouse on a stormy night. */
.mpv__scene {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(70px 40px at 72% 24%, rgba(255, 226, 150, .55), transparent 70%),
        linear-gradient(100deg, transparent 0 58%, rgba(255, 232, 170, .16) 66%, transparent 74%),
        linear-gradient(180deg, #0c1a28 0%, #1a3850 50%, #0b1620 51%, #050b10 100%);
}

.mpv__scene::after {
    content: "";
    position: absolute;
    left: 70.5%;
    top: 26%;
    width: 4%;
    height: 26%;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(180deg, #e9dcc0 0 22%, #b3433a 22% 40%, #e9dcc0 40% 60%, #b3433a 60% 80%, #e9dcc0 80%);
}

.mpv--movie .mpv__scene {
    background:
        radial-gradient(90px 60px at 30% 40%, rgba(120, 220, 160, .35), transparent 70%),
        radial-gradient(120px 80px at 70% 60%, rgba(229, 160, 13, .28), transparent 70%),
        linear-gradient(160deg, #10261c, #07110c);
}

.mpv--movie .mpv__scene::after {
    display: none;
}

/* mpv's on-screen controls along the bottom of the video. */
.mpv__osc {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 9px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .62);
    color: #e6e6e6;
    font-family: var(--mono);
    font-size: 10.5px;
}

.mpv__play {
    font-size: 9px;
    letter-spacing: -1px;
}

.mpv__seek {
    position: relative;
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .25);
    overflow: hidden;
}

.mpv__fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: #e6e6e6;
}

/* ── Keys ────────────────────────────────────────────────────── */
kbd {
    display: inline-block;
    min-width: 1.9em;
    padding: 1px 7px;
    border: 1px solid #44474f;
    border-bottom-width: 2px;
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--ink);
    font-size: .85em;
    line-height: 1.5;
    text-align: center;
}

.keys {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-top: 22px;
}

.key {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, .18);
}

.key kbd {
    margin-bottom: 8px;
}

.key p {
    color: var(--muted);
    font-size: 14.5px;
    line-height: 1.5;
}

/* ── How it works: Plex → CLIX → mpv ────────────────────────── */
.flow {
    display: grid;
    grid-template-columns: 1fr 44px 1fr 44px 1fr;
    align-items: stretch;
}

.flow__card {
    text-align: center;
    padding: 28px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.flow__card.is-center {
    border-color: rgba(229, 160, 13, .45);
    background:
        radial-gradient(260px 160px at 50% 0%, rgba(229, 160, 13, .12), transparent 70%),
        var(--surface);
    box-shadow: var(--shadow);
}

.flow__logo {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-deep);
    color: var(--ink);
}

.flow__logo img,
.flow__logo svg {
    width: 48px;
    height: 48px;
}

.flow__logo img.is-rounded {
    border-radius: 11px;
}

.flow__logo svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.flow__title {
    font-size: 19px;
    margin-bottom: 9px;
}

.flow__text {
    color: var(--muted);
    font-size: 15.5px;
}

.flow__arrow {
    display: grid;
    place-items: center;
    color: var(--accent);
}

.flow__arrow svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.notes {
    margin-top: 22px;
}

.note {
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, .18);
}

.note__title {
    font-size: 15.5px;
    font-weight: 600;
    margin-bottom: 4px;
}

.note__text {
    color: var(--muted);
    font-size: 15px;
}

/* ── Install ─────────────────────────────────────────────────── */
/* Let the text column shrink on phones instead of being pushed wide by the
   long install command. */
.cta__copy {
    min-width: 0;
}

.install {
    margin-top: 26px;
}

.install__label {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 14px;
}

.code {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--term);
    overflow: hidden;
}

.code pre {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 14px 16px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: var(--mono);
    font-size: 13.5px;
    line-height: 1.6;
    color: #d7d4cc;
}

.code pre::before {
    content: "$ ";
    color: var(--accent);
}

.code__copy {
    flex: none;
    padding: 0 16px;
    border: 0;
    border-left: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--ink);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .16s ease, color .16s ease;
}

.code__copy:hover {
    background: #3d4048;
}

.code__copy.is-done {
    color: #5fcf94;
}

.reqs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.reqs li {
    list-style: none;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(0, 0, 0, .18);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 13px;
}

.reqs {
    padding: 0;
    margin-bottom: 0;
}

/* ── More from tvtime.dev ──────────────────────────────────────── */
.family__card {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--ink);
}

.family__card img {
    width: 52px;
    height: 52px;
    flex: none;
    border-radius: 12px;
}

.family__name {
    font-size: 18px;
    font-weight: 700;
}

.family__tag {
    color: var(--muted);
    font-size: 14.5px;
}

.center-note {
    margin-top: 26px;
    text-align: center;
    color: var(--muted);
    font-size: 15px;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1090px) {
    .grid--3 {
        grid-template-columns: 1fr;
    }

    .grid--features {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .keys {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .flow {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .flow__arrow svg {
        transform: rotate(90deg);
    }
}

@media (max-width: 700px) {

    .grid--features,
    .grid--2 {
        grid-template-columns: 1fr;
    }

    .keys {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Five keys in two columns: let the last one fill its row. */
    .key:last-child {
        grid-column: 1 / -1;
    }

    .term__screen {
        height: 340px;
        font-size: 12.5px;
    }

    .mpv {
        right: 8px;
        width: 58%;
    }

    /* mpv's output wraps a lot on a phone; smaller text keeps it above the
       mpv window instead of underneath it. */
    .term__screen.is-mpv {
        font-size: 11px;
        line-height: 1.55;
    }
}

/* ── Small helpers for the terminal ─────────────────────────────── */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.term__note {
    margin-top: 12px;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}
