body[data-view='timeline'] #canvas-viewport,
body[data-view='list'] #canvas-viewport {
    display: none;
}

/* Outside the canvas the control group collapses to the theme control: zoom has
   nothing to act on, and the view switch in the top bar is the way back. */
body[data-view='timeline'] .canvas-dock > :not(.theme-cycle),
body[data-view='list'] .canvas-dock > :not(.theme-cycle) {
    display: none;
}

body[data-view='timeline'] #canvas-app::before,
body[data-view='list'] #canvas-app::before {
    opacity: 0.38;
}

.portfolio-view-shell {
    position: fixed;
    top: 152px;
    left: calc(var(--sidebar-w) + 28px);
    right: 24px;
    bottom: 22px;
    z-index: 850;
    display: none;
    overflow: auto;
    padding: 0 4px 34px 0;
    pointer-events: auto;
    scrollbar-gutter: stable;
}

body[data-view='timeline'] .portfolio-view-shell,
body[data-view='list'] .portfolio-view-shell {
    display: block;
}

.portfolio-view-panel {
    min-height: 100%;
    color: var(--text);
}

.view-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
}

.view-panel-head-compact {
    align-items: center;
    margin-bottom: 12px;
}

.view-panel-meta {
    min-width: 0;
}

.view-panel-kicker {
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--pink-dark);
}

.view-panel-head-compact .view-panel-kicker {
    margin-bottom: 0;
}

/* View titles share the canvas headings' Fraunces voice. */
.view-panel-head h1 {
    font-family: var(--font-serif);
    font-size: 30px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 0;
}

.view-panel-head p {
    max-width: 620px;
    margin-top: 7px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.timeline-legend {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: var(--shadow);
    white-space: nowrap;
}

.timeline-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

.timeline-legend i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--view-accent, var(--pink-dark));
}

.journey-timeline {
    position: relative;
    display: grid;
    /* Column-flow rather than a hardcoded count, so adding a milestone cannot
       wrap the timeline onto a second row. `align-items: start` stops a heavy
       year from stretching every other column to its height. */
    grid-auto-flow: column;
    grid-auto-columns: minmax(218px, 244px);
    align-items: start;
    gap: 26px;
    min-width: max-content;
    padding: 58px 8px 18px;
}

.timeline-rail {
    position: absolute;
    top: 74px;
    left: 18px;
    right: 18px;
    height: 1px;
    background: linear-gradient(90deg, rgba(178, 58, 72, 0.12), rgba(82, 101, 145, 0.18), rgba(125, 211, 168, 0.14));
}

.journey-column {
    --view-accent: var(--pink-dark);
    --view-wash: rgba(217, 138, 147, 0.12);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.journey-pin {
    position: absolute;
    top: 11px;
    left: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 3px solid white;
    background: var(--view-accent);
    box-shadow: 0 0 0 2px var(--view-accent), 0 12px 26px rgba(88, 93, 122, 0.12);
    z-index: 2;
}

.journey-column::before {
    content: '';
    position: absolute;
    top: 21px;
    left: 8px;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, var(--view-accent), rgba(88, 93, 122, 0.08));
    opacity: 0.42;
}

.journey-year {
    position: relative;
    width: max-content;
    margin-left: 34px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--view-wash);
    color: var(--view-accent);
    font-size: 14px;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.journey-column-card,
.timeline-item-card {
    position: relative;
    margin-left: 28px;
    border: 1px solid var(--card-border);
    background: linear-gradient(178deg, rgba(255, 255, 255, 0.98) 0%, rgba(253, 251, 248, 0.94) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.92),
        0 2px 8px rgba(37, 40, 55, 0.03),
        0 8px 24px rgba(37, 40, 55, 0.05);
    backdrop-filter: blur(14px);
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

body[data-theme='dark'] .journey-column-card,
body[data-theme='dark'] .timeline-item-card {
    background: var(--card-bg);
    box-shadow: inset 0 1px 0 rgba(255, 244, 230, 0.05);
}

.journey-column-card {
    padding: 17px 18px;
    border-radius: 18px;
}

.journey-column-card h2 {
    margin: 11px 0 8px;
    font-size: 15px;
    line-height: 1.35;
    color: var(--text);
}

.journey-column-card p {
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-secondary);
}

.timeline-card-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-item-card {
    padding: 14px;
    border-radius: 16px;
    cursor: pointer;
}

/* The layer filter hides cards with [hidden]; wide columns set display:flex,
   which would otherwise outrank the UA rule and leave filtered cards visible. */
.journey-column .timeline-item-card[hidden] {
    display: none;
}

.timeline-item-card:hover,
.timeline-item-card:focus-visible,
.portfolio-row:hover,
.portfolio-row:focus-visible {
    border-color: rgba(178, 58, 72, 0.28);
    box-shadow:
        inset 0 1px 0 #ffffff,
        0 4px 14px rgba(37, 40, 55, 0.05),
        0 16px 36px rgba(37, 40, 55, 0.09);
    transform: translateY(-2px);
    outline: none;
}

.timeline-item-top,
.portfolio-title-cell {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.view-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}

.timeline-item-copy {
    min-width: 0;
}

.timeline-item-copy h3,
.portfolio-title-cell strong {
    display: block;
    font-size: 14px;
    line-height: 1.32;
    color: var(--text);
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
}

.timeline-item-copy p,
.portfolio-title-cell span {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.35;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.timeline-item-desc {
    margin-top: 11px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.timeline-item-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    font-size: 11.5px;
    color: var(--text-muted);
}

.timeline-next-focus {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: 28px;
    padding: 15px;
    border: 1px dashed rgba(184, 169, 201, 0.48);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.58);
}

.timeline-next-focus span,
.view-soft-pill,
.view-mini-badge {
    display: inline-flex;
    align-items: center;
    width: max-content;
    max-width: 100%;
    border-radius: 999px;
    font-weight: 800;
    line-height: 1;
}

.timeline-next-focus span {
    padding: 7px 10px;
    background: rgba(232, 224, 240, 0.72);
    color: #7d6b8d;
    font-size: 11.5px;
}

.view-mini-badge {
    padding: 5px 8px;
    background: var(--view-wash, rgba(217, 138, 147, 0.11));
    color: var(--view-accent, var(--pink-dark));
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.view-soft-pill {
    padding: 6px 10px;
    background: rgba(232, 224, 240, 0.54);
    color: #7d6b8d;
    font-size: 11.5px;
}

.list-view .view-mini-badge,
.list-view .view-soft-pill {
    min-height: 22px;
    padding: 4px 8px;
    border: 1px solid rgba(150, 157, 180, 0.16);
    background: rgba(255, 255, 255, 0.46);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.045em;
    box-shadow: none;
}

.list-view .view-mini-badge {
    background: rgba(217, 138, 147, 0.09);
    border-color: rgba(217, 138, 147, 0.14);
    color: var(--pink-dark);
}

.list-result-count {
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 800;
    box-shadow: var(--shadow);
    white-space: nowrap;
}

.list-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1.35fr) repeat(3, minmax(150px, 0.65fr));
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow);
}

.list-toolbar label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.list-toolbar span {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.list-toolbar input,
.list-toolbar select {
    width: 100%;
    min-height: 38px;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.76);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    padding: 0 12px;
    outline: none;
}

.list-toolbar input:focus,
.list-toolbar select:focus {
    border-color: rgba(178, 58, 72, 0.34);
    box-shadow: 0 0 0 3px rgba(178, 58, 72, 0.1);
}

.portfolio-table-wrap {
    overflow: auto;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow);
}

.portfolio-table {
    width: 100%;
    min-width: 1120px;
    border-collapse: separate;
    border-spacing: 0;
}

.portfolio-table th,
.portfolio-table td {
    padding: 13px 14px;
    border-bottom: 1px solid rgba(42, 45, 68, 0.07);
    text-align: left;
    vertical-align: top;
}

.portfolio-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(255, 255, 255, 0.94);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.portfolio-table td {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
}

.portfolio-table tr:last-child td {
    border-bottom: none;
}

.portfolio-row {
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.portfolio-row:hover {
    background: rgba(217, 138, 147, 0.035);
}

.portfolio-table td:first-child,
.portfolio-table th:first-child {
    width: 250px;
}

.portfolio-table td:nth-child(4),
.portfolio-table th:nth-child(4) {
    width: 210px;
}

.portfolio-table td:nth-child(5),
.portfolio-table th:nth-child(5),
.portfolio-table td:nth-child(6),
.portfolio-table th:nth-child(6) {
    width: 250px;
}

.portfolio-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.portfolio-stack .project-tag {
    padding: 5px 8px;
    font-size: 11px;
}

.list-view .portfolio-stack {
    gap: 6px;
}

.list-view .portfolio-stack .project-tag {
    padding: 4px 8px;
    border-color: rgba(150, 157, 180, 0.18);
    background: rgba(255, 255, 255, 0.44);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    box-shadow: none;
}

.list-view .portfolio-stack .project-tag::before {
    width: 5px;
    height: 5px;
    opacity: 0.48;
}

.portfolio-date {
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.portfolio-empty-row td {
    padding: 34px 16px;
    text-align: center;
    color: var(--text-muted);
}

/* Stage colours come from the shared hue palette (base.css). */
.journey-column[data-tone],
.timeline-legend i[data-tone] {
    --view-accent: var(--hue);
    --view-wash: var(--hue-wash);
}

body[data-theme='dark'] .timeline-legend,
body[data-theme='dark'] .list-result-count,
body[data-theme='dark'] .list-toolbar,
body[data-theme='dark'] .portfolio-table-wrap,
body[data-theme='dark'] .timeline-next-focus {
    background: color-mix(in srgb, var(--surface-solid) 90%, transparent);
    border-color: var(--hairline);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.26);
}

body[data-theme='dark'] .journey-pin {
    border-color: var(--bg);
}


body[data-theme='dark'] .list-toolbar input,
body[data-theme='dark'] .list-toolbar select,
body[data-theme='dark'] .portfolio-table th {
    background: var(--bg);
    border-color: var(--hairline);
    color: var(--text);
}

body[data-theme='dark'] .portfolio-table th,
body[data-theme='dark'] .portfolio-table td {
    border-bottom-color: rgba(255, 255, 255, 0.07);
}

body[data-theme='dark'] .portfolio-row:hover {
    background: rgba(255, 255, 255, 0.035);
}

body[data-theme='dark'] .list-view .view-mini-badge,
body[data-theme='dark'] .list-view .view-soft-pill,
body[data-theme='dark'] .list-view .portfolio-stack .project-tag {
    background: rgba(255, 255, 255, 0.065);
    border-color: rgba(255, 255, 255, 0.09);
    color: var(--text-secondary);
}

body[data-theme='dark'] .list-view .view-mini-badge {
    background: rgba(217, 138, 147, 0.1);
    border-color: rgba(217, 138, 147, 0.14);
    color: #EBB5BC;
}

@media (max-width: 1440px) {
    .portfolio-view-shell {
        left: calc(var(--sidebar-w) + 18px);
        right: 16px;
    }

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

    .portfolio-table {
        min-width: 860px;
    }

    .portfolio-table th,
    .portfolio-table td {
        padding: 12px;
    }

    .portfolio-table td:first-child,
    .portfolio-table th:first-child {
        width: 220px;
    }

    .portfolio-table td:nth-child(4),
    .portfolio-table th:nth-child(4) {
        width: 170px;
    }

    .portfolio-table td:nth-child(5),
    .portfolio-table th:nth-child(5),
    .portfolio-table td:nth-child(6),
    .portfolio-table th:nth-child(6) {
        width: 190px;
    }
}

@media (max-width: 900px) {
    .portfolio-view-shell {
        top: 158px;
        left: 14px;
        right: 14px;
        bottom: 14px;
        padding-right: 0;
    }

    .view-panel-head {
        flex-direction: column;
        gap: 12px;
    }

    .timeline-legend {
        width: 100%;
        justify-content: space-between;
    }

    .journey-timeline {
        display: flex;
        flex-direction: column;
        min-width: 0;
        padding: 10px 0 22px;
    }

    .timeline-rail {
        display: none;
    }

    .journey-column {
        padding-left: 0;
    }

    .journey-column::before {
        left: 8px;
    }

    .journey-year,
    .journey-column-card,
    .timeline-item-card,
    .timeline-next-focus {
        margin-left: 30px;
    }

    .portfolio-table {
        min-width: 760px;
    }

    .portfolio-table th,
    .portfolio-table td {
        padding: 11px 10px;
    }

    .portfolio-table td:first-child,
    .portfolio-table th:first-child {
        width: 200px;
    }

    .portfolio-table td:nth-child(4),
    .portfolio-table th:nth-child(4) {
        width: 150px;
    }

    .portfolio-table td:nth-child(5),
    .portfolio-table th:nth-child(5),
    .portfolio-table td:nth-child(6),
    .portfolio-table th:nth-child(6) {
        width: 165px;
    }
}

@media (max-width: 1440px) {
    .portfolio-table-wrap {
        border: none;
        background: transparent;
        box-shadow: none;
        overflow: visible;
    }

    .portfolio-table,
    .portfolio-table tbody,
    .portfolio-table tr,
    .portfolio-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .portfolio-table {
        min-width: 0;
    }

    .portfolio-table thead {
        display: none;
    }

    .portfolio-table .portfolio-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 14px;
        padding: 14px;
        border: 1px solid var(--card-border);
        border-radius: 16px;
        background: var(--card-bg);
        box-shadow: var(--shadow-card);
    }

    .portfolio-table td {
        display: block;
        width: 100%;
        padding: 0;
        border-bottom: none;
        font-size: 14px;
        line-height: 1.58;
    }

    .portfolio-table td:first-child,
    .portfolio-table td:nth-child(4),
    .portfolio-table td:nth-child(5),
    .portfolio-table td:nth-child(6) {
        width: 100%;
    }

    .portfolio-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 6px;
        color: var(--text-muted);
        font-size: 11px;
        font-weight: 800;
        line-height: 1;
        text-transform: uppercase;
    }

    .portfolio-table td:first-child {
        grid-column: 1 / -1;
        width: 100%;
        padding-bottom: 12px;
        border-bottom: 1px solid rgba(42, 45, 68, 0.07);
    }

    .portfolio-table td:first-child::before {
        display: none;
    }

    .portfolio-table td:nth-child(4),
    .portfolio-table td:nth-child(5),
    .portfolio-table td:nth-child(6),
    .portfolio-table td:last-child {
        grid-column: 1 / -1;
    }

    .portfolio-table td:nth-child(7) {
        padding-top: 10px;
        border-top: 1px solid rgba(42, 45, 68, 0.07);
    }

    .portfolio-title-cell {
        align-items: flex-start;
    }

    .portfolio-title-cell .view-item-icon {
        width: 42px;
        height: 42px;
        border-radius: 14px;
    }

    .portfolio-title-cell strong {
        font-size: 14px;
    }
}

@media (max-width: 767px) {
    .portfolio-view-shell {
        top: 128px;
    }

    .view-panel-head h1 {
        font-size: 24px;
    }

    .view-panel-head p {
        font-size: 13px;
    }

    .timeline-legend {
        display: none;
    }

    .list-toolbar {
        grid-template-columns: 1fr;
        border-radius: 16px;
    }

    .portfolio-table-wrap {
        border: none;
        background: transparent;
        box-shadow: none;
        overflow: visible;
    }

    .portfolio-table,
    .portfolio-table tbody,
    .portfolio-table tr,
    .portfolio-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .portfolio-table thead {
        display: none;
    }

    .portfolio-table .portfolio-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 14px;
        padding: 14px;
        border: 1px solid var(--card-border);
        border-radius: 16px;
        background: var(--card-bg);
        box-shadow: var(--shadow-card);
    }

    .portfolio-table td {
        display: block;
        width: 100%;
        padding: 0;
        border-bottom: none;
        font-size: 14px;
        line-height: 1.58;
    }

    .portfolio-table td:first-child,
    .portfolio-table td:nth-child(4),
    .portfolio-table td:nth-child(5),
    .portfolio-table td:nth-child(6) {
        width: 100%;
    }

    .portfolio-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 6px;
        color: var(--text-muted);
        font-size: 11px;
        font-weight: 800;
        line-height: 1;
        text-transform: uppercase;
    }

    .portfolio-table td:first-child {
        grid-column: 1 / -1;
        width: 100%;
        padding-bottom: 12px;
        border-bottom: 1px solid rgba(42, 45, 68, 0.07);
    }

    .portfolio-table td:first-child::before {
        display: none;
    }

    .portfolio-table td:nth-child(4),
    .portfolio-table td:nth-child(5),
    .portfolio-table td:nth-child(6),
    .portfolio-table td:last-child {
        grid-column: 1 / -1;
    }

    .portfolio-table td:nth-child(7) {
        padding-top: 10px;
        border-top: 1px solid rgba(42, 45, 68, 0.07);
    }

    .portfolio-title-cell {
        align-items: flex-start;
    }

    .portfolio-title-cell .view-item-icon {
        width: 42px;
        height: 42px;
        border-radius: 14px;
    }

    .portfolio-title-cell strong {
        font-size: 14px;
    }

    .portfolio-stack {
        gap: 6px;
    }

    .portfolio-stack .project-tag {
        padding: 4px 8px;
    }

    .portfolio-empty-row td {
        display: block;
        border: 1px solid var(--card-border);
        border-radius: 16px;
        background: var(--card-bg);
    }
}

/* Dense stages read left-to-right in DOM order before moving to the next row. */
@media (min-width: 901px) {
    .journey-column-wide {
        grid-column: span 2;
    }
}
@media (min-width: 600px) {
    .journey-column-wide .timeline-card-stack {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        gap: 14px;
        margin-left: 28px;
    }
    .journey-column-wide .timeline-item-card {
        margin-left: 0;
        display: flex;
        flex-direction: column;
    }
    .journey-column-wide .timeline-item-foot {
        margin-top: auto;
        padding-top: 16px;
    }
}

/* Visitor navigation: keep the reading controls available while exploring. */
.timeline-track {
    overflow-x: auto;
    overscroll-behavior-x: contain;
}

.timeline-track[data-more='end'] { mask-image: linear-gradient(to right, #000 calc(100% - 72px), transparent); }
.timeline-track[data-more='start'] { mask-image: linear-gradient(to left, #000 calc(100% - 72px), transparent); }
.timeline-track[data-more='both'] { mask-image: linear-gradient(to right, transparent, #000 72px, #000 calc(100% - 72px), transparent); }

.timeline-navigation {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    background: var(--bg);
    border-bottom: 1px solid var(--hairline);
}

.timeline-periods {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.timeline-navigation button,
.list-active-filters button {
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    background: var(--surface-solid);
    color: var(--text-secondary);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.timeline-navigation button:hover,
.list-active-filters button:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.timeline-navigation button:disabled {
    opacity: 0.4;
    cursor: default;
}

.timeline-navigation .timeline-recent {
    flex-shrink: 0;
    color: var(--pink-dark);
    font-weight: 700;
}

.journey-column {
    scroll-margin-top: 68px;
    scroll-margin-left: 8px;
}

.timeline-navigation button:focus-visible,
.journey-column:focus-visible,
.list-active-filters button:focus-visible,
.list-filters summary:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 3px;
}

.list-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.list-toolbar {
    grid-template-columns: minmax(180px, 1.2fr) minmax(0, 2fr);
    align-items: end;
}

.list-filters { min-width: 0; }
.list-filters summary { display: none; }
.list-filter-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.list-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px;
}

.list-active-filters[hidden] { display: none; }

.list-active-filters button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.list-active-filters .list-clear-filters {
    border-color: transparent;
    background: transparent;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.list-active-filters .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Compact rows retain purpose, one outcome, technology, and date. Full copy
   remains searchable and is available in Detailed or in the case study. */
.list-view[data-list-density='compact'] .portfolio-table-wrap {
    overflow: visible;
    border: none;
    background: transparent;
    box-shadow: none;
}

.list-view[data-list-density='compact'] :is(.portfolio-table, tbody) {
    display: block;
    width: 100%;
    min-width: 0;
}

.list-view[data-list-density='compact'] thead { display: none; }
.list-view[data-list-density='compact'] .portfolio-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 1fr) minmax(100px, 0.55fr);
    grid-template-areas: 'title outcome stack date';
    align-items: center;
    gap: 18px;
    padding: 16px;
    margin-bottom: 8px;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    background: var(--card-bg);
    box-shadow: none;
}

.list-view[data-list-density='compact'] .portfolio-row td {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 0;
    border: none;
    font-size: 13px;
    line-height: 1.5;
    grid-column: auto;
}

.list-view[data-list-density='compact'] .portfolio-row td::before { display: none; }
.list-view[data-list-density='compact'] .portfolio-row td:nth-child(1) { grid-area: title; }
.list-view[data-list-density='compact'] .portfolio-row td:nth-child(4) { grid-area: stack; }
.list-view[data-list-density='compact'] .portfolio-row td:nth-child(6) {
    grid-area: outcome;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
.list-view[data-list-density='compact'] .portfolio-row td:nth-child(7) { grid-area: date; }
.list-view[data-list-density='compact'] .portfolio-row :is(td:nth-child(2), td:nth-child(3), td:nth-child(5)) { display: none; }
.list-view[data-list-density='compact'] .portfolio-title-cell { gap: 10px; }
.list-view[data-list-density='compact'] .portfolio-title-cell .view-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}
.list-view[data-list-density='compact'] .portfolio-title-cell > div { min-width: 0; }
.list-view[data-list-density='compact'] .portfolio-title-cell strong { font-size: 14px; }
.list-view[data-list-density='compact'] .portfolio-title-cell span {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 12px;
}
.list-view[data-list-density='compact'] .portfolio-date {
    white-space: normal;
    font-size: 11px;
}

@media (max-width: 1099px) {
    .list-view[data-list-density='compact'] .portfolio-row {
        grid-template-columns: minmax(0, 1fr) minmax(70px, 0.3fr);
        grid-template-areas: 'title date' 'outcome outcome' 'stack stack';
        gap: 10px 12px;
        padding: 14px;
    }
}

@media (max-width: 900px) {
    .timeline-track { overflow: visible; }
    .list-view .view-panel-head { flex-direction: row; gap: 10px; }
    .list-toolbar { grid-template-columns: minmax(140px, 1fr) minmax(0, 2fr); }
    .journey-column { scroll-margin-top: 116px; }
}

@media (max-width: 767px) {
    .timeline-navigation { align-items: flex-start; gap: 8px; }
    .timeline-navigation button { min-height: 36px; padding: 6px 9px; font-size: 12px; }
    .timeline-periods { gap: 4px; }
    .journey-column { scroll-margin-top: 130px; }
    .list-head-actions { gap: 6px; }
    .list-result-count { padding: 6px 8px; font-size: 11px; box-shadow: none; }
    .list-density > button { padding: 6px 8px; min-height: 32px; font-size: 12px; }
    .list-view .view-panel-kicker { font-size: 11px; letter-spacing: 0.04em; }
    .list-toolbar { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
    .list-filters:not([open]) { align-self: end; }
    .list-filters summary {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-height: 38px;
        padding: 0 12px;
        border: 1px solid var(--hairline);
        border-radius: 13px;
        color: var(--text);
        font-size: 13px;
        cursor: pointer;
        list-style: none;
    }
    .list-filters summary::-webkit-details-marker { display: none; }
    .list-filters summary::after { content: '+'; font-size: 16px; }
    .list-filters[open] summary::after { content: '−'; }
    .list-filters[open] { grid-column: 1 / -1; }
    .list-filters[open] summary { justify-content: flex-start; }
    .list-filter-controls { grid-template-columns: 1fr; margin-top: 10px; }
    .list-filter-count { padding: 2px 5px; border-radius: 4px; background: var(--surface-hover); }
    .list-filter-count[hidden] { display: none; }
}
