/* The dashboard in two steps (home.mjs): home, then Learn, Revise, Exam or Coursework.
   Colours come only from the dashboard's own variables (--gm-*, which every theme sets) and
   the theme's --th-* with the default notebook value behind it, so all themes apply. */

/* ---------- one place at a time ---------- */
.gm-app:not([data-place]) .gm-content > [data-place-in]:not([data-place-in~="home"]),
.gm-app[data-place="home"] .gm-content > [data-place-in]:not([data-place-in~="home"]),
.gm-app[data-place="learn"] .gm-content > [data-place-in]:not([data-place-in~="learn"]),
.gm-app[data-place="revise"] .gm-content > [data-place-in]:not([data-place-in~="revise"]),
.gm-app[data-place="exam"] .gm-content > [data-place-in]:not([data-place-in~="exam"]),
.gm-app[data-place="coursework"] .gm-content > [data-place-in]:not([data-place-in~="coursework"]) {
    display: none !important;
}
/* "Ready for a little progress?" (study-rhythm.mjs) is where a session starts: home only. */
.gm-app[data-place]:not([data-place="home"]) .gm-content > .sr-return { display: none; }
/* Coursework opens on a section: no section gap between the tabs and it. */
.gm-page .gm-app[data-place="coursework"] #gm-agents { margin-top: 0; }

/* ---------- the place tabs: the workspace pages' own index strip, under the header ---------- */
.gm-page .gm-place-index { padding-left: 48px; }
@media (max-width: 760px) { .gm-page .gm-place-index { padding-left: 16px; } }

/* ---------- home: the account at a glance ---------- */
.gm-page .gm-stat-row.gm-home-stats {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    margin-bottom: 28px;
}
@media (max-width: 760px) {
    .gm-page .gm-stat-row.gm-home-stats { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- home: today, in one line ---------- */
/* My Journey, what is due on the timetable and today's question: three cards of one size,
   in the home sheets' look. A panel with nothing to show is hidden; the rest share the row. */
.gm-app[data-place="home"] .gm-home-today {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: 24px;
    align-items: stretch;
    margin-right: 10px;
}
.gm-app[data-place="home"] .gm-home-today > * {
    min-width: 0;
    margin: 0;
    border: 1.5px solid var(--gm-paper-ink);
    border-radius: 16px;
    background: var(--gm-paper-fill);
    box-shadow: var(--gm-paper-slab);
}
/* On Revise the two revision panels stand as they always have; My Journey stays on home. */
.gm-app:not([data-place="home"]) .gm-home-today { display: contents; }
.gm-app:not([data-place="home"]) .gm-home-today .gm-journey-card { display: none; }

/* My Journey as a small card: the level, the way to the next one, the trail. */
.gm-home-today .gm-journey-card:not([hidden]) { display: flex; flex-direction: column; gap: 14px; padding: 22px 24px; }
.gm-home-today .gm-journey-next,
.gm-home-today .gm-journey-latest { display: none; }
.gm-home-today .gm-journey-emblem svg { width: 56px; height: 62px; }
.gm-home-today .gm-journey-foot { margin-top: auto; padding-top: 0; border-top: 0; }
.gm-home-today .gm-journey-go { margin-left: 0; }

/* Due today, sized for the card: the heading, the count, then the way to open it. */
.gm-app[data-place="home"] .gm-home-today .gm-due:not([hidden]) { display: flex; flex-direction: column; }
.gm-app[data-place="home"] .gm-home-today .gm-due-toggle { flex-direction: column; align-items: flex-start; gap: 8px; padding: 22px 24px; flex: 1; }
.gm-app[data-place="home"] .gm-home-today .gm-due-title { font-size: 1.1rem; line-height: 1.3; }
.gm-app[data-place="home"] .gm-home-today .gm-due-action { margin: auto 0 0; padding-top: 4px; }
.gm-app[data-place="home"] .gm-home-today .gm-due-body { padding: 0 24px 20px; }
.gm-app[data-place="home"] .gm-home-today .gm-daily-title { font-size: 1.1rem; }

/* ---------- home: classes beside where to next ---------- */
.gm-page .gm-home-pair {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
    gap: 0 28px;
    align-items: start;
    margin-bottom: 40px;
}

/* ---------- home: from your classes ---------- */
.gm-page .gm-news,
.gm-page .gm-contents {
    border: 1.5px solid var(--gm-paper-ink);
    border-radius: 16px;
    box-shadow: var(--gm-paper-slab);
}
.gm-page .gm-news {
    position: relative;
    margin: 48px 10px 0 0;
    padding: 22px clamp(20px, 3vw, 34px) 10px;
    background: var(--gm-paper-fill);
}
.gm-news-head { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.gm-news-list { display: grid; }
.gm-news-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 6px 24px;
    padding: 16px 4px;
    border-bottom: 1px solid color-mix(in srgb, var(--gm-paper-ink) 16%, transparent);
    color: inherit;
    text-decoration: none;
    transition: background-color 0.18s ease;
}
.gm-news-row:last-child { border-bottom: 0; }
.gm-news-row:hover { background: color-mix(in srgb, var(--gm-gold-soft) 70%, transparent); }
.gm-news-row:focus-visible { outline: 2px solid var(--gm-paper-ink); outline-offset: 2px; }
.gm-news-main { display: grid; gap: 4px; min-width: 0; }
.gm-news-title { font-weight: 700; color: var(--gm-paper-ink); overflow-wrap: anywhere; }
.gm-news-line {
    color: var(--gm-muted);
    font-size: 0.92rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 70ch;
}
.gm-news-side { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 6px 12px; }
.gm-news-meta { color: var(--gm-muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gm-news-row--live .gm-news-title::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 9px;
    border-radius: 50%;
    background: var(--gm-danger, #aa2e25);
    vertical-align: 0.1em;
}
.gm-news-empty { margin: 0; padding: 18px 4px 14px; color: var(--gm-muted); }
.gm-news-empty a { color: var(--gm-paper-ink); font-weight: 700; text-underline-offset: 3px; }
@media (max-width: 760px) {
    .gm-news-row { grid-template-columns: minmax(0, 1fr); }
    .gm-news-side { justify-content: flex-start; }
}

/* ---------- home: where to next, two columns: the place, then its tools ---------- */
.gm-page .gm-contents {
    position: relative;
    margin: 48px 10px 0 0;
    padding: 30px clamp(20px, 3.4vw, 40px) 10px;
    container-type: inline-size;
    background: var(--gm-paper-fill);
}
/* A home sheet's name rides on its top edge, as the Curiosity notebook's tab does. */
.gm-sheet-tab {
    position: absolute;
    top: -17px;
    left: 28px;
    margin: 0;
    padding: 7px 16px;
    border: 1.5px solid var(--gm-paper-ink);
    border-radius: 5px 5px 0 0;
    background: var(--th-sticky, #edcf83);
    color: var(--th-sticky-ink, var(--gm-paper-ink));
    font: 600 14px/1.2 "Space Grotesk", "Hanken Grotesk", sans-serif;
}
.gm-contents-list { list-style: none; margin: 0; padding: 0; }
.gm-contents-item {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    column-gap: clamp(24px, 4vw, 48px);
    align-items: start;
    padding: 30px 0;
}
.gm-contents-item + .gm-contents-item { border-top: 1.5px solid var(--gm-gold); }

/* Left: the place. The whole block opens it. */
.gm-contents-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    color: var(--gm-paper-ink);
    text-decoration: none;
    border-radius: 6px;
}
.gm-contents-name {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font: 800 clamp(1.8rem, 3vw, 2.5rem)/1.05 "Space Grotesk", "Hanken Grotesk", sans-serif;
    letter-spacing: -0.02em;
    transition: color 0.18s ease;
}
.gm-contents-arrow {
    width: 0.65em;
    height: 0.65em;
    flex: none;
    stroke-width: 2.4;
    transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.gm-contents-why { max-width: 46ch; font-size: 1.12rem; line-height: 1.45; text-wrap: pretty; }
/* Revise's line from the timetable: a sticky note under the place. */
.gm-contents-status {
    margin-top: 4px;
    padding: 4px 10px;
    border: 1.5px solid var(--gm-paper-ink);
    border-radius: 4px;
    background: var(--th-sticky, #edcf83);
    color: var(--th-sticky-ink, var(--gm-paper-ink));
    font-weight: 700;
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}
.gm-contents-status.is-due::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--gm-paper-ink);
    vertical-align: 0.08em;
}
.gm-contents-row:hover .gm-contents-name { color: var(--gm-gold-ink); }
.gm-contents-row:hover .gm-contents-arrow,
.gm-contents-row:focus-visible .gm-contents-arrow { transform: translateX(5px); }
.gm-contents-row:focus-visible { outline: 2px solid var(--gm-paper-ink); outline-offset: 6px; }

/* Right: the place's tools, each straight to where it lives. */
.gm-contents-tools {
    list-style: none;
    margin: 0;
    padding: 0 0 0 28px;
    border-left: 2px solid var(--gm-gold-soft);
    min-width: 0;
}
.gm-contents-tool {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 -12px;
    padding: 9px 12px;
    border-radius: 8px;
    color: color-mix(in srgb, var(--gm-paper-ink) 82%, var(--gm-paper-fill));
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.18s ease, color 0.18s ease;
}
.gm-contents-tool-arrow { width: 16px; height: 16px; flex: none; color: var(--gm-gold-ink); stroke-width: 2.2; }
.gm-contents-tool:hover { background: var(--gm-gold-soft); color: var(--gm-paper-ink); }
.gm-contents-tool:focus-visible { outline: 2px solid var(--gm-paper-ink); outline-offset: 1px; }

/* Sized by the card's own width: half the page beside the classes, or all of it. */
@container (max-width: 640px) {
    .gm-contents-item { column-gap: 22px; padding: 24px 0; }
    .gm-contents-name { font-size: 1.7rem; gap: 10px; }
    .gm-contents-why { font-size: 1rem; }
    .gm-contents-tools { padding-left: 18px; }
    .gm-contents-tool { padding: 7px 12px; font-size: 0.95rem; }
}
@container (max-width: 400px) {
    .gm-contents-item { grid-template-columns: minmax(0, 1fr); row-gap: 16px; }
    .gm-contents-tools { padding: 10px 0 0; border-left: 0; border-top: 2px solid var(--gm-gold-soft); }
}

/* ---------- places: the help-card rows (Revise tools, Exam, coursework coaches) ---------- */
.gm-page .gm-stat-row.gm-hub-row,
.gm-page .gm-stat-row.gm-exam-row {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    align-items: stretch;
}
.gm-hub-row .gm-help-card .gm-analyze-go { margin-top: auto; }
.gm-page .gm-stat-row.gm-exam-row { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-bottom: 0; }
/* Room for the GuideMate mascot, which stands on the Coaching Center card's top edge. */
.gm-page .gm-exam-row + .gm-study-transition { padding-bottom: 116px; }
.gm-section .gm-stat-row.gm-hub-row { margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
    .gm-news-row, .gm-contents-name, .gm-contents-arrow, .gm-contents-tool { transition: none; }
}
