/* ═══════════════════════════════════════════════════
   LAW STUDY JOURNAL — TIMELINE BLOG
   Google-inspired minimalist design system
   ═══════════════════════════════════════════════════ */

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

@view-transition {
  navigation: auto;
}

:root {
  /* Google-inspired palette */
  --surface:        #f8f9fa;
  --surface-card:   #ffffff;
  --surface-hover:  #f1f3f4;
  --border:         #e0e0e0;
  --border-light:   #eeeeee;

  --text-primary:   #202124;
  --text-secondary: #5f6368;
  --text-muted:     #9aa0a6;

  --accent:         #1a73e8;
  --accent-soft:    #e8f0fe;
  --accent-glow:    rgba(26, 115, 232, 0.12);

  --timeline-line:  #dadce0;
  --timeline-dot:   #1a73e8;
  --timeline-dot-ring: rgba(26, 115, 232, 0.15);

  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Typography */
  --font-display: 'Inter', 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body:    'Inter', 'Google Sans Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Shadows (Google elevation) */
  --shadow-1: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
  --shadow-2: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
  --shadow-hover: 0 2px 6px 0 rgba(60,64,67,0.3), 0 6px 12px 4px rgba(60,64,67,0.12);

  /* Animations */
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Use interpolate-size for modern browsers */
  interpolate-size: allow-keywords;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Loading State ───────────────────────────────── */
.timeline-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
  gap: var(--space-md);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}



/* ── Toolbar (sticky top bar) ────────────────────── */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248, 249, 250, 0.85);
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  border-bottom: 1px solid var(--border-light);
  padding: var(--space-sm) var(--space-xl);
}

.toolbar-inner {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  max-width: 900px;
  margin: 0 auto;
}

/* Search results anchor (positioned below toolbar) */
.search-results-anchor {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}

/* ── App Layout ─────────────────────────────────── */
.app-layout {
  max-width: 780px;
  margin: 0 auto;
}

.app-main {
  width: 100%;
}

/* ── Search ────────────────────────────────────── */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: 100px;
  box-shadow: 0 1px 2px rgba(60,64,67,0.1);
  transition:
    box-shadow 0.3s var(--ease-out),
    border-color 0.3s var(--ease-out);
  overflow: hidden;
}




.toolbar.focused .search-container {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.toolbar.has-results .search-container {
  border-color: var(--accent);
}

/* Search icon */
.search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: var(--space-lg);
  flex-shrink: 0;
}

.search-icon svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: color 0.2s var(--ease-out);
}

.toolbar.focused .search-icon svg {
  color: var(--accent);
}

/* Search input */
.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-primary);
  padding: 12px var(--space-md);
  line-height: 1.4;
  min-width: 0;
}

.search-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

/* Remove native search clear button */
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

/* Keyboard shortcut hint */
.search-shortcut {
  display: flex;
  align-items: center;
  padding-right: var(--space-md);
  flex-shrink: 0;
}

.search-shortcut kbd {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 7px 2px;
  line-height: 1.4;
}

/* Clear button */
.search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 6px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s var(--ease-out);
}

.search-clear:hover {
  background: var(--surface-hover);
}

.search-clear svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

/* ── Search Results Dropdown ───────────────────── */
.search-results {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-2);
  max-height: 420px;
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 0.25s var(--ease-out),
    transform 0.25s var(--ease-out);
}

.search-results:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
}

/* Custom scrollbar for results */
.search-results::-webkit-scrollbar {
  width: 6px;
}

.search-results::-webkit-scrollbar-track {
  background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* Search result item */
.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  cursor: pointer;
  transition: background 0.15s var(--ease-out);
  border-bottom: 1px solid var(--border-light);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.active {
  background: var(--accent-soft);
}

.search-result-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 7px;
  opacity: 0.6;
}

.search-result-content {
  flex: 1;
  min-width: 0;
}

.search-result-heading {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 2px;
}

.search-result-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.search-result-tag {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 100px;
}

.search-result-date {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.search-result-preview {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Highlight matched text */
.search-highlight {
  background: rgba(26, 115, 232, 0.15);
  color: var(--accent);
  font-weight: 500;
  border-radius: 2px;
  padding: 0 1px;
}

/* Empty state */
.search-empty {
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
}

.search-empty-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  opacity: 0.5;
}

.search-empty-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Result count label */
.search-result-count {
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
}

/* ── Subject Dropdown Selector ────────────────────── */
.subject-dropdown {
  position: relative;
  margin-top: var(--space-sm);
}

.subject-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px 6px 12px;
  cursor: pointer;
  transition:
    background 0.2s var(--ease-out),
    border-color 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out),
    color 0.2s var(--ease-out);
  user-select: none;
  -webkit-user-select: none;
}

.subject-dropdown-trigger:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}

.subject-dropdown-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.subject-dropdown.open .subject-dropdown-trigger {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.subject-dropdown-trigger.has-filter {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.subject-dropdown-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.subject-dropdown-label {
  line-height: 1.3;
}

.subject-dropdown-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease-out);
}

.subject-dropdown.open .subject-dropdown-chevron {
  transform: rotate(180deg);
}

/* Dropdown menu */
.subject-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  z-index: 50;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top left;
  transition:
    opacity 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}

.subject-dropdown-menu:not([hidden]) {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.subject-dropdown-menu::-webkit-scrollbar {
  width: 5px;
}

.subject-dropdown-menu::-webkit-scrollbar-track {
  background: transparent;
}

.subject-dropdown-menu::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* Dropdown option */
.subject-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 10px var(--space-lg);
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s var(--ease-out);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.subject-option:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.subject-option:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.subject-option + .subject-option {
  border-top: 1px solid var(--border-light);
}

.subject-option:hover {
  background: var(--surface-hover);
}

.subject-option.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.subject-option-name {
  flex: 1;
  min-width: 0;
}

.subject-option-count {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: 100px;
  padding: 1px 7px;
  flex-shrink: 0;
}

.subject-option.active .subject-option-count {
  color: var(--accent);
  background: rgba(26, 115, 232, 0.1);
}

.subject-option-check {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.15s var(--ease-out);
}

.subject-option.active .subject-option-check {
  opacity: 1;
}

/* ── Filter Bar ──────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}

/* ── Sort Toggle ─────────────────────────────────── */
.sort-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: 100px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s var(--ease-out);
  white-space: nowrap;
}

.sort-toggle:hover {
  border-color: var(--border);
  color: var(--text-primary);
  background: var(--surface-hover);
}

.sort-toggle:active {
  transform: scale(0.97);
}

.sort-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease-out);
}

.sort-toggle.asc .sort-icon {
  transform: rotate(180deg);
}

.sort-label {
  line-height: 1;
}

/* ── Timeline hidden state during search/filter ──── */
.timeline-entry.search-hidden,
.timeline-entry.filter-hidden {
  display: none;
}

.timeline-entry.search-match {
  animation: none;
  opacity: 1;
  transform: none;
}

/* ── Timeline Layout ─────────────────────────────── */
.timeline {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
  padding-left: calc(var(--space-2xl) + 24px);
}

/* Vertical timeline line */
.timeline::before {
  content: '';
  position: absolute;
  left: 32px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    var(--timeline-line) 4%,
    var(--timeline-line) 96%,
    transparent 100%
  );
}

/* ── Timeline Entry ──────────────────────────────── */
.timeline-entry {
  position: relative;
  margin-bottom: var(--space-xl);
}

/* Timeline dot */
.timeline-entry::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-2xl) - 18px);
  top: 22px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface-card);
  border: 3px solid var(--timeline-dot);
  box-shadow: 0 0 0 4px var(--surface);
  z-index: 2;
  transition: transform 0.3s var(--ease-spring), border-width 0.3s var(--ease-out), background-color 0.3s;
}

.timeline-entry:hover::before {
  transform: scale(1.2);
  background: var(--timeline-dot);
  border-width: 4px;
}

/* ── Time Label ──────────────────────────────────── */
.timeline-time {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  margin-left: 2px;
}

.timeline-date {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.timeline-hour {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ── Card ────────────────────────────────────────── */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.25s cubic-bezier(0.2, 0, 0, 1), border-color 0.25s var(--ease-out);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
  border-color: var(--border);
}

/* ── Card Header ─────────────────────────────────── */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-lg) var(--space-xs);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.card-heading {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  letter-spacing: -0.01em;
  flex: 1;
}

.card-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(26, 115, 232, 0.15);
  padding: 3px 10px;
  border-radius: 100px;
}

.card-header-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

/* Video badge icon in header */
.card-video-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(234, 67, 53, 0.1);
  color: #ea4335;
  flex-shrink: 0;
}

.card-video-badge svg {
  width: 12px;
  height: 12px;
}

/* Toggle chevron */
.card-toggle {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin-top: 2px;
  transition: background 0.2s var(--ease-out);
}

.card-header:hover .card-toggle {
  background: rgba(0,0,0,0.04);
}

.card-toggle svg {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  transition: transform 0.35s var(--ease-out);
}

.card.collapsed .card-toggle svg {
  transform: rotate(-90deg);
}

/* ── Card Body (collapsible) ─────────────────────── */
.card-body {
  overflow: hidden;
  transition: block-size 0.4s var(--ease-out), opacity 0.3s var(--ease-out);
  block-size: auto; /* Fallback */
  opacity: 1;
}

.card.collapsed .card-body {
  block-size: 0;
  opacity: 0;
}

.card-body-inner {
  padding: 0 var(--space-xl) var(--space-lg);
}

/* Subtle separator between header and body */
.card-body-inner::before {
  content: '';
  display: block;
  height: 1px;
  background: var(--border-light);
  margin-bottom: var(--space-md);
}

/* ── Video Embed ─────────────────────────────────── */
.card-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  margin-bottom: var(--space-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.card-video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ── Card Content Typography ─────────────────────── */
.card-body p {
  font-size: 1.05rem;
  color: var(--text-primary);
  line-height: 1.8;
  margin-bottom: 1.25rem;
  letter-spacing: 0.2px;
}

.card-body p:last-child {
  margin-bottom: 0;
}

.card-body strong {
  color: var(--text-primary);
  font-weight: 500;
}

.card-body em {
  font-style: italic;
  color: var(--text-primary);
}

.card-body ul,
.card-body ol {
  font-size: 1.05rem;
  color: var(--text-primary);
  line-height: 1.8;
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
  letter-spacing: 0.2px;
}

.card-body li {
  margin-bottom: var(--space-xs);
}

.card-body code {
  font-size: 0.82rem;
  background: var(--surface);
  border: 1px solid var(--border-light);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'Google Sans Mono', 'Fira Code', monospace;
}

.card-body blockquote {
  border-left: 4px solid var(--accent);
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 1.05rem;
  color: var(--text-primary);
  font-style: italic;
  line-height: 1.7;
}

/* ── Calendar Toggle Button ──────────────────────── */
.cal-toggle-btn {
  display: none;
}

@media (min-width: 768px) {
  .cal-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-2), 0 4px 16px rgba(26, 115, 232, 0.3);
    cursor: pointer;
    z-index: 200;
    transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease-out), opacity 0.2s;
  }

  .cal-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-hover), 0 6px 20px rgba(26, 115, 232, 0.35);
  }

  .cal-toggle-btn:active {
    transform: scale(0.95);
  }

  .cal-toggle-btn svg {
    width: 22px;
    height: 22px;
  }

  .cal-toggle-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
  }
}

/* ── Calendar Sidebar (fixed slide-in panel) ─────── */
.calendar-sidebar {
  display: none;
}

@media (min-width: 768px) {
  .calendar-sidebar {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    background: var(--surface-card);
    border-left: 1px solid var(--border-light);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
    padding: var(--space-xl);
    z-index: 250;
    transform: translateX(100%);
    transition: transform 0.35s var(--ease-out);
    overflow-y: auto;
  }

  .calendar-sidebar.open {
    transform: translateX(0);
  }
}

/* Sidebar header with title + close */
.cal-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
}

.cal-sidebar-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.cal-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s var(--ease-out), color 0.15s;
}

.cal-close-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.cal-close-btn svg {
  width: 16px;
  height: 16px;
}

/* Calendar backdrop overlay */
.cal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.15);
  z-index: 240;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
}

.cal-backdrop.visible {
  display: block;
  opacity: 1;
}


/* Calendar navigation */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.cal-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.15s var(--ease-out);
}

.cal-nav-btn:hover {
  background: var(--surface-hover);
}

.cal-nav-btn svg {
  width: 16px;
  height: 16px;
}

.cal-nav-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Calendar grid - Monthly */
.cal-grid {
  min-height: 200px;
}

.cal-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}

.cal-weekday {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: default;
  transition: background-color 0.2s var(--ease-out), color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
  user-select: none;
  border: 2px solid transparent;
}

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

.cal-day.other-month {
  color: var(--border);
}

.cal-day.today {
  font-weight: 700;
  color: var(--accent);
  border-color: var(--accent);
}

/* Remove the old dot for today */
.cal-day.today::after {
  display: none;
}

.cal-day.has-entries {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--accent-soft);
}

.cal-day.has-entries:hover {
  background: rgba(26, 115, 232, 0.18);
}

.cal-day.selected {
  background: var(--accent) !important;
  color: #fff !important;
  font-weight: 600;
}

.cal-day.selected::after {
  background: #fff;
}

/* Entry count badge */
.cal-day-count {
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 0.55rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.cal-day.selected .cal-day-count {
  background: rgba(255,255,255,0.3);
}


/* Legend */
.cal-legend {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-light);
}

.cal-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  flex-shrink: 0;
}

.cal-legend-text {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Selected day info strip */
.cal-selected-info {
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cal-selected-date {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent);
}

.cal-clear-btn {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.cal-clear-btn:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

/* ── Staggered entry animation ───────────────────── */
.timeline-entry {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.5s var(--ease-out) forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 640px) {
  .toolbar {
    padding: var(--space-sm) var(--space-md);
  }

  .toolbar-inner {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }

  .search-container {
    flex: 1 1 100%;
  }

  .filter-bar {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .sort-label {
    display: none;
  }

  .search-input {
    font-size: 0.85rem;
  }

  .search-shortcut {
    display: none;
  }

  .search-results {
    max-height: 340px;
  }

  .timeline {
    padding: var(--space-xl) var(--space-md);
    padding-left: calc(var(--space-xl) + 16px);
  }

  .timeline::before {
    left: 20px;
  }

  .timeline-entry::before {
    left: calc(-1 * var(--space-xl) - 10px);
    top: 20px;
    width: 10px;
    height: 10px;
  }

  .card-header {
    padding: var(--space-md) var(--space-lg);
  }

  .card-body-inner {
    padding: 0 var(--space-lg) var(--space-md);
  }

  .card-heading {
    font-size: 0.95rem;
  }

  .calendar-sidebar {
    display: none !important;
  }
}

/* ── Post View (Dedicated Page) ──────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s var(--ease-out);
}

.back-link:hover {
  color: var(--accent);
}

.post-layout {
  padding: var(--space-xl) var(--space-md);
  max-width: 900px;
}

.post-article {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  padding: var(--space-xl);
}

.post-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

.post-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: var(--space-md);
  letter-spacing: -0.5px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.post-video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  margin-bottom: var(--space-xl);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.post-video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.post-body p {
  font-size: 1.05rem;
  color: var(--text-primary);
  line-height: 1.8;
  margin-bottom: 1.25rem;
}

.post-body blockquote {
  border-left: 4px solid var(--accent);
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--accent-soft);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 1.05rem;
  color: var(--text-primary);
  font-style: italic;
  line-height: 1.7;
}

.post-body ul, .post-body ol {
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

/* ── Timeline Summary ────────────────────────────── */
.summary-body {
  opacity: 1 !important;
  block-size: auto !important;
  padding: 0 var(--space-lg) var(--space-lg);
}

.summary-body p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.summary-header {
  pointer-events: none;
}

.read-more-btn {
  display: inline-flex;
  align-items: center;
  margin-top: var(--space-xs);
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: opacity 0.2s var(--ease-out);
  pointer-events: auto;
}

.read-more-btn:hover {
  opacity: 0.7;
  text-decoration: underline;
}

/* ── Skeleton Loader ─────────────────────────────── */
.skeleton-card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  animation: pulse 1.5s infinite ease-in-out;
  box-shadow: var(--shadow-1);
}

.skeleton-line {
  height: 16px;
  background: var(--border-light);
  border-radius: 4px;
}

.skeleton-line.title {
  width: 60%;
  height: 24px;
  margin-bottom: var(--space-sm);
}

.skeleton-line.short { width: 40%; }
.skeleton-line.long { width: 100%; }

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* ── Reduced motion ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .timeline-entry {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .card-body,
  .card-toggle svg,
  .card,
  .card-header,
  .timeline-entry::before,
  .search-results,
  .search-container {
    transition: none !important;
  }
}
