/* === Reset & Base === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #1a1210;
  --bg-surface: #231a16;
  --bg-cell: #2d2118;
  --bg-cell-active: #3d2e22;
  --bg-cell-hover: #4a3828;
  --copper: #c47a5a;
  --copper-light: #e8a87c;
  --copper-bright: #f0c4a0;
  --text-primary: #e8ddd4;
  --text-secondary: #a89888;
  --text-muted: #6d5d50;
  --border: #3a2a20;

  --cat-claude-code: #6bcf7f;
  --cat-claude-ai: #5bb8d5;
  --cat-api: #f4a261;
  --cat-desktop: #c49bdb;
  --cat-other: #a89888;
}

/* === OpenAI Theme === */
body.theme-openai {
  --bg-primary: #f7f7f5;
  --bg-surface: #ffffff;
  --bg-cell: #f0f0ec;
  --bg-cell-active: #d4edda;
  --bg-cell-hover: #c3e6cb;
  --copper: #10a37f;
  --copper-light: #0d8c6c;
  --copper-bright: #08755a;
  --text-primary: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #999999;
  --border: #e0e0dc;

  --cat-codex: #10a37f;
  --cat-chatgpt: #6366f1;
  --cat-api: #f59e0b;
  --cat-desktop: #8b5cf6;
  --cat-other: #9ca3af;
}

body.theme-openai .person-avatar-fallback,
body.theme-openai .feature-avatar-fallback {
  color: #fff;
}

body.theme-openai .range-field input {
  color-scheme: light;
}

body.theme-openai .day-cell.out-of-range {
  opacity: 0.5;
  background: rgba(0, 0, 0, 0.04);
}

body.theme-openai .day-cell.adjacent-month {
  opacity: 0.6;
  background: rgba(0, 0, 0, 0.03);
}

body.theme-openai .day-cell.out-of-range:hover {
  background: rgba(0, 0, 0, 0.06);
}

body.theme-openai .day-cell.adjacent-month:hover {
  background: rgba(0, 0, 0, 0.05);
}

body.theme-openai .feature-pill:hover {
  background: rgba(0, 0, 0, 0.08);
}

body.theme-openai .calendar-toolbar {
  background: rgba(255, 255, 255, 0.86);
}

body.theme-openai .tooltip {
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* OpenAI category dot classes */
.cat-codex { background-color: var(--cat-codex); }
.cat-chatgpt { background-color: var(--cat-chatgpt); }

/* === Team Switcher === */
.team-switcher {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 1.5rem;
  padding: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.team-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.team-tab:hover {
  background: rgba(128, 128, 128, 0.1);
  color: var(--text-primary);
}

.team-tab.active {
  background: var(--copper);
  color: #fff;
}

.team-tab .team-logo {
  flex-shrink: 0;
}

.team-tab:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}

html {
  font-size: 15px;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* === Header === */
header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
}

.brand-icon {
  color: var(--copper);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
}

h1 {
  font-size: 2.7rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

h1 .highlight {
  color: var(--copper);
}

#day-count {
  color: var(--text-primary);
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

/* === Tracked People === */
.tracked-people {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  padding: 0 1rem;
}

.person {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.person:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.person:focus-visible,
.month-nav-button:focus-visible,
.range-reset:focus-visible,
.feature-pill:focus-visible,
.range-field input:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}

.person-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-cell);
  border: 2px solid var(--copper);
  object-fit: cover;
}

.person-avatar-fallback {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--copper);
  border: 2px solid var(--copper-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--bg-primary);
}

.person-info {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.person-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.person-handle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* === Calendar Toolbar === */
.calendar-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(35, 26, 22, 0.86);
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.month-nav-button,
.range-reset {
  border: 1px solid var(--border);
  background: var(--bg-cell);
  color: var(--text-primary);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.month-nav-button {
  width: 36px;
  height: 36px;
  font-size: 1.35rem;
  line-height: 1;
}

.month-nav-button:hover:not(:disabled),
.range-reset:hover {
  background: var(--bg-cell-hover);
  border-color: var(--copper);
}

.month-nav-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.month-nav-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.month-nav-label {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  text-transform: uppercase;
}

.month-nav-caption {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.range-controls {
  display: flex;
  align-items: flex-end;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.range-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.range-field span {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.range-field input {
  min-width: 150px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-surface);
  color: var(--text-primary);
  color-scheme: dark;
  padding: 0.65rem 0.8rem;
  font: inherit;
}

.range-field input:focus {
  outline: 2px solid var(--copper);
  outline-offset: 1px;
}

.range-reset {
  padding: 0.7rem 1rem;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* === Calendar === */
.calendar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.month-block {
  margin-bottom: 0;
  min-width: 0;
}

.month-label {
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--copper);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.weekday-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 4px;
}

.weekday-header span {
  min-width: 0;
  text-align: center;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0.3rem 0;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
}

/* === Date Cells === */
.day-cell {
  background: var(--bg-surface);
  border-radius: 6px;
  min-height: 98px;
  min-width: 0;
  padding: 0.45rem;
  position: relative;
  transition: background 0.15s;
}

.day-cell:hover {
  background: var(--bg-cell);
}

.day-cell.has-releases {
  background: var(--bg-cell-active);
}

.day-cell.has-releases:hover {
  background: var(--bg-cell-hover);
}

.day-cell.out-of-range {
  opacity: 0.48;
  background: rgba(45, 33, 24, 0.58);
}

.day-cell.adjacent-month {
  opacity: 0.62;
  background: rgba(45, 33, 24, 0.44);
}

.day-cell.out-of-range:hover {
  background: rgba(45, 33, 24, 0.55);
}

.day-cell.adjacent-month:hover {
  background: rgba(45, 33, 24, 0.44);
}

.day-cell.today {
  outline: 2px solid var(--copper);
  outline-offset: -2px;
}

.day-number {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.day-cell.has-releases .day-number {
  color: var(--copper-light);
}

/* === Feature Pills === */
.features-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.feature-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 2px 5px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.1s;
  text-decoration: none;
}

.feature-pill:hover {
  background: rgba(255, 255, 255, 0.08);
}

.feature-pill-disabled {
  cursor: default;
}

.feature-pill-disabled:hover {
  background: transparent;
}

.feature-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.feature-avatar,
.feature-avatar-fallback {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  flex-shrink: 0;
}

.feature-avatar {
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.feature-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--copper);
  color: var(--bg-primary);
  font-size: 0.58rem;
  font-weight: 700;
}

.feature-name {
  font-size: 0.72rem;
  font-weight: 550;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

/* Category colors */
.cat-claude-code { background-color: var(--cat-claude-code); }
.cat-claude-ai { background-color: var(--cat-claude-ai); }
.cat-api { background-color: var(--cat-api); }
.cat-desktop { background-color: var(--cat-desktop); }
.cat-other { background-color: var(--cat-other); }

/* === Tooltip === */
.tooltip {
  position: fixed;
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.84rem;
  color: var(--text-primary);
  max-width: 280px;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.tooltip.visible {
  display: block;
}

.tooltip-title {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.tooltip-meta {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

/* === Stats Bar === */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 1.95rem;
  font-weight: 800;
  color: var(--copper-light);
  line-height: 1;
}

.stat-label {
  font-size: 0.74rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* === Footer === */
footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.attribution {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.5rem;
}

.source {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.source a {
  color: var(--copper);
  text-decoration: none;
}

.source a:hover {
  text-decoration: underline;
}

/* === Legend === */
/* === Responsive === */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .container {
    padding: 1rem 0.5rem;
  }

  .tracked-people {
    gap: 0.75rem;
  }

  .calendar-toolbar {
    padding: 0.9rem;
  }

  .month-nav {
    width: 100%;
    justify-content: space-between;
  }

  .month-nav-copy {
    flex: 1;
    text-align: center;
  }

  .range-controls {
    width: 100%;
  }

  .range-field {
    flex: 1 1 140px;
  }

  .range-field input {
    min-width: 0;
    width: 100%;
  }

  .person-info {
    display: none;
  }

  .person-avatar,
  .person-avatar-fallback {
    width: 28px;
    height: 28px;
  }

  .day-cell {
    min-height: 78px;
    padding: 0.25rem;
  }

  .feature-name {
    font-size: 0.6rem;
  }

  .stats-bar {
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.4rem;
  }

  .calendar-toolbar {
    border-radius: 10px;
  }

  .month-nav-button {
    width: 32px;
    height: 32px;
  }

  .range-controls {
    gap: 0.6rem;
  }

  .range-reset {
    width: 100%;
  }

  .day-cell {
    min-height: 60px;
  }

  .feature-pill {
    gap: 2px;
    padding: 0 2px;
  }

  .feature-dot {
    width: 4px;
    height: 4px;
  }

  .feature-avatar,
  .feature-avatar-fallback {
    width: 13px;
    height: 13px;
  }

  .feature-name {
    font-size: 0.56rem;
  }
}
