/* =============================================================================
   Home — the gallery floor.
   Below the hero, the collection hangs left-anchored: one featured frame
   (the newest work with its wall label), a ledger of recent writing, slips
   from the notes cabinet, and three project frames in an uneven hang.
   ============================================================================= */

/* ---- Room shell: plate row with a rule running to the door --------------- */
.home-featured,
.home-room {
    padding-block: clamp(2.25rem, 6vh, 4rem);
}

/* ---- Featured frame: image on the wall, label beside it ------------------ */
.featured-frame {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    background: var(--bg-secondary);
    transition: border-color 0.3s ease;
}

.featured-frame:not(:has(.featured-media)) {
    grid-template-columns: 1fr;
}

.featured-frame:hover {
    border-color: var(--border-light);
}

.featured-media {
    position: relative;
    margin: 0;
    min-height: clamp(240px, 30vw, 420px);
    border-right: 1px solid var(--border-color);
}

.featured-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    border-radius: 0;
    filter: grayscale(55%) contrast(1.04);
    transition:
        filter 0.5s ease,
        transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.featured-frame:hover .featured-media img {
    filter: grayscale(0%) contrast(1);
    transform: scale(1.025);
}

.featured-label {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: clamp(1.5rem, 3vw, 2.75rem);
}

.featured-date {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-xs);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease;
}

.featured-frame:hover .featured-date {
    color: var(--accent-warm);
}

.featured-title {
    margin: 0;
    font-family: var(--font-family-display);
    font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem);
    font-weight: 280;
    letter-spacing: 0.01em;
    line-height: 1.25;
    color: var(--text-primary);
    text-wrap: balance;
}

.featured-desc {
    margin: 0;
    font-size: var(--font-size-md);
    line-height: 1.6;
    color: var(--text-secondary);
    letter-spacing: var(--tracking-snug);
    text-wrap: pretty;
    max-width: 40ch;
}

.featured-cta {
    margin-top: var(--spacing-sm);
    font-family: var(--font-family-mono);
    font-size: var(--font-size-x-small);
    letter-spacing: var(--tracking-widest);
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.25rem;
    transition:
        color 0.25s ease,
        border-color 0.25s ease;
}

.featured-frame:hover .featured-cta {
    color: var(--text-primary);
    border-bottom-color: var(--accent-warm);
}

@media (max-width: 768px) {
    .featured-frame {
        grid-template-columns: 1fr;
    }

    .featured-media {
        min-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .featured-label {
        padding: var(--spacing-lg);
    }
}

/* ---- Writing ledger: date key on the left, work on the right ------------- */
.home-ledger {
    list-style: none;
    margin: 0;
    padding: 0;
}

.home-ledger > li {
    margin: 0;
    padding-left: 0;
}

.home-ledger > li::before {
    display: none;
}

.ledger-row {
    display: grid;
    grid-template-columns: 9.5rem minmax(0, 1fr);
    gap: var(--spacing-lg);
    align-items: baseline;
    padding: clamp(0.9rem, 2.2vh, 1.35rem) var(--spacing-sm);
    border-radius: 2px;
    position: relative;
}

/* A wash of light comes in from the left on hover */
.ledger-row::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(var(--glow), 0.045),
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.45s ease;
    pointer-events: none;
    border-radius: inherit;
}

.ledger-row:hover::before,
.ledger-row:focus-visible::before {
    opacity: 1;
}

.ledger-key {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-xs);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.ledger-row:hover .ledger-key {
    color: var(--accent-warm);
}

.ledger-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.ledger-title {
    font-family: var(--font-family-display);
    font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.35rem);
    font-weight: 320;
    letter-spacing: 0.01em;
    line-height: 1.35;
    color: var(--text-secondary);
    text-wrap: balance;
    transition: color 0.3s ease;
}

.ledger-row:hover .ledger-title {
    color: var(--text-primary);
}

.ledger-desc {
    font-size: var(--font-size-sm);
    line-height: 1.55;
    color: var(--text-muted);
    letter-spacing: var(--tracking-snug);
    max-width: 58ch;
    text-wrap: pretty;
}

@media (max-width: 768px) {
    .ledger-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
        padding-inline: 0;
    }
}

/* ---- Note slips: three cards from the cabinet ----------------------------- */
.home-slips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: var(--spacing-md);
}

.home-slips > li {
    margin: 0;
    padding-left: 0;
}

.home-slips > li::before {
    display: none;
}

.slip-link {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    height: 100%;
    padding: var(--spacing-lg);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: transparent;
    transition:
        border-color 0.3s ease,
        background-color 0.3s ease;
}

.slip-link:hover {
    border-color: var(--border-light);
    background: var(--bg-secondary);
}

.slip-cat {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-xs);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.slip-link:hover .slip-cat {
    color: var(--accent-warm);
}

.slip-title {
    font-family: var(--font-family-display);
    font-size: var(--font-size-lg);
    font-weight: 320;
    letter-spacing: 0.01em;
    line-height: 1.4;
    color: var(--text-secondary);
    text-wrap: balance;
    transition: color 0.3s ease;
}

.slip-link:hover .slip-title {
    color: var(--text-primary);
}

/* ---- Project frames: one large work, two beside it ------------------------ */
.home-projects {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    grid-auto-rows: clamp(9rem, 15vw, 12.5rem);
    gap: var(--spacing-md);
}

.project-tile {
    position: relative;
    display: block;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: var(--bg-secondary);
    transition: border-color 0.3s ease;
}

.project-tile--tall {
    grid-row: span 2;
}

.project-tile:hover {
    border-color: var(--border-light);
}

.tile-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    border-radius: 0;
    filter: grayscale(60%) contrast(1.04);
    transition:
        filter 0.5s ease,
        transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-tile:hover .tile-image {
    filter: grayscale(0%) contrast(1);
    transform: scale(1.035);
}

.tile-scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(1, 1, 2, 0.9) 0%,
        rgba(1, 1, 2, 0.45) 45%,
        transparent 75%
    );
    pointer-events: none;
}

.tile-body {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: var(--spacing-lg);
}

.tile-title {
    font-family: var(--font-family-display);
    font-size: var(--font-size-xl);
    font-weight: 500;
    letter-spacing: var(--tracking-snug);
    color: var(--text-primary);
}

.tile-desc {
    font-size: var(--font-size-x-small);
    line-height: 1.5;
    color: rgba(var(--glow), 0.72);
    letter-spacing: var(--tracking-snug);
}

.tile-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
    font-family: var(--font-family-mono);
    font-size: var(--font-size-xs);
    letter-spacing: var(--tracking-wide);
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.tile-meta svg {
    width: 0.8em;
    height: 0.8em;
    opacity: 0.7;
}

/* sapi contract: hide the star entirely until the live value arrives */
.tile-meta:has([data-sapi-star]:empty) {
    display: none;
}

@media (max-width: 768px) {
    .home-projects {
        grid-template-columns: 1fr;
        grid-auto-rows: clamp(11rem, 42vw, 15rem);
    }

    .project-tile--tall {
        grid-row: auto;
    }
}

/* ---- Motion restraint ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    .featured-media img,
    .tile-image,
    .ledger-row::before {
        transition: none;
    }

    .featured-frame:hover .featured-media img,
    .project-tile:hover .tile-image {
        transform: none;
    }
}
