@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Fonts */
  --font-headings: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Colors (Dark Mode Default) */
  --bg: #090a0f;
  --panel: #11131c;
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #f3f4f6;
  --muted: #9ca3af;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --accent-gradient: linear-gradient(135deg, #6366f1, #a855f7);
  --tag-bg: rgba(99, 102, 241, 0.08);
  --tag-border: rgba(99, 102, 241, 0.15);
  --tag-text: #a5b4fc;
  --shadow: rgba(0, 0, 0, 0.4);
  --header-bg: rgba(9, 10, 15, 0.8);
  --input-bg: #161824;
  --timeline-line: rgba(255, 255, 255, 0.06);
  --category-bg: rgba(168, 85, 247, 0.1);
  --category-text: #d8b4fe;
}

@media (prefers-color-scheme: light) {
  :root {
    /* Colors (Light Mode) */
    --bg: #f8fafc;
    --panel: #ffffff;
    --panel-border: rgba(0, 0, 0, 0.06);
    --text: #0f172a;
    --muted: #64748b;
    --accent: #4f46e5;
    --accent-light: #3730a3;
    --accent-glow: rgba(79, 70, 229, 0.08);
    --accent-gradient: linear-gradient(135deg, #4f46e5, #7c3aed);
    --tag-bg: rgba(79, 70, 229, 0.05);
    --tag-border: rgba(79, 70, 229, 0.1);
    --tag-text: #4f46e5;
    --shadow: rgba(15, 23, 42, 0.05);
    --header-bg: rgba(248, 250, 252, 0.85);
    --input-bg: #f1f5f9;
    --timeline-line: rgba(0, 0, 0, 0.08);
    --category-bg: rgba(124, 58, 237, 0.06);
    --category-text: #7c3aed;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Sticky Header with Glassmorphism */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  background-color: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 100;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}

.brand {
  font-family: var(--font-headings);
  font-weight: 800;
  font-size: 1.25rem;
  text-decoration: none;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  transition: opacity 0.2s ease;
}

.brand:hover {
  opacity: 0.9;
}

nav {
  display: flex;
  gap: 20px;
  align-items: center;
}

nav > a {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

nav > a:hover {
  color: var(--accent);
}

/* Search Bar Container */
.search-container {
  display: flex;
  gap: 8px;
  align-items: center;
}

#q {
  padding: 8px 14px 8px 36px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--input-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 16px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  width: 220px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#q:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  width: 280px;
}

#search-mode {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

#search-mode:focus {
  border-color: var(--accent);
}

/* Layout */
main {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* Intro & Tagcloud */
.intro {
  margin-bottom: 32px;
  font-size: 1rem;
}

.intro p {
  margin: 0 0 16px;
}

.intro strong {
  font-size: 1.15rem;
  color: var(--accent-light);
}

.tagcloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Tag Pills */
.tag {
  display: inline-flex;
  align-items: center;
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--tag-border);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tag sup {
  font-size: 0.65rem;
  font-weight: 700;
  margin-left: 4px;
  opacity: 0.7;
  top: 0;
}

.tag:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Search results info */
.search-info {
  color: var(--accent-light);
  font-family: var(--font-headings);
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0 0 20px;
  padding: 10px 16px;
  background: var(--tag-bg);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}

.score {
  color: #10b981;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 8px;
  padding: 2px 6px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 4px;
}

.match-type {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 6px;
  background: var(--input-bg);
  border-radius: 4px;
  margin-left: 6px;
  border: 1px solid var(--panel-border);
}

/* Timeline Layout */
.month {
  position: relative;
  margin: 40px 0 20px;
  padding-left: 24px;
  font-family: var(--font-headings);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-light);
  text-transform: uppercase;
}

.month::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent-light);
  z-index: 2;
}

.cards {
  display: grid;
  gap: 16px;
  position: relative;
  padding-left: 20px;
  border-left: 2px solid var(--timeline-line);
}

/* Link Cards */
.link-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  background: var(--panel);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 4px 6px -1px var(--shadow), 0 2px 4px -1px var(--shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.link-card:has(.thumb img) {
  grid-template-columns: 88px 1fr;
}

@media (max-width: 640px) {
  .link-card, .link-card:has(.thumb img) {
    grid-template-columns: 1fr;
  }
}

.link-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 10px 15px -3px var(--shadow), 0 4px 6px -2px var(--shadow);
}

/* Thumbnails */
.link-card .thumb {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.link-card .thumb img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 8px;
  background-color: var(--input-bg);
  border: 1px solid var(--panel-border);
  transition: transform 0.3s ease;
}

.link-card:hover .thumb img {
  transform: scale(1.05);
}

.link-card .thumb img.favicon {
  width: 36px;
  height: 36px;
  padding: 6px;
  margin-top: 10px;
  object-fit: contain;
  background-color: var(--input-bg);
  border-radius: 8px;
}

/* Card Body */
.link-card .body {
  display: flex;
  flex-direction: column;
}

.link-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-headings);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
}

.link-card h3 a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.link-card h3 a:hover {
  color: var(--accent);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  margin: 0 0 10px;
}

.meta .domain {
  font-weight: 600;
  color: var(--text);
}

.meta .dot {
  opacity: 0.4;
}

.meta .cat {
  background: var(--category-bg);
  color: var(--category-text);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.summary {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0 0 12px;
  line-height: 1.6;
}

.tags {
  margin: auto 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tags .tag {
  padding: 2px 8px;
  font-size: 0.7rem;
}

/* Back Link for subpages */
h1 {
  font-family: var(--font-headings);
  font-size: 2.25rem;
  font-weight: 800;
  margin: 0 0 8px;
}

h1 + p {
  margin-bottom: 24px;
}

h1 + p a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

h1 + p a:hover {
  text-decoration: underline;
}

/* Footer */
footer {
  text-align: center;
  padding: 60px 24px 40px;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--panel-border);
  margin-top: 60px;
}

