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

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --accent: #2563eb;
  --done: #16a34a;
  --soon: #ca8a04;
  --locked: #cbd5e1;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* Hero */
.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.hero .tagline {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.hero .law {
  font-size: 0.9rem;
  color: var(--accent);
  font-style: italic;
}

/* Progress */
.progress-section {
  text-align: center;
  margin-bottom: 2rem;
}

.progress-text {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.progress-text .done-count {
  font-weight: 700;
  color: var(--done);
  font-size: 1.5rem;
}

.progress-bar {
  width: 100%;
  max-width: 400px;
  height: 8px;
  background: var(--surface);
  border-radius: 4px;
  margin: 0 auto;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--done);
  width: 0%;
  transition: width 0.3s ease;
}

/* Calendar */
.calendar-section {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.calendar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  min-width: 320px;
  flex: 1;
  max-width: 420px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.calendar h2 {
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

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

.calendar-header {
  font-size: 0.75rem;
  text-align: center;
  color: var(--text-muted);
  padding: 0.25rem;
  font-weight: 600;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.85rem;
  position: relative;
  cursor: default;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.calendar-day.empty {
  background: transparent;
}

.calendar-day.locked {
  background: var(--border);
  color: #94a3b8;
}

.calendar-day.soon {
  background: rgba(202, 138, 4, 0.12);
  color: var(--soon);
  border: 1px solid var(--soon);
}

.calendar-day.done {
  background: rgba(22, 163, 74, 0.12);
  color: var(--done);
  border: 1px solid var(--done);
  cursor: pointer;
}

.calendar-day.done:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
}

.calendar-day .day-number {
  font-weight: 600;
}

.calendar-day .day-name {
  font-size: 0.55rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}

.calendar-day .type-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 0.5rem;
  padding: 1px 3px;
  border-radius: 2px;
  text-transform: uppercase;
}

.type-badge.cli { background: #8b5cf6; color: white; }
.type-badge.web { background: #06b6d4; color: white; }
.type-badge.action { background: #f59e0b; color: black; }
.type-badge.extension { background: #ec4899; color: white; }
.type-badge.meta { background: #6b7280; color: white; }
.type-badge.mcp { background: #3b82f6; color: white; }

/* Tooltip */
.calendar-day[data-tagline]:hover::after {
  content: attr(data-tagline);
  position: absolute;
  bottom: 105%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}

/* Legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-dot.done { background: var(--done); }
.legend-dot.soon { background: var(--soon); }
.legend-dot.locked { background: var(--locked); }

.legend-divider {
  color: var(--border);
}

.type-tag {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
}

.type-tag.cli { background: #8b5cf6; color: white; }
.type-tag.web { background: #06b6d4; color: white; }
.type-tag.action { background: #f59e0b; color: black; }
.type-tag.extension { background: #ec4899; color: white; }
.type-tag.mcp { background: #3b82f6; color: white; }

/* Comments */
.comments-section {
  margin-bottom: 2rem;
}

.comments-section h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

/* Footer */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

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

/* ========== Navigation ========== */
.main-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
  color: var(--accent);
  background: var(--surface);
}

.nav-link.active {
  color: var(--accent);
  font-weight: 600;
}

.nav-divider {
  color: var(--border);
}

/* ========== Blog Styles ========== */

/* Post List */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.post-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.post-cover {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.post-info {
  padding: 1rem;
}

.post-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.post-info h2 {
  margin: 0.5rem 0;
  font-size: 1.2rem;
}

.post-info h2 a {
  color: var(--text);
  text-decoration: none;
}

.post-info h2 a:hover {
  color: var(--accent);
}

.post-excerpt {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.post-tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-muted);
}

/* Single Post */
.post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.post-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.post-header h1 {
  margin: 0.5rem 0;
}

.post-hero-image {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.post-body {
  line-height: 1.8;
}

.post-body h1, .post-body h2, .post-body h3 {
  margin: 1.5rem 0 0.75rem;
}

.post-body p {
  margin: 1rem 0;
}

.post-body code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.post-body pre {
  background: var(--bg);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
}

.post-body pre code {
  background: none;
  padding: 0;
}

.post-body img {
  max-width: 100%;
  border-radius: 8px;
}

.back-link {
  display: inline-block;
  margin-top: 1.5rem;
  color: var(--accent);
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
}

/* ========== Gallery Styles ========== */

.gallery-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.tab-btn {
  padding: 0.5rem 1.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.tab-btn:hover {
  border-color: var(--accent);
}

.tab-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.gallery-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.gallery-item h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.gallery-images {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gallery-images figure {
  margin: 0;
}

.gallery-images img {
  width: 100%;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.gallery-images img:hover {
  opacity: 0.9;
}

.gallery-images figcaption {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.gallery-album {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-album:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.album-cover {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.album-info {
  padding: 1rem;
}

.album-info time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.album-info h3 {
  margin: 0.25rem 0;
  font-size: 1rem;
}

.photo-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ========== Responsive ========== */
@media (max-width: 600px) {
  .hero h1 {
    font-size: 1.8rem;
  }

  .calendar {
    min-width: 100%;
  }

  .calendar-day {
    font-size: 0.75rem;
  }

  .calendar-day .day-name {
    display: none;
  }

  .post {
    padding: 1rem;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .main-nav {
    gap: 0.5rem;
    font-size: 0.85rem;
  }

  .nav-link {
    padding: 0.4rem 0.8rem;
  }
}
