:root {
  --cream: #f5f2eb; --ink: #16140f;
  --gutter: clamp(16px, 2.4vw, 40px);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden; /* the page never scrolls; the timeline scrolls inside itself */
}
#app { width: 100vw; height: 100vh; height: 100dvh; }
.mm-msg { padding: 2rem; font-weight: 300; }
.mm-err { color: #e23b2e; }

/* shell: masthead + view switch, then the active view filling the rest */
.mm-app {
  display: flex; flex-direction: column;
  width: 100%; height: 100%;
  padding: var(--gutter);
  gap: clamp(8px, 1.4vw, 20px);
}
.mm-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.mm-head-text { min-width: 0; flex: 1 1 24rem; }
.mm-title {
  font-weight: 200;
  font-size: clamp(1.4rem, 3.4vw, 2.8rem);
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--ink);
}
.mm-sub {
  margin-top: 0.35rem; max-width: 46rem;
  font-size: 0.85rem; font-weight: 300; line-height: 1.45; opacity: 0.8;
}
.mm-switch { display: flex; flex: 0 0 auto; }
.mm-switch .mm-btn + .mm-btn { border-left: 0; }
.mm-main { position: relative; flex: 1 1 auto; min-height: 0; }
.mm-pane { position: absolute; inset: 0; }
.mm-pane.is-hidden { display: none; }

.mm-btn {
  font: inherit; font-size: 0.78rem; letter-spacing: 0.04em;
  border: 1px solid var(--ink); background: var(--cream); color: var(--ink);
  padding: 0.3rem 0.8rem; border-radius: 2px; cursor: pointer;
  white-space: nowrap;
}
.mm-btn.on { background: var(--ink); color: var(--cream); }
.mm-btn:focus-visible, .tl-head:focus-visible { outline: 2px solid #1d54b8; outline-offset: 2px; }

/* map */
.mm-stage { position: relative; width: 100%; height: 100%; }
.mm-stage > svg { display: block; width: 100%; height: 100%; }
.mm-toggle {
  position: absolute; top: 0.6rem; right: 0.6rem;
  font: inherit; font-size: 0.78rem; letter-spacing: 0.04em;
  border: 1px solid var(--ink); background: var(--cream); color: var(--ink);
  padding: 0.3rem 0.8rem; border-radius: 2px; cursor: pointer;
}
.mm-toggle.on { background: var(--ink); color: var(--cream); }

/* cursor-tracking tooltip: project description (cell/info icon), sub-project (bubble), thread */
.mm-tip {
  position: fixed; pointer-events: none; z-index: 20;
  max-width: min(22rem, calc(100vw - 2rem));
  background: var(--ink); color: var(--cream);
  padding: 0.5rem 0.7rem; border-radius: 3px;
  font-size: 0.8rem; line-height: 1.45;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.28);
}
.mm-tip-img {
  display: block; width: 5.5rem; height: 5.5rem; object-fit: cover;
  border-radius: 50%; margin: 0.1rem auto 0.55rem;
  border: 2px solid rgba(245, 242, 235, 0.28);
}
.mm-tip-title { font-weight: 600; margin-bottom: 0.25rem; }
.mm-tip-body {
  font-weight: 300; opacity: 0.9;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 7; line-clamp: 7;
  overflow: hidden;
}

/* timeline */
.tl { display: flex; flex-direction: column; height: 100%; gap: 0.6rem; }
.tl-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem 1.2rem;
}
.tl-legend {
  list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem 0.95rem;
  font-size: 0.75rem; letter-spacing: 0.02em;
}
.tl-legend li { display: flex; align-items: center; gap: 0.35rem; }
.tl-legend svg { display: block; overflow: visible; }
.tl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.tl-count { font-size: 0.75rem; opacity: 0.7; font-variant-numeric: tabular-nums; }

/* the chart scrolls in both directions inside itself; the month axis sticks to its top */
.tl-scroll {
  flex: 1 1 auto; min-height: 0;
  overflow: auto; -webkit-overflow-scrolling: touch;
  border-top: 1px solid var(--ink);
}
.tl-svg { display: block; width: 100%; min-width: 1080px; height: auto; }
.tl-axis { position: sticky; top: 0; z-index: 2; }
.tl-head { cursor: pointer; }
.tl-head:hover text { text-decoration: underline; }
.tl-thread { cursor: default; }
.tl-thread:hover text { text-decoration: underline; }

.tl-tip-meta { font-size: 0.72rem; opacity: 0.75; margin-bottom: 0.25rem; }
.tl-tip-meta:last-of-type { margin-top: 0.3rem; margin-bottom: 0.1rem; }
.tl-tip-fate { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.85; }
.tl-tip-fate.is-unfinished { opacity: 1; font-weight: 600; }

@media (max-width: 600px) {
  .mm-sub { font-size: 0.78rem; }
  .tl-legend { font-size: 0.7rem; gap: 0.25rem 0.7rem; }
}

/* line: one line of time down the page; this pane scrolls vertically */
.mm-pane-line { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.ln { display: flex; flex-direction: column; gap: 0.8rem; }
.ln-bar { display: flex; flex-direction: column; gap: 0.5rem; }
.ln-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ln-chip { display: inline-flex; align-items: center; gap: 0.4rem; }
.ln-chip svg { display: block; }
.ln-legend {
  list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.9rem;
  font-size: 0.75rem; letter-spacing: 0.02em;
}
.ln-legend li { display: flex; align-items: center; gap: 0.35rem; }
.ln-legend svg { display: block; overflow: visible; }
.ln-legend .ln-rule { opacity: 0.7; flex-basis: 100%; }
.ln-chart { position: relative; width: 100%; border-top: 1px solid var(--ink); }
.ln-svg { position: absolute; top: 0; left: 0; display: block; overflow: visible; }
.ln-head { cursor: pointer; }
.ln-head:focus-visible { outline: 2px solid #1d54b8; }

/* cards: FIXED heights (MM.Line.Layout.cardHeight = 80, +38 with a note) */
.ln-card {
  position: absolute; overflow: hidden;
  background: var(--cream);
  border: 1px solid rgba(22, 20, 15, 0.22);
  border-left: 4px solid var(--strand, var(--ink));
  padding: 6px 9px 6px 8px;
  cursor: pointer;
  transition: box-shadow 120ms ease;
}
.ln-card.is-left { border-left-width: 1px; border-left-color: rgba(22, 20, 15, 0.22); border-right: 4px solid var(--strand, var(--ink)); }
.ln-card.is-focus { box-shadow: 0 0 0 1.5px var(--ink), 0 4px 14px rgba(0, 0, 0, 0.14); z-index: 3; }
.ln-kicker {
  display: flex; align-items: center; gap: 6px;
  height: 14px; line-height: 14px; margin-bottom: 4px;
  font-size: 10px; letter-spacing: 0.08em; white-space: nowrap;
}
.ln-kicker svg { flex: 0 0 auto; display: block; overflow: visible; }
.ln-moment { overflow: hidden; text-overflow: ellipsis; opacity: 0.8; }
.ln-card.is-unfinished .ln-moment { opacity: 1; font-weight: 700; }
.ln-date { margin-left: auto; padding-left: 6px; opacity: 0.65; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.ln-main { display: flex; gap: 8px; }
.ln-thumb { flex: 0 0 44px; width: 44px; height: 44px; object-fit: cover; border: 1px solid var(--ink); }
.ln-text { min-width: 0; flex: 1 1 auto; }
.ln-name {
  font-size: 13px; line-height: 17px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ln-what {
  font-size: 11.5px; line-height: 15px; font-weight: 300; height: 30px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.ln-note {
  margin-top: 4px; padding-top: 3px; border-top: 1px solid rgba(22, 20, 15, 0.18);
  font-size: 11.5px; line-height: 15px; font-style: italic; height: 34px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.ln-chart.is-narrow .ln-days { display: none; }
.ln-chart.is-narrow .ln-card { padding-left: 6px; padding-right: 6px; }
.ln-chart.is-narrow .ln-kicker { letter-spacing: 0.02em; gap: 4px; }
.ln-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.2rem; }
.ln-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.ln-seg { gap: 0; }
.ln-seg .mm-btn + .mm-btn { border-left: 0; }
.ln-group-label { font-size: 0.75rem; margin-right: 0.45rem; opacity: 0.75; }
.ln-month { cursor: pointer; }
.ln-month:hover text { text-decoration: underline; }
.ln-month:focus-visible { outline: 2px solid #1d54b8; }

/* git: the commit calendar, with weekly lines of code and prose under the same columns */
.mm-pane-git { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.gt { display: flex; flex-direction: column; gap: 0.9rem; padding-bottom: 1rem; }
.gt-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.6rem 1.4rem; border-top: 3px solid var(--ink); padding-top: 0.7rem;
}
.gt-big { font-size: clamp(1.4rem, 2.6vw, 2.1rem); font-weight: 600; letter-spacing: -0.01em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.gt-small { font-size: 0.75rem; opacity: 0.75; margin-top: 0.15rem; }
.gt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.4rem; }
.gt-key { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.6rem; font-size: 0.72rem; }
.gt-key-step { display: inline-flex; align-items: center; gap: 0.25rem; font-variant-numeric: tabular-nums; }
.gt-key svg, .ln-chip svg { display: block; }
.gt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gt-svg { display: block; width: 100%; min-width: 720px; height: auto; }
.gt-cell:hover { stroke: var(--ink); stroke-opacity: 1; stroke-width: 1.2; }
.gt-week:hover { fill: rgba(22, 20, 15, 0.05); }
.gt-note { font-size: 0.75rem; line-height: 1.45; opacity: 0.75; max-width: 62rem; }
