/* Tasks page (/tasks). Same surfaces as the Checklist and Inventory: themed page, white panels,
   blue ink; Onix / Ash through the garam_dark.css tokens. */
html:has(.garam-tasks-page), body:has(.garam-tasks-page) {
    background-color: var(--garam-theme-surface, #d2edfe) !important; background-image: none !important;
}
.garam-tasks-page {
    --task-ink: var(--garam-c-123c5c, #123c5c);
    --task-muted: var(--garam-c-527f99, #527f99);
    --task-border: var(--garam-c-bbdef5, #bbdef5);
    --task-soft: var(--garam-c-f0f9ff, #f0f9ff);
    --task-accent: var(--garam-theme-ui-accent, var(--garam-theme-accent, #087cce));
    min-height: 75vh; width: 100%; box-sizing: border-box; padding: 24px 16px 52px;
    color: var(--task-ink); font-family: inherit;
}
.garam-tasks-page *, .garam-tasks-page *::before, .garam-tasks-page *::after { box-sizing: border-box; }
.garam-tasks-page [hidden] { display: none !important; }
.tasks-layout { max-width: 1240px; width: 100%; margin: 0 auto; }
/* style.css makes every <header> a fixed flex row: this one is an ordinary block. */
.garam-tasks-page header.tasks-hero { display: block; position: relative; isolation: isolate; text-align: center; padding: 44px 12px 48px; }
.tasks-hero::before {
    content: ""; position: absolute; inset: 0; z-index: -1; opacity: .28; pointer-events: none;
    background: radial-gradient(var(--garam-c-86c7ed, #86c7ed) 1px, transparent 1px); background-size: 22px 22px;
    mask-image: linear-gradient(to bottom, black 20%, transparent 95%);
}
.tasks-title { margin: 0; color: #fff; font-size: clamp(32px, 6vw, 76px); font-weight: 700; letter-spacing: -.045em; line-height: 1.1; }
.tasks-intro { max-width: 620px; margin: 17px auto 0; color: #fff; font-size: 16px; line-height: 1.55; }

.tasks-summary {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px 20px; padding: 20px 24px;
    background: #fff; border: 1px solid var(--task-border); border-radius: 24px; box-shadow: 0 14px 30px rgba(21,99,153,.12);
}
.tasks-summary-copy { flex: 1; min-width: 220px; }
.tasks-summary-copy h2 { margin: 0 0 5px; font-size: clamp(18px, 2.2vw, 22px); font-weight: 700; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.tasks-summary-copy p { margin: 0; color: var(--task-muted); font-size: 14px; line-height: 1.5; }
.tasks-summary-copy p:empty { display: none; }
.tasks-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.tasks-filter {
    display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 8px 14px; border-radius: 13px;
    border: 1px solid var(--garam-c-a9cfea, #a9cfea); background: #fff; color: var(--garam-c-155a8d, #155a8d);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.tasks-filter span { padding: 1px 7px; border-radius: 99px; background: var(--task-soft); font-size: 12px; font-variant-numeric: tabular-nums; }
.tasks-filter span:empty { display: none; }
.tasks-filter:hover { background: var(--garam-c-e5f5ff, #e5f5ff); }
.tasks-filter[aria-pressed="true"] { border-color: var(--garam-c-0764a6, #0764a6); background: var(--garam-c-087cce, #087cce); color: #fff; }
.tasks-filter[aria-pressed="true"] span { background: rgb(255 255 255 / 22%); color: #fff; }
.tasks-filter:focus-visible, .task-claim:focus-visible { outline: 3px solid var(--garam-c-178fda, #178fda); outline-offset: 2px; }

.tasks-status { margin: 14px 0 0; padding: 11px 14px; border-radius: 13px; font-size: 14px; font-weight: 500; line-height: 1.5;
    background: #fff; border: 1px solid var(--task-border); color: var(--task-ink); }
.tasks-status[data-tone="success"] { background: #e8f8ef; color: #17663b; border-color: #a9dfbf; }
.tasks-status[data-tone="error"] { background: #fdecef; color: #9b1f35; border-color: #f3b9c4; }
.tasks-status a { color: inherit; font-weight: 600; }

.tasks-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 17px; align-items: stretch; }
.tasks-empty { grid-column: 1 / -1; padding: 55px 15px; border: 1px dashed var(--task-border); border-radius: 17px; text-align: center;
    color: var(--task-muted); }
.tasks-empty strong { font-size: 16px; font-weight: 600; }
.task-card { display: flex; flex-direction: column; min-width: 0; padding: 16px; border-radius: 20px; background: #fff;
    border: 1px solid var(--task-border); box-shadow: 0 10px 24px rgba(21,99,153,.08); }
.task-card.is-ready { border-color: var(--task-accent); box-shadow: 0 0 0 2px var(--task-accent), 0 10px 24px rgba(21,99,153,.12); }
.task-card.is-done { background: var(--task-soft); box-shadow: none; }
.task-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.task-card-head h3 { margin: 0; min-width: 0; font-size: 16px; font-weight: 700; letter-spacing: -.02em; line-height: 1.3; overflow-wrap: anywhere; }
.task-state { flex-shrink: 0; padding: 4px 9px; border-radius: 99px; background: var(--task-soft); color: var(--task-muted);
    font-size: 12px; font-weight: 600; white-space: nowrap; }
.task-card.is-ready .task-state { background: var(--task-accent); color: #fff; }
.task-card.is-done .task-state { background: #e8f8ef; color: #17663b; }
.task-card.is-locked .task-state { background: #fff6e2; color: #7a5300; }
.task-requirement { margin: 10px 0 0; font-size: 14px; line-height: 1.5; }
.task-how { margin: 3px 0 0; color: var(--task-muted); font-size: 12px; line-height: 1.45; }
.task-bar { height: 10px; margin-top: auto; border-radius: 99px; overflow: hidden; background: var(--task-soft); border: 1px solid var(--task-border); }
/* The bar sits at the bottom of the text, so the bars of a row line up; the text keeps a gap over it. */
.task-card > p:has(+ .task-bar) { margin-bottom: 14px; }
/* Only the transform changes while it fills. */
.task-bar span { display: block; height: 100%; border-radius: 99px; background: var(--task-accent); transform-origin: left center; }
.task-card.is-done .task-bar span { background: #1f9d6b; }
.task-count { margin: 6px 0 0; color: var(--task-muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.task-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px;
    border-top: 1px solid var(--task-border); }
.task-reward { display: flex; align-items: center; gap: 9px; min-width: 0; }
.task-reward img { display: block; width: 40px; height: 40px; flex: 0 0 40px; object-fit: contain; }
.task-reward-emoji { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; font-size: 24px; }
.task-reward-text { display: flex; flex-direction: column; min-width: 0; }
.task-reward-text small { color: var(--task-muted); font-size: 12px; }
.task-reward-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.task-claim { flex-shrink: 0; min-height: 40px; padding: 8px 16px; border-radius: 13px; border: 1px solid var(--garam-c-0764a6, #0764a6);
    background: var(--garam-c-087cce, #087cce); color: #fff; box-shadow: 0 4px 0 var(--garam-c-075a91, #075a91);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: transform .15s ease, filter .15s ease; }
.task-claim:hover:not(:disabled) { filter: brightness(.95); }
.task-claim:active:not(:disabled) { transform: translateY(1px); }
.task-claim:disabled { opacity: .5; cursor: default; }
.task-done-mark { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; background: #1f9d6b;
    color: #fff; font-size: 16px; font-weight: 700; }
.task-locked-note { margin: 10px 0 0; padding: 8px 11px; border-radius: 11px; background: #fff6e2; border: 1px solid #f0d58e; color: #7a5300;
    font-size: 12px; line-height: 1.45; }
/* A task was just claimed: one small pop. */
.task-card.is-just-claimed { animation: task-pop .4s var(--garam-ease-out, ease-out); }
@keyframes task-pop { 40% { transform: scale(1.03); } }

html[data-garam-mode="dark"] .garam-tasks-page {
    --task-ink: var(--garam-dark-text, #f3f4f7); --task-muted: var(--garam-dark-muted, #a5a8b2);
    --task-border: var(--garam-dark-border, #45464d); --task-soft: var(--garam-dark-raised, #34353c);
}
html[data-garam-mode="dark"] .tasks-summary,
html[data-garam-mode="dark"] .task-card,
html[data-garam-mode="dark"] .tasks-status:not([data-tone]),
html[data-garam-mode="dark"] .tasks-status[data-tone=""] { background: var(--garam-dark-panel, #23242a); }
html[data-garam-mode="dark"] .task-card.is-done { background: var(--garam-dark-raised, #34353c); }
html[data-garam-mode="dark"] .tasks-filter:not([aria-pressed="true"]) { background: var(--garam-dark-raised, #34353c); color: var(--garam-dark-text, #f3f4f7);
    border-color: var(--garam-dark-border, #45464d); }
html[data-garam-mode="dark"] .tasks-filter span { background: var(--garam-dark-panel, #23242a); }
/* Filled with the accent in the light themes; the dark accent is close to white, so white text on it could not be read. */
html[data-garam-mode="dark"] .tasks-filter[aria-pressed="true"],
html[data-garam-mode="dark"] .task-claim { background: var(--garam-dark-hover, #3d3e46); border-color: var(--garam-theme-ui-accent, #c8cad2);
    color: var(--garam-dark-text, #f3f4f7); box-shadow: none; }
html[data-garam-mode="dark"] .tasks-filter[aria-pressed="true"] span { background: var(--garam-dark-panel, #23242a); color: var(--garam-dark-text, #f3f4f7); }
html[data-garam-mode="dark"] .task-card.is-ready .task-state { background: var(--garam-dark-text, #f3f4f7); color: var(--garam-dark-panel, #23242a); }
html[data-garam-mode="dark"] .task-card.is-done .task-state { background: rgb(47 181 127 / 16%); color: #5fd3a8; }
html[data-garam-mode="dark"] .task-card.is-locked .task-state,
html[data-garam-mode="dark"] .task-locked-note { background: rgb(227 160 8 / 12%); border-color: rgb(227 160 8 / 45%); color: #f1c76a; }
html[data-garam-mode="dark"] .tasks-status[data-tone="success"] { background: rgb(47 181 127 / 12%); color: #5fd3a8; border-color: rgb(47 181 127 / 40%); }
html[data-garam-mode="dark"] .tasks-status[data-tone="error"] { background: rgb(239 68 88 / 12%); color: #ff9aa8; border-color: rgb(239 68 88 / 40%); }

@media (max-width: 1100px) { .tasks-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px) { .tasks-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 740px) {
    .garam-tasks-page { padding: 12px 9px 32px; }
    .garam-tasks-page header.tasks-hero { padding: 28px 9px 34px; }
    .tasks-title { font-size: clamp(32px, 7vw, 50px); }
    .tasks-intro { margin-top: 16px; font-size: 14px; }
    .tasks-summary { padding: 16px; border-radius: 18px; }
    .tasks-filters { width: 100%; }
    .tasks-filter { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 520px) {
    .tasks-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    .task-claim { transition: none; }
    .task-card.is-just-claimed { animation: none; }
}
