/* SnapHook Engineering Blog — Technical Blueprint Aesthetic
   Achromatic surfaces, hairline borders, rationed periwinkle accents,
   and developer-first typography. */

:root {
  --color-void: #000000;
  --color-carbon: #0f1015;
  --color-panel: #14161f;
  --color-graphite: #272a38;
  --color-steel: #7d849b;
  --color-ash: #a6adbb;
  --color-paper: #ffffff;
  --color-periwinkle: #7089ba;
  --color-periwinkle-soft: rgba(112, 137, 186, 0.15);
  --color-emerald: #10b981;
  --color-amber: #f59e0b;
  --color-rose: #f43f5e;

  --font-sans: "Inter Variable", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  --max-w-page: 1180px;
  --max-w-article: 820px;

  /* Motion */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
  background-color: var(--color-void);
  color: var(--color-paper);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

a:hover {
  color: var(--color-periwinkle);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

img, svg {
  display: block;
  max-width: 100%;
}

/* ------------------------------------------------ Layout Containers ---- */

.blog-shell {
  max-width: var(--max-w-page);
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

.article-shell {
  max-width: var(--max-w-article);
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

/* ------------------------------------------------ Common Top Navigation ---- */

.shell {
  width: 100%;
  max-width: var(--max-w-page);
  margin: 0 auto;
  padding: 0 24px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-void);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}

.topnav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--color-paper);
  transition: opacity 0.15s var(--ease-smooth);
}

.logo:hover {
  text-decoration: none;
  opacity: 0.88;
}

.logo-mark {
  width: 22px;
  height: 22px;
  flex: none;
}

.navlinks {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.navlinks a {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-ash);
  border-radius: var(--radius-sm);
  transition: color 0.15s var(--ease-smooth);
}

.navlinks a:hover,
.navlinks a[aria-current="page"] {
  color: var(--color-paper);
  text-decoration: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border: 1px solid var(--color-paper);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-paper);
  background: transparent;
  text-decoration: none;
  transition: background-color 0.18s var(--ease-smooth),
              color 0.18s var(--ease-smooth),
              border-color 0.18s var(--ease-smooth),
              transform 0.18s var(--ease-spring),
              box-shadow 0.18s var(--ease-smooth);
}

.pill:hover {
  background: var(--color-paper);
  color: var(--color-void);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.08);
}

.pill:active {
  transform: translateY(0) scale(0.98);
}

.pill.ghost {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--color-ash);
}

.pill.ghost:hover {
  border-color: var(--color-paper);
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-paper);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.pill.ghost:active {
  transform: translateY(0) scale(0.98);
}

@media (max-width: 860px) {
  .navlinks {
    display: none;
  }
}

/* ------------------------------------------------ Hero Header ---- */

.blog-hero {
  padding: 64px 0 40px 0;
  text-align: left;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  position: relative;
}

.eyebrow-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-periwinkle);
  background: var(--color-periwinkle-soft);
  border: 1px solid rgba(112, 137, 186, 0.3);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 16px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-emerald);
  box-shadow: 0 0 8px var(--color-emerald);
  display: inline-block;
  animation: radarPulse 2.4s infinite;
  flex-shrink: 0;
}

@keyframes radarPulse {
  0% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.05); opacity: 1; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.blog-hero-title {
  font-size: clamp(32px, 5.5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--color-paper);
  margin-bottom: 16px;
  max-width: 820px;
}

.blog-hero-sub {
  font-size: clamp(16px, 2.5vw, 19px);
  color: var(--color-steel);
  line-height: 1.5;
  max-width: 680px;
  margin-bottom: 32px;
}

/* ------------------------------------------------ Search & Filter Bar ---- */

.blog-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0;
  flex-wrap: wrap;
}

.blog-search-box {
  position: relative;
  flex: 1 1 280px;
  max-width: 440px;
}

.blog-search-input {
  width: 100%;
  padding: 10px 40px 10px 38px;
  background: var(--color-carbon);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: var(--color-paper);
  font-size: 14px;
  transition: border-color 0.18s var(--ease-smooth),
              box-shadow 0.18s var(--ease-smooth),
              background-color 0.18s var(--ease-smooth);
}

.blog-search-input:focus {
  outline: none;
  border-color: var(--color-periwinkle);
  box-shadow: 0 0 0 3px rgba(112, 137, 186, 0.15);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-steel);
  pointer-events: none;
}

.search-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-steel);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 2px 6px;
  pointer-events: none;
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--color-carbon);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--color-steel);
  transition: all 0.15s var(--ease-smooth), transform 0.14s var(--ease-spring);
}

.filter-pill:hover {
  color: var(--color-paper);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.filter-pill:active {
  transform: translateY(0) scale(0.97);
}

.filter-pill.active {
  background: var(--color-periwinkle-soft);
  color: var(--color-paper);
  border-color: var(--color-periwinkle);
}

/* ------------------------------------------------ Featured Article Card ---- */

.featured-section {
  margin-top: 16px;
  margin-bottom: 48px;
}

.featured-card {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  background: var(--color-carbon);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 36px;
  transition: border-color 0.25s var(--ease-smooth),
              transform 0.25s var(--ease-spring),
              box-shadow 0.25s var(--ease-smooth);
  position: relative;
  overflow: hidden;
}

.featured-card:hover {
  border-color: rgba(112, 137, 186, 0.55);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.65);
  transform: translateY(-3px);
}

.featured-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tag-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(112, 137, 186, 0.2);
  color: var(--color-periwinkle);
  border: 1px solid rgba(112, 137, 186, 0.35);
}

.time-stamp {
  font-size: 13px;
  color: var(--color-steel);
}

.featured-title {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-paper);
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

.featured-excerpt {
  font-size: 15px;
  color: var(--color-ash);
  line-height: 1.6;
  margin-bottom: 24px;
}

.author-byline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-graphite);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--color-paper);
}

.author-info {
  display: flex;
  flex-direction: column;
}

.author-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-paper);
}

.author-role {
  font-size: 11px;
  color: var(--color-steel);
}

.featured-graphic {
  background: #090a0f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-steel);
  overflow: hidden;
}

.code-snippet-preview {
  color: #34d399;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

@media (max-width: 860px) {
  .featured-card {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------ Article Cards Grid ---- */

.blog-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.grid-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.grid-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-steel);
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 24px;
  margin-bottom: 64px;
}

.blog-card {
  background: var(--color-carbon);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 26px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s var(--ease-smooth),
              transform 0.22s var(--ease-spring),
              box-shadow 0.2s var(--ease-smooth);
  position: relative;
}

.blog-card:hover {
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.blog-card-title {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--color-paper);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.blog-card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.blog-card-excerpt {
  font-size: 14px;
  color: var(--color-steel);
  line-height: 1.6;
  margin-bottom: 20px;
  flex: 1 1 auto;
}

.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: var(--color-steel);
}

.read-more-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  color: var(--color-periwinkle);
  position: relative;
  z-index: 2;
  transition: color 0.15s var(--ease-smooth), transform 0.2s var(--ease-spring);
}

.read-more-link span {
  display: inline-block;
  transition: transform 0.2s var(--ease-spring);
}

.blog-card:hover .read-more-link {
  color: #8fa5d4;
  transform: translateX(4px);
}

/* ------------------------------------------------ Empty Search State ---- */

.blog-empty {
  text-align: center;
  padding: 60px 24px;
  background: var(--color-carbon);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  margin-bottom: 64px;
}

.blog-empty h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.blog-empty p {
  color: var(--color-steel);
  font-size: 14px;
  margin-bottom: 18px;
}

/* ------------------------------------------------ RSS / Newsletter Box ---- */

.rss-card {
  background: linear-gradient(180deg, var(--color-carbon) 0%, #0d0f17 100%);
  border: 1px solid rgba(112, 137, 186, 0.25);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-bottom: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  transition: border-color 0.2s var(--ease-smooth),
              transform 0.2s var(--ease-spring),
              box-shadow 0.2s var(--ease-smooth);
}

.rss-card:hover {
  border-color: rgba(112, 137, 186, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
}

.rss-card-text {
  max-width: 580px;
}

.rss-card-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--color-paper);
}

.rss-card-desc {
  font-size: 14px;
  color: var(--color-ash);
  line-height: 1.5;
}

.rss-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rss-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--color-periwinkle);
  color: #000;
  font-weight: 600;
  font-size: 13px;
  transition: background-color 0.18s var(--ease-smooth),
              transform 0.18s var(--ease-spring),
              box-shadow 0.18s var(--ease-smooth);
}

.rss-btn:hover {
  background: #8fa5d4;
  color: #000;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(112, 137, 186, 0.35);
}

.rss-btn:active {
  transform: translateY(0) scale(0.98);
}

/* ------------------------------------------------ Article Reader Styles ---- */

.article-header {
  padding: 56px 0 36px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
  margin-bottom: 40px;
}

.article-back-nav {
  margin-bottom: 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-steel);
  font-weight: 500;
  transition: color 0.15s var(--ease-smooth), transform 0.15s var(--ease-spring);
}

.back-link:hover {
  color: var(--color-paper);
  transform: translateX(-3px);
}

.article-title {
  font-size: clamp(28px, 4.5vw, 42px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--color-paper);
  margin-bottom: 16px;
}

.article-lede {
  font-size: 19px;
  line-height: 1.5;
  color: var(--color-ash);
  margin-bottom: 28px;
}

.article-author-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* Prose Typography */

.prose {
  font-size: 17px;
  line-height: 1.75;
  color: #d1d5db;
}

.prose p {
  margin-bottom: 24px;
}

.prose h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-paper);
  margin-top: 48px;
  margin-bottom: 18px;
  letter-spacing: -0.015em;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.prose h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-paper);
  margin-top: 36px;
  margin-bottom: 14px;
}

.prose ul, .prose ol {
  margin-bottom: 24px;
  padding-left: 24px;
}

.prose li {
  margin-bottom: 8px;
}

.prose strong {
  color: var(--color-paper);
  font-weight: 600;
}

.prose a {
  color: var(--color-periwinkle);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--color-paper);
}

.prose pre {
  background: #0b0c11;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  overflow-x: auto;
  margin-bottom: 28px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
}

.prose pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: #e2e8f0;
}

.prose img {
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin: 32px 0;
}

.prose hr {
  border: none;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
  margin: 48px 0;
}

/* Callout Box */

.callout {
  background: var(--color-carbon);
  border-left: 4px solid var(--color-periwinkle);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 18px 20px;
  margin: 28px 0;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout-warning {
  border-left-color: var(--color-amber);
}

.callout-success {
  border-left-color: var(--color-emerald);
}

/* ------------------------------------------------ Footer ---- */

.blog-footer {
  margin-top: auto;
  background: #08090d;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
  padding: 40px 0;
}

.blog-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--color-steel);
}

.blog-footer-links {
  display: flex;
  gap: 20px;
}

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

/* ------------------------------------------------ Toast Alert ---- */

.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  background: #1e2230;
  border: 1px solid rgba(112, 137, 186, 0.4);
  color: var(--color-paper);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ------------------------------------------------ Reduced Motion ---- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
