/* ================================================
   Design Tokens
   ================================================ */
:root {
  /* Light Mode */
  --bg-base: #fafaf9;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --text-primary: #1c1917;
  --text-secondary: #57534e;
  --text-muted: #a8a29e;
  --accent: #ea580c;
  --accent-soft: rgba(234, 88, 12, 0.08);
  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.1);
  --glow: 0 4px 32px rgba(234, 88, 12, 0.12);
  --blob-1: rgba(234, 88, 12, 0.06);
  --blob-2: rgba(124, 58, 237, 0.05);
  --blob-3: rgba(8, 145, 178, 0.04);
  
  --font-display: "hm", Georgia, serif;
  --font-mono: "code", "JetBrains Mono", "Fira Code", monospace;
  --font-body: "hm", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
}

[data-theme="dark"] {
  --bg-base: #0a0e1a;
  --bg-surface: rgba(15, 23, 42, 0.85);
  --bg-card: rgba(255, 255, 255, 0.04);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.1);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --glow: 0 0 60px rgba(249, 115, 22, 0.2);
  --blob-1: rgba(249, 115, 22, 0.08);
  --blob-2: rgba(168, 85, 247, 0.07);
  --blob-3: rgba(6, 182, 212, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.35s ease, color 0.35s ease;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background Decorations */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: float 20s infinite alternate ease-in-out;
}

.bg-blob-1 {
  top: -10%; left: -10%;
  width: 50vw; height: 50vw;
  background: var(--blob-1);
}

.bg-blob-2 {
  bottom: -10%; right: -10%;
  width: 60vw; height: 60vw;
  background: var(--blob-2);
  animation-delay: -5s;
}

.bg-blob-3 {
  top: 40%; left: 40%;
  width: 40vw; height: 40vw;
  background: var(--blob-3);
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(5%, 5%) scale(1.1); }
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 1rem var(--space-xl);
}

.header-content {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

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

.back-link svg {
  width: 18px;
  height: 18px;
}

.header-title {
  text-align: center;
}

.header-title h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text-primary);
}

.header-title p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

[data-theme="dark"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: none; }

/* Main Content */
.wrap {
  position: relative;
  z-index: 2;
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-xl) 1rem;
}

.notes-feed {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.note-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2rem;
  backdrop-filter: blur(20px);
  box-shadow: var(--glow);
  transition: transform 0.3s ease, border-color 0.3s ease;
  animation: cardEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.note-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.note-header {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.note-date {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.note-date::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.note-content {
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.8;
}

.note-content h1 {
  display: none; /* Hide the top level H1 which is usually the date in these files */
}

.note-content h2 {
  font-size: 1.2rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.note-content p {
  margin-bottom: 1rem;
}

.note-content img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 1rem 0;
  border: 1px solid var(--border);
}

.note-content blockquote {
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
  font-style: italic;
}

.note-content code {
  font-family: var(--font-mono);
  background: var(--border);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
}

.note-content pre {
  background: var(--bg-base);
  padding: 1rem;
  border-radius: 12px;
  overflow-x: auto;
  border: 1px solid var(--border);
}

.note-content pre code {
  background: none;
  padding: 0;
}

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

.note-content a:hover {
  text-decoration: underline;
}

.load-more-btn {
  display: block;
  width: 100%;
  padding: 1rem;
  margin-top: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(20px);
}

.load-more-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
  .site-header {
    padding: 1rem;
  }
  
  .note-card {
    padding: 1.5rem;
    border-radius: 20px;
  }
}
