/*
#	Project: SupDoc - Document Management System
#	Homepage portal layout (aligned with SupGuide home)
#	Copyright (C) 2026 SupDoc. All Rights Reserved.
*/

/* ---- Home directory grid (SupDoc-inspired, gray/white) ---- */
.sg-home-hero .article-description {
  max-width: 40rem;
  color: var(--docs-text-secondary);
  font-size: 1.05rem;
  line-height: 1.65;
}

.sg-home-dirs {
  margin-top: 1.75rem;
}

.sg-home-dirs-head {
  margin-bottom: 1rem;
}

.sg-home-dirs-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--docs-text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  letter-spacing: -0.01em;
}

.sg-home-dirs-title i {
  color: var(--docs-text-muted);
  font-size: 1.15rem;
}

.sg-dir-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}

.sg-dir-card,
.article-content a.sg-dir-card,
.article-content a.sg-dir-card:hover,
.article-content a.sg-dir-card:focus,
.article-body a.sg-dir-card,
.article-body a.sg-dir-card:hover {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.15rem 1.2rem;
  border: 1px solid var(--docs-border-primary, #e5e7eb);
  border-radius: 12px;
  background: var(--docs-bg-primary, #fff);
  color: inherit;
  text-decoration: none !important;
  border-bottom-style: solid;
  border-bottom-width: 1px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    border-color 0.2s ease,
    box-shadow 0.22s ease,
    transform 0.2s ease,
    background-color 0.2s ease;
  min-height: 148px;
  outline: none;
}

.sg-dir-card *,
.sg-dir-card:hover *,
.article-content a.sg-dir-card:hover * {
  text-decoration: none !important;
}

.sg-dir-card:hover,
.article-content a.sg-dir-card:hover,
.article-content a.sg-dir-card:focus-visible,
.article-body a.sg-dir-card:hover {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow:
    0 12px 28px rgba(37, 99, 235, 0.12),
    0 2px 8px rgba(15, 23, 42, 0.06);
  transform: translateY(-3px);
  color: inherit;
  text-decoration: none !important;
}

.sg-dir-card:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.1);
}

.sg-dir-card-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(59, 130, 246, 0.16) 100%);
  color: #2563eb;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.sg-dir-card:hover .sg-dir-card-icon {
  transform: scale(1.06);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16) 0%, rgba(59, 130, 246, 0.28) 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.18);
}

.sg-dir-card-icon i {
  font-size: 1.35rem;
}

.sg-dir-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  flex: 1;
}

.sg-dir-card-title {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--docs-text-primary, #0f172a);
  text-decoration: none !important;
  transition: color 0.18s ease;
}

.sg-dir-card:hover .sg-dir-card-title {
  color: #1d4ed8;
}

.sg-dir-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--docs-text-muted, #64748b);
  text-decoration: none !important;
}

.sg-dir-card-meta code {
  font-size: 0.78em;
  background: var(--docs-bg-secondary, #f1f5f9);
  padding: 0.15em 0.45em;
  border-radius: 6px;
  color: var(--docs-text-secondary, #475569);
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.sg-dir-card:hover .sg-dir-card-meta code {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(147, 197, 253, 0.7);
  color: #1e40af;
}

.sg-dir-card-action {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #2563eb;
  margin-top: auto;
  text-decoration: none !important;
  transition: gap 0.18s ease, color 0.18s ease;
}

.sg-dir-card:hover .sg-dir-card-action {
  color: #1d4ed8;
  gap: 0.45rem;
}

.sg-dir-card-action i {
  transition: transform 0.18s ease;
}

.sg-dir-card:hover .sg-dir-card-action i {
  transform: translateX(3px);
}

.sg-home-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1.25rem;
  border: 1px dashed var(--docs-border-primary);
  border-radius: 12px;
  color: var(--docs-text-muted);
  background: var(--docs-bg-secondary, #f8fafc);
}

.sg-home-empty i {
  font-size: 2.25rem;
  opacity: 0.4;
  display: block;
  margin-bottom: 0.65rem;
}

.sg-home-empty p {
  margin: 0;
  font-size: 0.9375rem;
}

[data-theme="dark"] .sg-dir-card,
[data-theme="dark"] .article-content a.sg-dir-card {
  background: var(--docs-bg-primary, #1e293b);
  box-shadow: none;
}

[data-theme="dark"] .sg-dir-card:hover,
[data-theme="dark"] .article-content a.sg-dir-card:hover,
[data-theme="dark"] .sg-search-sticky.is-fixed {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  border-bottom-color: var(--docs-border-primary);
}

[data-theme="dark"] .sg-search-result:hover {
  border-color: rgba(148, 163, 184, 0.28);
  background: linear-gradient(180deg, rgba(51, 65, 85, 0.9) 0%, rgba(30, 41, 59, 1) 100%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .sg-dir-card-icon {
  background: rgba(148, 163, 184, 0.12);
  color: #93c5fd;
}

[data-theme="dark"] .sg-dir-card:hover .sg-dir-card-icon {
  background: rgba(147, 197, 253, 0.16);
  box-shadow: none;
}

[data-theme="dark"] .sg-dir-card:hover .sg-dir-card-title {
  color: #93c5fd;
}

[data-theme="dark"] .sg-dir-card:hover .sg-dir-card-meta code {
  background: rgba(147, 197, 253, 0.1);
  border-color: rgba(148, 163, 184, 0.35);
  color: #bfdbfe;
}

[data-theme="dark"] .sg-dir-card-action,
[data-theme="dark"] .sg-dir-card:hover .sg-dir-card-action {
  color: #93c5fd;
}

@media (max-width: 576px) {
  .sg-dir-grid {
    grid-template-columns: 1fr;
  }
  .sg-search-form .btn-primary {
    width: 100%;
  }
}

/* Home sidebar: click-to-open hint sits tight under the product list */
.docs-nav--home {
  display: flex;
  flex-direction: column;
  padding-bottom: 1rem;
  box-sizing: border-box;
}

.docs-nav--home > .nav-list {
  flex-shrink: 0;
}

.sg-home-nav-hint {
  margin: 0.35rem 0.75rem 0.75rem;
  padding: 0.85rem 0.85rem 1rem;
  border-radius: 0.65rem;
  border: 1px dashed var(--docs-border-primary, #e2e8f0);
  background: var(--docs-bg-secondary, #f8fafc);
  text-align: center;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  color: var(--docs-text-muted, #64748b);
  position: relative;
}

.sg-home-nav-hint::before {
  content: "";
  position: absolute;
  top: -0.45rem;
  left: 1.35rem;
  width: 0.7rem;
  height: 0.7rem;
  border-left: 1px dashed var(--docs-border-primary, #e2e8f0);
  border-top: 1px dashed var(--docs-border-primary, #e2e8f0);
  background: var(--docs-bg-secondary, #f8fafc);
  transform: rotate(45deg);
}

.sg-home-nav-hint-visual {
  position: relative;
  width: 2.75rem;
  height: 3.1rem;
  margin-bottom: 0.55rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.sg-home-nav-hint-arrow {
  position: relative;
  z-index: 2;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--docs-primary, #3b82f6);
  animation: sg-home-nav-arrow 1.2s ease-in-out infinite;
}

.sg-home-nav-hint-pulse {
  position: absolute;
  left: 50%;
  top: 1.15rem;
  width: 2.1rem;
  height: 2.1rem;
  margin-left: -1.05rem;
  border-radius: 999px;
  background: rgba(var(--docs-primary-rgb, 59, 130, 246), 0.16);
  animation: sg-home-nav-pulse 2s ease-out infinite;
}

.sg-home-nav-hint-icon {
  position: relative;
  z-index: 1;
  margin-top: -0.15rem;
  font-size: 1.55rem;
  color: var(--docs-primary, #3b82f6);
  transform-origin: 30% 80%;
  animation: sg-home-nav-point 1.2s ease-in-out infinite;
}

.sg-home-nav-hint-title {
  margin: 0 0 0.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--docs-text-primary, #0f172a);
  line-height: 1.35;
}

.sg-home-nav-hint-desc {
  margin: 0;
  max-width: 13rem;
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--docs-text-muted, #64748b);
}

@keyframes sg-home-nav-pulse {
  0% { transform: scale(0.72); opacity: 0.7; }
  70% { transform: scale(1.28); opacity: 0; }
  100% { transform: scale(1.28); opacity: 0; }
}

@keyframes sg-home-nav-point {
  0%, 100% { transform: translateY(2px) rotate(-18deg); }
  50% { transform: translateY(-3px) rotate(-8deg); }
}

@keyframes sg-home-nav-arrow {
  0%, 100% { transform: translateY(3px); opacity: 0.55; }
  50% { transform: translateY(-2px); opacity: 1; }
}

[data-theme="dark"] .sg-home-nav-hint {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(51, 65, 85, 0.45);
}

[data-theme="dark"] .sg-home-nav-hint::before {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(51, 65, 85, 0.9);
}

[data-theme="dark"] .sg-home-nav-hint-title {
  color: #e2e8f0;
}

[data-theme="dark"] .sg-home-nav-hint-desc {
  color: #94a3b8;
}

@media (prefers-reduced-motion: reduce) {
  .sg-home-nav-hint-pulse,
  .sg-home-nav-hint-icon,
  .sg-home-nav-hint-arrow {
    animation: none;
  }
}
