/* Home dashboard — rebuild from the asset kit (Nov 7, 2026).
 * Kit palette (web/taleclip-tokens.css) scoped to .tc-home as --tch-* vars.
 * Dark mode matches the target render; light mode falls back to pastel
 * tints so the page stays legible in every theme.
 * NOTE: the 44px min-heights below carry !important because book-studio.css
 * sets .btn, button { min-height: 40px !important; } under 430px; without it
 * the dashboard touch targets render at 40px on phones. tc-home.css loads
 * after book-studio.css, so equal-specificity ties also resolve in its favour.
 * The hero Start Creating button is AMBER (kit primary) — a deliberate,
 * approved override of the Phase 2 violet-CTA rule, hero button only. */
.tc-home {
    --tch-bg: #090e21;
    --tch-panel: #141b35;
    --tch-panel-2: #1b2544;
    --tch-panel-3: #11172d;
    --tch-elevated: #1a2240;
    --tch-border: #354269;
    --tch-border-strong: #6954a4;
    --tch-text: #f5f6ff;
    --tch-muted: #a5b1d0;
    --tch-violet: #b45cff;
    --tch-purple: #8b35f5;
    --tch-blue: #349bff;
    --tch-cyan: #36dceb;
    --tch-amber: #ffc400;
    --tch-green: #20e78a;
    --tch-rose: #e0479e;
    --tch-tone-violet: linear-gradient(135deg, #51258b, #171e3e);
    --tch-tone-blue: linear-gradient(135deg, #1d4e89, #12233d);
    --tch-tone-cyan: linear-gradient(135deg, #0f766e, #0f2a33);
    --tch-tone-rose: linear-gradient(135deg, #7c2d5e, #2a1230);
    --tch-tone-amber: linear-gradient(135deg, #7a4a12, #2a1c0e);
    --tch-tone-purple: linear-gradient(135deg, #4c1d95, #1e1440);
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    min-width: 0;
    padding: 4px 0 28px;
    color: var(--tc-text);
}
[data-theme-mode="light"] .tc-home {
    --tch-panel: #ffffff;
    --tch-panel-2: #f4f0fc;
    --tch-panel-3: #ebe4f8;
    --tch-border: #c9bfe0;
    --tch-border-strong: #a78bfa;
    --tch-text: #1e1b3a;
    --tch-muted: #5b5470;
    --tch-tone-violet: linear-gradient(135deg, rgba(139,53,245,0.20), rgba(139,53,245,0.06));
    --tch-tone-blue: linear-gradient(135deg, rgba(52,155,255,0.20), rgba(52,155,255,0.06));
    --tch-tone-cyan: linear-gradient(135deg, rgba(54,220,235,0.24), rgba(54,220,235,0.07));
    --tch-tone-rose: linear-gradient(135deg, rgba(224,71,158,0.20), rgba(224,71,158,0.06));
    --tch-tone-amber: linear-gradient(135deg, rgba(255,196,0,0.26), rgba(255,196,0,0.07));
    --tch-tone-purple: linear-gradient(135deg, rgba(124,58,237,0.20), rgba(124,58,237,0.06));
}

/* ---- Hero: dark cinematic banner, art full-bleed on the right -----------
   Reference composition: the art spans the right ~60% and bleeds to the
   hero's top, right and bottom edges (no inset frame). Only the copy side
   keeps padding; the art column runs flush to the hero edges. */
.tc-home-hero {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
    gap: 0;
    align-items: stretch;
    border-radius: 20px;
    padding: 0 0 0 28px;
    color: #f5f6ff;
    background:
        linear-gradient(90deg, rgba(9,14,33,0.94) 0%, rgba(9,14,33,0.62) 52%, rgba(9,14,33,0.10) 100%),
        url('/static/img/home/hero_background.svg') center/cover,
        #080e2b;
    border: 1px solid #38427a;
}
.tc-home-hero__copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 28px 24px 28px 0;
}
.tc-home-kicker {
    margin: 0 0 8px;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #c9b8ff;
}
.tc-home-hero__title {
    margin: 0 0 10px;
    font-size: clamp(1.9rem, 1.2rem + 2vw, 2.7rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: #f5f6ff;
}
.tc-home-hero__title-accent {
    background: linear-gradient(90deg, #b45cff, #7c5cff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.tc-home-hero__lead {
    margin: 0 0 18px;
    max-width: 56ch;
    color: #c9d2ea;
    font-size: 1rem;
    line-height: 1.5;
}
.tc-home-hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.tc-home-hero__actions .btn-hero,
.tc-home-hero__actions .btn-hero-outline { min-height: 44px !important; padding: 0 18px; }
/* Amber hero CTA (kit primary). Scoped to the hero only; every other
   generate CTA in the app stays violet per the Phase 2 decision.
   color !important answers light-mode-overrides.css, which forces
   `.page-section button { color: … !important }` and would turn the dark
   label white on the amber gradient. */
.tc-home .tc-home-hero__actions .btn-hero {
    background: linear-gradient(110deg, #ffdc35, #ffb900);
    border: 1px solid #ffe55d;
    color: #111 !important;
    box-shadow: 0 10px 24px -12px rgba(255,185,0,0.65);
}
.tc-home .tc-home-hero__actions .btn-hero:hover {
    background: linear-gradient(110deg, #ffe55d, #ffc400);
    color: #111 !important;
}
.tc-home-hero__actions .btn-hero-outline {
    background: rgba(9,14,33,0.45);
    border: 1px solid #5c638d;
    color: #f5f6ff;
}
.tc-home-hero__art {
    min-width: 0;
    min-height: 220px;
    /* Bleed to the hero edges: square on the copy side, hero radius on
       the outer corners. No inset frame, no shadow. */
    border-radius: 0 20px 20px 0;
    overflow: hidden;
}
.tc-home-hero__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 42%;
}

/* ---- Creation cards: six distinct tones with kit icons ------------------ */
.tc-home-shortcuts {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    min-width: 0;
}
.tc-home-shortcut {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-height: 118px !important;
    min-width: 0;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--tch-border-strong);
    background: var(--tch-tone-violet);
    color: var(--tch-text);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.tc-home-shortcut:hover {
    transform: translateY(-2px);
    border-color: var(--tch-violet);
    box-shadow: 0 12px 28px -14px rgba(139,53,245,0.65);
}
.tc-home-shortcut--violet { background: var(--tch-tone-violet); }
.tc-home-shortcut--blue { background: var(--tch-tone-blue); border-color: #3b82c4; }
.tc-home-shortcut--cyan { background: var(--tch-tone-cyan); border-color: #2bb3a3; }
.tc-home-shortcut--rose { background: var(--tch-tone-rose); border-color: #c44a8a; }
.tc-home-shortcut--amber { background: var(--tch-tone-amber); border-color: #c47f2a; }
.tc-home-shortcut--purple { background: var(--tch-tone-purple); border-color: #8b5cf6; }
.tc-home-shortcut__icon {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
}
/* White icons on the dark tones (reference look). Light mode keeps the
   kit gradient strokes, which read on the pastel tints. */
[data-theme-mode="dark"] .tc-home-shortcut__icon { filter: brightness(0) invert(1); }
.tc-home-shortcut strong { font-size: 0.95rem; line-height: 1.25; }
.tc-home-shortcut span {
    color: var(--tch-muted);
    font-size: 0.82rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
[data-theme-mode="dark"] .tc-home-shortcut span { color: rgba(245,246,255,0.78); }
.tc-home-shortcut:focus-visible,
.tc-home-tool:focus-visible,
.tc-home-card:focus-visible,
.tc-home-link:focus-visible,
.tc-home-hero__actions button:focus-visible,
.tc-home-empty-cta:focus-visible {
    outline: 2px solid var(--tc-primary);
    outline-offset: 2px;
}

/* ---- Layout: projects+recent left, system+tools right ------------------- */
.tc-home-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
    gap: 14px;
    min-width: 0;
}
.tc-home-panel {
    min-width: 0;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--tch-border);
    background: linear-gradient(135deg, var(--tch-panel-2), var(--tch-panel-3));
}
.tc-home-panel--wide { grid-column: 1 / -1; }
.tc-home-panel__head,
.tc-home-queue__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}
.tc-home-panel h2 { margin: 0; font-size: 1.05rem; color: var(--tch-text); }
.tc-home-link {
    min-height: 44px !important;
    padding: 0 10px;
    border: 0;
    background: transparent;
    color: var(--tc-link);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

/* ---- Projects: real book projects, kit art as fallback thumbs ----------- */
.tc-home-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    min-width: 0;
}
.tc-home-card,
.tc-home-recent-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-height: 44px !important;
    min-width: 0;
    padding: 0 0 10px;
    border-radius: 14px;
    border: 1px solid var(--tch-border);
    background: var(--tch-elevated);
    color: inherit;
    text-align: left;
    cursor: pointer;
    font: inherit;
    overflow: hidden;
}
.tc-home-card strong,
.tc-home-recent-card strong { font-size: 0.95rem; padding: 0 10px; }
.tc-home-card em,
.tc-home-recent-card em {
    color: var(--tch-muted);
    font-style: normal;
    font-size: 0.82rem;
    padding: 0 10px;
    overflow-wrap: anywhere;
}
.tc-home-card strong,
.tc-home-recent-card strong,
.tc-home-activity li span,
.tc-home-queue li span { overflow-wrap: anywhere; min-width: 0; }
.tc-home-project__thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    background: var(--tch-panel-2);
}
.tc-home-project strong { padding-top: 10px; }
.tc-home-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
}
.tc-home-empty-cta {
    min-height: 44px !important;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid var(--tch-border-strong);
    background: var(--tch-tone-violet);
    color: var(--tch-text);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

/* ---- System & Engine Status: rows + RAM/GPU rings ----------------------- */
.tc-home-system {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    min-width: 0;
}
.tc-home-engines { display: grid; gap: 8px; flex: 1 1 auto; min-width: 0; }
.tc-home-engine,
.tc-home-activity li,
.tc-home-queue li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    min-height: 44px !important;
    padding: 8px 10px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--tc-bg) 55%, transparent);
}
.tc-home-engine > span:nth-child(2) { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.tc-home-engine strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tc-home-engine__dot {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--tch-muted);
}
.tc-home-engine[data-state="ready"] .tc-home-engine__dot {
    background: var(--tch-green);
    box-shadow: 0 0 8px var(--tch-green);
}
.tc-home-engine[data-state="ready"] strong { color: var(--tch-green); }
.tc-home-engine[data-state="offline"] .tc-home-engine__dot {
    background: var(--tc-danger);
    box-shadow: 0 0 8px var(--tc-danger);
}
.tc-home-engine[data-state="offline"] strong { color: var(--tc-danger); }
.tc-home-engine[data-state="unknown"] strong { color: var(--tch-muted); }
.tc-home-rings {
    display: flex;
    gap: 14px;
    flex: 0 0 auto;
    padding-top: 2px;
}
.tc-home-ring {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
}
.tc-home-ring__wrap {
    position: relative;
    width: 84px;
    height: 84px;
}
.tc-home-ring__svg { display: block; width: 84px; height: 84px; }
.tc-home-ring__track {
    fill: none;
    stroke: color-mix(in srgb, var(--tc-text) 12%, transparent);
    stroke-width: 9;
}
.tc-home-ring__fill {
    fill: none;
    stroke-width: 9;
    stroke-linecap: round;
    stroke-dasharray: 213.6;
    stroke-dashoffset: 213.6;
    transform: rotate(-90deg);
    transform-origin: 42px 42px;
    transition: stroke-dashoffset 0.6s ease;
}
.tc-home-ring__fill--ram { stroke: var(--tch-violet); }
.tc-home-ring__fill--gpu { stroke: var(--tch-blue); }
.tc-home-ring__pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
    color: var(--tch-text);
}
.tc-home-ring__label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--tch-muted);
}
.tc-home-ring__sub {
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    color: var(--tch-muted);
    white-space: nowrap;
}

/* ---- Recent creations: clean thumbnails --------------------------------- */
.tc-home-recent {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
}
.tc-home-recent-card { padding: 0; border: 0; background: transparent; }
.tc-home-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 10px;
    background: var(--tch-panel-2);
    display: block;
}
.tc-home-recent-card:hover .tc-home-thumb {
    outline: 2px solid var(--tch-violet);
    outline-offset: 1px;
}

/* ---- Quick Tools: four icon buttons ------------------------------------- */
.tc-home-tools {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
}
.tc-home-tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 88px !important;
    min-width: 0;
    padding: 12px 8px;
    border-radius: 14px;
    border: 1px solid var(--tch-border);
    background: var(--tch-elevated);
    color: var(--tch-text);
    text-align: center;
    cursor: pointer;
    font: inherit;
    transition: border-color 0.16s ease, background-color 0.16s ease;
}
.tc-home-tool:hover {
    border-color: var(--tch-violet);
    background: color-mix(in srgb, var(--tch-violet) 14%, var(--tch-elevated));
}
.tc-home-tool__icon { font-size: 1.5rem; line-height: 1; }
.tc-home-tool strong {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

/* ---- Activity / Queue (kept from Phase 3) ------------------------------- */
.tc-home-empty, .tc-home-state { color: var(--tch-muted); font-size: 0.92rem; }
.tc-home-state--error { color: var(--tc-warning); }
.tc-home-activity, .tc-home-queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tc-home-queue-scroll { max-height: 280px; overflow: auto; }
.tc-home .btn-hero { min-height: 44px !important; background: var(--tc-primary, #8b35f5); color: var(--tc-primary-text, #fff); }
.tc-home .btn-hero-outline { min-height: 44px !important; }

@media (min-width: 1440px) {
    .tc-home-layout { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr); }
}
@media (max-width: 1440px) {
    /* Right column is narrow here; rings go below the engine list. */
    .tc-home-system { flex-wrap: wrap; }
    .tc-home-rings { margin-left: auto; margin-right: auto; }
}
@media (max-width: 1280px) {
    .tc-home-shortcuts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tc-home-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tc-home-recent { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tc-home-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .tc-home-layout { grid-template-columns: 1fr; }
    .tc-home-hero { grid-template-columns: 1fr; padding: 20px 16px 0; }
    .tc-home-hero__copy { padding: 0; }
    /* Stacked art bleeds to the hero's left, right and bottom edges. */
    .tc-home-hero__art { min-height: 180px; margin: 20px -16px 0; border-radius: 0 0 20px 20px; }
    .tc-home-system { flex-wrap: wrap; }
}
@media (max-width: 768px) {
    .tc-home-layout { grid-template-columns: 1fr; }
    .tc-home-hero__actions .btn-hero,
    .tc-home-hero__actions .btn-hero-outline,
    .tc-home .btn-hero { width: 100%; }
    .tc-home-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
    .tc-home-shortcuts,
    .tc-home-tools,
    .tc-home-cards,
    .tc-home-recent { grid-template-columns: 1fr; }
    .tc-home { gap: 12px; }
}
