/* Modern Vibrant Minimalistic Blog Styles */

/* Self-hosted Inter — variable font, one file covers weights 400-800 */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --max-width: 1200px;
  --radius: 8px;
}

/* Light Mode - Vibrant & Minimalistic */
:root, [data-theme="light"] {
  --color-primary: #FF6B6B;
  --color-primary-dark: #EE5A52;
  /* Ink shade of the brand coral, for anything that must clear a contrast
     threshold: 4.96:1 with white and against the page background, where
     --color-primary manages only 2.78:1. Used by the focus ring and the skip
     link; the filled buttons and in-post links still use --color-primary and
     still fail AA (see docs/audits/2026-07-26-accessibility.md H4/H7). */
  --color-primary-ink: #CC3A3A;
  --color-secondary: #4ECDC4;
  --color-accent: #FFE66D;
  --color-purple: #A78BFA;
  --color-text: #1A1A2E;
  --color-text-light: #6B7280;
  --color-border: #E5E7EB;
  --color-bg: #FFFFFF;
  --color-bg-alt: #F8F9FA;
  --color-bg-code: #F3F4F6;
  --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 10px 20px rgba(0, 0, 0, 0.04);
  --card-shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.1), 0 16px 32px rgba(0, 0, 0, 0.08);
}

/* Dark Mode - Vibrant & Minimalistic */
[data-theme="dark"] {
  --color-primary: #FF8787;
  --color-primary-dark: #FF6B6B;
  /* Dark mode needs no darkening — #FF8787 is already 7.66:1 on --color-bg. */
  --color-primary-ink: #FF8787;
  --color-secondary: #6EEEE8;
  --color-accent: #FFF89C;
  --color-purple: #C4B5FD;
  --color-text: #F9FAFB;
  --color-text-light: #D1D5DB;
  --color-border: #374151;
  --color-bg: #111827;
  --color-bg-alt: #1F2937;
  --color-bg-code: #374151;
  --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
  --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.3), 0 10px 20px rgba(0, 0, 0, 0.2);
  --card-shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.4), 0 16px 32px rgba(0, 0, 0, 0.3);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 80px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* Site Header / Brand */
.site-header {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  min-height: 72px;
  /* keep clear of the fixed hamburger button */
  padding-right: 6rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--color-text);
}

.brand-logo {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease;
}

.brand:hover .brand-logo {
  transform: scale(1.08) rotate(-3deg);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.2;
}

.brand-accent {
  color: var(--color-primary);
}

/* Inline SVG icon sizing (nav, menu, hamburger) */
.nav-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.menu-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.hamburger-icon svg {
  width: 24px;
  height: 24px;
  display: block;
  color: var(--color-text);
}

.premium-star {
  position: absolute;
  right: -7px;
  bottom: -5px;
}

.premium-star svg {
  width: 13px;
  height: 13px;
  display: block;
}

/* Hamburger Menu Toggle */
.menu-toggle {
  position: fixed;
  /* 0.5rem centers the 56px button in the 72px header (8+56+8); 1.5rem made it
     overhang the header bottom by 8px on desktop. Mobile override below. */
  top: 0.5rem;
  right: 1.5rem;
  z-index: 1000;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  border: none;
  background: var(--color-bg-alt);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.menu-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--card-shadow-hover);
}

.menu-toggle:active {
  transform: scale(0.95);
}

.hamburger-icon {
  font-size: 1.75rem;
  line-height: 1;
}

/* Menu Dropdown */
.menu-dropdown {
  position: fixed;
  /* 8px below the button's new bottom edge (0.5rem + 56px + 8px) */
  top: 4.5rem;
  right: 1.5rem;
  z-index: 999;
  background: var(--color-bg);
  border-radius: 20px;
  box-shadow: var(--card-shadow-hover);
  border: 1px solid var(--color-border);
  min-width: 200px;
  overflow: hidden;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.menu-dropdown.hidden {
  display: none;
}

.menu-item {
  width: 100%;
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--color-text);
  font-size: 1rem;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-item:hover {
  background: var(--color-bg-alt);
}

.menu-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 1.25rem;
}

.menu-label {
  flex: 1;
  text-align: left;
  font-weight: 500;
}

/* Theme icons in menu */
.theme-icon-menu {
  position: absolute;
  transition: all 0.3s ease;
}

/* Icon + label advertise the mode you'll SWITCH TO, not the current one:
   light mode shows moon + "Dark Mode", dark mode shows sun + "Light Mode" */
[data-theme="light"] .theme-icon-menu.sun {
  opacity: 0;
  transform: scale(0);
}

[data-theme="light"] .theme-icon-menu.moon {
  opacity: 1;
  transform: scale(1);
}

[data-theme="dark"] .theme-icon-menu.sun {
  opacity: 1;
  transform: scale(1);
}

[data-theme="dark"] .theme-icon-menu.moon {
  opacity: 0;
  transform: scale(0);
}

[data-theme="light"] .theme-label-to-light {
  display: none;
}

[data-theme="dark"] .theme-label-to-dark {
  display: none;
}

/* Auth icons in menu */
.auth-icon-menu {
  position: absolute;
  transition: all 0.3s ease;
}

.menu-item .auth-icon-menu.logged-out {
  opacity: 1;
  transform: scale(1);
}

.menu-item .auth-icon-menu.logged-in {
  opacity: 0;
  transform: scale(0);
}

.menu-item.authenticated .auth-icon-menu.logged-out {
  opacity: 0;
  transform: scale(0);
}

.menu-item.authenticated .auth-icon-menu.logged-in {
  opacity: 1;
  transform: scale(1);
}

/* Auth labels */
.auth-label-in {
  display: none;
}

.menu-item.authenticated .auth-label-out {
  display: none;
}

.menu-item.authenticated .auth-label-in {
  display: block;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--color-bg);
  border-radius: 24px;
  padding: 2.5rem;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--card-shadow-hover);
  animation: slideUp 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--color-text-light);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

.modal-content h2 {
  margin-bottom: 1.5rem;
  color: var(--color-text);
  font-size: 1.75rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.9375rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
  transition: all 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.btn-primary {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 0.5rem;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--card-shadow);
}

.btn-primary:active {
  transform: translateY(0);
}

.error-message {
  padding: 0.75rem 1rem;
  background: rgba(255, 0, 0, 0.1);
  border: 1px solid rgba(255, 0, 0, 0.3);
  border-radius: 8px;
  color: #dc2626;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.error-message.hidden {
  display: none;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-bg);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--color-border);
  z-index: 100;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: var(--color-text-light);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 12px;
  min-width: 70px;
  position: relative;
}

.nav-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 80%;
  height: 3px;
  background: var(--color-primary);
  border-radius: 0 0 3px 3px;
  transition: transform 0.3s ease;
}

.nav-btn:hover {
  background: var(--color-bg-alt);
  color: var(--color-primary);
  transform: translateY(-3px);
}

.nav-btn:hover::before {
  transform: translateX(-50%) scaleX(1);
}

.nav-btn:active {
  transform: translateY(-1px);
}

.nav-icon {
  font-size: 1.25rem;
}

.nav-label {
  font-size: 0.75rem;
  font-weight: 500;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 3rem 0;
}

/* Section Headers */
.page-header {
  text-align: center;
  margin-bottom: 3rem;
}

.page-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.page-header p {
  color: var(--color-text-light);
  font-size: 1.125rem;
}

.page-header .highlight {
  color: var(--color-primary);
}

.page-header .back-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.page-header .back-link:hover {
  text-decoration: underline;
}

/* Posts Grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Post Card */
.post-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
}

.post-card-link:nth-child(1) { animation-delay: 0.1s; }
.post-card-link:nth-child(2) { animation-delay: 0.2s; }
.post-card-link:nth-child(3) { animation-delay: 0.3s; }
.post-card-link:nth-child(4) { animation-delay: 0.4s; }
.post-card-link:nth-child(5) { animation-delay: 0.5s; }
.post-card-link:nth-child(n+6) { animation-delay: 0.6s; }

.post-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 1.75rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.post-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.post-card-link:hover .post-card {
  transform: translateY(-8px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--color-primary);
}

.post-card-link:hover .post-card::before {
  transform: scaleX(1);
}

.post-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--color-text-light);
}

.post-meta time {
  color: var(--color-text-light);
}

.post-meta .category {
  background: var(--color-primary);
  color: white;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.2s;
}

.post-meta .category:hover {
  background: var(--color-primary-dark);
}

.post-title {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  color: var(--color-text);
  transition: color 0.2s;
}

.post-card-link:hover .post-title {
  color: var(--color-primary);
}

.post-excerpt {
  color: var(--color-text-light);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tag {
  background: var(--color-bg-alt);
  color: var(--color-text-light);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.2s;
  display: inline-block;
}

.read-more {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
  display: inline-block;
}

/* Blog Post Page */
.blog-post {
  max-width: 800px;
  margin: 0 auto;
}

.post-header {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
}

.post-header h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 800;
  line-height: 1.2;
}

.post-content {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--color-text);
}

.post-content h1,
.post-content h2,
.post-content h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.post-content h1 {
  font-size: 2rem;
}

.post-content h2 {
  font-size: 1.75rem;
}

.post-content h3 {
  font-size: 1.5rem;
}

.post-content p {
  margin-bottom: 1.5rem;
}

.post-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  transition: color 0.2s;
}

.post-content a:hover {
  color: var(--color-primary-dark);
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 2rem 0;
  box-shadow: var(--shadow-md);
}

.post-content code {
  background: var(--color-bg-code);
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
  color: #e83e8c;
}

.post-content pre {
  background: var(--color-bg-code);
  padding: 1.5rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--color-border);
}

.post-content pre code {
  background: none;
  padding: 0;
  color: var(--color-text);
  font-size: 0.875rem;
}

/* Shiki-highlighted code blocks: the inline styles carry both themes; swap to
   the --shiki-dark variables when the site is in dark mode. */
.post-content pre.shiki {
  background-color: var(--color-bg-alt) !important;
}

.post-content pre.shiki code {
  color: inherit;
  font-family: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Menlo, Consolas, monospace;
  line-height: 1.6;
}

[data-theme="dark"] .post-content pre.shiki {
  background-color: var(--color-bg-code) !important;
}

[data-theme="dark"] .post-content pre.shiki span {
  color: var(--shiki-dark) !important;
}

/* Code blocks with a filename label: ```ts title="src/utils/blog.ts" or ```ts:src/utils/blog.ts
   The wrapper owns the outer border/radius; the <pre> inside loses its top corners
   and top border so the header bar and the code read as one box. */
.post-content .code-block {
  margin: 1.5rem 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.post-content .code-filename {
  padding: 0.5rem 1rem;
  font-family: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--color-text-light);
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  white-space: nowrap;
}

.post-content .code-block pre {
  margin: 0;
  border: 0;
  border-radius: 0;
}

/* Copy button injected on code blocks (see [...slug].astro script) */
.post-content pre {
  position: relative;
}

.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--color-text-light);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.post-content pre:hover .code-copy-btn,
.code-copy-btn:focus-visible {
  opacity: 1;
}

.code-copy-btn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* Smooth in-page anchor jumps from the table of contents */
html {
  scroll-behavior: smooth;
}

.post-content h2,
.post-content h3 {
  scroll-margin-top: 1.5rem;
}

.post-content blockquote {
  border-left: 4px solid var(--color-primary);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--color-text-light);
}

.post-content ul,
.post-content ol {
  margin-left: 2rem;
  margin-bottom: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2rem 0;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.back-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.back-link:hover {
  text-decoration: underline;
}

/* Tags Page */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.tag-item {
  background: var(--color-bg-alt);
  padding: 0.75rem 1.5rem;
  border-radius: 20px;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
  border: 2px solid var(--color-border);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--card-shadow);
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
  position: relative;
  overflow: hidden;
}

.tag-item:nth-child(1) { animation-delay: 0.05s; }
.tag-item:nth-child(2) { animation-delay: 0.1s; }
.tag-item:nth-child(3) { animation-delay: 0.15s; }
.tag-item:nth-child(4) { animation-delay: 0.2s; }
.tag-item:nth-child(5) { animation-delay: 0.25s; }
.tag-item:nth-child(6) { animation-delay: 0.3s; }
.tag-item:nth-child(n+7) { animation-delay: 0.35s; }

.tag-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}

.tag-item:hover {
  background: var(--color-primary);
  color: white;
  transform: translateY(-4px) scale(1.05);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--color-primary);
}

.tag-item:hover::before {
  left: 100%;
}

.tag-count {
  background: rgba(0, 0, 0, 0.15);
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.875rem;
  transition: background 0.3s ease;
}

.tag-item:hover .tag-count {
  background: rgba(255, 255, 255, 0.25);
}

/* Categories Grid */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.category-card {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: white;
  padding: 2rem;
  border-radius: 24px;
  text-decoration: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
}

.category-card:nth-child(1) { animation-delay: 0.1s; }
.category-card:nth-child(2) { animation-delay: 0.2s; }
.category-card:nth-child(3) { animation-delay: 0.3s; }
.category-card:nth-child(4) { animation-delay: 0.4s; }
.category-card:nth-child(n+5) { animation-delay: 0.5s; }

.category-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.category-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--card-shadow-hover);
}

.category-card:hover::before {
  opacity: 1;
}

.category-card h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.category-card p {
  opacity: 0.95;
  font-size: 1rem;
}

/* Search Page */
.search-page {
  max-width: 800px;
  margin: 0 auto;
}

.search-tips {
  background: var(--color-bg-alt);
  padding: 2rem;
  border-radius: var(--radius);
  margin-top: 2rem;
}

.search-tips h3 {
  margin-bottom: 1rem;
  color: var(--color-text);
}

.search-tips ul {
  list-style: none;
  padding: 0;
}

.search-tips li {
  padding: 0.5rem 0;
  color: var(--color-text-light);
}

.search-tips li:before {
  content: "✓ ";
  color: var(--color-primary);
  font-weight: bold;
  margin-right: 0.5rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--color-bg-alt);
  border-radius: var(--radius);
}

.empty-state h2 {
  color: var(--color-text);
  margin-bottom: 1rem;
}

.empty-state p {
  color: var(--color-text-light);
  font-size: 1.125rem;
}

.empty-state code {
  background: var(--color-bg-code);
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-family: monospace;
}


/* Section Spacing */
.recent-posts,
.all-posts {
  margin-bottom: 3rem;
}

.recent-posts h2,
.all-posts h2 {
  font-size: 2rem;
  margin-bottom: 2rem;
  font-weight: 700;
}

/* Responsive Design */
@media (max-width: 768px) {
  .posts-grid {
    grid-template-columns: 1fr;
  }

  .post-header h1 {
    font-size: 2rem;
  }

  .page-header h1 {
    font-size: 2rem;
  }

  .categories-grid {
    grid-template-columns: 1fr;
  }

  .nav-btn {
    padding: 0.4rem 0.6rem;
    min-width: 60px;
  }

  .nav-icon {
    font-size: 1.1rem;
  }

  .nav-label {
    font-size: 0.7rem;
  }

  .theme-toggle {
    top: 1rem;
    right: 1rem;
    width: 48px;
    height: 48px;
  }

  .theme-icon {
    font-size: 1.25rem;
  }

  .menu-toggle {
    top: 1rem;
    right: 1rem;
    width: 48px;
    height: 48px;
  }

  .hamburger-icon {
    font-size: 1.5rem;
  }

  .menu-dropdown {
    top: 4rem;
    right: 1rem;
  }
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Loading States */
.loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-alt) 0%,
    var(--color-border) 50%,
    var(--color-bg-alt) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
  border-radius: 8px;
}

.skeleton-card {
  padding: 1.75rem;
  border: 1px solid var(--color-border);
  border-radius: 24px;
  background: var(--color-bg);
}

.skeleton-title {
  height: 24px;
  width: 70%;
  margin-bottom: 1rem;
}

.skeleton-text {
  height: 16px;
  width: 100%;
  margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
  width: 80%;
}

/* Site Footer (cross-links to the lans.cloud tools site — mirrors its footer) */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 0;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 1.25rem;
  row-gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: var(--color-text-light);
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--color-primary);
}

.footer-tools {
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
}

.footer-tools-label {
  color: var(--color-text-light);
  font-size: 0.875rem;
  font-weight: 600;
}

.footer-note {
  color: var(--color-text-light);
  font-size: 0.875rem;
}

/* ---------------------------------------------------------------------------
   Accessibility baseline
   --------------------------------------------------------------------------- */

/* `hidden` must actually hide. There were three SCOPED `.hidden` rules
   (.menu-dropdown, .modal, .error-message) and no general one, so every other
   use of the class silently did nothing — which is why the Subscribe menu item
   rendered both its labels and announced as "Subscribe Manage Subscription",
   and why the premium star showed for non-premium users. `!important` because
   a component's own `display: flex` would otherwise win against the UA rule. */
[hidden],
.hidden {
  display: none !important;
}

/* Skip link: first tab stop on every page, visible only while focused. Without
   it, reaching a post means tabbing past the whole footer nav on every page. */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -100%;
  z-index: 2000;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 10px 10px;
  background: var(--color-primary-ink);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}

/* The chip is red-on-red against its own ring, so give this one a dark outline
   instead of the brand one. */
.skip-link:focus-visible {
  outline-color: var(--color-text);
}

/* One consistent keyboard-focus ring, in the ink shade rather than
   --color-primary: the brand coral is only 2.78:1 against the page in light
   mode, and a focus indicator is a non-text UI component needing 3:1
   (WCAG 1.4.11). --color-primary-ink measures 4.96:1 light, 7.66:1 dark.
   Components that draw their own indicator are more specific and keep theirs —
   currently the three form-input rules (global .form-group, PricingCard,
   premium/access), each of which substitutes a border + shadow. */
:focus-visible {
  outline: 3px solid var(--color-primary-ink);
  outline-offset: 2px;
}

/* <main> is only focusable so the skip link can land on it — the jump itself is
   the feedback, a ring around the whole page body is not. */
.main-content:focus,
.main-content:focus-visible {
  outline: none;
}

/* Respect the OS "reduce motion" setting. Note the negative delay and non-zero
   duration rather than `animation: none`: the card/tag/category entrances are
   `opacity: 0` plus `fadeInUp ... forwards`, so cancelling the animation
   outright would leave that content permanently invisible. This lands each one
   on its end state immediately instead. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
