:root {
  --brand-700: #173b64;
  --brand-500: #2f6da8;
  --brand-300: #5aa4e0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #fff;
  border-bottom: 1px solid #eee;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  width: 100%;
}

.header-bar {
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
  transform-origin: 50% 50%;

  /* Spin using the rotate property (doesn't conflict with hover scaling) */
  rotate: 0deg;
  animation: ensoSpin 13.3s linear infinite;

  /* Hover scaling uses the scale property */
  scale: 1;
  transition: scale 0.25s ease;
}

.brand-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  background: linear-gradient(10deg, var(--brand-700) 0%, var(--brand-500) 45%, var(--brand-300) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand:hover .brand-mark {
  scale: 1.05;
}

@keyframes ensoSpin {
  to { rotate: -360deg; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark { animation: none; }
}

/* ─────────────── HEADER MAGIC ─────────────── */
.header-right {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 18px;
  flex-wrap: nowrap;
  min-width: 0;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: nowrap;
  min-width: 0;
}

.nav-link {
  position: relative;
  text-decoration: none;
  color: #2a2a2a;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.95rem;
  padding: 6px 4px;
  border-radius: 6px;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-700), var(--brand-500), var(--brand-300));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover::after,
.nav-link:focus-visible::after {
  transform: scaleX(1);
}

.nav-link:focus-visible {
  outline: 2px solid rgba(61,127,189,.35);
  outline-offset: 2px;
}

.nav-link.active {
  background: none;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-image: linear-gradient(90deg, var(--brand-700), var(--brand-500), var(--brand-300));
  font-weight: 600;
}

/* ────────────── Responsive ────────────── */
@media (max-width: 700px) {
  .header-bar {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 14px;
  }
  .header-right {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  .main-nav {
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* ─────────────── Footer etc ─────────────── */
.footer {
  padding: 20px 0;
  font-size: 0.9rem;
  color: #555;
  text-align: center;
  width: 100%;
  border-top: 1px solid #eee;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.footer a {
  color: inherit;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.frw-logo-hover {
  display: inline-block;
  width: 20px;
  height: 18px;
  background-image: var(--img1);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: background-image 0.2s ease-in-out;
  cursor: pointer;
}

.frw-logo-hover:hover,
.frw-logo-hover.active {
  background-image: var(--img2);
}

.header-avatar {
  position: relative;
  margin-left: 0; /* No extra left margin! */
  cursor: pointer;
  display: flex;
  align-items: center;
}

.header-avatar .avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ddd;
  transition: transform 0.2s ease;
}

.header-avatar .avatar-img:hover {
  transform: scale(1.04);
}

.avatar-menu {
  position: absolute;
  top: 52px;
  right: 0;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    width: min(260px, calc(100vw - 24px));
    padding: 8px 0;
  z-index: 9999;
}

.avatar-menu.hidden {
  display: none;
}

.avatar-menu a {
  display: block;
  padding: 10px 16px;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.92rem;
  text-decoration: none;
  color: #333;
}

.avatar-menu a:hover {
  background: #f5f7fa;
}
/* Mobile hamburger menu divider: make the "gap" look intentional */
.nav-divider {
  display: none;          /* never show on desktop */
}

/* When hamburger menu is open on mobile, show a thin divider line */
@media (max-width: 700px) {
  .main-nav.is-open .nav-divider {
    display: block;
    width: 100%;
    height: 0;
    border-top: 1px solid #e6e6e6;
    margin: 10px 0;
  }
}