/* === UseLayouts-Inspired Blog ===
   Spring physics, bento grids, staggered reveals,
   glassmorphism, smooth micro-interactions */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #0a0a0f;
  --color-surface: rgba(255, 255, 255, 0.04);
  --color-surface-hover: rgba(255, 255, 255, 0.08);
  --color-glass: rgba(255, 255, 255, 0.06);
  --color-glass-border: rgba(255, 255, 255, 0.1);
  --color-text: #e8e8ed;
  --color-text-secondary: #8b8b9e;
  --color-accent: #6366f1;
  --color-accent-glow: rgba(99, 102, 241, 0.3);
  --color-accent-soft: rgba(99, 102, 241, 0.12);
  --color-success: #34d399;
  --color-border: rgba(255, 255, 255, 0.06);
  --max-width: 900px;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 100px;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  overflow-x: hidden;
}

/* Subtle grain texture overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s var(--smooth);
}
a:hover {
  color: #818cf8;
  text-decoration: none;
}

/* === HEADER — Glassmorphism nav bar === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--color-border);
  padding: 0.875rem 2rem;
}
.site-header .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.site-header .logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  transition: opacity 0.2s;
}
.site-header .logo:hover {
  opacity: 0.8;
}

/* Nav — pill indicator slides between items */
.site-header nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-pill);
  padding: 0.25rem;
}
.site-header nav a {
  position: relative;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  transition: color 0.25s var(--smooth), background 0.25s var(--smooth);
  z-index: 1;
}
.site-header nav a:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.06);
}
.site-header nav a.active {
  color: #fff;
  background: var(--color-accent);
}

/* === MAIN CONTAINER === */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

/* === PAGE TITLE — fade-up entrance === */
.page-title {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #e8e8ed 0%, #8b8b9e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-subtitle {
  color: var(--color-text-secondary);
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

/* === STAGGER ANIMATION — cards reveal on load === */
@keyframes stagger-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}
.stagger-item {
  opacity: 0;
  animation: stagger-in 0.5s var(--spring) forwards;
}
.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }

/* === BENTO GRID — home page layout === */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.bento-grid .post-card:first-child {
  grid-column: 1 / -1;
}
@media (max-width: 640px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }
}

/* === POST CARDS — glass card with hover lift === */
.post-card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.35s var(--spring),
              box-shadow 0.35s var(--smooth),
              border-color 0.35s var(--smooth),
              background 0.35s var(--smooth);
  overflow: hidden;
  cursor: pointer;
}
.post-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(99, 102, 241, 0.06),
    transparent 40%
  );
  opacity: 0;
  transition: opacity 0.4s var(--smooth);
  pointer-events: none;
}
.post-card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(99, 102, 241, 0.2);
  background: var(--color-surface-hover);
  box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.4),
              0 0 0 1px rgba(99, 102, 241, 0.1);
}
.post-card:hover::before {
  opacity: 1;
}
.post-card h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}
.post-card h2 a {
  color: var(--color-text);
  transition: color 0.2s;
}
.post-card h2 a:hover {
  color: #818cf8;
}
/* Featured (first) card gets bigger text */
.bento-grid .post-card:first-child h2 {
  font-size: 1.4rem;
}
.post-card .meta {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.post-card .summary {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}
/* Arrow indicator on hover */
.post-card .arrow {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.3s var(--smooth), transform 0.3s var(--spring);
}
.post-card .arrow svg {
  width: 14px;
  height: 14px;
  stroke: var(--color-accent);
  stroke-width: 2;
  fill: none;
}
.post-card:hover .arrow {
  opacity: 1;
  transform: translateX(0);
}

/* === CATEGORY BADGES — pill style === */
.badge {
  display: inline-flex;
  align-items: center;
  background: var(--color-accent-soft);
  color: #818cf8;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background 0.2s, transform 0.2s var(--spring);
}
.badge:hover {
  background: rgba(99, 102, 241, 0.2);
  transform: scale(1.05);
}

/* === CATEGORY GRID — bento with count animation === */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.category-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: transform 0.35s var(--spring),
              border-color 0.35s var(--smooth),
              background 0.35s var(--smooth),
              box-shadow 0.35s var(--smooth);
  overflow: hidden;
}
.category-card::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  background: var(--color-accent);
  border-radius: 2px;
  transition: transform 0.35s var(--spring);
}
.category-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.15);
  background: var(--color-surface-hover);
  box-shadow: 0 8px 30px -6px rgba(0, 0, 0, 0.3);
  text-decoration: none;
  color: var(--color-text);
}
.category-card:hover::after {
  transform: translateX(-50%) scaleX(1);
}
.category-card h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--color-text);
}
.category-card .count {
  color: var(--color-text-secondary);
  font-size: 0.85rem;
}
.category-card .count-num {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* === SINGLE POST — article layout === */
.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}
.post-header .meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
}

/* Post content — clean typography */
.post-content {
  margin-top: 1.5rem;
  line-height: 1.85;
  color: rgba(232, 232, 237, 0.85);
}
.post-content h2 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}
.post-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}
.post-content p {
  margin-bottom: 1.25rem;
}
.post-content ul, .post-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}
.post-content li {
  margin-bottom: 0.4rem;
}
.post-content strong {
  color: var(--color-text);
  font-weight: 600;
}
.post-content code {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.88em;
  font-family: "JetBrains Mono", "Fira Code", monospace;
}
.post-content pre {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-glass-border);
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  border: 1px solid var(--color-glass-border);
  transition: all 0.25s var(--spring);
  margin-bottom: 1.5rem;
}
.back-link:hover {
  color: var(--color-text);
  background: var(--color-surface-hover);
  transform: translateX(-4px);
}

/* === ABOUT PAGE === */
.about-content {
  background: var(--color-surface);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius);
  padding: 2.5rem;
}
.about-content p {
  color: rgba(232, 232, 237, 0.85);
  margin-bottom: 1.25rem;
  line-height: 1.85;
}
.about-content a {
  border-bottom: 1px solid rgba(99, 102, 241, 0.3);
  transition: border-color 0.2s;
}
.about-content a:hover {
  border-color: var(--color-accent);
}

/* === CONTACT FORM — floating labels + focus ring === */
.contact-form {
  background: var(--color-surface);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius);
  padding: 2.5rem;
}
.form-group {
  position: relative;
  margin-bottom: 1.5rem;
}
.form-group label {
  display: block;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.4rem;
  transition: color 0.2s;
}
.form-group:focus-within label {
  color: var(--color-accent);
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--color-text);
  transition: border-color 0.3s var(--smooth),
              box-shadow 0.3s var(--smooth),
              background 0.3s var(--smooth);
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--color-accent);
  background: rgba(99, 102, 241, 0.04);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(139, 139, 158, 0.5);
}
.form-group textarea {
  min-height: 140px;
  resize: vertical;
}

/* Status button — idle/loading/success states */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--color-accent);
  color: #fff;
  border: none;
  padding: 0.7rem 1.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.25s var(--spring),
              background 0.25s var(--smooth),
              box-shadow 0.25s var(--smooth);
}
.btn:hover {
  background: #4f46e5;
  transform: scale(1.03);
  box-shadow: 0 4px 20px var(--color-accent-glow);
}
.btn:active {
  transform: scale(0.97);
}
/* Shine sweep on hover */
.btn::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transform: skewX(-20deg);
  transition: left 0.5s var(--smooth);
}
.btn:hover::after {
  left: 125%;
}

.success-msg {
  background: rgba(52, 211, 153, 0.1);
  color: var(--color-success);
  border: 1px solid rgba(52, 211, 153, 0.2);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: stagger-in 0.4s var(--spring);
}
.success-msg::before {
  content: "\2713";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.15);
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* === 404 PAGE === */
.not-found {
  text-align: center;
  padding: 4rem 0;
}
.not-found .big-code {
  font-size: 6rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 139, 158, 0.2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 1rem;
}

/* === FOOTER — minimal === */
.site-footer {
  text-align: center;
  padding: 2.5rem 2rem;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  border-top: 1px solid var(--color-border);
  margin-top: 4rem;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .site-header .inner {
    flex-direction: column;
    gap: 0.75rem;
  }
  .site-header nav {
    width: 100%;
    justify-content: center;
  }
  .container {
    padding: 1.5rem 1.25rem;
  }
  .page-title {
    font-size: 1.75rem;
  }
  .about-content, .contact-form {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }
  .category-grid {
    grid-template-columns: 1fr;
  }
  .site-header nav a {
    font-size: 0.8rem;
    padding: 0.35rem 0.65rem;
  }
}
