/*
 * One dark, quiet page. Colour carries meaning and nothing else does:
 *   --c      whoever owns the thing it is set on (a person, or gold for shared)
 *   amber / red   a deadline that is getting close
 * Everything else is greys, and anything that is only a control (.hover) is
 * invisible until the pointer is on its row.
 */

:root {
    --bg: #0e1016;
    --panel: #161922;
    --line: #262b38;
    --text: #e8eaf0;
    --muted: #7d8395;
    --ok: #68d391;
    --soon: #f6ad55;
    --urgent: #fc8181;
    --c: #f6c453;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
}

* { box-sizing: border-box; }

body { margin: 0; min-height: 100vh; background: var(--bg); }

h1, h2, h3, h4, p, ul { margin: 0; padding: 0; font-size: inherit; font-weight: inherit; }
ul { list-style: none; }
small, .muted { color: var(--muted); font-size: 12px; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }

input {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 4px 9px;
    min-width: 0;
    color-scheme: dark;
}
input::placeholder { color: var(--muted); }
input:focus { outline: none; border-color: var(--c); }

/* --- the way in ---------------------------------------------------------- */

.gate {
    max-width: 300px;
    margin: 20vh auto 0;
    padding: 0 16px;
    display: grid;
    gap: 14px;
    text-align: center;
}
.gate h1 { font-size: 26px; font-weight: 700; }
.gate input { padding: 10px 12px; text-align: center; }
.gate .err { color: var(--urgent); }
.who-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.primary { background: var(--c); color: #111; font-weight: 700; padding: 10px 14px; border-radius: 9px; }
.primary:hover { filter: brightness(1.08); }

/* --- the top bar --------------------------------------------------------- */

.top {
    max-width: 1320px;
    margin: 0 auto;
    padding: 18px 20px 0;
    display: flex;
    align-items: center;
    gap: 14px;
}
.brand { font-weight: 700; margin-right: auto; }
.streak { color: var(--muted); font-variant-numeric: tabular-nums; filter: grayscale(1); cursor: default; }
.streak.lit { color: var(--text); filter: none; }

.quiet { color: var(--muted); font-size: 13px; padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.quiet:hover { color: var(--text); }
.top .quiet[style] { color: var(--c); }
.del.armed { color: #111; background: var(--urgent); }

/* --- what is due --------------------------------------------------------- */

.due {
    max-width: 1320px;
    margin: 0 auto;
    padding: 18px 20px 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 4px 24px;
}
.due-row {
    display: flex; align-items: baseline; gap: 8px;
    min-width: 0;
    padding: 2px 0 2px 9px;
    border-left: 2px solid var(--c);
    text-align: left;
}
.due-row .chip { flex: none; min-width: 5.5em; }
.due-row small { flex: 1 1 0; min-width: 0; }
.due-title, .due-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-row:hover .due-title { color: var(--c); }
.due + .board { padding-top: 48px; }

/* --- the board ----------------------------------------------------------- */

/* Three columns that read as three: wide gutters, with a rule down each. */
.board {
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px 20px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: calc(100vh - 60px);
}
.lane { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-content: start; padding: 0 36px; }
.lane:first-child { padding-left: 0; }
.lane:last-child { padding-right: 0; }
.lane + .lane { border-left: 1px solid var(--line); }
.lane h2 { font-size: 15px; font-weight: 700; color: var(--c); }
.lane > :first-child { min-height: 26px; margin-bottom: 8px; }

.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.cards:empty { display: none; }

.person-head { display: flex; align-items: center; gap: 10px; }
.person-head .meter { flex: 1; max-width: 140px; }

.meter { display: block; height: 3px; background: var(--line); border-radius: 99px; overflow: hidden; }
.meter i {
    display: block;
    height: 100%;
    width: 0;
    background: var(--c);
    border-radius: 99px;
    transition: width 0.5s ease-out;
}

/* --- a goal -------------------------------------------------------------- */

.goal {
    background: var(--panel);
    border-radius: 12px;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}
.goal.done .meter i { background: var(--ok); }
.goal > header { cursor: grab; }
.goal.dragging { opacity: 0.4; }
.lane.drop { background: color-mix(in srgb, var(--c) 8%, transparent); border-radius: 12px; }

.row { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
h3.title { font-size: 16px; font-weight: 650; }
h4.title { font-size: 13px; font-weight: 600; color: var(--muted); }

.ms { display: grid; grid-template-columns: minmax(0, 1fr); margin-top: 4px; }
.fold { flex: none; width: 14px; margin-left: -2px; color: var(--muted); font-size: 15px; line-height: 1; text-align: left; }
.fold:hover { color: var(--text); }
.ms .tick { color: var(--ok); font-weight: 700; font-size: 13px; }

.item { padding-left: 1px; }
.item.done .title, .leaf.done > .row > .title { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }

.check {
    flex: none;
    width: 18px; height: 18px;
    border: 1.5px solid var(--muted);
    border-radius: 5px;
    display: grid; place-items: center;
    transition: border-color 0.12s, background 0.12s;
}
.check:hover { border-color: var(--c); }
.check[aria-checked='true'] { background: var(--c); border-color: var(--c); }
.check[aria-checked='true']::after {
    content: '';
    width: 4px; height: 9px;
    border: solid #111;
    border-width: 0 2px 2px 0;
    transform: translateY(-1px) rotate(45deg);
}

.who {
    flex: none;
    width: 18px; height: 18px;
    border: 1.5px solid var(--c);
    border-radius: 99px;
    color: var(--c);
    font-size: 10px; font-weight: 700; line-height: 1;
    display: grid; place-items: center;
}
.who.hover { color: var(--muted); border-color: var(--muted); }

.chip { font-size: 12px; white-space: nowrap; color: var(--muted); padding: 0 2px; }
.chip.soon { color: var(--soon); }
.chip.urgent, .chip.late { color: var(--urgent); }
.chip.late { font-weight: 700; }
.chip:hover { color: var(--text); }

.adder { justify-self: start; color: var(--muted); font-size: 13px; padding: 2px 0; }
.adder:hover { color: var(--c); }
.add { display: flex; }
.add input { flex: 1; }
input.editing { flex: 1; min-width: 80px; }

/* Controls that exist only while the pointer is on their row or card. */
.hover { opacity: 0; transition: opacity 0.12s; }
.row:hover > .hover, .hover:focus-visible, .del.armed { opacity: 1; }
@media (hover: none) { .hover { opacity: 0.5; } }

.drawer summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.drawer[open] summary { margin-bottom: 10px; }
.drawer .goal { opacity: 0.7; }

/* --- celebrations: small on purpose -------------------------------------- */

#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }

#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 22; display: grid; gap: 6px; justify-items: center; pointer-events: none; }
.toast {
    max-width: min(360px, calc(100vw - 32px));
    padding: 7px 14px;
    border-radius: 99px;
    font-size: 13px;
    background: var(--panel);
    border: 1px solid var(--line);
    animation: fade-in 0.2s ease-out;
    transition: opacity 0.4s;
}
.toast.leaving { opacity: 0; }

.item.fresh .check, .leaf.fresh > .row > .check { animation: pop 0.3s ease-out; }
.goal.flash { animation: flash 1.2s ease-out; }

@keyframes pop { 0% { transform: scale(0.8); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 2px var(--c); } 100% { box-shadow: 0 0 0 2px transparent; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }

/* --- narrow screens ------------------------------------------------------ */

@media (max-width: 900px) {
    .board { grid-template-columns: minmax(0, 1fr); padding: 16px; min-height: 0; }
    .top, .due { padding: 14px 16px 0; }
    .due + .board { padding-top: 32px; }
    .lane, .lane:first-child, .lane:last-child { padding: 0; }
    .lane + .lane { border-left: 0; border-top: 1px solid var(--line); margin-top: 28px; padding-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
