/* ==========================================================================
   /study — Study Hub page
   Layout only: the hero, space cards, activity rail and week chart all reuse
   the shared components in study.css. Tokens only, no raw colours.
   ========================================================================== */

/* --- Header ------------------------------------------------------------- */
.st-hub-head-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.st-hub-hint {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 10px; border: 0; border-radius: 8px; background: transparent;
    font-size: 12px; color: var(--st-ink-3);
}
.st-hub-hint:hover { background: var(--st-fill); color: var(--st-ink); }

/* Sync state. Deliberately quiet: it matters only when it goes wrong, so it
   sits below the subtitle at label size rather than competing with it. */
.st-hub-sync { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--st-ink-3); }
.st-hub-sync__text { min-width: 0; }
.st-hub-sync__btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px;
    background: transparent; color: var(--st-ink-3); cursor: pointer;
}
.st-hub-sync__btn:hover { background: var(--st-fill); color: var(--st-ink); }
.st-hub-sync__btn:focus-visible { outline: 2px solid var(--st-focus); outline-offset: 2px; }

/* --- Body frame ---------------------------------------------------------- */
/* `.st-page__inner` is a gapped flex column, so an empty host would still
   reserve a 28px gap — collapse it instead. */
.st-hub-body { display: flex; flex-direction: column; gap: 28px; }
.st-hub-banner-host:empty, .st-hub-hero-host:empty { display: none; }

/* --- Demo-data notice ---------------------------------------------------- */
.st-hub-demo { display: flex; width: 100%; align-items: center; }
.st-hub-demo__text { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.st-hub-demo__close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px;
    background: transparent; color: inherit; cursor: pointer; opacity: 0.7;
}
.st-hub-demo__close:hover { opacity: 1; }
.st-hub-demo__close:focus-visible { outline: 2px solid var(--st-focus); outline-offset: 2px; }

/* --- Three-column body: spaces span two, rail takes one ----------------- */
.st-hub-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; align-items: start; }
.st-hub-spaces { grid-column: span 2; }
.st-hub-space-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* --- Space card --------------------------------------------------------- */
.st-hub-card { padding: 20px; }
.st-hub-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.st-hub-card-id { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.st-hub-card-code { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--st-space, var(--st-accent)); }
.st-hub-card-name { font-size: 20px; line-height: 1.2; }
/* Pushed to the bottom so cards in a row line their footers up. */
.st-hub-card-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: auto; font-size: 12px; color: var(--st-ink-3); }
/* Hover already lifts in the MiDOTs theme; the flat themes need the border. */
.st-hub-card:hover, .st-hub-card:focus-visible { border-color: var(--st-border-strong); }
.st-hub-card:focus-visible { outline: 2px solid var(--st-focus); outline-offset: 3px; transform: var(--st-lift); box-shadow: var(--st-shadow-soft-hover); }

/* The "go and study this" nudge on a board that has never been studied. It is
   text inside the card's own <a>, not a nested link — a link in a link is
   invalid and the whole card already goes to the right place. */
.st-hub-card-cta { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--st-space, var(--st-accent)); }
.st-hub-card:hover .st-hub-card-cta { gap: 6px; }

/* Stand-in for the mastery ring on a space with nothing measured yet. */
.st-hub-card-ring-new {
    width: 52px; height: 52px; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    border: 2px dashed var(--st-border-strong); border-radius: 50%; color: var(--st-ink-4);
}

/* --- "Add a study space" tile -------------------------------------------- */
/* The tile is a container, not a link: adopting an existing board and creating
   a new one are two different destinations, so each gets its own button.
   Soft accent fill + solid primary CTA so it reads as a door, not a ghost. */
.st-hub-new {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; padding: 20px; min-height: 158px; text-align: center;
}
.st-hub-add {
    background: var(--st-accent-soft);
    border-color: var(--st-accent);
    color: var(--st-accent);
}
.st-hub-add:hover, .st-hub-add:focus-within {
    border-color: var(--st-accent);
    background: var(--st-accent-soft);
}
.st-hub-add__icon {
    width: 40px; height: 40px; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--st-accent);
    color: var(--st-on-accent);
    box-shadow: var(--st-shadow-primary);
}
.st-hub-new-title { font-weight: 700; font-size: 14px; color: var(--st-ink); }
.st-hub-new-sub { font-size: 12px; color: var(--st-ink-2); }
.st-hub-add__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

/* --- Rail: recent activity ---------------------------------------------- */
.st-hub-rail { gap: 14px; }
.st-hub-activity-row { align-items: flex-start; }
.st-hub-activity-empty { padding: 16px; font-size: 13px; }

/* --- Rail: this week ----------------------------------------------------- */
.st-hub-week { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.st-hub-week-title { font-size: 13px; font-weight: 700; }
.st-hub-bars { display: flex; align-items: flex-end; gap: 6px; height: 48px; }
.st-hub-bar { flex: 1 1 0; min-height: 3px; border-radius: 3px; background: var(--st-accent); }
/* Today reads as "in progress", so it takes the warm token rather than a
   second shade of accent nobody can tell apart at 12px wide. */
.st-hub-bar--today { background: var(--st-warm); }
.st-hub-bar--future { background: var(--st-border-strong); }
.st-hub-week-foot { font-size: 12px; color: var(--st-ink-2); }

/* --- Loading, first run, error ------------------------------------------- */
/* Boards arrive after the first paint, so the skeleton holds the page's real
   shape: one hero block and a grid of card-sized blocks. */
.st-hub-loading { display: flex; flex-direction: column; gap: 28px; }
.st-hub-hero-skel { height: 96px; border-radius: var(--st-radius-card); }
.st-hub-card-skel { min-height: 158px; border-radius: var(--st-radius-card); }

.st-hub-empty { max-width: 640px; margin: 20px auto; width: 100%; }
.st-hub-error { max-width: 520px; margin: 20px auto; width: 100%; text-align: center; }
.st-hub-error .st-empty__text { margin: 10px 0 18px; }
.st-hub-error .st-btn-row { justify-content: center; }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 1100px) {
    .st-hub-cols { gap: 20px; }
    .st-hub-space-grid { gap: 14px; }
}

@media (max-width: 900px) {
    /* Rail drops below the spaces. */
    .st-hub-cols { grid-template-columns: minmax(0, 1fr); }
    .st-hub-spaces { grid-column: auto; }
    .st-hub-rail { gap: 16px; }
    /* The shortcut is meaningless on the layouts that hide the sidebar. */
    .st-hub-hint { display: none; }
}

@media (max-width: 760px) {
    .st-hub-space-grid { grid-template-columns: minmax(0, 1fr); }
    .st-hub-head-actions { width: 100%; }
    .st-hub-head-actions .st-btn { flex: 1 1 auto; }
    .st-hub-hero .st-btn { flex: 1 1 auto; }
    .st-hub-card-name { font-size: 18px; }
    .st-hub-new { min-height: 0; }
    .st-hub-card-skel { min-height: 130px; }
    /* Full-width buttons inside the tile would fight the head actions above. */
    .st-hub-add__actions .st-btn { flex: 0 0 auto; }
}
