/* Shared site header + footer for landing, blog, tools, and guides */

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

html {
  overflow-x: hidden;
  max-width: 100%;
}

.main-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background:
    linear-gradient(180deg, rgba(5, 8, 21, 0.95) 0%, rgba(5, 8, 21, 0.98) 100%),
    radial-gradient(circle at top left, rgba(79, 70, 229, 0.1) 0%, transparent 60%);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(17, 24, 39, 0.5);
  padding: 1rem 0;
}

.main-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(90, 141, 238, 0.3), transparent);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  grid-template-areas: 'logo search toggle nav';
  align-items: center;
  gap: 0.75rem 1rem;
  position: relative;
}

.header-logo {
  grid-area: logo;
}

.header-search {
  grid-area: search;
}

.nav-toggle {
  grid-area: toggle;
}

.header-nav {
  grid-area: nav;
}

@media (min-width: 769px) {
  .header-container {
    grid-template-columns: auto minmax(9rem, 14rem) 1fr;
    grid-template-areas: 'logo search nav';
  }

  .header-search {
    justify-self: start;
  }

  .header-nav {
    justify-self: end;
  }
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #e5e7eb;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-backdrop {
  display: none;
}

.header-logo {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none !important;
  flex-shrink: 0;
}

.header-logo img,
.header-logo .logo-image {
  display: block;
  height: 40px;
  width: auto;
  max-width: min(280px, 55vw);
  object-fit: contain;
  object-position: left center;
}

.header-nav {
  display: flex;
  gap: 1.75rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-nav .nav-link {
  color: #e5e7eb;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.header-nav .nav-link:hover,
.header-nav .nav-link.is-active {
  color: #5a8dee;
  text-decoration: none;
}

.header-nav .cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #5a8dee 0%, #7c3aed 50%, #ec4899 100%);
  color: #fff !important;
  text-decoration: none !important;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.45);
}

.header-nav .cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(37, 99, 235, 0.65);
}

.site-footer {
  background: #050815;
  color: #fff;
  padding: 3rem 0 1.5rem;
  margin-top: 3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.site-footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2rem;
}

.site-footer-brand .logo-image,
.site-footer-brand img {
  height: 36px;
  width: auto;
  display: block;
  margin-bottom: 0.75rem;
}

.site-footer-brand p {
  margin: 0;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.9rem;
  line-height: 1.5;
}

.site-footer-social {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.site-footer-social a {
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.2s ease;
  line-height: 0;
}

.site-footer-social a:hover {
  color: #5a8dee;
  text-decoration: none;
}

.site-footer h4 {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li {
  margin: 0 0 0.55rem;
}

.site-footer a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.9rem;
}

.site-footer a:hover {
  color: #5a8dee;
  text-decoration: underline;
}

.site-footer-bottom {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  text-align: center;
}

.site-footer-bottom p {
  margin: 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  .header-container,
  .site-footer-inner {
    padding: 0 1rem;
  }

  .header-container {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      'logo search toggle'
      'nav nav nav';
  }

  .header-logo img,
  .header-logo .logo-image {
    height: 32px;
    max-width: min(200px, 58vw);
  }

  .nav-toggle {
    display: inline-flex;
  }

  .main-header .header-nav {
    display: none;
    position: absolute;
    top: calc(100% + 0.65rem);
    left: 1rem;
    right: 1rem;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0.25rem;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    background: rgba(5, 8, 21, 0.98);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    z-index: 120;
    grid-area: nav;
  }

  .main-header .header-nav.is-open {
    display: flex;
  }

  .main-header .header-nav .nav-link,
  .main-header .header-nav .cta-button {
    width: 100%;
    justify-content: center;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    min-height: 44px;
    box-sizing: border-box;
  }

  .main-header .header-nav .nav-link {
    border-radius: 12px;
  }

  .main-header .header-nav .nav-link:hover,
  .main-header .header-nav .nav-link.is-active {
    background: rgba(90, 141, 238, 0.12);
  }

  .header-nav .cta-button {
    margin-top: 0.35rem;
    padding: 0.85rem 1.1rem;
    font-size: 1rem;
  }

  .nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    z-index: 90;
  }

  body.nav-open .nav-backdrop {
    display: block;
  }

  body.nav-open {
    overflow: hidden;
  }

  .site-footer-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.header-search {
  display: flex;
  align-items: center;
  margin: 0;
  min-width: 0;
  justify-self: stretch;
}

.header-search input[type='search'] {
  width: 100%;
  min-width: 0;
  max-width: 18rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #e5e7eb;
  font: inherit;
  font-size: 0.875rem;
}

.header-search input[type='search']:focus {
  outline: none;
  border-color: rgba(90, 141, 238, 0.65);
  box-shadow: 0 0 0 2px rgba(90, 141, 238, 0.2);
}

.header-search input[type='search']::placeholder {
  color: #9ca3af;
}

.search-page .search-form {
  display: flex;
  gap: 0.75rem;
  margin: 1.25rem 0 1.75rem;
  flex-wrap: wrap;
}

.search-page .search-form input[type='search'] {
  flex: 1 1 16rem;
  min-width: 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #e5e7eb;
  font: inherit;
  font-size: 1rem;
}

.search-page .search-form input[type='search']:focus {
  outline: none;
  border-color: rgba(90, 141, 238, 0.65);
  box-shadow: 0 0 0 2px rgba(90, 141, 238, 0.2);
}

.search-page .search-form button {
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #5a8dee, #7c3aed);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.search-results-wrap {
  margin-top: 0.5rem;
}

.search-hint,
.search-empty,
.search-count {
  color: #9ca3af;
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.search-result a {
  display: block;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  text-decoration: none;
  color: inherit;
}

.search-result a:hover {
  border-color: rgba(90, 141, 238, 0.35);
  background: rgba(90, 141, 238, 0.08);
}

.search-result-title {
  display: block;
  font-weight: 600;
  color: #f9fafb;
  margin-bottom: 0.25rem;
}

.search-result-meta {
  display: block;
  font-size: 0.82rem;
  color: #a5b4fc;
  margin-bottom: 0.35rem;
}

.search-result-desc {
  display: block;
  font-size: 0.92rem;
  color: #cbd5e1;
  line-height: 1.5;
}
