/* diary.css — styles for slop's diary page */
.diary-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.diary-controls input[type="search"] {
  flex: 1 1 240px;
  min-width: 0;
}

.diary-controls .btn {
  font-size: 13px;
  padding: 6px 12px;
}

.diary-tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  width: 100%;
  justify-content: flex-start;
}

.diary-tag-filters button {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.diary-tag-filters button:hover {
  background: var(--bg-soft);
}

.diary-tag-filters button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Active tag filter button */
.diary-tag-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* All entries button */
.diary-tag-btn[data-tag=""] {
  background: var(--bg-soft);
  color: var(--fg);
  border-color: var(--fg);
}

.diary-tag-btn[data-tag=""]:hover {
  background: var(--accent);
  color: #fff;
}

/* Passport progress */
.diary-progress {
  font-size: 13px;
  opacity: 0.8;
  white-space: nowrap;
}

/* Statistics */
.diary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  flex: 1 1 120px;
  min-width: 100px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-value {
  display: block;
  font-size: 32px;
  font-weight: bold;
  font-family: ui-monospace, monospace;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 4px;
  font-family: ui-monospace, monospace;
}

.diary-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.diary-chart-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.diary-chart-card h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--fg);
}

.diary-chart {
  width: 100%;
  height: auto;
}

/* Calendar view */
.diary-calendar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.diary-cal-month {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-soft);
}

.diary-cal-header {
  font-weight: bold;
  margin-bottom: 8px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.diary-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: bold;
  color: var(--fg-muted);
  text-align: center;
  font-family: ui-monospace, monospace;
}

.diary-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.diary-cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  border: 1px solid transparent;
  position: relative;
  min-height: 36px;
}

.diary-cal-day:hover {
  background: var(--bg);
  border-color: var(--accent);
  transform: scale(1.05);
  z-index: 1;
}

.diary-cal-day:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.diary-cal-day--has-entry {
  background: var(--bg);
  font-weight: bold;
}

.diary-cal-day--has-entry .diary-cal-mood {
  display: block;
  font-size: 10px;
  margin-top: 2px;
  line-height: 1;
}

.diary-cal-day--today {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.diary-cal-day--empty {
  visibility: hidden;
}

.diary-cal-mood {
  font-size: 11px;
}

/* Featured entry */
.news-featured-content {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.news-featured-entry {
  flex: 1 1 300px;
  min-width: 0;
}

.diary-daily-stamp-badge {
  font-size: 11px;
  padding: 3px 8px;
  opacity: 0.7;
}

/* Modal */
.diary-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
}

.diary-modal__content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}

.diary-modal__close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--fg);
  font-size: 20px;
  cursor: pointer;
}

.diary-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.diary-modal__date {
  font-size: 14px;
  opacity: 0.7;
  font-family: ui-monospace, monospace;
}

.diary-modal__mood {
  font-size: 18px;
}

.diary-modal__body p {
  margin: 0 0 12px;
  line-height: 1.6;
}

.diary-modal__tags {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.diary-modal__tags span {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  padding: 2px 8px;
  margin: 0 4px 4px 0;
  background: var(--bg-soft);
  border-radius: 4px;
}

/* Print */
@media print {
  .diary-tag-filters,
  .diary-actions,
  .diary-daily-stamp-badge,
  .diary-modal {
    display: none !important;
  }
}

/* Responsive */
@media (max-width: 600px) {
  .diary-calendar {
    grid-template-columns: 1fr;
  }
  .diary-cal-day {
    font-size: 11px;
    min-height: 32px;
  }
  .diary-cal-weekdays {
    font-size: 9px;
  }
  .diary-charts {
    grid-template-columns: 1fr;
  }
  .stat-card {
    min-width: calc(50% - 6px);
  }
  .diary-view-toggles {
    flex-wrap: wrap;
  }
  .diary-view-btn {
    flex: 1 1 auto;
  }
}

/* View toggles */
.diary-view-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
}

.diary-view-btn {
  flex: 1 1 120px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.diary-view-btn:hover {
  background: var(--bg-soft);
  border-color: var(--accent);
}

.diary-view-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* On This Day */
.diary-otd {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.diary-otd-entry {
  flex: 1 1 280px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.diary-otd-entry:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.diary-otd-entry .date {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 4px;
}

.diary-otd-entry .title {
  font-weight: bold;
  margin-bottom: 8px;
}

.diary-otd-entry .mood {
  font-size: 16px;
  float: right;
}

/* Streak display */
.streak-display {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.streak-card {
  flex: 1 1 120px;
  min-width: 100px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.streak-card.current {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow, rgba(155, 89, 182, 0.3));
}

.streak-value {
  display: block;
  font-size: 48px;
  font-weight: bold;
  font-family: ui-monospace, monospace;
  line-height: 1;
  color: var(--accent);
}

.streak-card.current .streak-value {
  color: var(--accent);
}

.streak-label {
  display: block;
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 4px;
  font-family: ui-monospace, monospace;
}

/* Mood Heatmap */
.diary-heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.heatmap-month {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.heatmap-header {
  font-weight: bold;
  margin-bottom: 8px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.heatmap-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  margin-bottom: 4px;
  font-size: 9px;
  color: var(--fg-muted);
  text-align: center;
  font-family: ui-monospace, monospace;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  cursor: help;
  transition: transform 0.1s;
  min-height: 14px;
}

.heatmap-cell:hover {
  transform: scale(1.5);
  z-index: 10;
}

.heatmap-cell--empty {
  background: transparent;
}

.diary-heatmap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-family: ui-monospace, monospace;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* Favorites panel */
.diary-favorites-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.diary-fav-entry {
  flex: 1 1 280px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
}

.diary-fav-entry:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.diary-fav-entry .date {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 4px;
}

.diary-fav-entry .title {
  font-weight: bold;
  margin-bottom: 8px;
}

.diary-fav-entry .mood {
  font-size: 16px;
}

.fav-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}

.diary-fav-entry:hover .fav-remove {
  opacity: 1;
}

.fav-remove:hover {
  color: var(--accent);
}

/* Monthly summaries */
.diary-monthly-summaries {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.monthly-summary {
  flex: 1 1 280px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.monthly-summary h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--fg);
}

.monthly-summary .summary-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  font-family: ui-monospace, monospace;
}

.monthly-summary .stat {
  background: var(--bg);
  padding: 8px;
  border-radius: 4px;
  text-align: center;
}

.monthly-summary .stat-value {
  display: block;
  font-size: 20px;
  font-weight: bold;
  color: var(--accent);
}

.monthly-summary .stat-label {
  display: block;
  font-size: 10px;
  color: var(--fg-muted);
  margin-top: 2px;
}

.monthly-summary .top-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
}

.monthly-summary .top-tags span {
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 999px;
  font-family: ui-monospace, monospace;
}

/* Weekly summary */
.weekly-summary {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.weekly-summary .week-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.weekly-summary .week-date {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--accent);
}

.weekly-summary .week-count {
  font-size: 18px;
  font-weight: bold;
  font-family: ui-monospace, monospace;
  color: var(--fg);
}

.weekly-summary .week-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  font-family: ui-monospace, monospace;
}

.weekly-summary .week-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Search highlighting */
mark {
  background: var(--accent);
  color: #fff;
  padding: 0 2px;
  border-radius: 2px;
}

/* Entry card enhancements */
.news-card {
  position: relative;
}

.news-card__favorite {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
}

.news-card:hover .news-card__favorite,
.news-card__favorite:hover {
  opacity: 1;
  color: #ffd700;
}

.news-card__favorite[aria-pressed="true"] {
  color: #ffd700;
  opacity: 1;
}

/* Reading time */
.reading-time {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Related entries */
.related-entries {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.related-entries h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--fg-muted);
}

.related-entries ul {
  margin: 0;
  padding-left: 20px;
}

.related-entries li {
  margin: 4px 0;
  font-size: 13px;
}

/* Entry meta in modal */
.news-modal__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0;
  font-size: 12px;
  font-family: ui-monospace, monospace;
}

.news-modal__meta .reading-time {
  color: var(--fg-muted);
}

/* Weekly summaries section */
.diary-weekly-section {
  margin-top: 24px;
}

.diary-weekly-section h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--fg);
}