/* Productivity overview — portfolio-themed, GitHub-style heatmap + spider chart */

/* Page shell (overview + pillar pages) */
:root {
  --bg: #0b0c0f;
  --bg2: #12151c;
  --surface: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --faint: rgba(255, 255, 255, 0.45);
  --accent: #c9a227;
  --sans: "Inter", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --r: 14px;
  --page-pad: 18px;
}

html[data-theme="light"] {
  --bg: #eef1f5;
  --bg2: #f7f9fc;
  --surface: rgba(17, 22, 34, 0.05);
  --border: rgba(17, 22, 34, 0.12);
  --text: rgba(17, 22, 34, 0.93);
  --muted: rgba(17, 22, 34, 0.72);
  --faint: rgba(17, 22, 34, 0.52);
  --accent: #9b7a18;
}

body.cat-shell,
body[data-pillars-page],
body[data-productivity-category] {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: linear-gradient(180deg, var(--bg), var(--bg2));
  min-height: 100vh;

  --p-bg: var(--bg2);
  --p-surface: var(--surface);
  --p-border: var(--border);
  --p-text: var(--text);
  --p-muted: var(--muted);
  --p-faint: var(--faint);
  --p-accent: var(--accent);
  --p-radius: var(--r);

  --p-heat-rgb: 57, 211, 83;
  --p-heat-empty: #161b22;
  --p-heat-0: var(--p-heat-empty);
  --p-heat-1: rgba(var(--p-heat-rgb), 0.22);
  --p-heat-2: rgba(var(--p-heat-rgb), 0.44);
  --p-heat-3: rgba(var(--p-heat-rgb), 0.66);
  --p-heat-4: rgb(var(--p-heat-rgb));
}

html[data-theme="light"] body.cat-shell,
html[data-theme="light"] body[data-pillars-page],
html[data-theme="light"] body[data-productivity-category] {
  --p-heat-rgb: 34, 139, 58;
  --p-heat-empty: #ebedf0;
  --p-heat-0: var(--p-heat-empty);
  --p-heat-1: rgba(var(--p-heat-rgb), 0.28);
  --p-heat-2: rgba(var(--p-heat-rgb), 0.48);
  --p-heat-3: rgba(var(--p-heat-rgb), 0.72);
  --p-heat-4: rgb(var(--p-heat-rgb));
}

.cat-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px var(--page-pad) 48px;
}

.cat-page h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 2rem;
  margin: 0 0 8px;
}

.cat-lead {
  color: var(--muted);
  line-height: 1.7;
  margin: 0 0 24px;
}

.cat-lead--page {
  margin-bottom: 20px;
}

.cat-page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.cat-back {
  color: var(--accent);
  font-size: 14px;
  text-decoration: none;
}

.cat-theme-toggle {
  font: inherit;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.pillar-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.pillar-tab {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.pillar-tab:hover {
  color: var(--text);
  border-color: var(--accent);
}

.pillar-tab.is-active {
  background: rgba(201, 162, 39, 0.18);
  border-color: var(--accent);
  color: var(--text);
}

.pillar-panel {
  display: none;
}

.pillar-panel.is-active {
  display: block;
}

.pillar-studio-page .pillar-studio {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--page-pad, 18px) 32px;
}

.pillar-studio-page .productivity-live-preview {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--page-pad, 18px) 48px;
}

.pillar-studio-page .productivity-live-widget {
  width: 100%;
}

#featured {
  scroll-margin-top: 72px;
}

/* Hero embed — fits column beneath Focus */
.hero-productivity {
  margin-top: 14px;
  width: 100%;
  min-width: 0;
}

.productivity--hero .productivity-panel,
.productivity--hero .productivity-overview-card {
  padding: 12px;
  margin-bottom: 10px;
}

.productivity--hero .productivity-heatmap-title {
  font-size: 12px;
}

.productivity--hero .productivity-heatmap-head {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.productivity--hero .productivity-year-picker {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
}

.productivity--hero .productivity-cell {
  width: var(--heatmap-cell);
  height: var(--heatmap-cell);
}

.productivity--hero .productivity-day-labels {
  font-size: 9px;
}

.productivity--hero .productivity-heatmap-months {
  font-size: 9px;
}

.productivity--hero .productivity-heatmap-footer {
  font-size: 10px;
  margin-top: 8px;
}

.productivity--hero .productivity-footer-note {
  display: none;
}

.productivity--hero .productivity-overview-header {
  margin-bottom: 10px;
}

.productivity--hero .productivity-overview-title {
  font-size: 12px;
}

.productivity--hero .productivity-profile-badge {
  font-size: 10px;
  padding: 3px 8px 3px 3px;
}

.productivity--hero .productivity-avatar {
  width: 20px;
  height: 20px;
  font-size: 9px;
}

.productivity--hero .productivity-overview-hint {
  font-size: 10px;
  margin-bottom: 8px;
}

.productivity--hero .productivity-overview-grid {
  max-width: 100%;
  gap: 8px;
}

.productivity--hero .productivity-grid-cell {
  padding: 10px 6px;
}

.productivity--hero .productivity-grid-icon {
  width: 22px;
  height: 22px;
}

.productivity--hero .productivity-grid-label {
  font-size: 10px;
}

.productivity--hero .productivity-overview-split {
  gap: 12px;
}

.productivity--hero .productivity-overview-right {
  min-height: 160px;
  padding-left: 8px;
}

.productivity--hero .productivity-radar {
  max-width: 200px;
}

.productivity--hero .productivity-radar-label {
  font-size: 8px;
}

.productivity--hero .productivity-radar-pct {
  font-size: 9px;
}

@media (max-width: 640px) {
  .productivity--hero .productivity-overview-split {
    grid-template-columns: 1fr;
  }

  .productivity--hero .productivity-overview-right {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--p-border);
    padding-top: 12px;
  }
}

.productivity {
  --p-bg: var(--bg2, #0f1117);
  --p-surface: var(--surface, rgba(255, 255, 255, 0.06));
  --p-border: var(--border, rgba(255, 255, 255, 0.12));
  --p-text: var(--text, rgba(255, 255, 255, 0.92));
  --p-muted: var(--muted, rgba(255, 255, 255, 0.65));
  --p-faint: var(--faint, rgba(255, 255, 255, 0.45));
  --p-accent: var(--accent, #c9a227);
  --p-radius: var(--r, 14px);

  /* GitHub-style contribution scale: Less (translucent) → More (opaque) */
  --p-heat-rgb: 57, 211, 83;
  --p-heat-empty: #161b22;
  --p-heat-0: var(--p-heat-empty);
  --p-heat-1: rgba(var(--p-heat-rgb), 0.22);
  --p-heat-2: rgba(var(--p-heat-rgb), 0.44);
  --p-heat-3: rgba(var(--p-heat-rgb), 0.66);
  --p-heat-4: rgb(var(--p-heat-rgb));

  --p-radar-fill: rgba(57, 211, 83, 0.28);
  --p-radar-stroke: #39d353;
  --p-radar-axis: rgba(57, 211, 83, 0.35);
  --p-radar-dot: #e6edf3;

  font-family: var(--sans, system-ui, sans-serif);
  color: var(--p-text);
}

html[data-theme="light"] .productivity {
  --p-heat-rgb: 34, 139, 58;
  --p-heat-empty: #ebedf0;
  --p-heat-0: var(--p-heat-empty);
  --p-heat-1: rgba(var(--p-heat-rgb), 0.28);
  --p-heat-2: rgba(var(--p-heat-rgb), 0.48);
  --p-heat-3: rgba(var(--p-heat-rgb), 0.72);
  --p-heat-4: rgb(var(--p-heat-rgb));
  --p-radar-fill: rgba(33, 110, 57, 0.22);
  --p-radar-stroke: #216e39;
  --p-radar-axis: rgba(33, 110, 57, 0.4);
  --p-radar-dot: #1f2328;
}

.productivity-panel {
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  padding: 16px;
  margin-bottom: 16px;
}

.productivity-heatmap-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.productivity-heatmap-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.productivity-year-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.productivity-year-btn {
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--p-muted);
  cursor: pointer;
}

.productivity-year-btn:hover {
  color: var(--p-text);
}

.productivity-year-btn.is-active {
  background: #1f6feb;
  color: #fff;
  border-color: #1f6feb;
}

html[data-theme="light"] .productivity-year-btn.is-active {
  background: #0969da;
  border-color: #0969da;
}

.productivity-heatmap-wrap {
  --heatmap-label-width: 28px;
  --heatmap-cell: 12px;
  --heatmap-gap: 3px;
  --heatmap-weeks: 53;
  overflow-x: auto;
  padding-bottom: 4px;
  display: grid;
  grid-template-columns: var(--heatmap-label-width) minmax(0, max-content);
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 4px;
  align-items: start;
}

.productivity--hero .productivity-heatmap-wrap {
  --heatmap-label-width: 24px;
  --heatmap-cell: 10px;
  --heatmap-gap: 2px;
}

.productivity-heatmap-cols {
  display: contents;
}

.productivity-day-labels {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(7, var(--heatmap-cell));
  gap: var(--heatmap-gap);
  font-size: 10px;
  color: var(--p-muted);
  width: var(--heatmap-label-width);
  line-height: var(--heatmap-cell);
}

.productivity-heatmap-months,
.productivity-heatmap-grid {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(var(--heatmap-weeks), var(--heatmap-cell));
  gap: var(--heatmap-gap);
}

.productivity-heatmap-months {
  grid-row: 1;
  min-height: 16px;
  font-size: 10px;
  color: var(--p-muted);
}

.productivity-month-label {
  white-space: nowrap;
  justify-self: start;
  align-self: end;
  /* Center on gutter before the first week column that contains this month */
  transform: translateX(calc(-0.5 * (var(--heatmap-cell) + var(--heatmap-gap))));
}

.productivity-month-label--start {
  transform: none;
}

.productivity-heatmap-grid {
  grid-row: 2;
  grid-template-rows: repeat(7, var(--heatmap-cell));
  grid-auto-flow: column;
}

.productivity-cell {
  width: var(--heatmap-cell, 12px);
  height: var(--heatmap-cell, 12px);
  padding: 0;
  border: none;
  border-radius: 2px;
  background: var(--p-heat-0);
  cursor: default;
}

.productivity-cell[data-level="1"] {
  background: var(--p-heat-1);
}

.productivity-cell[data-level="2"] {
  background: var(--p-heat-2);
}

.productivity-cell[data-level="3"] {
  background: var(--p-heat-3);
}

.productivity-cell[data-level="4"] {
  background: var(--p-heat-4);
}

.productivity-cell--empty {
  background: var(--p-heat-empty, var(--p-heat-0));
  opacity: 1;
}

.productivity-cell:not(:disabled):hover {
  outline: 1px solid var(--p-accent);
  outline-offset: 1px;
}

.productivity-heatmap-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--p-muted);
}

.productivity-footer-note {
  cursor: default;
}

.productivity-legend {
  display: flex;
  align-items: center;
  gap: 4px;
}

.productivity-legend .productivity-cell {
  pointer-events: none;
}

/* Activity overview card */
.productivity-overview-card {
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  padding: 16px;
}

.productivity-overview-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.productivity-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--p-border);
}

html[data-theme="light"] .productivity-profile-badge {
  background: rgba(255, 255, 255, 0.7);
}

.productivity-avatar {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--p-heat-3), var(--p-heat-1));
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  color: #0d1117;
}

.productivity-overview-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.productivity-overview-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: center;
}

.productivity-overview-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--p-muted);
}

.productivity-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 220px;
}

.productivity-grid-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: 10px;
  border: 1px solid var(--p-border);
  background: rgba(0, 0, 0, 0.15);
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}

html[data-theme="light"] .productivity-grid-cell {
  background: rgba(255, 255, 255, 0.5);
}

.productivity-grid-cell:hover {
  border-color: var(--p-accent);
  background: rgba(201, 162, 39, 0.08);
}

.productivity-grid-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.productivity-grid-icon {
  width: 28px;
  height: 28px;
  fill: var(--p-heat-4);
}

.productivity-grid-label {
  font-size: 11px;
  color: var(--p-muted);
  line-height: 1.2;
}

.productivity-icon-badge {
  position: absolute;
  top: -4px;
  right: -10px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--p-accent);
  color: #0b0c0f;
  line-height: 1.2;
}

.productivity-overview-right {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  border-left: 1px solid var(--p-border);
  padding-left: 12px;
}

.productivity-radar {
  width: 100%;
  max-width: 240px;
  height: auto;
}

.productivity-radar-axis {
  stroke: var(--p-radar-axis);
  stroke-width: 1;
}

.productivity-radar-polygon {
  fill: var(--p-radar-fill);
}

.productivity-radar-polygon-stroke {
  fill: none;
  stroke: var(--p-radar-stroke);
  stroke-width: 2;
  filter: drop-shadow(0 0 6px rgba(57, 211, 83, 0.45));
}

.productivity-radar-dot {
  fill: var(--p-radar-dot);
  stroke: var(--p-radar-stroke);
  stroke-width: 1.5;
}

.productivity-radar-dot--center {
  fill: var(--p-radar-stroke);
}

.productivity-radar-label {
  font-size: 9px;
  fill: var(--p-muted);
}

.productivity-radar-pct {
  font-size: 10px;
  font-weight: 600;
  fill: var(--p-heat-4);
}

.productivity-error {
  color: #e57373;
  font-size: 14px;
}

.productivity-milestone-banner {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--p-radius);
  border: 1px solid var(--p-border);
  background: rgba(57, 211, 83, 0.06);
  font-size: 12px;
  color: var(--p-muted);
}

.productivity-milestone-line {
  margin: 0 0 4px;
}

.productivity-milestone-line:last-child {
  margin-bottom: 0;
}

.productivity-milestone-line strong {
  font-weight: 700;
  color: var(--p-text);
}

.productivity-heatmap-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.productivity-filter-btn {
  font: inherit;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--p-border);
  background: transparent;
  color: var(--p-muted);
  cursor: pointer;
}

.productivity-filter-btn:hover {
  border-color: var(--p-accent);
  color: var(--p-text);
}

.productivity-filter-btn.is-active {
  background: rgba(201, 162, 39, 0.15);
  border-color: var(--p-accent);
  color: var(--p-text);
}

/* Category pages */
.cat-hero-form {
  max-width: 720px;
  margin: 0 auto 24px;
  padding: 20px;
  border-radius: var(--p-radius);
  border: 1px solid var(--p-border);
  background: var(--p-surface);
}

.cat-hero-form h2 {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 600;
}

.cat-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cat-form-grid .cat-field--full {
  grid-column: 1 / -1;
}

.cat-field label {
  display: block;
  font-size: 12px;
  color: var(--p-muted);
  margin-bottom: 4px;
}

.cat-field input,
.cat-field select {
  width: 100%;
  font: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--p-border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--p-text);
}

html[data-theme="light"] .cat-field input,
html[data-theme="light"] .cat-field select {
  background: #fff;
}

.cat-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.cat-form-actions button {
  font: inherit;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: var(--p-accent, #c9a227);
  color: #111;
  font-weight: 600;
  cursor: pointer;
}

.cat-form-actions button:hover {
  filter: brightness(1.08);
}

.cat-form-actions button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.cat-form-status {
  font-size: 13px;
  color: var(--p-muted);
}

.cat-form-error {
  color: #e57373;
  font-size: 14px;
}

.cat-event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.cat-event {
  display: grid;
  grid-template-columns: 6.5rem 5rem 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--p-border);
  font-size: 14px;
}

.cat-event--empty {
  color: var(--p-muted);
  grid-template-columns: 1fr;
}

.cat-event time {
  color: var(--p-muted);
  font-size: 12px;
}

.cat-event-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--p-faint);
}

.cat-event-intensity {
  color: var(--p-heat-4);
  letter-spacing: 2px;
}

.cat-load-more {
  display: block;
  margin: 16px auto 48px;
  font: inherit;
  padding: 8px 20px;
  border-radius: 8px;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  color: var(--p-text);
  cursor: pointer;
}

.cat-list-sentinel {
  height: 1px;
}

@media (max-width: 768px) {
  .productivity-overview-split {
    grid-template-columns: 1fr;
  }

  .productivity-overview-right {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--p-border);
    padding-top: 16px;
  }

  .productivity-year-picker {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .productivity-grid-cell {
    transition: none;
  }
}
