/* ===========================================================
   UNAMIQ - portfolio
   One timeline of what we built, newest first. The line runs
   down the middle and the steps alternate sides.
=========================================================== */

/* ---------- Timeline ---------- */

.timeline-section{ padding-top:24px; }

/* --x is where the line runs: the middle, or the left on phones. */
.timeline{
    --x:50%;
    position:relative;
    padding-bottom:40px;
}

.timeline::before,
.timeline-fill{
    content:"";
    position:absolute;
    top:0;
    left:var(--x);
    width:2px;
    transform:translateX(-1px);
}

.timeline::before{
    bottom:0;
    background:var(--border-color);
}

/* Fills in orange as you scroll back in time (js/portfolio.js). */
.timeline-fill{
    height:0;
    background:var(--accent);
}

.tl-list{
    list-style:none;
    padding:0;
    margin:0;
}

.tl-item{
    position:relative;
    padding-bottom:110px;
}

.tl-dot{
    position:absolute;
    top:4px;
    left:var(--x);
    width:16px;
    height:16px;
    transform:translateX(-50%);

    border:2px solid var(--text);
    border-radius:50%;
    background:var(--bg-color);
}

.is-now .tl-dot{
    border-color:var(--accent);
    background:var(--accent);
    box-shadow:0 0 0 6px rgba(var(--accent-rgb), .18);
}

.tl-when{
    font-family:"Space Mono", monospace;
    font-size:var(--fs-xs);
    letter-spacing:.06em;
    color:var(--accent-ink);
    margin-bottom:8px;
}

.tl-body h3{
    font-size:clamp(1.4rem, 2.2vw, 1.8rem);
    font-weight:500;
    letter-spacing:-.015em;
    margin-bottom:12px;
}

.tl-body > p:not(.tl-when){
    max-width:44ch;
    color:var(--text-muted);
    line-height:1.6;
    margin-bottom:24px;
}

.tl-photos{
    display:grid;
    gap:10px;
}

.tl-photos-2,
.tl-photos-4{ grid-template-columns:repeat(2, 1fr); }
.tl-photos-3{ grid-template-columns:repeat(3, 1fr); }

.tl-photo{
    display:block;
    aspect-ratio:4 / 3;
    overflow:hidden;
    background:var(--bg-alt);
}

.tl-photos-1 .tl-photo{ aspect-ratio:16 / 9; }

.tl-photo picture,
.tl-photo img{
    display:block;
    width:100%;
    height:100%;
}

.tl-photo img{ object-fit:cover; }

/* Center: steps alternate sides of the line, and a short note sits on
   the other side, across from the pictures. */
.timeline .tl-item{
    display:grid;
    grid-template-columns:minmax(0, 1fr) minmax(0, 1fr);
    column-gap:96px;
}

.timeline .tl-item:nth-child(odd) .tl-body{ grid-column:1; text-align:right; }
.timeline .tl-item:nth-child(odd) .tl-body > p{ margin-left:auto; }
.timeline .tl-item:nth-child(odd) .tl-note{ grid-column:2; }

.timeline .tl-item:nth-child(even) .tl-body{ grid-column:2; }
.timeline .tl-item:nth-child(even) .tl-note{
    grid-column:1;
    grid-row:1;
    margin-left:auto;
    text-align:right;
}

.tl-note{
    align-self:center;
    max-width:40ch;
    color:var(--text-muted);
    line-height:1.6;
}

/* Steps rise into view once (the script adds .is-animated). */
.timeline.is-animated .tl-item{
    opacity:0;
    transform:translateY(28px);
    transition:opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1);
}

.timeline.is-animated .tl-item.is-visible{
    opacity:1;
    transform:none;
}

/* ---------- Viewer ---------- */

.viewer{
    padding:0;
    border:none;
    background:transparent;
    max-width:min(92vw, 1400px);
    max-height:90vh;
}

.viewer::backdrop{ background:rgba(11, 11, 12, .88); }

.viewer img{
    display:block;
    max-width:100%;
    max-height:90vh;
}

.viewer-close{
    position:absolute;
    top:10px;
    right:10px;
    width:40px;
    height:40px;

    border:none;
    background:#0B0B0C;
    color:#F5F5F4;
    font-size:1.4rem;
    cursor:pointer;
}

/* ---------- Phones: the line moves to the left ---------- */

@media(max-width:760px){
    .timeline{ --x:9px; }

    /* As specific as the alternating rules above, so these win. */
    .timeline .tl-list .tl-item .tl-body{
        width:auto;
        max-width:none;
        margin-left:0;
        padding:0 0 0 44px;
        text-align:left;
    }

    .timeline .tl-list .tl-item .tl-body > p{ margin-left:0; }

    /* One column: the note goes under the pictures. */
    .timeline .tl-list .tl-item{ grid-template-columns:minmax(0, 1fr); }

    .timeline .tl-list .tl-item .tl-body,
    .timeline .tl-list .tl-item .tl-note{ grid-column:1; }

    .timeline .tl-list .tl-item .tl-note{
        grid-row:auto;
        margin:18px 0 0;
        padding-left:44px;
        text-align:left;
    }

    .tl-photos-3{ grid-template-columns:repeat(2, 1fr); }
}

/* ---------- A video step ---------- */

.tl-video video{
    display:block;
    width:100%;
    aspect-ratio:16 / 9;
    object-fit:cover;
    background:#0B0B0C;
}

/* ---------- Coming soon: a dashed dot ---------- */

.timeline .is-teaser .tl-dot{
    border:2px dashed var(--accent);
    background:var(--bg-color);
    box-shadow:none;
}

/* ---------- Where it started: the bottom of the line ---------- */

/* The line stops at this dot, and the step has no space under it. */
.timeline .tl-start{ padding-bottom:0; }
.timeline{ padding-bottom:0; }

.timeline .tl-start .tl-dot{
    border-color:var(--accent);
    background:var(--accent);
}

/* Hide the line below the last dot, so the timeline ends there. */
.timeline .tl-start::after{
    content:"";
    position:absolute;
    top:20px;
    bottom:0;
    left:var(--x);
    width:4px;
    transform:translateX(-2px);
    background:var(--bg-color);
}

/* ---------- The note across from each step ---------- */

.tl-note p + p{ margin-top:14px; }

/* Status, Function: a small label in the mono face, then the value. */
.tl-note .tl-fact{
    color:var(--text);
}

.tl-note .tl-fact span{
    margin-right:8px;
    font-family:"Space Mono", monospace;
    font-size:var(--fs-xs);
    letter-spacing:.06em;
    text-transform:uppercase;
    color:var(--accent-ink);
}

/* A video with photos under it. */
.tl-video + .tl-photos{ margin-top:10px; }

/* Frames for pictures that are still to come. */
.tl-photo-empty{ background:var(--bg-alt); }
