/* ===========================================
   ooooooo.top — Refined Design System
   =========================================== */

/* ----- CSS Variables ----- */
:root {
  /* Light palette */
  --bg:              #faf8f5;
  --bg-alt:          #f4f1ec;
  --card-bg:         #ffffff;
  --text:            #18181b;
  --text-secondary:  #71717a;
  --text-tertiary:   #a1a1aa;
  --border:          #e4e4e7;
  --border-light:    #f0efe9;
  --accent:          #6366f1;
  --accent-hover:    #4f46e5;
  --accent-soft:     #eef2ff;
  --tag-bg:          #eef2ff;
  --tag-text:        #6366f1;
  --code-bg:         #1e293b;
  --code-text:       #e2e8f0;
  --shadow-sm:       0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:       0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg:       0 12px 32px rgba(0,0,0,0.08);
  --radius:          12px;
  --radius-sm:       8px;
  --radius-full:     9999px;
  --max-width:       720px;
  --font-mono:       'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
  --font-sans:       -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-serif:      'Georgia', 'Times New Roman', serif;
  --ease-out:        cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:     cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark palette */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:              #09090b;
    --bg-alt:          #12121a;
    --card-bg:         #16161e;
    --text:            #e4e4e7;
    --text-secondary:  #a1a1aa;
    --text-tertiary:   #71717a;
    --border:          #27272a;
    --border-light:    #1f1f26;
    --accent:          #818cf8;
    --accent-hover:    #6366f1;
    --accent-soft:     #1e1b4b;
    --tag-bg:          #1e1b4b;
    --tag-text:        #a5b4fc;
    --code-bg:         #0f0f17;
    --code-text:       #e2e8f0;
    --shadow-sm:       0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:       0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:       0 12px 32px rgba(0,0,0,0.5);
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s var(--ease-out), color 0.3s var(--ease-out);
}

::selection {
  background: var(--accent);
  color: #ffffff;
}

/* ----- Keyframes ----- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ----- Navigation ----- */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
}

nav::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: 0.85;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease-out);
}

@supports (backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px)) {
  nav::before {
    border-bottom-color: var(--border);
  }
}

nav .logo,
nav .links {
  position: relative;
  z-index: 1;
}

nav .logo {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.03em;
  transition: opacity 0.2s var(--ease-out);
}

nav .logo:hover { opacity: 0.7; }

nav .logo span { color: var(--accent); }

nav .links {
  display: flex;
  gap: 4px;
}

nav .links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  transition: all 0.2s var(--ease-out);
}

nav .links a:hover {
  color: var(--text);
  background: var(--border-light);
}

nav .links a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ----- Main Container ----- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 20px 80px;
  animation: fadeInUp 0.6s var(--ease-out) both;
}

/* ----- Hero Section ----- */
.hero {
  padding: 48px 0 40px;
  animation: fadeInUp 0.7s var(--ease-out) 0.1s both;
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@media (prefers-color-scheme: dark) {
  .hero h1 {
    background: linear-gradient(135deg, #f0f0f5 0%, #a1a1aa 100%);
    -webkit-background-clip: text;
    background-clip: text;
  }
}

.hero p {
  margin-top: 16px;
  color: var(--text-secondary);
  font-size: 1.125rem;
  line-height: 1.7;
  max-width: 560px;
}

/* ----- Post List ----- */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ----- Post Card ----- */
.post-card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s var(--ease-out);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.5s var(--ease-out) both;
}

.post-card:nth-child(1) { animation-delay: 0.15s; }
.post-card:nth-child(2) { animation-delay: 0.2s; }
.post-card:nth-child(3) { animation-delay: 0.25s; }
.post-card:nth-child(4) { animation-delay: 0.3s; }
.post-card:nth-child(5) { animation-delay: 0.35s; }
.post-card:nth-child(6) { animation-delay: 0.4s; }
.post-card:nth-child(7) { animation-delay: 0.45s; }
.post-card:nth-child(8) { animation-delay: 0.5s; }
.post-card:nth-child(9) { animation-delay: 0.55s; }
.post-card:nth-child(10) { animation-delay: 0.6s; }

.post-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
  pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

.post-card:hover::after {
  opacity: 0.15;
}

.post-card time {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

.post-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 8px;
  line-height: 1.4;
  letter-spacing: -0.02em;
  transition: color 0.2s var(--ease-out);
}

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

.post-card .excerpt {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card .tags {
  margin-top: 14px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ----- Tag ----- */
.tag {
  display: inline-flex;
  align-items: center;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.75rem;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: all 0.2s var(--ease-out);
}

.post-card:hover .tag {
  background: var(--accent-soft);
}

/* ----- Article Detail ----- */
article {
  padding: 12px 0;
  animation: fadeInUp 0.5s var(--ease-out) 0.05s both;
}

article header {
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

article header time {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

article header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.25;
  margin-top: 12px;
}

article header .tags {
  margin-top: 16px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ----- Article Body ----- */
.article-body {
  font-size: 1.0625rem;
  line-height: 1.82;
  color: var(--text);
}

.article-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 48px 0 16px;
  letter-spacing: -0.025em;
  line-height: 1.35;
}

.article-body h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 32px 0 10px;
  letter-spacing: -0.02em;
}

.article-body p {
  margin-bottom: 20px;
}

.article-body ul,
.article-body ol {
  margin-bottom: 20px;
  padding-left: 28px;
}

.article-body li {
  margin-bottom: 8px;
}

.article-body li::marker {
  color: var(--text-tertiary);
}

.article-body strong {
  color: var(--text);
  font-weight: 600;
}

.article-body code {
  background: var(--border-light);
  color: var(--accent);
  padding: 3px 7px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.875em;
  font-weight: 500;
}

.article-body pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 22px 24px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 24px 0;
  font-size: 0.875rem;
  line-height: 1.7;
  border: 1px solid var(--border);
}

.article-body pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-weight: 400;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 0 8px 20px;
  color: var(--text-secondary);
  margin: 24px 0;
  font-style: italic;
  background: var(--bg-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.article-body a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease-out);
}

.article-body a:hover {
  border-bottom-color: var(--accent);
}

.article-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 24px 0;
  box-shadow: var(--shadow-md);
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* ----- Back Link ----- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 48px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  transition: all 0.2s var(--ease-out);
}

.back-link:hover {
  color: var(--text);
  background: var(--border-light);
}

/* ----- About Page ----- */
.about-page {
  padding: 12px 0;
  animation: fadeInUp 0.5s var(--ease-out) 0.05s both;
}

.about-page h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 32px;
}

.about-page p {
  color: var(--text-secondary);
  margin-bottom: 18px;
  max-width: 600px;
  font-size: 1.0625rem;
  line-height: 1.82;
}

.about-page .socials {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}

.about-page .socials a {
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  transition: all 0.2s var(--ease-out);
}

.about-page .socials a:hover {
  background: var(--accent);
  color: #ffffff;
}

/* ----- Footer ----- */
footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 20px 44px;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  text-align: center;
  border-top: 1px solid var(--border);
  animation: fadeIn 0.6s var(--ease-out) 0.4s both;
}

footer a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}

footer a:hover {
  color: var(--text-secondary);
}

/* ----- Responsive ----- */
@media (max-width: 640px) {
  .hero {
    padding: 32px 0 28px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  article header h1 {
    font-size: 1.625rem;
  }

  .about-page h1 {
    font-size: 1.75rem;
  }

  .post-card {
    padding: 20px 22px;
  }

  .post-card h2 {
    font-size: 1.125rem;
  }

  .article-body {
    font-size: 1rem;
  }

  .article-body h2 {
    font-size: 1.3rem;
    margin: 36px 0 12px;
  }

  .article-body pre {
    padding: 16px 18px;
    font-size: 0.8rem;
  }

  nav {
    padding: 12px 16px;
  }
}
