/*
  Nav — verified via get_design_context on the live instance 2:13525
  (Home page, fileKey DU3fuTo8QXIJ0uMcI3jh91). Pixel values (padding,
  gaps, radius) below are the literal values read from that instance,
  not a formal spacing/radius token system — Figma does not define one
  (see docs/Portfolio_Data_Inventory.md).
*/

/* UI: GLOBAL-NAV-01 | Site navigation | inspect/adjust */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 80px;
  background-color: rgba(19, 20, 20, 0.9);
  position: sticky;
  top: 0;
  z-index: 100;
}

/*
  .nav-menu exists only to give the mobile dropdown one panel to
  position/pad as a unit (see the max-width:768px block) — at every
  wider breakpoint it must NOT introduce a box of its own, or it would
  collapse .nav-links and .nav-cta from two separate space-between
  flex items of .site-nav down to one, changing how they're spaced
  from each other on desktop. display:contents dissolves the wrapper
  there, so .nav-links/.nav-cta act as direct .site-nav flex children
  exactly as before.
*/
.nav-menu {
  display: contents;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo__icon {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

/*
  Requested 2026-08-25: replace the exported glow SVG with a soft
  CSS shadow in #C31188. drop-shadow (not box-shadow) so the glow
  follows the avatar PNG's own transparent silhouette instead of its
  rectangular bounding box. Applies to every "nav-logo__avatar" use
  on the site (Nav + Footer share this class).
*/
.nav-logo__avatar {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 40px;
  object-fit: cover;
  margin: 0 auto;
  filter: drop-shadow(0 0 6px #c31188);
}

.nav-logo__text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--color-white);
  letter-spacing: -0.004px;
  white-space: nowrap;
}

/*
  Mobile-only back arrow (716:12726, "On case"): on a case-study page's
  mobile nav, the logo is replaced entirely by a back-to-home chevron.
  Hidden by default (desktop always keeps the logo, on every page); the
  breakpoint block below shows it instead of the logo, only when
  .site-nav carries the --case modifier.

  Fixed 2026-09-08: was reusing the shared icon-arrow-right.svg (a
  wide line+arrowhead shape, natively ~square) forced into a narrow
  10x18 box — that asset sets preserveAspectRatio="none", so a
  non-matching box stretches/squishes its content rather than
  letterboxing it, which is exactly why it read as "narrowed". Figma's
  actual back icon (716:12727) is a plain chevron, not that arrow, so
  this is now its own small inline SVG (matching the stroke style of
  the site's other inline icons) sized at its natural aspect ratio —
  nothing to distort.
*/
.nav-back {
  display: none;
  /* Matches .nav-logo__icon's 40x40px box exactly (per Roman: every
     page's header must be the same height as Home's) — this was 24x24,
     16px shorter, making case-study headers visibly shorter than
     Home's on mobile. The chevron itself stays its natural small size
     (below), just centered in the taller box. */
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
}

.nav-back svg {
  width: 8px;
  height: 14px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links__link {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  color: var(--color-white);
  letter-spacing: -0.0032px;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s ease;
}

/*
  Hover added 2026-08-25, verified against Figma's "Menu button"
  component set (2:15301) — Hover variant: purple-light text +
  underline. The set also has an "Active" (current-page) variant in
  pink, not implemented here — that needs route/section detection,
  which is out of scope for a hover-only pass.
*/
.nav-links__link:hover {
  color: var(--color-purple-light);
  text-decoration: underline;
}

/* Shows which popup (Case Studies / Feedbacks) is currently open, per
   Roman — clicking it again while active is a no-op (see js/nav.js). */
.nav-links__link.is-active {
  color: var(--color-purple-light);
  text-decoration: underline;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  background-color: #151515;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--color-white);
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
}

/* Hover added 2026-08-25, verified against Figma "Button Second" (2:15357) — nav-cta shares that visual style. */
.nav-cta:hover {
  background-color: #181413;
  border-color: #6a5aba;
  color: var(--color-cta-purple);
}

/*
  Added 2026-09-15 — hidden by default (desktop keeps a single header
  button, Download CV); the mobile breakpoint below re-shows this one
  as a second bottom button in the open menu, per Roman.
*/
.nav-cta--contact {
  display: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 24px;
  height: 24px;
  position: relative;
}

.nav-toggle__bar {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--color-white);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/*
  Hamburger -> X (716:12799, "Close"): the icon itself never changed
  state before — three static bars regardless of open/closed. Rotates
  the top/bottom bars into an X and fades the middle one out, using
  absolute positioning on all three so the rotated bars pivot around
  the toggle's own center instead of their own (now-collapsed) gap-based
  position.
*/
.site-nav.is-open .nav-toggle__bar {
  position: absolute;
  top: 50%;
  left: 0;
}

.site-nav.is-open .nav-toggle__bar:nth-child(1) {
  transform: translateY(-50%) rotate(45deg);
}

.site-nav.is-open .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.site-nav.is-open .nav-toggle__bar:nth-child(3) {
  transform: translateY(-50%) rotate(-45deg);
}

/*
  Breakpoint below is a reasonable implementation default — Figma's
  system-part board documents a distinct mobile Nav state (logo +
  hamburger) but does not specify a pixel breakpoint. Not a verified
  Figma value.

  Horizontal padding fixed 2026-09-08: was a hardcoded 24px, not
  var(--page-px) — Figma's actual mobile nav frames (716:12790,
  716:12726, 716:12799) all measure a 16px margin (Logo/back-arrow
  starts at x=16, Menu/Close ends 16px from the 374px frame's right
  edge), matching --page-px exactly, not a nav-specific value.
*/
@media (max-width: 768px) {
  .site-nav {
    padding: 8px var(--page-px);
  }

  /*
    716:12790 ("Default", home) vs 716:12726 ("On case") — the logo is
    replaced entirely by a back arrow on case-study pages, mobile only;
    desktop always keeps the logo everywhere, out of scope here. Stays
    the arrow in both the closed and open (716:12799) states, since
    opening the menu doesn't touch which one is showing.
  */
  .site-nav--case .nav-logo {
    display: none;
  }

  .site-nav--case .nav-back {
    display: flex;
  }

  .nav-menu {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  /*
    Single panel (not .nav-links and .nav-cta positioned/padded
    separately) so the links and the button share one consistent
    rhythm and the same horizontal inset. Gap bumped to 16px 2026-09-08
    per Roman's request (was 8px, matching the "Menu is open" reference
    716:12799 literally — he wants more breathing room than that in
    practice).
  */
  .site-nav.is-open .nav-menu {
    display: flex;
    flex-direction: column;
    /* 32px per Roman (was 16px) — gap between every item in the open
       mobile menu: the nav-links group and the Download CV button. */
    gap: 32px;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 16px var(--page-px);
    background-color: var(--color-dark-alien);
  }

  .nav-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* 32px per Roman (was 16px) — same gap as above, between the
       individual links (Case Studies / Feedbacks). */
    gap: 32px;
  }

  /*
    Mobile-only Contact Me button, per Roman: the open mobile menu
    gets its own "Contact Me" as a second bottom button alongside
    Download CV, opening the same contact popup as everywhere else
    (js/nav.js) — desktop doesn't get an equivalent header button, on
    purpose (see the .nav-cta--contact base rule above, in the
    unconditional part of this stylesheet).
  */
  .nav-cta--contact {
    display: inline-flex;
  }

  /* Full width of the panel (716:12799's "Button Second" spans the
     same width as the menu links above it), not hugging its own
     content like the desktop nav-cta does. */
  .nav-cta {
    width: 100%;
  }
}

/*
  Nav popups (Case Studies / Feedbacks) — added 2026-09-12, per Figma
  "Case pop up" (868:14474) and "Reviews" (868:14980). Matches Figma's
  own design: a single translucent panel (no separate opaque scrim) so
  the current page stays visible around it, per Roman — inset from the
  header and viewport edges rather than true edge-to-edge fullscreen.
  Wired up in js/nav.js.

  2026-09-12 (correction): no scroll-lock on <html> — Roman wants the
  page behind the popup to stay scrollable while it's open, and a
  sticky-positioned .site-nav can misbehave (lose its stuck position)
  under overflow:hidden on the root element in some browsers, which
  read as the header "disappearing". The popup itself is
  position:fixed, so it stays put on screen regardless of background
  scroll either way.
*/
.nav-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 96px 24px 24px;
  overflow: hidden;
}

@media (min-width: 1024px) {
  .nav-popup-overlay {
    padding: 112px 40px 40px;
  }
}

.nav-popup {
  position: relative;
  width: 100%;
  max-width: 1200px;
  max-height: 100%;
  overflow: hidden;
  background-color: rgba(19, 20, 20, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  padding: 40px;
  display: flex;
  flex-direction: column;
}

@media (min-width: 1024px) {
  .nav-popup {
    border-radius: 24px;
  }
}

.nav-popup__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--color-white);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.nav-popup__close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-popup__close svg {
  width: 16px;
  height: 16px;
}

.nav-popup__heading {
  color: var(--color-white);
  text-align: center;
  margin: 0 0 24px;
}

.nav-popup__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Case Studies popup ---------- */

.nav-popup__cases-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 20px;
  overflow-y: auto;
  min-height: 0;
}

.nav-popup-case {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 200px;
  padding: 12px;
  border-radius: 12px;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.nav-popup-case:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

/*
  Wraps a cloned .case-card__media node (see js/nav.js renderCaseCard)
  — deliberately no img-specific rules here. Each case's own media
  modifier class (.case-card__media--ridi, --yoy, --atj2, or Uniqkey's
  .uniqkey-dashboard-frame/.uniqkey-laptop-frame — all in home.css,
  loaded on every page) already sizes/positions its own images
  correctly; this is just a plain frame around whatever composite that
  produces, at this card's smaller scale.
*/
.nav-popup-case__media {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.04);
}

.nav-popup-case__media .case-card__media {
  max-width: none;
  margin: 0;
}

.nav-popup-case__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--color-white);
  margin: 0;
}

.nav-popup-case__desc {
  font-size: 13px;
  line-height: 1.4;
  color: var(--color-light-gray);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Feedbacks popup ---------- */
/* .reviews-carousel is relocated here from its normal spot on the page
   (and moved back on close) — reuses the exact same markup/JS/CSS
   already driving it elsewhere, per Roman ("ті ж самі... крапки та
   перемикачі"). This wrapper just centers it and caps its width. */
.nav-popup__feedback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  min-height: 0;
}

.nav-popup__feedback .reviews-carousel {
  width: 100%;
  max-width: 900px;
}

/* ---------- Contact popup ---------- */
/* Added 2026-09-15 — "Contact Me" now offers a real choice of channel
   (js/nav.js openContactPopup) instead of silently just being a
   LinkedIn link. */
.nav-popup__contact-wrap {
  align-items: center;
  justify-content: center;
}

.nav-popup__contact {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  overflow-y: auto;
}

.nav-popup-contact-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.04);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.nav-popup-contact-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

/* LinkedIn carries the most context (experience, recommendations) for
   this portfolio's audience — a touch more visual weight than
   Telegram/Email, not a hard "recommended" label. */
.nav-popup-contact-link--primary {
  background-color: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-popup-contact-link--primary:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-popup-contact-link__icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.nav-popup-contact-link__icon img {
  width: 100%;
  height: 100%;
}

.nav-popup-contact-link__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.nav-popup-contact-link__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--color-white);
  margin: 0;
}

.nav-popup-contact-link__desc {
  font-size: 13px;
  line-height: 1.4;
  color: var(--color-light-gray);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
