/* ── portfolio: lf (terminal file manager) clone. tokens only; accent per-section ── */

#portfolio-root { font-size: 0.92rem; }

.lf {
    border: 1px solid var(--line);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    /* fit a tall viewport without pushing the footer too far */
    height: min(62vh, 34rem);
    min-height: 22rem;
    outline: none;
}
.lf:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); }

/* ── columns ── */
.lf-cols {
    display: grid;
    grid-template-columns: max-content 1fr 1.4fr;
    flex: 1 1 auto;
    min-height: 0;
}
/* nothing selected: drop the preview column, keep the cats column at its full browse width */
.lf.lf-no-preview .lf-cols { grid-template-columns: 15rem 1fr; }
.lf.lf-no-preview .lf-col-preview { display: none; }

.lf-col {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--line);
    padding: 0.25rem 0;
    scrollbar-width: thin;
}
.lf-col-preview {
    border-right: 0;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── rows (lf-style) ── */
.lf-list { list-style: none; margin: 0; padding: 0; }

.lf-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.12rem 0.7rem;
    cursor: pointer;
    color: var(--fg);
    line-height: 1.5;
}
.lf-row:nth-child(odd) { background: rgba(255, 255, 255, 0.022); }
.lf-row:hover { background: rgba(255, 255, 255, 0.06); }
.lf-row.is-dim { opacity: 0.4; transition: opacity 0.12s ease; }
.lf-row.is-dim:hover { opacity: 1; }

.lf-name {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
}
.lf-label {
    display: inline;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.lf-bullet { display: inline-block; color: var(--dim); margin-right: 0.5ch; }
.lf-row.is-active .lf-bullet { color: var(--bg); }
.lf-caret { display: inline-block; width: 1.2ch; color: var(--dim); cursor: pointer; }
.lf-caret:hover { color: var(--accent); }
.lf-row.is-active .lf-caret { color: var(--bg); }
/* active row: scroll a too-long name so it's fully readable */
.lf-label.is-marquee { max-width: none; overflow: visible; text-overflow: clip; animation: lf-marquee 6s ease-in-out infinite alternate; }
@keyframes lf-marquee { 0%, 12% { transform: translateX(0); } 88%, 100% { transform: translateX(var(--marq-shift, 0)); } }
.lf-dir .lf-name { color: var(--fg); }

.lf-meta, .lf-tag {
    margin-left: auto;
    color: var(--dim);
    font-size: 0.82em;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* blurb yields first so the category name stays readable */
.lf-meta { flex: 0 1000 auto; min-width: 0; }
.lf-tag { flex: 0 0 auto; min-width: 2.2em; text-align: right; }

/* categories column: show full names; the blurb lives in the preview */
.lf-col-cats .lf-meta { display: none; }

/* selected-but-unfocused: subtle marker so you can see where you'll return */
.lf-row.is-sel {
    background: rgba(255, 255, 255, 0.05);
    color: var(--fg);
}
.lf-row.is-sel .lf-name { text-decoration: none; }

/* active row in the FOCUSED column: lf inverse bar */
.lf-row.is-active,
.lf-row.is-active:hover {
    background: var(--accent);
    color: var(--bg);
}
.lf-row.is-active .lf-name,
.lf-row.is-active .lf-meta,
.lf-row.is-active .lf-tag { color: var(--bg); }
.lf-row.is-active .lf-meta,
.lf-row.is-active .lf-tag { opacity: 0.7; }

.lf-empty {
    padding: 0.3rem 0.7rem;
    color: var(--dim);
    font-style: normal;
    white-space: normal;
}

/* ── preview pane ── */
.lf-preview {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.lf-media {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background:
        repeating-linear-gradient(45deg,
            rgba(255, 255, 255, 0.012) 0 10px,
            transparent 10px 20px),
        var(--panel);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lf-video, .lf-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.lf-video.is-hidden { display: none; }
/* deter casual saving: no text-select / drag of media */
.lf-video, .lf-img, .lf-modal-media, .lf-collage-cell img { -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }

/* overlay controls (mute / expand) on the preview media */
.lf-media-ctrls { position: absolute; bottom: 0.5rem; right: 0.5rem; display: flex; gap: 0.4rem; z-index: 3; }
.lf-ctrl {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; padding: 0;
    background: rgba(10, 10, 10, 0.66); border: 1px solid var(--line); color: var(--fg);
    cursor: pointer; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.lf-ctrl:hover { border-color: var(--accent); color: var(--accent); }
.lf-ctrl.is-on { color: var(--accent); border-color: var(--accent); }
.lf-ctrl svg { display: block; }

/* reduced-motion play control */
.lf-play {
    position: absolute;
    font: inherit;
    font-size: 0.85rem;
    color: var(--bg);
    background: var(--accent);
    border: 0;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    letter-spacing: 0.02em;
}
.lf-play:hover { filter: brightness(1.08); }

/* placeholder block */
.lf-ph {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    height: 100%;
    color: var(--dim);
    text-align: center;
    padding: 1rem;
}
.lf-ph-inline { background: transparent; }
.lf-ph-mark {
    font-size: 1.6rem;
    line-height: 1;
    color: var(--dim);
    opacity: 0.8;
}
.lf-ph-cap { font-size: 0.82rem; color: var(--dim); }

/* filmstrip glyph drawn in css so we don't depend on a unicode codepoint */
.lf-ph-film {
    width: 2.4rem;
    height: 1.8rem;
    border: 1.5px solid var(--line);
    border-radius: 2px;
    position: relative;
    background:
        linear-gradient(var(--line), var(--line)) left 0.18rem top / 0.32rem 0.28rem repeat-y,
        linear-gradient(var(--line), var(--line)) right 0.18rem top / 0.32rem 0.28rem repeat-y;
    background-clip: content-box;
    padding: 0 0.55rem;
}

/* directory-listing preview (categories column focused) */
.lf-dir-prev {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 0.7rem 0.9rem 0.5rem;
}
.lf-dir-head {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.15rem;
}
.lf-dir-path { color: var(--accent); }
.lf-dir-n { color: var(--dim); font-size: 0.8rem; margin-left: auto; }
.lf-dir-blurb { color: var(--dim); font-size: 0.85rem; margin-bottom: 0.5rem; }
.lf-dl {
    list-style: none;
    margin: 0;
    padding: 0.3rem 0 0;
    border-top: 1px solid var(--line);
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}
.lf-dl-row {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.1rem 0;
    color: var(--fg);
    white-space: nowrap;
}
.lf-dl-name { overflow: hidden; text-overflow: ellipsis; }
.lf-dl-tag { margin-left: auto; color: var(--dim); font-size: 0.8em; }
.lf-dl-empty { padding: 0.2rem 0; color: var(--dim); }
.lf-dir-foot {
    color: var(--dim);
    font-size: 0.78rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--line);
    margin-top: 0.3rem;
}

/* info block below preview */
.lf-info {
    flex: 0 0 auto;
    border-top: 1px solid var(--line);
    padding: 0.6rem 0.8rem 0.7rem;
    background: var(--panel);
    overflow-y: auto;
    max-height: 45%;
}
.lf-title {
    color: var(--fg);
    font-weight: 500;
    margin-bottom: 0.15rem;
}
.lf-summary {
    color: var(--dim);
    font-size: 0.88rem;
    line-height: 1.55;
    white-space: normal;
}
.lf-info-grid {
    display: grid;
    grid-template-columns: 4rem 1fr;
    gap: 0.05rem 0.6rem;
    margin-top: 0.5rem;
    font-size: 0.84rem;
}
.lf-info-k { color: var(--accent); }
.lf-info-v { color: var(--fg); }
.lf-info-head { display: flex; align-items: baseline; gap: 0.6rem; }
.lf-info-head .lf-title { margin-bottom: 0; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lf-client { color: var(--accent); font-size: 0.85rem; margin-bottom: 0.25rem; }
.lf-linkrow { margin: 0.2rem 0 0.1rem; font-size: 0.85rem; }
.lf-link { color: var(--accent); text-decoration: none; }
.lf-link:hover { text-decoration: underline; }
.lf-modal-link a { color: var(--accent); }
.lf-edit { flex: 0 0 auto; font: inherit; font-size: 0.78rem; color: var(--dim); background: transparent; border: 1px solid var(--line); padding: 0.05rem 0.5rem; cursor: pointer; }
.lf-edit:hover { color: var(--accent); border-color: var(--accent); }

/* inline metadata editor (localhost only) */
.lf-editor { display: flex; flex-direction: column; gap: 0.45rem; }
.lf-fld-row { display: grid; grid-template-columns: 4.5rem 1fr; align-items: center; gap: 0.6rem; }
.lf-fld-l { color: var(--accent); font-size: 0.82rem; }
.lf-fld { font: inherit; font-size: 0.85rem; color: var(--fg); background: var(--bg); border: 1px solid var(--line); padding: 0.25rem 0.4rem; width: 100%; }
.lf-fld:focus { outline: none; border-color: var(--accent); }
textarea.lf-fld { resize: vertical; line-height: 1.5; align-self: start; }
.lf-editor-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.2rem; }
.lf-save, .lf-cancel { font: inherit; font-size: 0.82rem; padding: 0.2rem 0.7rem; cursor: pointer; border: 1px solid var(--line); }
.lf-save { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.lf-save:hover { filter: brightness(1.08); }
.lf-cancel { background: transparent; color: var(--fg); }
.lf-cancel:hover { border-color: var(--accent); color: var(--accent); }
.lf-save-status { color: var(--dim); font-size: 0.8rem; }
.lf-check .lf-check-wrap { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--fg); font-size: 0.85rem; cursor: pointer; }
.lf-editor input[type="checkbox"] { accent-color: var(--accent); width: auto; cursor: pointer; margin: 0; }
.lf-info:has(.lf-editor) { max-height: 72%; }   /* give the form room over the media */

/* ── status line ── */
.lf-status {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-top: 1px solid var(--line);
    padding: 0.3rem 0.7rem;
    font-size: 0.82rem;
    background: var(--panel);
    color: var(--dim);
    white-space: nowrap;
    overflow: hidden;
}
.lf-path { color: var(--accent); }
.lf-spacer { flex: 1 1 auto; }
.lf-count { color: var(--fg); }
.lf-hint {
    color: var(--dim);
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 0 1 auto;
}

/* ── mobile: scoped thumbnail grid (category chips → folder covers + clip/photo thumbs → drill / modal) ── */
.lf-mobile { display: none; }
@media (max-width: 700px) {
    #portfolio-root { font-size: 0.95rem; }
    .lf { height: auto; min-height: 0; border: 0; }
    .lf-m-on .lf-cols, .lf-m-on .lf-manage, .lf-m-on .lf-status { display: none; }
    .lf-mobile { display: block; }

    .lf-m-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
    .lf-m-chip { font: inherit; font-size: 0.9rem; color: var(--dim); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0.32rem 0.95rem; cursor: pointer; }
    .lf-m-chip.is-on { color: var(--bg); background: var(--accent); border-color: var(--accent); }

    .lf-m-bar { display: flex; align-items: baseline; gap: 0.7rem; margin-bottom: 0.7rem; }
    .lf-m-back { font: inherit; font-size: 0.92rem; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; flex: 0 0 auto; }
    .lf-m-crumb { color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .lf-m-note { color: var(--dim); font-size: 0.82rem; line-height: 1.5; margin: -0.1rem 0 1rem; }
    .lf-m-for { color: var(--accent); }

    .lf-m-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
    .lf-m-cell { position: relative; display: block; text-align: left; padding: 0; background: var(--panel); border: 1px solid var(--line); cursor: pointer; overflow: hidden; -webkit-tap-highlight-color: transparent; }
    .lf-m-cell:active { border-color: var(--accent); }
    .lf-m-thumb { display: block; width: 100%; aspect-ratio: 16 / 10; background-color: var(--bg); background-position: center; background-size: cover; background-repeat: no-repeat; }
    .lf-m-thumb.lf-m-ph { display: flex; align-items: center; justify-content: center; color: var(--dim); font-size: 1.5rem; }
    .lf-m-badge { position: absolute; top: 6px; right: 6px; background: rgba(10, 10, 10, 0.82); color: var(--fg); border: 1px solid var(--line); font-size: 0.72rem; line-height: 1; padding: 0.2rem 0.42rem; border-radius: 3px; }
    .lf-m-badge.lf-m-play { color: var(--accent); }
    .lf-m-label { display: block; padding: 0.45rem 0.55rem 0.6rem; color: var(--fg); font-size: 0.82rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .lf-m-cell.is-folder .lf-m-label { color: var(--accent); }
    .lf-m-empty { color: var(--dim); font-size: 0.9rem; padding: 1.2rem 0; }
}

/* ── fullscreen media modal ── */
.lf-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.lf-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.86); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.lf-modal-box { position: relative; z-index: 1; max-width: 94vw; max-height: 92vh; display: flex; flex-direction: column; gap: 0.7rem; }
.lf-modal-stage { display: flex; align-items: center; justify-content: center; min-height: 0; }
.lf-modal-media { max-width: 94vw; max-height: 78vh; width: auto; height: auto; display: block; background: #000; border: 1px solid var(--line); }
.lf-modal-ph { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; padding: 4rem; color: var(--dim); border: 1px solid var(--line); background: var(--panel); }
.lf-modal-cap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; color: var(--dim); font-size: 0.9rem; }
.lf-modal-title { color: var(--fg); }
.lf-modal-client { color: var(--accent); }
.lf-modal-meta { display: flex; flex-wrap: wrap; gap: 0.2rem 1.2rem; color: var(--fg); }
.lf-mm-k { color: var(--dim); }
.lf-modal-nav { margin-left: auto; color: var(--dim); font-size: 0.8rem; }
.lf-modal-x { position: absolute; top: -0.2rem; right: -0.2rem; background: var(--bg); border: 1px solid var(--line); color: var(--fg); font: inherit; line-height: 1; padding: 0.3rem 0.55rem; cursor: pointer; }
.lf-modal-x:hover { border-color: var(--accent); color: var(--accent); }
body.lf-modal-on { overflow: hidden; }

/* themed modal player bar (replaces native controls — no download menu) */
.lf-pbar { display: flex; align-items: center; gap: 0.7rem; padding: 0.1rem; }
.lf-pp, .lf-mmute, .lf-grab { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0; cursor: pointer; background: var(--bg); border: 1px solid var(--line); color: var(--fg); }
.lf-pp:hover, .lf-mmute:hover, .lf-grab:hover { border-color: var(--accent); color: var(--accent); }
.lf-mmute.is-on { color: var(--accent); border-color: var(--accent); }
.lf-pp svg, .lf-mmute svg { display: block; }
.lf-t { flex: 0 0 auto; color: var(--dim); font-size: 0.8rem; font-variant-numeric: tabular-nums; min-width: 2.6rem; }
.lf-t-cur { text-align: right; }
.lf-seek { flex: 1 1 auto; height: 8px; background: var(--line); cursor: pointer; position: relative; }
.lf-seek-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); }
.lf-seek:hover { box-shadow: 0 0 0 1px var(--accent); }

/* localhost content manager bar */
.lf-manage { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; flex: 0 0 auto; border-top: 1px solid var(--line); padding: 0.3rem 0.6rem; background: var(--panel); font-size: 0.8rem; }
.lf-manage[hidden] { display: none; }
.lf-m-lead { color: var(--accent); }
.lf-m-ctx { color: var(--fg); max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lf-m-sp { flex: 1 1 auto; }
.lf-m-btn { font: inherit; font-size: 0.78rem; color: var(--fg); background: var(--bg); border: 1px solid var(--line); padding: 0.1rem 0.5rem; cursor: pointer; }
.lf-m-btn:hover { border-color: var(--accent); color: var(--accent); }
.lf-m-danger:hover { border-color: var(--c-orange); color: var(--c-orange); }
.lf-m-status { color: var(--dim); margin-left: 0.3rem; }
.lf-m-status.bad { color: var(--c-orange); }

/* drag-and-drop move */
.lf-row.lf-dragging { opacity: 0.4; }
.lf-row.lf-drop-target, .lf-row.lf-drop-target:hover { outline: 1px dashed var(--accent); outline-offset: -2px; background: rgba(255, 255, 255, 0.05); }
.lf-col-items.lf-drop-here { box-shadow: inset 0 0 0 1px var(--accent); }

/* thumbnail-set toast */
.lf-toast { position: fixed; left: 50%; bottom: 3rem; transform: translateX(-50%); z-index: 1200; background: rgba(10, 10, 10, 0.92); border: 1px solid var(--accent); color: var(--fg); padding: 0.4rem 0.9rem; font-size: 0.85rem; white-space: nowrap; pointer-events: none; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.lf-toast.bad { border-color: var(--c-orange); color: var(--c-orange); }

@media (max-width: 700px) {
    .lf-modal { padding: 0.8rem; }
    .lf-modal-media { max-height: 70vh; }
    .lf-modal-nav { display: none; }
}

/* ── nested groups + collage preview ── */
.lf-collage-wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0.4rem; }
.lf-collage { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 4px; }
.lf-collage-cell { padding: 0; border: 1px solid var(--line); background: var(--panel); cursor: pointer; aspect-ratio: 16 / 9; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.lf-collage-cell:hover { border-color: var(--accent); }
.lf-collage-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (prefers-reduced-motion: reduce) {
    .lf-label.is-marquee { animation: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
}
