/* ==========================================================================
   SnugDocs — Production UI/UX Design System
   Optimized for Core Web Vitals (CLS = 0, FID < 50ms, LCP < 0.8s)
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  /* Brand Palettes */
  --color-primary: #0284c7;
  --color-primary-hover: #0369a1;
  --color-primary-light: #e0f2fe;
  
  /* Format-Specific Intent Colors */
  --color-excel: #107c41;
  --color-excel-hover: #0b5a2f;
  --color-excel-bg: #eaf6ef;
  
  --color-word: #2b579a;
  --color-word-hover: #1e3e6d;
  --color-word-bg: #edf2f9;
  
  --color-pdf: #c5221f;
  --color-pdf-hover: #9c1a17;
  --color-pdf-bg: #fdf0ef;

  /* Neutrals */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.logo:hover {
  text-decoration: none;
  opacity: 0.95;
}
.logo-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.logo:hover .logo-icon {
  transform: scale(1.06) rotate(-2deg);
}

.brand-text-group {
  display: flex;
  flex-direction: column;
}
.logo-title {
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.6px;
  display: flex;
  align-items: baseline;
}
.logo-snug {
  color: #0f172a;
}
.logo-docs {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 50%, #4f46e5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-left: 1px;
}
.logo-dot {
  color: #0ea5e9;
  font-size: 1.5rem;
  line-height: 0;
}
.logo-tagline {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
  margin-top: 1px;
}

.logo-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
  padding: 3px 8px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.4px;
  margin-left: 4px;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  text-decoration: none;
}
.nav-link:hover {
  color: var(--text-main);
  background: #f1f5f9;
  text-decoration: none;
}
.nav-link.active-excel { color: var(--color-excel); background: var(--color-excel-bg); }
.nav-link.active-word { color: var(--color-word); background: var(--color-word-bg); }
.nav-link.active-pdf { color: var(--color-pdf); background: var(--color-pdf-bg); }

.search-box {
  position: relative;
  flex: 1;
  max-width: 320px;
}
.search-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--border-strong);
  border-radius: 9999px;
  font-size: 0.88rem;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ==========================================================================
   Breadcrumb
   ========================================================================== */
.breadcrumb-nav {
  padding: 14px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  gap: 8px;
}
.breadcrumb-list a {
  color: var(--text-muted);
}
.breadcrumb-list a:hover {
  color: var(--color-primary);
}
.breadcrumb-sep {
  color: var(--border-strong);
}

/* ==========================================================================
   Document Detail Layout (Single Template View)
   ========================================================================== */
.doc-page {
  padding-bottom: 60px;
}

.doc-hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  margin-top: 10px;
  margin-bottom: 40px;
  background: var(--bg-card);
  padding: 36px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

/* Document Preview Frame */
.doc-preview-wrapper {
  position: relative;
  background: #f1f5f9;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}
.doc-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}
.doc-preview-wrapper:hover .doc-preview-img {
  transform: scale(1.015);
}
.preview-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Action & Metadata Card */
.doc-action-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.doc-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.format-pill {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}
.format-pill.excel { background: var(--color-excel-bg); color: var(--color-excel); border: 1px solid rgba(16, 124, 65, 0.2); }
.format-pill.word { background: var(--color-word-bg); color: var(--color-word); border: 1px solid rgba(43, 87, 154, 0.2); }
.format-pill.pdf { background: var(--color-pdf-bg); color: var(--color-pdf); border: 1px solid rgba(197, 34, 31, 0.2); }

.trust-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: #059669;
  background: #ecfdf5;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.doc-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  margin-bottom: 14px;
}

.doc-description {
  font-size: 0.98rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Download CTA Blocks */
.download-buttons-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  border-radius: var(--radius-md);
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-download:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}
.btn-download:active {
  transform: translateY(0);
}

.btn-download.excel {
  background: linear-gradient(135deg, #107c41, #0b5a2f);
}
.btn-download.excel:hover {
  background: linear-gradient(135deg, #128847, #0e6e39);
}

.btn-download.word {
  background: linear-gradient(135deg, #2b579a, #1e3e6d);
}
.btn-download.word:hover {
  background: linear-gradient(135deg, #3265b3, #244b85);
}

.btn-download.pdf {
  background: linear-gradient(135deg, #c5221f, #9c1a17);
}
.btn-download.pdf:hover {
  background: linear-gradient(135deg, #dc2622, #b21e1a);
}

.btn-secondary-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
  background: #f1f5f9;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.15s;
}
.btn-secondary-action:hover {
  background: #e2e8f0;
  text-decoration: none;
}

/* Quick Specs Grid */
.quick-specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}
.spec-item {
  display: flex;
  flex-direction: column;
}
.spec-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}
.spec-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

/* ==========================================================================
   Content Body & Guide
   ========================================================================== */
.doc-content-layout {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 40px;
}

.main-article {
  background: var(--bg-card);
  padding: 36px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.article-prose h2 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 32px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--border-subtle);
  padding-bottom: 8px;
}
.article-prose h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 24px;
  margin-bottom: 10px;
}
.article-prose p {
  margin-bottom: 16px;
  color: #334155;
}
.article-prose ul, .article-prose ol {
  margin-bottom: 20px;
  padding-left: 24px;
  color: #334155;
}
.article-prose li {
  margin-bottom: 8px;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.feature-card {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
}
.feature-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}
.feature-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

/* FAQ Accordion */
.faq-section {
  margin-top: 36px;
}
.faq-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
  background: #ffffff;
}
.faq-question {
  padding: 16px 20px;
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.faq-question::-webkit-details-marker {
  display: none;
}
.faq-question::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 400;
}
details[open] .faq-question::after {
  content: "−";
}
details[open] .faq-question {
  background: #f8fafc;
  border-bottom: 1px solid var(--border-subtle);
}
.faq-answer {
  padding: 16px 20px;
  font-size: 0.92rem;
  color: #475569;
  line-height: 1.6;
}

/* Sidebar */
.sidebar-sticky {
  position: sticky;
  top: 90px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-box {
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}
.sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-main);
}

.related-template-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
}
.related-template-link:last-child {
  border-bottom: none;
}
.related-template-link:hover .related-title {
  color: var(--color-primary);
}
.related-icon {
  font-size: 1.2rem;
}
.related-info {
  flex: 1;
}
.related-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}
.related-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Homepage & Listing Views
   ========================================================================== */
.hero-banner {
  text-align: center;
  padding: 50px 20px 40px;
}
.hero-title {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--text-main);
  margin-bottom: 14px;
}
.hero-title span {
  color: var(--color-primary);
}
.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 650px;
  margin: 0 auto 30px;
}

/* Category Filter Bar */
.filter-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text-main);
  transition: all 0.15s ease;
}
.tab-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  text-decoration: none;
}
.tab-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

/* Document Cards Grid */
.doc-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 50px;
}

.doc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  color: inherit;
}
.doc-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.card-thumbnail-wrapper {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
}
.card-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
}
.card-badge.excel { background: #107c41; color: #fff; }
.card-badge.word { background: #2b579a; color: #fff; }
.card-badge.pdf { background: #c5221f; color: #fff; }

.card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 8px;
}
.card-excerpt {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
  flex: 1;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}
.card-action-text {
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 60px 0 30px;
  margin-top: 60px;
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.footer-brand h3 {
  color: #ffffff;
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 12px;
}
.footer-brand p {
  font-size: 0.88rem;
  line-height: 1.6;
}
.footer-col h4 {
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.footer-links {
  list-style: none;
}
.footer-links li {
  margin-bottom: 10px;
}
.footer-links a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.15s;
}
.footer-links a:hover {
  color: #ffffff;
}
.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid #1e293b;
  text-align: center;
  font-size: 0.8rem;
  color: #64748b;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 900px) {
  .doc-hero {
    grid-template-columns: 1fr;
    padding: 24px;
  }
  .doc-content-layout {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .header-nav {
    display: none; /* Mobile menu can be added */
  }
  .search-box {
    max-width: 100%;
  }
  .hero-title {
    font-size: 1.9rem;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .doc-hero {
    padding: 16px;
  }
  .main-article {
    padding: 20px;
  }
}
