/* ---------- Global header (html/header.html) ---------- */
/* Desktop: logo left, links in a row on the right.
   Phones (under 760px wide): logo left, ☰ on the right; ☰ opens the links full screen. */

:root { --header-h: 60px; }

/* The empty box each page puts the header into. It keeps the header's space
   reserved while it loads (so the page doesn't jump) and keeps it stuck to the top. */
#site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: calc(var(--header-h) + env(safe-area-inset-top));
  background: var(--brand);
}

.site-header {
  display: flex;
  align-items: center;
  gap: 12px;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;   /* clears the phone's notch/status bar */
  background: var(--brand);
  border-bottom: 3px solid var(--accent);
}

.site-logo { flex: none; display: flex; }
.site-logo img { width: 44px; height: 44px; border-radius: 50%; display: block; }

/* ----- Links: desktop row ----- */
.site-nav {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.site-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;                             /* finger-sized (NFR-03) */
  padding: 0 10px;
  border-radius: 8px;
  color: var(--brand-text);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.site-nav a:hover,
.site-nav a:focus-visible { background: rgba(255, 255, 255, 0.12); color: var(--accent); }

/* ----- ☰ button (hidden on desktop) ----- */
.menu-toggle {
  display: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  padding: 11px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
}
.menu-toggle span {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--brand-text);
  transition: transform 0.2s, opacity 0.2s;
}
/* ☰ becomes × while open */
.menu-open .menu-toggle span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
.menu-open .menu-toggle span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ----- Phones: ☰ shown, links become a full screen ----- */
@media (max-width: 759px) {
  .menu-toggle { display: flex; }

  /* Menu panel: slides in from the right, 45% of the screen wide.
     The huge shadow dims the rest of the page; tapping there closes it (js/header.js). */
  .site-nav {
    display: flex;
    position: fixed;
    right: 0;
    bottom: 0;
    top: calc(var(--header-h) + env(safe-area-inset-top));
    width: 45vw;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    padding: 8px 0;
    background: var(--brand);
    overflow-y: auto;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
  }
  .menu-open .site-nav {
    transform: none;
    visibility: visible;
    box-shadow: 0 0 0 100vmax rgba(10, 16, 35, 0.45);
    transition: transform 0.25s ease;
  }

  .site-nav a {
    min-height: 52px;
    padding: 10px 14px;
    font-size: 1rem;
    line-height: 1.25;
    white-space: normal;                         /* long names wrap inside the narrow panel */
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0;
  }

  /* Stop the page behind from scrolling while the menu is open */
  body.menu-open { overflow: hidden; }
}
