/* ============================================
   NMN Labo — Main Stylesheet
   Clean, modern blog design focused on readability
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: #374151; background: #fff; line-height: 1.7; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

/* --- Utility Classes --- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border-width: 0; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }
.antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.font-sans { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; }

/* --- Layout --- */
.max-w-6xl { max-width: 72rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-sm { max-width: 24rem; }
.max-w-none { max-width: none; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Padding */
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.p-2 { padding: 0.5rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.pt-3 { padding-top: 0.75rem; }
.pt-6 { padding-top: 1.5rem; }
.pt-8 { padding-top: 2rem; }
.pt-16 { padding-top: 4rem; }
.pb-4 { padding-bottom: 1rem; }
.pb-6 { padding-bottom: 1.5rem; }
.pb-16 { padding-bottom: 4rem; }

/* Margin */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.mt-16 { margin-top: 4rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mb-12 { margin-bottom: 3rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.mx-2 { margin-left: 0.5rem; margin-right: 0.5rem; }

/* Gap */
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-12 { gap: 3rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }

/* --- Flexbox --- */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }

/* --- Grid --- */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* --- Display & Position --- */
.block { display: block; }
.inline-block { display: inline-block; }
.hidden { display: none; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.top-16 { top: 4rem; }
.top-20 { top: 5rem; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.inset-0 { inset: 0; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

/* --- Sizing --- */
.w-full { width: 100%; }
.w-3\.5 { width: 0.875rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-7 { width: 1.75rem; }
.w-8 { width: 2rem; }
.w-12 { width: 3rem; }
.h-0\.5 { height: 0.125rem; }
.h-16 { height: 4rem; }
.h-full { height: 100%; }
.h-3\.5 { height: 0.875rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-7 { height: 1.75rem; }
.h-8 { height: 2rem; }
.h-12 { height: 3rem; }
.aspect-\[16\/9\] { aspect-ratio: 16 / 9; }

/* --- Typography --- */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.leading-tight { line-height: 1.25; }
.leading-snug { line-height: 1.375; }
.leading-relaxed { line-height: 1.75; }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.uppercase { text-transform: uppercase; }
.underline { text-decoration: underline; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-center { text-align: center; }
.select-none { user-select: none; }

/* --- Colors --- */
.text-white { color: #fff; }
.text-gray-200 { color: #e5e7eb; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }
.text-emerald-200 { color: #a7f3d0; }
.text-emerald-600 { color: #059669; }
.text-emerald-700 { color: #047857; }
.text-amber-600 { color: #d97706; }
.text-amber-700 { color: #b45309; }

.bg-white { background-color: #fff; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-emerald-50 { background-color: #ecfdf5; }
.bg-emerald-600 { background-color: #059669; }
.bg-emerald-700 { background-color: #047857; }
.bg-amber-50 { background-color: #fffbeb; }

.bg-white\/95 { background-color: rgba(255,255,255,0.95); }

.bg-gradient-to-b { background: linear-gradient(to bottom, #f9fafb, #fff); }
.bg-gradient-to-br { background: linear-gradient(to bottom right, #ecfdf5, #f0fdfa); }

/* --- Borders --- */
.border { border-width: 1px; border-style: solid; }
.border-t { border-top-width: 1px; border-top-style: solid; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.border-gray-50 { border-color: #f9fafb; }
.border-gray-100 { border-color: #f3f4f6; }
.border-gray-200 { border-color: #e5e7eb; }
.border-amber-100 { border-color: #fef3c7; }
.border-emerald-200 { border-color: #a7f3d0; }
.rounded-full { border-radius: 9999px; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }

/* --- Effects --- */
.shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.object-cover { object-fit: cover; }
.backdrop-blur-sm { backdrop-filter: blur(4px); }

/* --- Transitions --- */
.transition-colors { transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
.transition-all { transition: all 0.2s ease; }
.transition-transform { transition: transform 0.3s ease; }
.duration-300 { transition-duration: 300ms; }
.duration-500 { transition-duration: 500ms; }
.duration-150 { transition-duration: 150ms; }

/* --- Hover States --- */
.hover\:text-emerald-600:hover { color: #059669; }
.hover\:text-emerald-700:hover { color: #047857; }
.hover\:text-amber-700:hover { color: #b45309; }
.hover\:text-amber-800:hover { color: #92400e; }
.hover\:bg-gray-50:hover { background-color: #f9fafb; }
.hover\:bg-emerald-50:hover { background-color: #ecfdf5; }
.hover\:bg-emerald-100:hover { background-color: #d1fae5; }
.hover\:bg-emerald-700:hover { background-color: #047857; }
.hover\:border-emerald-200:hover { border-color: #a7f3d0; }
.hover\:border-emerald-300:hover { border-color: #6ee7b7; }
.hover\:border-gray-200:hover { border-color: #e5e7eb; }
.hover\:shadow-lg:hover { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }

.group:hover .group-hover\:text-emerald-700 { color: #047857; }
.group:hover .group-hover\:scale-105 { transform: scale(1.05); }
.group:hover .group-hover\:translate-x-1 { transform: translateX(0.25rem); }

/* --- Responsive --- */
@media (min-width: 640px) {
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
  .sm\:flex-row { flex-direction: row; }
  .sm\:hidden { display: none; }
  .sm\:inline-flex { display: inline-flex; }
}
@media (min-width: 768px) {
  .md\:flex { display: flex; }
  .md\:hidden { display: none; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
  .md\:py-24 { padding-top: 6rem; padding-bottom: 6rem; }
  .md\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
  .md\:text-5xl { font-size: 3rem; line-height: 1.1; }
}
@media (min-width: 1024px) {
  .lg\:grid { display: grid; }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:grid-cols-\[220px_1fr\] { grid-template-columns: 220px 1fr; }
  .lg\:gap-12 { gap: 3rem; }
  .lg\:block { display: block; }
  .lg\:hidden { display: none; }
}

/* ============================================
   Article Content Prose Styles
   Clean, spacious, scannable — inspired by just-glow.com
   ============================================ */

.article-content {
  font-family: 'Source Serif 4', 'Georgia', serif;
  font-size: 1.125rem;
  line-height: 1.85;
  color: #374151;
}

.article-content > * + * { margin-top: 1.5rem; }

/* Headings */
.article-content h2 {
  font-family: 'Inter', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: #111827;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #ecfdf5;
  line-height: 1.3;
  scroll-margin-top: 5rem;
}

.article-content h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1f2937;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  scroll-margin-top: 5rem;
}

.article-content h4 {
  font-family: 'Inter', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #374151;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  scroll-margin-top: 5rem;
}

/* Paragraphs */
.article-content p { margin-bottom: 1.5rem; color: #4b5563; }
.article-content strong { color: #1f2937; font-weight: 700; }

/* Links */
.article-content a {
  color: #047857;
  text-decoration: underline;
  text-decoration-color: #a7f3d0;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
.article-content a:hover { color: #059669; text-decoration-color: #059669; }

/* Lists */
.article-content ul, .article-content ol { padding-left: 1.5rem; margin-bottom: 1.5rem; }
.article-content ul { list-style-type: disc; }
.article-content ol { list-style-type: decimal; }
.article-content li { margin-bottom: 0.5rem; color: #4b5563; padding-left: 0.25rem; }
.article-content li strong { color: #1f2937; }

/* Blockquotes */
.article-content blockquote {
  border-left: 4px solid #059669;
  background: #f0fdf4;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  border-radius: 0 0.5rem 0.5rem 0;
  font-style: italic;
  color: #374151;
}
.article-content blockquote p { margin-bottom: 0; }

/* Tables */
.article-content table { width: 100%; border-collapse: collapse; margin: 2rem 0; font-family: 'Inter', sans-serif; font-size: 0.875rem; }
.article-content thead th { background: #f9fafb; font-weight: 600; text-align: left; padding: 0.75rem 1rem; border-bottom: 2px solid #e5e7eb; color: #374151; }
.article-content tbody td { padding: 0.75rem 1rem; border-bottom: 1px solid #f3f4f6; color: #4b5563; }
.article-content tbody tr:hover { background: #f9fafb; }

/* Images */
.article-content img { border-radius: 0.75rem; margin: 2rem 0; }

/* Code */
.article-content code { font-size: 0.875em; background: #f3f4f6; padding: 0.2em 0.4em; border-radius: 0.25rem; color: #1f2937; }
.article-content pre { background: #1f2937; color: #e5e7eb; padding: 1.25rem; border-radius: 0.75rem; overflow-x: auto; margin: 2rem 0; }
.article-content pre code { background: none; padding: 0; color: inherit; }

/* Horizontal rule */
.article-content hr { border: none; border-top: 2px solid #f3f4f6; margin: 3rem 0; }

/* ============================================
   Table of Contents Styles
   ============================================ */

.toc-sidebar nav > ul,
.toc-sidebar ul { list-style: none; padding: 0; margin: 0; }

.toc-sidebar ul li a {
  display: block;
  padding: 0.35rem 0.75rem;
  color: #6b7280;
  font-size: 0.8125rem;
  line-height: 1.5;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}
.toc-sidebar ul li a:hover { color: #047857; border-left-color: #a7f3d0; }
.toc-sidebar ul li a.active { color: #047857; font-weight: 600; border-left-color: #059669; }
.toc-sidebar ul ul { padding-left: 0.75rem; }

.toc-mobile nav > ul, .toc-mobile ul { list-style: none; padding: 0; }
.toc-mobile ul li a { display: block; padding: 0.4rem 0; color: #6b7280; text-decoration: none; transition: color 0.15s ease; }
.toc-mobile ul li a:hover { color: #047857; }
.toc-mobile ul ul { padding-left: 1rem; }

/* ============================================
   Search Results
   ============================================ */
#search-results a { display: block; padding: 0.75rem 1rem; border-bottom: 1px solid #f3f4f6; transition: background-color 0.15s ease; }
#search-results a:hover { background: #f9fafb; }
#search-results .search-title { font-weight: 600; color: #111827; font-size: 0.875rem; }
#search-results .search-excerpt { color: #6b7280; font-size: 0.75rem; margin-top: 0.25rem; }

/* ============================================
   Details/Summary
   ============================================ */
details summary::-webkit-details-marker { display: none; }
details summary { list-style: none; }
details[open] summary svg { transform: rotate(180deg); }

/* ============================================
   Reading Progress Bar
   ============================================ */
#reading-progress { transition: width 0.15s ease-out; }

/* ============================================
   Scrollbar
   ============================================ */
.toc-sidebar nav::-webkit-scrollbar { width: 3px; }
.toc-sidebar nav::-webkit-scrollbar-track { background: transparent; }
.toc-sidebar nav::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* ============================================
   Print Styles
   ============================================ */
@media print {
  header, footer, aside, #reading-progress, .toc-sidebar { display: none !important; }
  .article-content { font-size: 12pt; }
  body { color: #000; }
}
