:root {
  --desk: #d6dcdf;
  --surface: #f4f3ed;
  --text: #263641;
  --text-2: #5f6f78;
  --border: #8998a0;
  --accent: #334f84;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #242a2d;
    --surface: #30363a;
    --text: #e0e8e9;
    --text-2: #b0bdc3;
    --border: #65737c;
    --accent: #a9bdf0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #242a2d;
  --surface: #30363a;
  --text: #e0e8e9;
  --text-2: #b0bdc3;
  --border: #65737c;
  --accent: #a9bdf0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  padding: 24px;
  background: var(--desk);
  color: var(--text);
  font: 13.5px/1.45 var(--mono);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: progress; opacity: .6; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 8px 0;
  border-radius: 0;
}
input:focus { outline: none; border-bottom-color: var(--accent); box-shadow: 0 1px 0 var(--accent); }
input::placeholder { color: var(--text-2); opacity: 1; }
.button {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 3px 10px;
  font-size: 12px;
}
.button:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Header, toolbar, weather ---- */

.masthead, .toolbar, .weather, main { max-width: 1280px; margin-left: auto; margin-right: auto; }
.masthead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-bottom: 16px; }
.identity {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-right: auto;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.03em;
}
.clock { display: flex; gap: 14px; color: var(--text-2); font-size: 12px; }
#time { color: var(--text); }

.toolbar, .window, .weather {
  background: var(--surface);
  border: 1px solid var(--border);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 19px;
  padding: 10px 13px;
  box-shadow: 2px 2px 0 var(--border);
  margin-bottom: 20px;
}

.weather { box-shadow: 2px 2px 0 var(--border); margin-bottom: 20px; }
.weather-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 20px 15px 12px;
}
.now { display: flex; align-items: center; gap: 8px; min-width: 80px; }
#rain-summary { margin: 0; flex: 1; min-width: 16ch; }
#rain-chance { color: var(--text-2); }
.weather details { padding: 0 15px 16px; }
.weather summary { cursor: pointer; color: var(--accent); font-size: 12px; width: max-content; }
.weather summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.weather details[open] summary { margin-bottom: 12px; }
.bars { height: 64px; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--border); }
.bars i { flex: 1; background: var(--border); opacity: .45; }
.bars i.wet { background: var(--accent); opacity: 1; }
.axis { position: relative; height: 18px; margin-top: 4px; color: var(--text-2); font-size: 11px; }
.axis span { position: absolute; }

/* ---- Windows ---- */

main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}
.column { display: grid; gap: 20px; }
.window { box-shadow: 3px 3px 0 var(--border); }
.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 8px 13px;
  background: var(--desk);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}
.titlebar .count { font-weight: 400; color: var(--text-2); }
.titlebar button { font-weight: 400; color: var(--accent); }
.titlebar button:hover { text-decoration: underline; text-underline-offset: 3px; }
.content { padding: 12px 15px 16px; }

/* ---- Tasks ---- */

.list ul { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  padding: 4px 0;
}
.list li[draggable]:active { cursor: grabbing; }
.list input[type=checkbox] {
  appearance: none;
  width: 14px;
  height: 14px;
  margin: 0;
  flex: none;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  place-content: center;
  cursor: pointer;
}
.list input[type=checkbox]:hover { border-color: var(--accent); }
.list input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
.list input[type=checkbox]:checked::after {
  content: '';
  width: 7px;
  height: 4px;
  margin-top: -2px;
  border: solid var(--surface);
  border-width: 0 0 1.5px 1.5px;
  transform: rotate(-45deg);
}
.list .text { flex: 1; min-width: 0; overflow-wrap: anywhere; cursor: text; }
.list .edit { flex: 1; padding: 2px 0; }
.list li.done .text { color: var(--text-2); text-decoration: line-through; }
.row-action { color: var(--text-2); display: grid; place-items: center; width: 24px; height: 24px; flex: none; opacity: 0; }
.row-action:hover { color: var(--accent); }
.list li:hover .row-action, .list li:focus-within .row-action { opacity: 1; }
@media (hover: none) { .row-action { opacity: 1; } }
.list form { margin-top: 4px; }
.clear-done { margin-top: 12px; font-size: 12px; color: var(--text-2); }
.clear-done:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ---- Repositories ---- */

.repos { container-type: inline-size; }
#login { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
#login input { flex: 1; width: auto; }
#login-error { flex-basis: 100%; margin: 0; font-size: 12px; }
#login-error:empty { display: none; }
#repo-search { margin-bottom: 4px; }
#repo-status { margin: 8px 0 0; color: var(--text-2); }
#repo-status:empty { display: none; }
#repo-list { list-style: none; margin: 0; padding: 0; }
#repo-list li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  min-height: 40px;
  padding: 6px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 45%, transparent);
}
#repo-list li:last-child { border-bottom: 0; }
#repo-list li.archived { color: var(--text-2); }
.repo-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.repo-name > a:first-child { font-weight: 600; overflow-wrap: anywhere; }
.tag, .site, .meta { font-size: 12px; color: var(--text-2); }
.site { color: var(--accent); }
.meta { display: flex; gap: 12px; justify-content: flex-end; white-space: nowrap; }
.pin { display: grid; place-items: center; width: 24px; height: 24px; color: var(--text-2); }
.pin:hover { color: var(--accent); }
.pin.on { color: var(--accent); }
.pin.on .icon { fill: currentColor; }
@container (max-width: 440px) {
  #repo-list li { grid-template-columns: 24px minmax(0, 1fr); }
  .meta { grid-column: 2; justify-content: flex-start; }
}

/* ---- Toast ---- */

#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  padding: 8px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 2px 2px 0 var(--border);
  font-size: 12px;
}
#toast button { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ---- Small screens ---- */

@media (max-width: 680px) {
  main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 540px) {
  input { font-size: 16px; }
  .clock { order: 3; flex-basis: 100%; }
  .weather-row { justify-content: space-between; }
  #rain-summary { order: 3; flex-basis: 100%; }
  .list li { min-height: 44px; }
  .row-action, .pin { width: 32px; height: 32px; }
  #repo-list li { grid-template-columns: 32px minmax(0, 1fr); }
}
