/* Home, the page after signing in (overview/index.php and partials/home/).
   [D75; the mock is docs/mockups/home.html. D77, the ghosts before the
   numbers; its mock is docs/mockups/empty-states.html]

   The classes:

     .home-date          the date over the greeting, as a phone's large
                         title has it
     .home-attention     the words of "N things need your attention." under
                         the greeting, lightly underlined, the link to their
                         page (D81)
     .home, .home-grid   the container its queries ask, and the grid: the
                         last 30 days and the Copilot's card side by side,
                         the top reels and the models under them across the
                         full width; one column below 860 pixels of its
                         own
     .home-head          a modifier of .card-header: the link or word beside
                         the title stays on the title's line on a phone too
     .home-link          that link ("All reels", with its chevron)
     .home-soon          "Soon", outlined, beside the Copilot's title
     .home-month         the last 30 days: .home-choice, the GET form whose
                         .home-pick is the title that is a choice
                         (.home-pick-text, the chevron, and over them
                         .home-pick-select, invisible); the chart is
                         LineChart's bare variant (analytics.css); until
                         there is one, a .ghost-chart filling the card
     .home-copilot       the Copilot's card: .home-copilot-text, an
                         .empty-state, and .home-ask, the field to ask,
                         dashed while it does nothing
     .home-reels-row, .home-reel, .home-reel-handle
                         the top reels, covers (.rl-cover) in one row that
                         scrolls sideways, with their plays (.acc-reel-plays);
                         .home-ghost-covers the room of their ghost
     .home-table, .home-row, .home-row-head, .home-row-link, .home-who,
     .home-who-text, .home-who-name, .home-who-sub, .home-avatar, .home-num,
     .home-num-main, .home-wide
                         the models: rows of few columns, the figures right
                         aligned, the chart's figure alone on a phone, the
                         others (.home-wide) from 640 pixels of the card, a
                         column each, as many as there are (no plays where
                         none are read, D93); .is-unknown the dash of plays
                         not read or not collected yet, and "No link" for
                         visits and clicks (D104); a row's link its name,
                         .home-row-link, stretched over it; .home-ghost-rows
                         the rows' ghost

   Black, white and grey from the tokens; green and red only for a change. */

.home-date {
    margin-bottom: 2px;
    color: var(--color-text-subtle);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

/* The sentence as it was, its words a link only a light underline gives
   away, as the developer chose over a pill on 8 October 2026 (D81). */
.home-attention {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--color-border-strong);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color var(--duration-fast) var(--ease-in-out),
                text-decoration-color var(--duration-fast) var(--ease-in-out);
}

@media (hover: hover) {
    .home-attention:hover {
        color: var(--color-text);
        text-decoration-color: currentColor;
    }
}

/* ------------------------------------------------------------------------
   The grid. Its own width decides, as the sidebar takes its share.
   ------------------------------------------------------------------------ */

.home {
    container: home / inline-size;
}

.home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "month" "copilot" "reels" "models";
    gap: var(--space-4);
    align-items: start;
}

.home-month { grid-area: month; }
.home-copilot { grid-area: copilot; }
.home-reels { grid-area: reels; }
.home-models { grid-area: models; }

@container home (min-width: 860px) {
    .home-grid {
        grid-template-columns: minmax(0, 1fr) 320px;
        grid-template-areas: "month copilot" "reels reels" "models models";
        gap: var(--space-5);
    }

    /* The Copilot's card is as tall as the month's. */
    .home-grid > .home-copilot {
        align-self: stretch;
    }
}

@container home (min-width: 1040px) {
    .home-grid {
        grid-template-columns: minmax(0, 1fr) 340px;
    }
}

/* ------------------------------------------------------------------------
   What the cards share
   ------------------------------------------------------------------------ */

.home-head {
    flex-wrap: nowrap;
    align-items: center;
}

.home-head > :first-child {
    flex: 1 1 auto;
}

.home-head .card-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.home-head .card-title .icon {
    width: 18px;
    height: 18px;
}

.home-link {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 2px;
    margin-right: -4px;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    text-decoration: none;
}

.home-link .icon {
    width: 16px;
    height: 16px;
}

@media (hover: hover) {
    .home-link:hover {
        color: var(--color-text);
    }
}

.home-soon {
    flex: none;
    padding: 1px 8px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-full);
    color: var(--color-text-subtle);
    font-size: 11px;
    font-weight: var(--weight-medium);
    line-height: 16px;
}

/* ------------------------------------------------------------------------
   The last 30 days
   ------------------------------------------------------------------------ */

/* A column, so that until there is a chart its ghost fills the card. */
.home-month {
    display: flex;
    flex-direction: column;
}

.home-month .card-body {
    padding-top: var(--space-4);
}

.home-month > .ghost-chart {
    flex: 1;
    min-height: 360px;
}

.home-choice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
}

/* "Plays" with its chevron in the card title's type; the select lies over
   it, invisible, so a phone opens its own picker. A ring only for the
   keyboard: a click or a tap shows none. */
.home-pick {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    margin: -4px -8px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    letter-spacing: -0.015em;
    line-height: var(--leading-tight);
}

.home-pick .icon {
    flex: none;
    width: 18px;
    height: 18px;
    color: var(--color-text-subtle);
}

.home-pick-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-pick-select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    /* 16 pixels, so a phone does not zoom into it. */
    font-size: var(--text-md);
    cursor: pointer;
}

@media (hover: hover) {
    .home-pick:hover {
        background: var(--color-surface-hover);
    }

    .home-pick:hover .icon {
        color: var(--color-text);
    }
}

.home-pick:has(.home-pick-select:focus-visible) {
    outline: 2px solid var(--color-focus);
    outline-offset: 0;
}

.home-choice + .card-description {
    margin-top: 2px;
}

/* ------------------------------------------------------------------------
   The Copilot's card
   ------------------------------------------------------------------------ */

.home-copilot {
    display: flex;
    flex-direction: column;
}

.home-copilot-text {
    flex: 1;
    justify-content: center;
    padding: var(--space-8) var(--space-5) var(--space-4);
}

.home-ask {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 40px;
    margin: 0 var(--space-5) var(--space-5);
    padding: 0 var(--space-3);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-sm);
    color: var(--color-text-subtle);
    font-size: var(--text-sm);
}

.home-ask .icon {
    flex: none;
    width: 16px;
    height: 16px;
}

@media (min-width: 640px) {
    .home-ask {
        margin: 0 var(--space-6) var(--space-6);
    }
}

/* ------------------------------------------------------------------------
   Top reels: covers in one row that scrolls sideways
   ------------------------------------------------------------------------ */

/* Positioned, so the row clips the screen reader's words of its reels,
   placed absolutely, instead of the page growing sideways (found 16
   October 2026, with the sidebar open). */
.home-reels-row {
    position: relative;
    display: flex;
    gap: 10px;
    margin-top: var(--space-4);
    padding: 0 var(--space-5) var(--space-5);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline: var(--space-5);
    scrollbar-width: thin;
    list-style: none;
}

.home-reels-row > li {
    flex: none;
    width: 112px;
    scroll-snap-align: start;
}

.home-reel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: inherit;
    text-decoration: none;
}

/* The cover's own look, everywhere the same (reels.css, D101); under the
   pointer its ring darkens, as a field's border does. */
@media (hover: hover) {
    .home-reel:hover .rl-cover {
        --color-cover-ring: var(--color-control-border-hover);
    }
}

.home-reel-handle {
    overflow: hidden;
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Their ghost, with the room the row has in the card. */
.home-ghost-covers {
    margin-top: var(--space-4);
    padding: 0 var(--space-5) var(--space-5);
}

@media (min-width: 640px) {
    .home-reels-row {
        gap: 12px;
        padding: 0 var(--space-6) var(--space-6);
        scroll-padding-inline: var(--space-6);
    }

    .home-reels-row > li {
        width: 124px;
    }

    .home-ghost-covers {
        padding: 0 var(--space-6) var(--space-6);
    }
}

/* ------------------------------------------------------------------------
   Models: who carries the week
   ------------------------------------------------------------------------ */

.home-models {
    container: home-models / inline-size;
}

.home-table {
    margin-top: var(--space-4);
    list-style: none;
}

.home-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-columns: auto;
    grid-auto-flow: column;
    align-items: center;
    gap: var(--space-4);
    min-height: 60px;
    padding: 10px var(--space-5);
    border-top: 1px solid var(--color-border);
    color: inherit;
    text-decoration: none;
}

.home-row-head {
    min-height: 0;
    padding-block: 8px;
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
}

/* A model's row leads to its numbers as a whole: its name is the link,
   stretched over the row, so the triangle after its plays can lie over it
   as a button of its own (D104). The row shows the link's hover and its
   keyboard focus, never a ring on a click (D102). */
li.home-row {
    position: relative;
}

.home-row-link {
    color: inherit;
    text-decoration: none;
}

.home-row-link::after {
    content: '';
    position: absolute;
    inset: 0;
}

.home-row-link:focus-visible {
    outline: none;
}

.home-row:has(.home-row-link:focus-visible) {
    outline: 2px solid var(--color-focus);
    outline-offset: -2px;
}

.home-row .an-inc {
    z-index: 1;
}

@media (hover: hover) {
    .home-row:has(.home-row-link:hover) {
        background: var(--color-surface-hover);
    }
}

.home-who {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.home-who-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.home-who-name {
    overflow: hidden;
    font-weight: var(--weight-medium);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-who-sub {
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
}

.home-avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
}

.home-num {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.home-num-main {
    font-weight: var(--weight-medium);
}

/* Plays no read has read yet: the dash, quiet. */
.home-num-main.is-unknown {
    color: var(--color-text-subtle);
    font-weight: var(--weight-normal);
}

.home-num .an-change {
    font-size: 11.5px;
}

/* The rows' ghost: a name of a name's length, a bar for each figure. */
.home-ghost-rows {
    list-style: none;
}

.home-ghost-rows .ghost-lines > .ghost-bar {
    width: 64px;
}

.home-ghost-rows .ghost-lines > .ghost-bar-sm {
    width: 48px;
}

.home-ghost-rows > li:nth-child(2) .ghost-lines > .ghost-bar {
    width: 52px;
}

.home-ghost-rows > li:nth-child(2) .ghost-lines > .ghost-bar-sm {
    width: 40px;
}

.home-ghost-rows > li:nth-child(3) .ghost-lines > .ghost-bar {
    width: 70px;
}

.home-ghost-rows > li:nth-child(3) .ghost-lines > .ghost-bar-sm {
    width: 44px;
}

.home-num > .ghost-bar {
    width: 44px;
}

/* On a phone the chart's figure alone; the others from a wider card. */
.home-wide {
    display: none;
}

@media (min-width: 640px) {
    .home-row {
        padding-inline: var(--space-6);
    }
}

@container home-models (min-width: 640px) {
    .home-row {
        grid-auto-columns: 112px;
    }

    .home-wide {
        display: flex;
    }

    .home-row-head .home-wide {
        display: block;
    }
}
