/* ====================================================================
   HOME (profile) — body styles
   ====================================================================
   Shared atoms (.rail-heading / .kr-tag / .kr-btn / .kr-cursor) moved to
   kr-atoms.css so they apply on every route. Don't reintroduce them here.
   ==================================================================== */

.profile-body {
  padding: 32px 40px 60px;
  display: flex;
  flex-direction: column;
  gap: 44px;
  min-width: 0;
}

/* ─── Identity row ─── */

.prof-identity {
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  gap: 32px;
  align-items: start;
}

/* avatar column */
.prof-avatar-col { display: flex; flex-direction: column; gap: 14px; }
.prof-avatar {
  width: 240px;
  height: 240px;
  background: var(--io-surface-overlay);
  border: 1px solid var(--io-border);
  border-radius: var(--io-radius-sm);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.prof-avatar-img { display: block; width: 200px; height: 200px; object-fit: contain; }
.prof-avatar-tag {
  position: absolute;
  left: 10px; top: 10px;
  font-family: var(--io-font-display);
  font-size: 10px;
  color: var(--io-accent-bright);
  letter-spacing: 0.08em;
}
.prof-avatar-online {
  position: absolute;
  right: 10px; bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--io-font-mono);
  font-size: 10px;
  color: var(--io-success);
}
.prof-avatar-online-dot {
  width: 6px; height: 6px;
  background: var(--io-success);
  box-shadow: 0 0 4px var(--io-success);
  border-radius: 50%;
  display: inline-block;
}
.prof-avatar-actions {
  display: flex;
  gap: 6px;
}
.prof-msg-btn { flex: 1; }

/* identity copy */
.prof-copy { min-width: 0; }
.prof-kicker {
  font-family: var(--io-font-display);
  font-size: var(--io-fs-micro);
  color: var(--io-accent-bright);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.prof-name {
  font-family: var(--io-font-display);
  font-size: 56px;
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--io-text-primary);
}
.prof-subtitle {
  font-family: var(--io-font-mono);
  font-size: var(--io-fs-base);
  color: var(--io-text-tertiary);
  margin-top: 6px;
}
.prof-bio {
  margin-top: 22px;
  max-width: 620px;
  font-family: var(--io-font-mono);
  font-size: var(--io-fs-base);
  line-height: 1.65;
  color: var(--io-text-secondary);
}
.prof-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 18px;
}

/* links column */
.prof-links-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prof-links {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 8px;
  background: var(--io-border);
  border-radius: var(--io-radius-sm);
  overflow: hidden;
}
.prof-link {
  background: var(--io-surface-base);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--io-font-mono);
  font-size: var(--io-fs-sm);
  color: var(--io-text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease;
}
.prof-link:hover { background: var(--io-surface-overlay); }
.prof-link-icon { color: var(--io-accent); width: 16px; text-align: center; }
.prof-link-k { color: var(--io-text-tertiary); width: 76px; }
.prof-link-v { flex: 1; color: var(--io-text-primary); }
.prof-link-out { color: var(--io-text-disabled); font-size: 10px; }

/* ─── Heatmap ─── */

.prof-heatmap-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.prof-heatmap-stats {
  font-family: var(--io-font-mono);
  font-size: var(--io-fs-micro);
  color: var(--io-text-tertiary);
  white-space: nowrap;
}
.prof-heatmap-stats .accent { color: var(--io-accent-bright); }
.prof-heatmap-stats .strong { color: var(--io-text-primary); }

.prof-heatmap-box {
  padding: 18px;
  border-radius: var(--io-radius-sm);
  overflow: visible;
  text-align: left;   /* heatmap-root is inline-block; left-align so it
                         sits against the left edge of the section box */
}

/* ─── heatmap + 3 side widgets share one row ─── */

.prof-heatmap-row {
  display: flex;
  flex-wrap: wrap;          /* drop side widgets under heatmap when narrow */
  align-items: stretch;
  gap: 18px;
}

/* ─── heatmap section — 2-column layout ────────────────────────────────
   Heatmap pane on the left (fixed natural width, the grid drives it),
   year/org menu vertical on the right filling whatever horizontal space
   the heatmap doesn't use. The grid is a fixed-pixel thing that won't
   scale, so the menu is the answer to "what do I do with the leftover
   width" rather than trying to make the grid stretch. */
.prof-heatmap-section {
  display: flex;
  flex: 1 1 100%;             /* take the whole heatmap-row width */
  gap: 24px;
  align-items: flex-start;
  min-width: 0;
}
.prof-heatmap-grids {
  flex: 0 0 auto;             /* natural width of the inner grid */
  min-width: 0;
}
.prof-heatmap-pane[hidden] { display: none; }

/* The vertical menu on the right — fills remaining width. Each item is
   a row with [year/label] on the left and [commit count] on the right. */
.prof-heatmap-menu {
  /* Pin to the right edge of the section — leftover space sits as a gap
     between the heatmap and the menu, not after the menu. Reads cleaner
     when the section is wider than (grid + menu + gap). */
  margin-left: auto;
  flex: 0 0 320px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--io-font-mono);
}
.prof-heatmap-menu-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-family: var(--io-font-pixel);
  font-size: var(--io-fs-micro);
  letter-spacing: 1.5px;
  color: var(--io-text-tertiary);
  text-transform: uppercase;
}
.prof-heatmap-menu-head i { color: var(--io-accent); }
.prof-heatmap-menu-sub {
  margin: 10px 0 4px;
  font-family: var(--io-font-pixel);
  font-size: var(--io-fs-micro);
  letter-spacing: 1.5px;
  color: var(--io-text-disabled);
  text-transform: uppercase;
}
.prof-heatmap-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 30px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid var(--io-border);
  border-radius: var(--io-radius-xs);
  color: var(--io-text-secondary);
  font-family: var(--io-font-mono);
  font-size: var(--io-fs-sm);
  cursor: pointer;
  text-align: left;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.prof-heatmap-tab .k { display: inline-flex; align-items: center; gap: 6px; }
.prof-heatmap-tab .v {
  color: var(--io-text-tertiary);
  font-size: var(--io-fs-micro);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.prof-heatmap-tab:hover {
  color: var(--io-text-primary);
  background: var(--io-surface-overlay);
  border-color: var(--io-text-tertiary);
}
.prof-heatmap-tab:hover .v { color: var(--io-text-secondary); }
.prof-heatmap-tab.is-active {
  color: var(--io-accent);
  background: var(--io-accent-subtle);
  border-color: var(--io-accent);
}
.prof-heatmap-tab.is-active .v { color: var(--io-accent); }
.prof-heatmap-tab.is-org .k i { color: var(--io-accent); opacity: 0.7; font-size: 10px; }

.prof-heatmap-stats .muted {
  color: var(--io-text-tertiary);
  font-family: var(--io-font-mono);
  font-size: var(--io-fs-micro);
}
.prof-heatmap-stats .muted code {
  color: var(--io-accent);
  background: var(--io-surface-overlay);
  border: 1px solid var(--io-border);
  border-radius: var(--io-radius-xs);
  padding: 0 5px;
}

/* leading-pad cells — keep Jan 1 aligned to its day-of-week row without
   actually rendering a square at the top-left corner. */
.heatmap-cell.pad {
  visibility: hidden;
  pointer-events: none;
  border-color: transparent;
}

.heatmap-root {
  font-family: var(--io-font-mono);
  color: var(--io-text-tertiary);
  display: inline-block;       /* shrink-wrap to grid width */
}
.heatmap-months {
  display: grid;
  grid-template-columns: repeat(var(--heatmap-cols, 53), 12px);
  column-gap: 3px;
  font-size: 10px;
  margin-bottom: 6px;
  letter-spacing: 0.08em;
}
.heatmap-months span {
  white-space: nowrap;          /* labels are wider than 12px — let them overflow right */
  grid-row: 1;
}
.heatmap-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-columns: repeat(var(--heatmap-cols, 53), 12px);
  grid-template-rows: repeat(7, 12px);
  gap: 3px;
}
.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid var(--io-border-subtle);
  position: relative;
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.heatmap-grid .heatmap-cell:hover {
  z-index: 10;
  transform: scale(1.4);
  box-shadow: 0 0 6px var(--io-accent-glow);
}
.heatmap-grid .heatmap-cell:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.714);  /* counter the parent's 1.4x scale */
  background: var(--io-surface-sunken);
  border: 1px solid var(--io-accent-dim);
  border-radius: var(--io-radius-sm);
  padding: 6px 10px;
  font-family: var(--io-font-mono);
  font-size: var(--io-fs-micro);
  font-weight: 400;
  color: var(--io-text-primary);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6), 0 0 6px var(--io-accent-glow);
  letter-spacing: 0.02em;
  transform-origin: center bottom;
}
/* Theme-aware contribution levels. Each cell is the active accent mixed
   into the active surface at increasing weight, so the heatmap retints
   correctly when the theme changes. l0 is a near-surface idle cell (a
   hint of tertiary text over surface-base), the rest progress accent. */
.heatmap-cell.l0 { background: color-mix(in srgb, var(--io-text-tertiary) 8%,  var(--io-surface-base)); }
.heatmap-cell.l1 { background: color-mix(in srgb, var(--io-accent)        18%, var(--io-surface-base)); }
.heatmap-cell.l2 { background: color-mix(in srgb, var(--io-accent)        38%, var(--io-surface-base)); }
.heatmap-cell.l3 { background: color-mix(in srgb, var(--io-accent)        65%, var(--io-surface-base)); }
.heatmap-cell.l4 { background: var(--io-accent); }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 10px;
}
.heatmap-legend .heatmap-cell { display: inline-block; }

/* ─── Bottom row ─── */

.prof-bottom-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
}

/* papers list */
.paper-mini-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
}
.paper-mini {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--io-border-subtle);
  align-items: baseline;
}
.paper-mini[data-paper-open] { cursor: pointer; }
.paper-mini[data-paper-open]:hover .paper-mini-t { color: var(--io-accent-bright); }
.paper-mini:last-child { border-bottom: none; }
.paper-mini-y {
  font-family: var(--io-font-display);
  font-size: 18px;
  color: var(--io-accent-bright);
}
.paper-mini-t {
  font-family: var(--io-font-mono);
  font-size: var(--io-fs-base);
  color: var(--io-text-primary);
  line-height: 1.35;
}
.paper-mini-t .glitch-text {
  display: inline-block;
  outline: none;
}
.paper-mini-t .glitch-text:hover,
.paper-mini-t .glitch-text:focus {
  color: var(--io-accent-bright);
  text-shadow: 0 0 16px color-mix(in srgb, var(--io-accent-bright) 45%, transparent);
}
.paper-mini-venue {
  font-family: var(--io-font-mono);
  font-size: var(--io-fs-micro);
  color: var(--io-text-tertiary);
  margin-top: 6px;
}
.paper-mini-draft { color: var(--io-warning); margin-left: 6px; }
.paper-mini-actions {
  display: flex;
  gap: 6px;
  align-self: center;
}
.paper-mini-actions .kr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 54px;
  padding-inline: 8px;
  white-space: nowrap;
}
.paper-mini-actions .kr-btn i {
  flex: 0 0 auto;
}

/* right column: now playing + recently */
.prof-right-col {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.prof-now-card {
  margin-top: 14px;
  padding: 14px;
  background: var(--io-surface-overlay);
  border: 1px solid var(--io-border);
  border-radius: var(--io-radius-sm);
  font-family: var(--io-font-mono);
}
.prof-now-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.prof-now-art {
  width: 48px;
  height: 48px;
  background: var(--io-surface-base);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--io-radius-sm);
  overflow: hidden;
}
.prof-now-art i   { color: var(--io-accent); font-size: 20px; }
.prof-now-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prof-now-meta { flex: 1; min-width: 0; }
.prof-now-track { font-family: var(--io-font-mono); font-size: var(--io-fs-sm); color: var(--io-text-primary); }
.prof-now-album { font-family: var(--io-font-mono); font-size: 11px; color: var(--io-text-tertiary); margin-top: 2px; }
.prof-now-play { color: var(--io-accent-bright); cursor: pointer; }
.prof-now-bar {
  margin-top: 12px;
  height: 3px;
  background: var(--io-surface-sunken);
  border-radius: 2px;
  overflow: hidden;
}
.prof-now-bar-fill {
  width: 43%;
  height: 100%;
  background: var(--io-accent-dim);
}
.prof-now-times {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--io-text-tertiary);
}

/* Recent — infinite vertical scroll. The track contains the list emitted
   twice; translateY runs 0 → -50% so the second copy lands exactly where
   the first started, making the loop seamless. Hover pauses for politeness;
   prefers-reduced-motion skips the animation entirely. */
.prof-recent-list {
  margin-top: 10px;
  font-family: var(--io-font-mono);
  font-size: var(--io-fs-micro);
  color: var(--io-text-tertiary);
  line-height: 1.85;
  max-height: 8.25em;
  overflow: hidden;
  position: relative;
  /* fade top + bottom so lines don't pop in / out abruptly */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 18%, #000 82%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 18%, #000 82%, transparent 100%);
}
.prof-recent-track {
  display: flex;
  flex-direction: column;
  animation: prof-recent-scroll 38s linear infinite;
  will-change: transform;
}
.prof-recent-list:hover .prof-recent-track { animation-play-state: paused; }
.prof-recent-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prof-recent-sigil { color: var(--io-accent); margin-right: 6px; }

@keyframes prof-recent-scroll {
  from { transform: translateY(0); }
  to   { transform: translateY(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .prof-recent-track { animation: none; }
}
