/* =====================================================================
   HOME PAGE: original custom CSS (pasted from Cargo, unchanged)
   ===================================================================== */

/* Toggle mechanism - radios are invisible, labels trigger them */
.view-toggle-input {
    display: none;
}

/* Block-by-block entrance - rows appear instantly in place, one after another */
@keyframes blockIn {
    to {
        opacity: 1;
    }
}

.list-view .row {
    opacity: 0;
    animation: blockIn 0.05s steps(1) forwards;
    animation-delay: calc(0.1s + (var(--i) - 1) * 0.15s);
}
.toggle-label {
    cursor: pointer;
}
.toggle-label:hover {
    font-style: italic;
}

/* Whichever view is active gets a heavier font-weight */
#view-list-radio:checked ~ column-set label[for="view-list-radio"],
#view-grid-radio:checked ~ column-set label[for="view-grid-radio"],
#view-about-radio:checked ~ column-set label[for="view-about-radio"] {
    font-weight: 700;
}
/* List shows by default, Grid and About wrappers hidden by default */
.list-view {
    display: block;
}
.grid-view-wrapper {
    display: none;
    position: relative;
    margin-top: 0px;
}
.about-view {
    display: none;
    padding-bottom: 820px;
}
.selected-work-wrap {
    position: relative;
}
/* Checking Grid swaps which section is visible */
#view-grid-radio:checked ~ .list-view {
    display: none;
}
#view-grid-radio:checked ~ .grid-view-wrapper {
    display: block;
}
/* Checking About swaps which section is visible */
#view-about-radio:checked ~ .list-view {
    display: none;
}
#view-about-radio:checked ~ .about-view {
    display: block;
}
/* Image grid itself */
.grid-view {
    position: relative;
    z-index: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
/* Text overlay sits on top, isolated from the grid's layout */
.grid-text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}
/* But the rows themselves stay clickable/hoverable - only the empty gaps pass clicks through */
.grid-text-overlay column-set {
    pointer-events: auto;
}
/* Grid square styling */
.grid-item {
    display: block;
    aspect-ratio: 1 / 1.1;
    overflow: hidden;
    transition: opacity 0.25s ease;
}
.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Squares snap in one after another, synced to the same timing as their matching row */
@keyframes blockInGrid {
    to { opacity: 0.2; }
}
.grid-item {
    opacity: 0;
    animation: blockInGrid 0.05s steps(1) forwards;
}
.grid-item { animation-delay: calc(0.1s + (var(--i) - 1) * 0.15s); }

/* Hovering the square itself also brings it to full opacity */
.grid-item:hover {
    opacity: 1 !important;
}
/* Grid overlay rows snap in one after another, synced to their matching square */
.grid-text-overlay .row {
    transition: opacity 0.25s ease;
}

@keyframes blockInGridRow {
    to { opacity: 0.5; }
}
.grid-text-overlay .row {
    opacity: 0;
    animation: blockInGridRow 0.05s steps(1) forwards;
    animation-delay: calc(0.1s + (var(--i) - 1) * 0.15s);
}

/* Hover links between grid squares, list rows and previews are per-project, so they live in home.generated.css */

/* --- Your existing rules below, unchanged --- */
.row-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}
.preview-area {
    position: absolute;
    top: 0;
    left: 49%;
    width: 51%;
    height: 889px;
    pointer-events: none;
    overflow: hidden;
    z-index: -1;
}
.preview-track {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 30px 0;
    box-sizing: border-box;
    opacity: 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    transition: opacity 0.25s ease;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

column-set {
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}
/* Table rows: whole row goes blue/italic on hover */
column-set:not(:first-of-type):has(a):hover,
column-set:not(:first-of-type):has(a):hover a {
    color: #000000;
    font-weight: 500;
    font-style: italic;
}
/* Top nav row: only the hovered word changes */
column-set:first-of-type a:hover {
    color: #000000;
    font-weight: 500;
    font-style: italic;
}


/* About view: hide the table header row (# Year Title ...) that sits under the nav */
#view-about-radio:checked ~ column-set:nth-of-type(2) {
    display: none;
}


/* =====================================================================
   OVERRIDES (must stay last)
   ===================================================================== */

/* In Cargo the list preview panel starts level with the table header
   row, i.e. below the nav row plus one blank line. */
.list-view .preview-area {
    top: calc(var(--pad-top) + 2 * var(--fs) * var(--lh));
}

/* Phones: no hover previews, two-up grid */
@media (max-width: 768px) {
    .preview-area { display: none; }
    .grid-view { grid-template-columns: repeat(2, 1fr); }
}


/* =====================================================================
   PHONES (768px and narrower): the home page becomes a tappable list.
   Tap a row to see that project's picture and summary; "View" opens it.
   Markup is built in the Worker; the per-project bits (which picture,
   its size) are generated into the page's <style>.
   ===================================================================== */
.m-home { display: none; }

@media (max-width: 768px) {
    /* hide everything desktop, show the phone version */
    .page > :not(.m-home) { display: none !important; }
    .m-home { display: block; }

    .m-home .hohepa,
    .m-home column-set { line-height: 1.1; }

    .mobile-row-input { display: none; }
    .mobile-row-label {
        display: flex;
        align-items: flex-start;   /* number lines up with the first line of a wrapped title */
        gap: 43px;
        cursor: pointer;
        padding: 0;
        line-height: 1;
    }
    .row-num { width: 30px; }
    .row-title { flex: 1; }
    .view-link {
        opacity: 0;
        pointer-events: none;
        font-size: 12px;
        text-decoration: underline;
        margin-right: 20px;
    }

    /* one picture frame per project, only the selected one is shown */
    .preview-frame {
        display: none;
        position: relative;
        overflow: hidden;
        width: 100%;
        height: 400px;
        margin-top: 40px;
    }
    .preview-frame img {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        object-fit: cover;
        min-width: 100%;
        min-height: 100%;
        max-width: none;
        max-height: none;
    }

    /* summary under the picture */
    .footer-col {
        display: none;
        margin-top: 40px;
        padding-bottom: 40px;
    }
    .footer-col span {
        display: inline-block;
        vertical-align: top;
        line-height: 1.2;
    }
    .footer-label { min-width: 90px; padding-right: 8px; }   /* raise 90px to push the right column further right */
    .footer-value { max-width: 240px; }
}
