/* ========================================
   n9dev.com - 九峰智创 Custom Styles
   Phase 1: Foundation
   ======================================== */

:root {
  --brand-dark: #0a1628;
  --brand-darker: #0f172a;
  --brand-black: #000000;
  --brand-gray: #111111;
  --brand-ice: #00d4ff;
  --brand-sky: #38bdf8;
  --brand-ice-dim: rgba(0, 212, 255, 0.1);
  --header-height: 64px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--brand-dark);
  color: #e2e8f0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header */
.site-header {
  height: var(--header-height);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
  background-color: rgba(10, 22, 40, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Logo */
.brand-logo {
  font-weight: 700;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #ffffff 0%, var(--brand-sky) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Navigation Links */
.nav-link {
  position: relative;
  transition: color 0.2s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-ice), var(--brand-sky));
  transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.nav-link:hover,
.nav-link.active {
  color: var(--brand-ice);
}

/* Dropdown Menus */
.dropdown-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.group:hover .dropdown-menu,
.dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.dropdown-item:hover {
  background-color: var(--brand-ice-dim);
  color: var(--brand-ice);
  padding-left: 1.25rem;
}

/* Mobile Menu */
.mobile-menu {
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
}

.mobile-menu.open {
  transform: translateX(0);
}

.mobile-overlay {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Floating Sidebar */
.floating-sidebar {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-btn {
  writing-mode: horizontal-tb;
  transition: all 0.3s ease;
  box-shadow: -2px 0 12px rgba(0, 212, 255, 0.15);
}

.sidebar-btn:hover {
  transform: translateX(-4px);
  box-shadow: -4px 0 20px rgba(0, 212, 255, 0.3);
}

/* Main Content Padding for Fixed Header */
main {
  padding-top: var(--header-height);
}

/* Footer */
.site-footer {
  border-top: 1px solid rgba(56, 189, 248, 0.1);
}

.footer-link {
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--brand-ice);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--brand-ice), var(--brand-sky));
  transition: all 0.3s ease;
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
  transform: translateY(-1px);
}

.btn-outline {
  border: 1px solid var(--brand-ice);
  color: var(--brand-ice);
  transition: all 0.3s ease;
}

.btn-outline:hover {
  background-color: var(--brand-ice);
  color: var(--brand-dark);
}

/* Cards */
.card {
  background-color: var(--brand-darker);
  border: 1px solid rgba(56, 189, 248, 0.08);
  transition: all 0.3s ease;
}

.card:hover {
  border-color: rgba(56, 189, 248, 0.2);
  box-shadow: 0 8px 30px rgba(0, 212, 255, 0.08);
}

/* Utility */
.text-gradient {
  background: linear-gradient(135deg, var(--brand-ice), var(--brand-sky));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.bg-grid {
  background-image: linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* Responsive */
@media (max-width: 1023px) {
  :root {
    --header-height: 56px;
  }

  .floating-sidebar {
    top: auto;
    bottom: 1.5rem;
    right: 1rem;
    transform: none;
    flex-direction: row;
  }

  .sidebar-btn {
    writing-mode: horizontal-tb;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem !important;
  }

  /* Improve hero spacing on tablets */
  .min-h-\[90vh\] {
    min-height: auto;
  }
}

@media (max-width: 767px) {
  .floating-sidebar {
    bottom: 1rem;
    right: 0.75rem;
    gap: 0.375rem;
  }

  .sidebar-btn {
    padding: 0.625rem 0.875rem;
    font-size: 0.75rem;
  }

  /* Prevent horizontal overflow */
  body {
    overflow-x: hidden;
  }

  /* Ensure images and cards don't overflow */
  .card {
    word-break: break-word;
  }

  /* Fix dropdown menu width on touch */
  .dropdown-menu {
    position: fixed !important;
    left: 0.5rem !important;
    right: 0.5rem !important;
    width: auto !important;
  }
}

@media (max-width: 639px) {
  /* Ultra-small screens */
  .grid {
    gap: 0.75rem !important;
  }

  .sidebar-btn span {
    display: none !important;
  }
}
