/* Layout: full-viewport stove board. Composer on top, four heat lanes side by side (hot → cold, unsorted tray last),
   each lane scrolls on its own so the page never does on a laptop. Done lives in a slide-over. Completion = ballpoint stroke. */

/* Schibsted Grotesk (variable, 400–700), self-hosted under the SIL Open Font License: see fonts/OFL-SchibstedGrotesk.txt */
@font-face {
  font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(fonts/SchibstedGrotesk-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(fonts/SchibstedGrotesk-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #f3f4f7;
  --sheet: #ffffff;
  --ink: #1b1f2a;
  --muted: #6b7183;
  --rule: #e4e6ec;
  --rule-strong: #c9cdd8;
  --pen: #2445c9;
  --pen-soft: #e6ebfb;
  --danger: #b4232f;
  --hot: #d6451b;
  --warm: #b97c00;
  --cool: #4f78a8;
  --cold: #7d8597;
  --shadow: 0 1px 2px rgb(20 24 40 / .06), 0 4px 16px rgb(20 24 40 / .06);
  --lift: 0 8px 28px rgb(20 24 40 / .16);
  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111318; --sheet: #191c23; --ink: #e8eaf0; --muted: #8d93a5;
    --rule: #272b35; --rule-strong: #3a3f4c; --pen: #8ea3ff; --pen-soft: #232a45; --danger: #ff7b85;
    --hot: #ff7d52; --warm: #f0b443; --cool: #84a8d6; --cold: #8d93a5;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25); --lift: 0 10px 30px rgb(0 0 0 / .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #111318; --sheet: #191c23; --ink: #e8eaf0; --muted: #8d93a5;
  --rule: #272b35; --rule-strong: #3a3f4c; --pen: #8ea3ff; --pen-soft: #232a45; --danger: #ff7b85;
  --hot: #ff7d52; --warm: #f0b443; --cool: #84a8d6; --cold: #8d93a5;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25); --lift: 0 10px 30px rgb(0 0 0 / .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 15px; line-height: 1.42;
  -webkit-font-smoothing: antialiased;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 18px 12px;
  overflow: hidden;
}
button { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }

.app { height: 100%; max-width: 1600px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }

/* Top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.top h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; display: flex; align-items: baseline; gap: 12px; }
.top h1 small { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.top-acts { display: flex; align-items: center; gap: 4px; }
.ghost-btn {
  border: 0; background: none; cursor: pointer; color: var(--muted);
  font-size: 13.5px; font-weight: 500; padding: 6px 8px; border-radius: 6px;
}
.ghost-btn:hover { color: var(--ink); background: var(--rule); }
.top-acts .done-btn { margin-left: 6px; }
.done-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--sheet); border-radius: 999px;
  padding: 6px 8px 6px 12px; font-size: 14px; font-weight: 600;
}
.done-btn:hover { border-color: var(--rule-strong); }
.done-btn .n {
  min-width: 24px; padding: 1px 7px; border-radius: 999px; background: var(--pen-soft); color: var(--pen);
  font-variant-numeric: tabular-nums; text-align: center; font-size: 13px;
}
.done-btn.bump .n { animation: bump .35s ease-out; }
@keyframes bump { 40% { transform: scale(1.3); } }

/* Composer */
.composer {
  display: flex; align-items: center; gap: 10px;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px;
  padding: 6px 6px 6px 16px; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: var(--pen); box-shadow: 0 0 0 3px var(--pen-soft); }
.composer.tall { align-items: flex-end; }
#new {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 16px; line-height: 1.45; padding: 8px 0;
  resize: none; overflow-y: auto; max-height: 30vh; display: block;
}
#new::placeholder { color: var(--muted); }
.pick { display: flex; gap: 2px; background: var(--paper); border-radius: 9px; padding: 3px; flex: none; }
.pick button {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; cursor: pointer;
  color: var(--muted); font-size: 13px; font-weight: 500; padding: 6px 10px; border-radius: 7px; white-space: nowrap;
}
.pick button:hover { color: var(--ink); }
.pick button[aria-checked="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 0 0 1px var(--rule), 0 1px 2px rgb(0 0 0 / .06); }
.pick button svg { color: var(--heat); }
.add-btn {
  flex: none; border: 0; border-radius: 8px; background: var(--pen); color: var(--sheet); cursor: pointer;
  font-weight: 600; font-size: 14px; padding: 9px 16px; white-space: nowrap;
}
.add-btn:disabled { opacity: .35; cursor: default; }
.multi { margin: -6px 0 0; padding-left: 16px; font-size: 13px; color: var(--muted); }
.multi b { color: var(--pen); font-weight: 600; }

/* Heat colours per lane */
[data-prio="h"] { --heat: var(--hot); }
[data-prio="m"] { --heat: var(--warm); }
[data-prio="l"] { --heat: var(--cool); }
[data-prio="n"] { --heat: var(--cold); }
.heat { width: 14px; height: 13px; flex: none; }

/* Stove: the front burner (Boiling over) gets the big space; cooler lists stack on the side, shrinking as they cool. */
.board {
  flex: 1; min-height: 0; display: grid; gap: 12px;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .8fr);
}
.board .lane[data-prio="h"] { grid-row: 1 / span 3; }
.lane[data-prio="h"] .lane-head { padding: 16px 18px 10px; }
.lane[data-prio="h"] .lane-title h2 { font-size: 20px; letter-spacing: -0.015em; }
.lane[data-prio="h"] .lane-head .heat { width: 18px; height: 17px; margin-top: 5px; }
.lane[data-prio="h"] .items { padding: 2px 10px 12px; }
.lane[data-prio="h"] .items li { padding-block: 10px; font-size: 15.5px; }
.lane {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 14px;
  transition: border-color .12s, background-color .12s;
}
.lane[data-prio="n"] { background: transparent; border-style: dashed; border-color: var(--rule-strong); }
.lane.over { border-color: var(--heat); background: color-mix(in srgb, var(--heat) 7%, var(--sheet)); }
.lane-head { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px 8px; }
.lane-head .heat { margin-top: 3px; color: var(--heat); }
.lane-title { flex: 1; min-width: 0; }
.lane-title h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.005em; }
.lane-title p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); }
.lane-count {
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--heat);
  background: color-mix(in srgb, var(--heat) 12%, transparent); border-radius: 999px; padding: 1px 8px; margin-top: 1px;
}
.expand {
  flex: none; width: 28px; height: 28px; margin: -3px -6px 0 -4px; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; opacity: .5;
}
.lane:hover .expand, .expand:focus-visible, .expand[aria-pressed="true"] { opacity: 1; }
.expand:hover { background: var(--rule); color: var(--ink); }
.expand svg { width: 15px; height: 15px; }

/* Expanded: one group takes the stage, the others fold into a rail (still drop targets, click to switch) */
.board.expanded { grid-template-columns: minmax(0, 1fr) minmax(190px, 230px); grid-template-rows: auto auto auto 1fr; }
.board.expanded .lane.focus { grid-column: 1; grid-row: 1 / -1; }
.board.expanded .lane:not(.focus) { grid-column: 2; grid-row: auto; }
.board.expanded .lane:not(.focus) .lane-body { display: none; }
.board.expanded .lane:not(.focus) .lane-head { padding: 10px 12px; cursor: pointer; align-items: center; }
.board.expanded .lane:not(.focus) .lane-head .heat { margin-top: 0; width: 14px; height: 13px; }
.board.expanded .lane:not(.focus) .lane-title p { display: none; }
.board.expanded .lane:not(.focus) .lane-title h2 { font-size: 14px; }
.board.expanded .lane:not(.focus):hover { border-color: var(--heat); }
.board.expanded .lane.focus .lane-head { padding: 16px 18px 10px; }
.board.expanded .lane.focus .lane-title h2 { font-size: 20px; }
.board.expanded .lane.focus .items {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); column-gap: 20px;
  align-content: start; padding: 2px 12px 14px;
}
.board.expanded .lane.focus .items li { box-shadow: inset 0 -1px 0 var(--rule); }
.board.expanded .lane.focus .items li:hover { box-shadow: none; }
.board.expanded .lane.focus .items .ph { height: auto; min-height: 38px; background: transparent; border: 2px dashed var(--heat); border-radius: 9px; margin: 3px 0; }

.lane-body { position: relative; flex: 1; min-height: 0; display: flex; }
.items { list-style: none; margin: 0; padding: 2px 6px 10px; flex: 1; min-height: 60px; overflow-y: auto; overscroll-behavior: contain; }
.lane-empty {
  position: absolute; inset: 8px 14px auto; margin: 0; pointer-events: none;
  color: var(--muted); font-size: 13.5px; line-height: 1.45;
  border: 1px dashed var(--rule-strong); border-radius: 10px; padding: 14px; text-align: center;
}
.lane[data-prio="n"] .lane-empty { border-color: transparent; }

/* Rows */
.items li {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 6px 8px 2px; border-radius: 9px; position: relative;
  cursor: grab; transition: background-color .12s;
}
.items li + li { box-shadow: 0 -1px 0 var(--rule); }
.items li:hover, .items li:focus-within { background: var(--paper); box-shadow: none; }
.items li:hover + li, .items li:focus-within + li { box-shadow: none; }
.lane[data-prio="n"] .items li:hover { background: var(--sheet); }
.items li.dragging { opacity: .35; }
.items li.landed { animation: landed .5s ease-out; }
@keyframes landed { from { background: color-mix(in srgb, var(--heat) 18%, transparent); } }
.items li.enter { animation: enter .6s ease-out; }
@keyframes enter { from { background: var(--pen-soft); } }
.items .ph { height: 2px; background: var(--heat); border-radius: 2px; margin: 2px 4px; box-shadow: none !important; padding: 0; cursor: default; }

.grip { width: 12px; flex: none; align-self: stretch; display: grid; place-items: center; color: var(--muted); opacity: 0; }
.grip svg { width: 8px; height: 14px; }
.items li:hover .grip { opacity: .7; }

.check {
  flex: none; width: 20px; height: 20px; margin-top: 1px; padding: 0; cursor: pointer;
  border: 2px solid color-mix(in srgb, var(--heat) 70%, var(--muted)); border-radius: 50%;
  background: transparent; display: grid; place-items: center; color: var(--sheet);
  transition: background .15s, border-color .15s;
}
.check:hover { border-color: var(--pen); background: var(--pen-soft); }
.check svg { width: 11px; height: 11px; opacity: 0; }
li.done .check { background: var(--pen); border-color: var(--pen); }
li.done .check svg { opacity: 1; }

.text {
  flex: 1; min-width: 0; padding: 0; margin: 0; background: none; border: 0; text-align: left;
  overflow-wrap: anywhere; cursor: text; line-height: 1.42;
}
li.done .text { color: var(--muted); }
li.done .text span {
  background-image: linear-gradient(var(--pen), var(--pen)); background-repeat: no-repeat;
  background-position: 0 58%; background-size: 100% 1.5px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
li.done.just .text span { animation: strike .3s ease-out; }
@keyframes strike { from { background-size: 0% 1.5px; } }
.items li.leaving { animation: leave .25s ease-in forwards; }
@keyframes leave { to { opacity: 0; transform: translateX(8px); } }

.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; margin-top: 1px;
  border: 0; border-radius: 999px; padding: 2px 9px 2px 8px; cursor: pointer;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  color: var(--pen); background: var(--pen-soft);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.chip:hover { text-decoration: line-through; }
li.wip .check { border-color: var(--pen); }
li.wip .check::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--pen); grid-area: 1 / 1; }
li.wip .check svg { grid-area: 1 / 1; }
.act.wip-on { color: var(--pen); }

.edit {
  flex: 1; min-width: 0; font: inherit; color: var(--ink); line-height: 1.42;
  border: 0; outline: 0; background: var(--pen-soft); border-radius: 4px; padding: 0 6px; margin: -1px -6px;
}

.acts { display: flex; gap: 2px; margin: -4px 0; opacity: 0; flex: none; }
.items li:hover .acts, .items li:focus-within .acts { opacity: 1; }
.act {
  width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  cursor: pointer; display: grid; place-items: center;
}
.act svg { width: 15px; height: 15px; }
.act:hover { background: var(--rule); color: var(--ink); }
.act.del:hover { color: var(--danger); }
@media (hover: none) { .acts { opacity: .7; } .grip { display: none; } }

/* Move menu */
.menu {
  position: fixed; z-index: 30; min-width: 220px; padding: 5px;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--lift);
}
.menu p { margin: 4px 8px 6px; font-size: 12px; color: var(--muted); }
.menu button {
  width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; cursor: pointer;
  padding: 7px 8px; border-radius: 6px; text-align: left; font-size: 14px;
}
.menu button:hover, .menu button:focus-visible { background: var(--paper); outline: none; }
.menu button[aria-current="true"] { color: var(--muted); }
.menu button .heat { color: var(--heat); }
.menu button span { flex: 1; }
.menu kbd { margin-left: auto; }

/* Footer keys */
.keys { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12.5px; color: var(--muted); }
.keys > span { display: inline-flex; align-items: center; gap: 5px; }
.status { margin-left: auto; }
kbd {
  font: inherit; font-size: 11.5px; line-height: 1; color: var(--ink);
  border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; background: var(--sheet);
}

/* Done slide-over */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgb(10 12 20 / .25); opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.panel {
  position: fixed; z-index: 21; top: 0; right: 0; bottom: 0; width: min(400px, 100%);
  background: var(--sheet); border-left: 1px solid var(--rule); box-shadow: var(--lift);
  display: flex; flex-direction: column; transform: translateX(105%); transition: transform .22s ease;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.panel.open { transform: none; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 18px 18px 10px; }
.panel-head h2 { margin: 0; font-size: 18px; flex: 1; }
.clear { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13.5px; padding: 6px 4px; }
.clear:hover { color: var(--danger); }
.clear.confirm { color: var(--danger); font-weight: 600; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 10px 24px; }
.panel-body h3 { margin: 14px 8px 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.panel-body .items { overflow: visible; padding: 0; min-height: 0; }
.panel-body .items li { cursor: default; }
.tag { font-size: 12px; color: var(--heat); white-space: nowrap; margin-top: 2px; display: inline-flex; gap: 4px; align-items: center; }
.panel-empty { color: var(--muted); padding: 30px 18px; text-align: center; }

/* Toast */
.toast {
  position: fixed; z-index: 40; left: 50%; transform: translate(-50%, 20px);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--paper); border-radius: 10px; padding: 9px 9px 9px 16px;
  display: flex; align-items: center; gap: 14px; font-size: 14px; box-shadow: var(--lift);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; background: transparent; color: var(--pen-soft); font-weight: 700; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.toast button[hidden] { display: none; }

/* Smaller screens: let the page scroll instead of the lanes */
@media (max-width: 1100px) { .pick .lbl-long { display: none; } }
@media (max-width: 960px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100%; }
  .board { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .board .lane[data-prio="h"] { grid-row: auto; }
  .board.expanded { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .board.expanded .lane.focus, .board.expanded .lane:not(.focus) { grid-column: auto; grid-row: auto; }
  .board.expanded .lane.focus { order: -1; }
  .items { overflow: visible; }
  .composer { flex-wrap: wrap; }
  #new { flex-basis: 100%; }
  .pick { flex: 1; }
  .pick button { flex: 1; justify-content: center; }
}
@media (max-width: 600px) {
  .keys .k { display: none; }
  .pick button { padding: 6px 4px; font-size: 12px; }
  .top { gap: 8px; }
  .top h1 { gap: 8px; }
  .top-acts { gap: 0; }
  .ghost-btn { padding: 6px 5px; }
  .top-acts .done-btn { margin-left: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
