/* ============================================================================
   LIVING PROFILE - COMPONENTS
   Layout and components only. No raw colors, fonts or sizes here:
   everything comes from theme.css. To restyle, edit theme.css.
   ========================================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }

/* --- Top tab bar ------------------------------------------------------- */
.tabs {
  display: flex; align-items: center; gap: var(--space-1);
  background: var(--bg-tab); border-bottom: 1px solid var(--line);
  padding: 0 var(--space-3); overflow-x: auto;
}
.tab { padding: 10px 14px; font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap; }
.tab.is-active {
  color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.tabs .spacer { flex: 1; }
.sync { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; padding-right: var(--space-2); }
.sync .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); margin-right: 6px; animation: pulse 2.4s ease-in-out infinite; }

/* --- Three-column shell ------------------------------------------------ */
.shell { display: flex; flex-wrap: wrap; align-items: stretch; }
.sidebar {
  flex: 0 1 var(--sidebar-width); min-width: 200px;
  background: var(--bg-sunken); border-right: 1px solid var(--line);
  padding: var(--space-3) var(--space-2); font-size: var(--text-sm);
}
.note { flex: 999 1 560px; min-width: 0; padding-bottom: var(--space-8); }
.rail {
  flex: 0 1 var(--rail-width); min-width: 240px;
  background: var(--bg-sunken); border-left: 1px solid var(--line);
  padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-4);
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .rail { border-left: 0; border-top: 1px solid var(--line); flex-basis: 100%; }
}

/* --- File tree --------------------------------------------------------- */
.label { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); letter-spacing: .04em; text-transform: uppercase; }
.tree .label { padding: 0 var(--space-2) var(--space-2); display: block; }
.side-inner { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; padding-bottom: var(--space-4); scrollbar-width: thin; }
.tree .label + .toc, .tree .label + .tree-group, .tree .label + .tree-row { margin-top: 0; }
.toc { margin-bottom: var(--space-4); border-left: 1px solid var(--line); margin-left: var(--space-2); }
.tree-row { display: flex; align-items: center; gap: 6px; padding: 4px var(--space-2); border-radius: var(--radius-sm); color: var(--text); line-height: 1.35; }
a.tree-row { text-decoration: none; }
a.tree-row:hover, summary.tree-row:hover { background: var(--bg-raised); color: var(--text-strong); text-decoration: none; }
.tree-row.child { padding-left: calc(var(--space-2) + 18px); color: var(--text-muted); }
.tree-row.child.is-link { color: var(--text); }
.tree-row.is-current { background: var(--bg-raised); color: var(--text-strong); box-shadow: inset 2px 0 0 var(--accent); }
.tree-row > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row .ext { flex: 0 0 auto; font-size: 11px; color: var(--text-muted); opacity: 0; transition: opacity .15s; }
.tree-row:hover .ext, .tree-row:focus-visible .ext { opacity: 1; }
.tree-row .count { flex: 0 0 auto; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tree-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.toc-row { margin-left: -1px; border-left: 2px solid transparent; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-muted); padding-left: var(--space-3); }
.toc-row.is-active { color: var(--text-strong); border-left-color: var(--accent); background: var(--accent-soft); }
.tree-group > summary { list-style: none; cursor: pointer; user-select: none; }
.tree-group > summary::-webkit-details-marker { display: none; }
.tree-row.group .g-name { flex: 1; font-weight: 500; }
.tree-row.group .caret { flex: 0 0 12px; width: 12px; height: 12px; display: inline-block; }
.tree-group > summary .caret::before { content: ""; display: block; width: 0; height: 0; margin: 2px 0 0 2px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 6px solid var(--text-muted); transform: rotate(-90deg); transition: transform .15s; }
.tree-group[open] > summary .caret::before { transform: none; }
.tree-row.group.leaf .caret::before { content: ""; display: block; width: 5px; height: 5px; margin: 3px 0 0 3px; border-radius: 50%; background: var(--line-strong); }
html { scroll-behavior: smooth; } h2[id], section[id], .pnote[id] { scroll-margin-top: var(--space-4); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media (max-width: 900px) {
  .sidebar.tree { display: block; flex-basis: 100%; min-width: 0; position: sticky; top: 0; z-index: 5; padding: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-inner { position: static; max-height: none; overflow: visible; padding: 0; }
  .side-inner > .label, .side-inner > .tree-group, .side-inner > .tree-row { display: none; }
  .toc { display: flex; overflow-x: auto; gap: 2px; margin: 0; border: 0; padding: 6px var(--space-3); scrollbar-width: none; }
  .toc-row { white-space: nowrap; border: 0; border-radius: var(--radius-round); padding: 4px 12px; margin: 0; }
  .side-inner:not(:has(.toc)) { display: none; }
}

/* --- Banner & title ---------------------------------------------------- */
.banner { position: relative; height: var(--banner-height); }   /* no overflow:hidden, so the avatar can hang below */
.banner::after { z-index: 1; }
.banner img.cover { width: 100%; height: 100%; object-fit: cover; object-position: var(--banner-focus); opacity: .92; display: block; }
.banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, var(--bg) 100%); }
.banner img.avatar {
  position: absolute; left: 48px; bottom: calc(var(--avatar-size) * -0.32); z-index: 2;
  width: var(--avatar-size); height: var(--avatar-size); border-radius: 50%;
  object-fit: cover; object-position: center 25%; border: 4px solid var(--bg);
}
.page { max-width: var(--content-width); margin: 0 auto; padding: calc(var(--space-8) + var(--space-4)) var(--space-8) 0; }
.crumb { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
h1.title { margin: 6px 0 var(--space-4); font-family: var(--font-display); font-weight: 600; font-size: var(--text-h1); color: var(--text-strong); line-height: 1.1; }
h1.title .caret { color: var(--accent); animation: blink 1s step-end infinite; }
h2 { font-family: var(--font-display); font-weight: 600; font-size: var(--text-h2); color: var(--text-strong); margin: var(--space-8) 0 var(--space-2); }

/* --- Properties -------------------------------------------------------- */
.props {
  display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 10px 0; margin-bottom: var(--space-6); font-size: var(--text-sm);
}
.props dt { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); margin: 0; }
.props dd { margin: 0; }
@media (max-width: 560px) { .props { grid-template-columns: 1fr; } .props dd { margin-bottom: 6px; } }

/* --- Callout ----------------------------------------------------------- */
.callout { border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius-md) var(--radius-md) 0; padding: 12px 16px; margin-bottom: var(--space-6); }
.callout-title { font-weight: 600; color: var(--accent-text); font-size: var(--text-sm); }

/* --- Lists, tables ----------------------------------------------------- */
ul.bullets { margin: 0; padding-left: 20px; }
ul.bullets li { margin: 4px 0; }
.query { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); margin-bottom: 6px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; padding: 8px; border-bottom: 1px solid var(--line-strong); color: var(--text-muted); font-weight: 500; }
table.data td { padding: 8px; border-bottom: 1px solid var(--line); }
table.data .num { text-align: right; font-family: var(--font-mono); }

/* --- Commit chart ------------------------------------------------------ */
.bars { height: 110px; display: flex; gap: 3px; align-items: flex-end; border-bottom: 1px solid var(--line-strong); }
.bars span { flex: 1; background: var(--chart-bar); border-radius: 2px 2px 0 0; transform-origin: bottom; animation: rise 1.1s cubic-bezier(.2,.8,.2,1) both; }
.bars span.quiet { background: var(--chart-bar-quiet); }
.bars-legend { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }

/* --- Timeline ---------------------------------------------------------- */
.timeline { position: relative; }
.timeline .row { display: grid; grid-template-columns: 64px 14px 1fr; gap: 0 12px; padding: 7px 0; position: relative; }
.timeline .row::before { content: ""; position: absolute; left: calc(64px + 12px + 6px); top: 0; bottom: 0; width: 2px; background: var(--line); }
.timeline .year { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-muted); padding-top: 2px; font-variant-numeric: tabular-nums; }
.timeline .dot { position: relative; z-index: 1; width: 10px; height: 10px; margin: 7px 0 0 2px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.timeline .row.same .dot { width: 6px; height: 6px; margin: 9px 0 0 4px; border: 0; background: var(--line-strong); }
.timeline .what { min-width: 0; }
.timeline .detail { color: var(--text-muted); font-size: var(--text-sm); margin-top: 2px; }
.timeline .era { display: flex; align-items: baseline; gap: 10px; margin: var(--space-4) 0 2px; padding-left: calc(64px + 12px + 14px + 12px); }
.timeline .era:first-child { margin-top: 0; }
.timeline .era-name { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); }
.timeline .era-range { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }
@media (max-width: 560px) { .timeline .row { grid-template-columns: 44px 14px 1fr; gap: 0 8px; } .timeline .row::before { left: calc(44px + 8px + 6px); } .timeline .era { padding-left: calc(44px + 8px + 14px + 8px); } }

/* --- Right rail -------------------------------------------------------- */
.graph svg { width: 100%; height: 240px; display: block; }
.graph .edge { stroke: var(--graph-edge); stroke-width: 1; }
.graph .node { fill: var(--graph-node); }
.graph .node.hot { fill: var(--graph-node-hot); }
.graph .center { fill: var(--accent); }
.graph text { fill: var(--text-muted); font-family: var(--font-body); font-size: 8.5px; }
.graph .float { animation: float 4s ease-in-out infinite; }
.backlink { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.backlink .ctx { color: var(--text-muted); font-size: 12px; }
.pulse-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.pulse-cell { background: var(--bg-raised); border-radius: var(--radius-sm); padding: var(--space-2); }
.pulse-cell .v { font-size: 20px; color: var(--text-strong); }
.pulse-cell .l { font-size: var(--text-xs); color: var(--text-muted); }

/* --- Help exchange (off by default in config) -------------------------- */
.hx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-3); }
.hx-card { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-4); }
.hx-row { display: flex; justify-content: space-between; gap: var(--space-2); padding: 6px 0; border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.hx-row .bounty { color: var(--accent-2); font-family: var(--font-mono); }


/* --- Stat strip -------------------------------------------------------- */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; margin-bottom: var(--space-6); }
.stat { background: var(--bg); padding: var(--space-3) var(--space-2); }
.stat .v { font-size: 22px; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.stat .l { font-size: var(--text-xs); color: var(--text-muted); }
.small { font-size: var(--text-sm); margin: 0 0 var(--space-2); }

/* --- Activity heatmap -------------------------------------------------- */
.heat-box { position: relative; }
.heat-frame { display: flex; gap: 6px; }
.heat-days { display: grid; grid-template-rows: repeat(7, 12px); gap: 3px; padding-top: 18px; font-family: var(--font-mono); font-size: 10px; line-height: 12px; color: var(--text-muted); }
.heat-wrap { overflow-x: auto; min-width: 0; }
.heat-months { position: relative; height: 18px; font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }
.heat-months span { position: absolute; top: 0; white-space: nowrap; }
.heat { outline: none; border-radius: 3px; width: max-content; }
.heat:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.heat i[data-d] { cursor: pointer; transition: transform .12s ease; }
.heat i[data-d]:hover, .heat i.is-sel { transform: scale(1.25); box-shadow: 0 0 0 1.5px var(--text-strong); position: relative; z-index: 1; }
.heat i.is-today { box-shadow: inset 0 0 0 1.5px var(--accent-2); }
.heat i.is-pin { box-shadow: 0 0 0 1.5px var(--accent); }
.heat-tip { position: absolute; z-index: 5; transform: translate(-50%, calc(-100% - 8px)); pointer-events: none; white-space: nowrap; background: var(--text-strong); color: var(--bg); font-size: var(--text-xs); font-family: var(--font-mono); padding: 4px 8px; border-radius: var(--radius-sm); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.heat-tip::after { content: ""; position: absolute; left: calc(50% + var(--ax, 0px)); bottom: -4px; margin-left: -4px; border: 4px solid transparent; border-bottom: 0; border-top-color: var(--text-strong); }
.heat-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; align-items: center; margin-top: 8px; }
.heat-read { font-size: var(--text-sm); color: var(--text-muted); min-height: 1.4em; font-variant-numeric: tabular-nums; }
.heat-read b { color: var(--text-strong); font-weight: 500; }
.heat-foot .heat-legend { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .heat i[data-d] { transition: none; } }
.heat { display: grid; grid-template-rows: repeat(7, 12px); grid-auto-flow: column; grid-auto-columns: 12px; gap: 3px; }
.heat i, .heat-legend i { width: 12px; height: 12px; border-radius: 2px; display: block; background: var(--heat-0); }
.heat i.l1, .heat-legend i.l1 { background: var(--heat-1); }
.heat i.l2, .heat-legend i.l2 { background: var(--heat-2); }
.heat i.l3, .heat-legend i.l3 { background: var(--heat-3); }
.heat i.l4, .heat-legend i.l4 { background: var(--heat-4); }
.heat-legend { display: flex; gap: 4px; align-items: center; justify-content: flex-end; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); margin-top: 6px; }

/* --- Two columns, growth line, horizontal bars ------------------------- */
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-6); }
.growth { width: 100%; height: auto; display: block; }
.growth .axis { stroke: var(--line-strong); }
.growth .area { fill: var(--accent-soft); }
.growth .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-dasharray: 2000; animation: draw 2.6s ease-out both; }
.growth .now { fill: var(--accent); animation: pulse 2s ease-in-out infinite; }
.growth text { fill: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.hbar { display: grid; grid-template-columns: 130px 1fr 52px; gap: 10px; align-items: center; font-size: var(--text-sm); padding: 4px 0; }
.hbar .track { height: 8px; background: var(--bg-raised); border-radius: 4px; overflow: hidden; }
.hbar .fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; transform-origin: left; animation: grow 1.2s cubic-bezier(.2,.8,.2,1) both; }
.hbar .fill.alt { background: var(--chart-alt); }
.hbar .num { text-align: right; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }
.cols { height: 120px; display: flex; gap: 4px; align-items: flex-end; border-bottom: 1px solid var(--line-strong); margin-top: var(--space-2); }
.cols span { flex: 1; height: 100%; display: flex; flex-direction: column-reverse; align-items: center; }
.cols b { display: block; width: 100%; background: var(--chart-alt); border-radius: 2px 2px 0 0; transform-origin: bottom; animation: rise 1s cubic-bezier(.2,.8,.2,1) both; }
.cols em { font-style: normal; font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }

/* --- Topic cloud ------------------------------------------------------- */
.cloud { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; }
.cloud span { color: var(--text-strong); line-height: 1.3; }
.cloud sup { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); margin-left: 2px; }

@keyframes draw { from { stroke-dashoffset: 2000; } to { stroke-dashoffset: 0; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }


/* --- Daily journal ----------------------------------------------------- */
.journal { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4); margin-bottom: var(--space-6); overflow: hidden; }
.j-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.j-title { flex: 1; text-align: center; }
.j-date { font-family: var(--font-display); font-size: 22px; color: var(--text-strong); }
.j-nav { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); font-size: 22px; cursor: pointer; }
.j-nav:disabled { opacity: .3; cursor: default; }
.j-top { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; }
.ring-wrap { position: relative; width: 96px; height: 96px; flex: 0 0 96px; }
.ring { width: 96px; height: 96px; transform: rotate(-90deg); display: block; }
.ring .trk { fill: none; stroke: var(--line); stroke-width: 9; }
.ring .val { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.j-score { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.j-score .v { font-size: 26px; color: var(--text-strong); line-height: 1; }
.j-score .l { font-size: 10px; color: var(--text-muted); }
.j-delta { font-family: var(--font-mono); font-size: var(--text-xs); margin-bottom: 4px; }
.j-headline { flex: 1 1 260px; font-family: var(--font-display); font-size: 21px; color: var(--text-strong); line-height: 1.3; }
.j-themes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-family: var(--font-body); }
.j-themes span { font-size: var(--text-xs); color: var(--accent-text); background: var(--accent-soft); border-radius: var(--radius-round); padding: 2px 10px; }
.j-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; margin: var(--space-4) 0; }
.chip { background: var(--bg); padding: var(--space-2); }
.chip .v { font-size: 20px; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.chip .l { font-size: var(--text-xs); color: var(--text-muted); }
.chip .dd { font-family: var(--font-mono); font-size: var(--text-xs); min-height: 1em; }
.up { color: var(--accent-2); } .down { color: var(--text-muted); } .flat { color: var(--text-muted); }
.j-lists ul { margin-top: 4px; }
.flip-l { animation: flipL .45s ease both; } .flip-r { animation: flipR .45s ease both; }
@keyframes flipL { from { opacity: 0; transform: translateX(-24px) rotateY(8deg); } to { opacity: 1; transform: none; } }
@keyframes flipR { from { opacity: 0; transform: translateX(24px) rotateY(-8deg); } to { opacity: 1; transform: none; } }

/* --- Scoreboard -------------------------------------------------------- */
.scoreboard { margin-bottom: var(--space-6); }
.sb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-3); }
.sb-stat .v { font-size: 30px; color: var(--text-strong); line-height: 1.1; }
.sb-stat .v small { font-size: 14px; color: var(--text-muted); }
.sb-stat .l { font-size: var(--text-xs); color: var(--text-muted); }
.sb-bars { height: 90px; display: flex; gap: 3px; align-items: flex-end; border-bottom: 1px solid var(--line-strong); }
.sb-bars span { flex: 1; background: var(--chart-bar-quiet); border-radius: 2px 2px 0 0; transform-origin: bottom; animation: rise 1s cubic-bezier(.2,.8,.2,1) both; }
.sb-bars span.yday { background: var(--accent); }
.sb-bars span.today { background: repeating-linear-gradient(45deg, var(--chart-bar-quiet), var(--chart-bar-quiet) 3px, transparent 3px, transparent 6px); }
.sb-lower { margin-top: var(--space-4); }
.lb-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.lb-row .rank { font-family: var(--font-mono); color: var(--text-muted); }
.lb-row .num { font-family: var(--font-mono); }
.lb-row.me .who { color: var(--text-strong); font-weight: 600; }
.lb-row.empty .who { color: var(--text-muted); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 2px 8px; justify-self: start; }
.sb-how { margin-top: var(--space-3); font-size: var(--text-sm); color: var(--text-muted); }
.sb-how summary { cursor: pointer; color: var(--accent-text); }

/* --- Footer ------------------------------------------------------------ */
.foot { margin-top: var(--space-8); padding-top: var(--space-3); border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }

/* --- Motion (respects reduced-motion) ---------------------------------- */
@keyframes pulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes float { 0%,100% { transform: translate(0,0); } 50% { transform: translate(3px,-4px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

.note { max-width: 100%; }
.lede { font-size: var(--text-lg); color: var(--text-muted); margin: -8px 0 var(--space-6); }
.pnote { padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.pn-title { font-family: var(--font-display); font-size: 19px; color: var(--text-strong); }
.pn-ex { color: var(--text); font-size: var(--text-sm); }
.pn-date { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }

.lb-wrap { position: relative; }
.lb-row.empty .invite-btn { font: inherit; font-size: var(--text-sm); cursor: pointer; background: transparent; color: var(--accent-text); border: 1px dashed var(--accent); border-radius: var(--radius-sm); padding: 2px 10px; justify-self: start; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.lb-row.empty .invite-btn::before { content: "+"; font-family: var(--font-mono); }
.lb-row.empty .invite-btn:hover, .lb-row.empty .invite-btn[aria-expanded="true"] { background: var(--accent-soft); border-style: solid; text-decoration: none; }
.lb-row.empty .invite-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.invite-pop { position: absolute; z-index: 20; width: min(340px, 100%); background: var(--bg-raised); border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.35); }
.invite-pop .inv-head { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.invite-pop .inv-title { font-weight: 600; color: var(--text-strong); font-size: var(--text-sm); }
.invite-pop .inv-sub { color: var(--text-muted); font-size: var(--text-xs); margin: 2px 0 10px; line-height: 1.45; }
.invite-pop .inv-close { background: none; border: 0; color: var(--text-muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.invite-pop .inv-link { display: flex; gap: 6px; }
.invite-pop .inv-url { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; }
.invite-pop button.inv-copy { background: var(--accent); color: var(--bg); border: 0; border-radius: var(--radius-sm); padding: 6px 12px; font: inherit; font-size: var(--text-sm); font-weight: 600; cursor: pointer; }
.invite-pop .inv-ways { display: flex; gap: 6px; margin-top: 8px; }
.invite-pop .inv-ways a, .invite-pop .inv-ways button { flex: 1; text-align: center; font: inherit; font-size: var(--text-sm); color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 0; cursor: pointer; text-decoration: none; }
.invite-pop .inv-ways a:hover, .invite-pop .inv-ways button:hover { border-color: var(--accent); color: var(--text-strong); text-decoration: none; }
.invite-pop .inv-status { min-height: 1.2em; margin-top: 6px; font-size: var(--text-xs); color: var(--accent-2); }
.invite-pop button:focus-visible, .invite-pop a:focus-visible, .invite-pop input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Heatmap sizing (2026-10-12): cells grow with the column (11-18px), room for the hover zoom, no stray scrollbar */
.heat-box { container-type: inline-size; }
.heat-frame { --gap: 3px; --cell: clamp(8px, calc((100cqw - 46px - 25 * var(--gap)) / 26), 18px); }
@container (max-width: 460px) { .heat-frame { --gap: 2px; } }
.heat, .heat-days { gap: var(--gap, 3px); }
.heat-days { grid-template-rows: repeat(7, var(--cell, 12px)); line-height: var(--cell, 12px); }
.heat-wrap { overflow-x: auto; overflow-y: hidden; padding: 4px; margin: -4px; scrollbar-width: none; }
.heat-wrap::-webkit-scrollbar { display: none; }
.heat { grid-template-rows: repeat(7, var(--cell, 12px)); grid-auto-columns: var(--cell, 12px); }
.heat i { width: var(--cell, 12px); height: var(--cell, 12px); border-radius: 3px; }
.heat i[data-d]:hover, .heat i.is-sel { transform: scale(1.18); }

/* --- Standard nav: pages block + add-friend --------------------------- */
.toc.pages .friend-row { color: var(--accent); }
.toc.pages .friend-row:hover { color: var(--accent); background: var(--accent-soft); }
.tree-row.group .g-link { color: inherit; text-decoration: none; }
.tree-row.group .g-link:hover { color: var(--accent); text-decoration: underline; }
