@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/ibm-plex-sans-var.woff2') format('woff2');
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/ibm-plex-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/ibm-plex-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f1f1ef;
  --surface: #f7f7f5;
  --ink: #141414;
  --muted: #4f4f4b;
  --faint: #6a6a65;
  --line: #d7d7d1;
  --line-strong: #b6b6af;
  --sans: 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111110;
  --surface: #181817;
  --ink: #ececea;
  --muted: #b4b4af;
  --faint: #8f8f89;
  --line: #2b2b29;
  --line-strong: #43433f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #111110;
    --surface: #181817;
    --ink: #ececea;
    --muted: #b4b4af;
    --faint: #8f8f89;
    --line: #2b2b29;
    --line-strong: #43433f;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--ink);
  color: var(--bg);
}

button, input { font: inherit; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: var(--bg);
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 11px;
}

.skip:focus { left: 0; }

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 28px;
}

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.masthead-inner {
  max-width: 1040px;
  height: 56px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wordmark {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}

.masthead-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.masthead-note {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
}

.theme-btn {
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 5px 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.theme-btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.theme-btn:active { transform: translateY(1px); }

.hero { padding: 56px 0 0; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 48px;
}

h1 {
  margin: 0;
  max-width: 18ch;
  font-family: var(--sans);
  font-size: clamp(42px, 7.4vw, 78px);
  font-weight: 600;
  line-height: 0.97;
  letter-spacing: -0.045em;
}

.lede {
  max-width: 46ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.hero-figure {
  text-align: right;
  padding-bottom: 4px;
}

.figure-number {
  font-family: var(--sans);
  font-size: clamp(56px, 8.5vw, 90px);
  font-weight: 600;
  line-height: 0.82;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.figure-caption {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
}

.ledger {
  display: grid;
  grid-template-columns: repeat(40, minmax(0, 1fr));
  gap: 3px;
  margin-top: 36px;
}

.tick {
  height: 6px;
  background: var(--line);
  transition: background 0.15s ease;
}

.tick.is-on { background: var(--ink); }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 22px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.metrics > div {
  padding: 12px 16px 12px 0;
  border-right: 1px solid var(--line);
}

.metrics > div + div { padding-left: 16px; }

.metrics > div:last-child {
  padding-right: 0;
  border-right: 0;
}

.metrics dt {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
}

.metrics dd {
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.focus {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-top: 40px;
  padding: 18px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
}

.focus-label {
  padding-top: 3px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
}

.focus-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.focus-sub {
  max-width: 65ch;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.focus .text-link { align-self: center; }

.text-link {
  border: 0;
  border-radius: 0;
  background: none;
  padding: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  white-space: nowrap;
  cursor: pointer;
}

.text-link:hover { color: var(--muted); }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 36px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.filters {
  display: flex;
  gap: 18px;
}

.filter {
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: none;
  padding: 0 0 6px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
}

.filter:hover { color: var(--ink); }

.filter.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.saved {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.saved.is-visible { opacity: 1; }

.weeks { border-bottom: 1px solid var(--line); }

.week { border-top: 1px solid var(--line); }

.week:first-child { border-top: 0; }

.week.is-current { box-shadow: inset 2px 0 0 var(--ink); }

.week-head {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr) auto 1.2rem;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  list-style: none;
  cursor: pointer;
}

.week-head::-webkit-details-marker { display: none; }

.week-head:hover { background: var(--surface); }

.week-num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.week-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.week-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.week-meta {
  display: flex;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
}

.week-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.week-toggle {
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1;
  color: var(--faint);
  text-align: right;
}

.week-toggle::before { content: '+'; }

details[open] .week-toggle::before { content: '-'; }

.week.is-done .week-title,
.week.is-done .week-count { color: var(--muted); }

.week-body {
  padding: 0 0 16px 4.2rem;
}

.tasks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.task {
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.task:nth-child(odd) { border-right: 1px solid var(--line); }

.task:nth-last-child(-n + 2) { border-bottom: 0; }

.task label {
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 16px 12px 0;
  cursor: pointer;
}

.task:nth-child(even) label { padding-left: 16px; }

.task label:hover { background: var(--surface); }

.task input {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin: 2px 0 0;
  border: 1px solid var(--faint);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  transition: background 0.1s ease, border-color 0.1s ease;
}

.task input:checked {
  border-color: var(--ink);
  background: var(--ink);
}

.task input:focus-visible { outline-offset: 2px; }

.task-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.task-kind {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.task-text {
  font-size: 13.8px;
  line-height: 1.45;
}

.task input:checked ~ .task-copy .task-kind { color: var(--ink); }

.task input:checked ~ .task-copy .task-text {
  color: var(--faint);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.empty {
  margin: 0;
  padding: 28px 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding: 18px 0 48px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
}

.foot p { margin: 0; }

.foot a {
  color: var(--faint);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.foot a:hover { color: var(--ink); }

@media (max-width: 760px) {
  .wrap,
  .masthead-inner {
    padding-left: 18px;
    padding-right: 18px;
  }

  .masthead-inner { height: 52px; }

  .masthead-note { display: none; }

  .saved { display: none; }

  .toolbar { align-items: flex-start; }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .hero { padding-top: 40px; }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  h1 { font-size: clamp(38px, 11.5vw, 54px); }

  .hero-figure {
    display: flex;
    align-items: baseline;
    gap: 12px;
    text-align: left;
  }

  .figure-number { font-size: 56px; }

  .figure-caption { margin-top: 0; }

  .ledger {
    grid-template-columns: repeat(20, minmax(0, 1fr));
    margin-top: 24px;
  }

  .metrics > div { padding: 10px 10px 10px 0; }

  .metrics > div + div { padding-left: 10px; }

  .metrics dd { font-size: 17px; }

  .focus {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 16px 0;
  }

  .focus-label { padding-top: 0; }

  .focus .text-link {
    align-self: start;
    justify-self: start;
  }

  .toolbar { margin-top: 28px; }

  .toolbar-actions { gap: 14px; }

  .week-head {
    grid-template-columns: 2.4rem minmax(0, 1fr) auto 1rem;
    gap: 10px;
    padding: 14px 0;
  }

  .week-num { font-size: 12px; }

  .week-title { font-size: 15.5px; }

  .week-body {
    padding-left: 0;
    padding-bottom: 12px;
  }

  .tasks { grid-template-columns: 1fr; }

  .task:nth-child(odd) { border-right: 0; }

  .task:nth-child(even) label { padding-left: 0; }

  .task:nth-last-child(2) { border-bottom: 1px solid var(--line); }

  .task:last-child { border-bottom: 0; }

  .task label { padding: 11px 0; }

  .task-text { font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
