/* =========================================================================
   Sparrows — iOS-style navigation island
   One compact, persistent nav for every page.
   Loaded last so it owns the nav layer on every stylesheet stack.
   ========================================================================= */

.ios-nav,
.nav-drawer {
  --isl-ink: #101014;
  --isl-soft: rgba(16, 16, 20, .58);
  --isl-line: rgba(25, 39, 75, .09);
  --isl-accent: #2337ec;
  --isl-ease: cubic-bezier(.32, .72, 0, 1);
  --isl-font: "Inter", system-ui, -apple-system, Arial, sans-serif;
  --isl-top: 0px;
  --isl-wide: 720px;
  /* hangs off the top edge like the notch: square above, rounded below,
     with a concave bevel flaring into the top edge on either side */
  --isl-radius: 0 0 24px 24px;
  --isl-radius-mini: 0 0 18px 18px;
  --isl-bevel: 20px;
  --isl-skin: #fff;
  --isl-blur: blur(18px) saturate(1.15);
}

.ios-nav {
  position: fixed;
  z-index: 90;
  top: var(--isl-top);
  right: 0;
  left: 0;
  display: flex;
  justify-content: center;
  padding-inline: max(16px, var(--isl-bevel));
  font-family: var(--isl-font);
  pointer-events: none;
}

/* ------------------------------------------------------------------ shell */
.ios-nav-island {
  position: relative;
  display: flex;
  align-items: center;
  width: min(100%, var(--isl-wide));
  max-width: 100%;
  min-height: 48px;
  padding: 5px 9px 5px 18px;
  border-radius: var(--isl-radius);
  background: var(--isl-skin);
  box-shadow: 0 18px 52px rgba(20, 31, 61, .13), inset 0 0 0 1px var(--isl-line);
  color: var(--isl-ink);
  -webkit-backdrop-filter: var(--isl-blur);
  backdrop-filter: var(--isl-blur);
  pointer-events: auto;
  transition:
    width .62s var(--isl-ease),
    min-height .52s var(--isl-ease),
    padding .52s var(--isl-ease),
    border-radius .52s var(--isl-ease),
    background-color .42s ease,
    box-shadow .42s ease,
    color .32s ease,
    transform .58s var(--isl-ease),
    opacity .4s ease;
}

/* The bar flares out to meet the top edge. The retained area is explicitly
   outside a bevel-sized quarter-circle, creating a concave edge that points
   back toward the island instead of another convex corner. */
.ios-nav-island::before,
.ios-nav-island::after {
  content: "";
  position: absolute;
  top: 0;
  width: var(--isl-bevel);
  height: var(--isl-bevel);
  background: var(--isl-skin);
  -webkit-backdrop-filter: var(--isl-blur);
  backdrop-filter: var(--isl-blur);
  pointer-events: none;
  /* the quarter-disc is scaled, not resized: uniform scale keeps the arc
     exact and keeps the morph off the layout path */
  transform: scale(var(--isl-bevel-scale, 1));
  transition: transform .52s var(--isl-ease), background-color .42s ease;
}
.ios-nav-island::before {
  right: calc(100% - 1px);
  transform-origin: 100% 0;
  -webkit-mask: radial-gradient(circle var(--isl-bevel) at 0 100%, transparent calc(100% - 1px), #000 100%);
  mask: radial-gradient(circle var(--isl-bevel) at 0 100%, transparent calc(100% - 1px), #000 100%);
}
.ios-nav-island::after {
  left: calc(100% - 1px);
  transform-origin: 0 0;
  -webkit-mask: radial-gradient(circle var(--isl-bevel) at 100% 100%, transparent calc(100% - 1px), #000 100%);
  mask: radial-gradient(circle var(--isl-bevel) at 100% 100%, transparent calc(100% - 1px), #000 100%);
}

.ios-nav-stack { display: grid; grid-template-areas: "island"; width: 100%; align-items: center; }
.ios-nav-full { grid-area: island; min-width: 0; }

.ios-nav-full {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  width: 100%;
  min-width: 0;
  transition: opacity .3s ease .1s, transform .44s var(--isl-ease) .08s, visibility 0s;
}

/* -------------------------------------------------------------- expanded UI */
.ios-nav-brand {
  display: inline-flex; align-items: center;
  white-space: nowrap; color: inherit;
}
.sparrows-logo-frame {
  display: block;
  width: 96px;
  height: 43px;
  overflow: hidden;
}
.sparrows-brand-logo {
  display: block;
  width: 100%;
  height: auto;
  transform: translateY(-32%);
}

.ios-nav-menu {
  display: flex; align-items: center; gap: 22px;
}
.ios-nav-menu a,
.ios-nav-drop > button {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 0; border: 0; background: none;
  color: var(--isl-soft); font-family: inherit; font-size: 13px; font-weight: 400;
  cursor: pointer; transition: color .16s ease;
}
.ios-nav-menu a:hover,
.ios-nav-menu a.is-current,
.ios-nav-drop > button:hover,
.ios-nav-drop > button.is-current { color: var(--isl-ink); }
.ios-nav-drop { position: relative; }
.ios-nav-drop > button svg { width: 12px; height: 12px; transition: transform .22s var(--isl-ease); }
.ios-nav-drop.is-open > button svg { transform: rotate(180deg); }

.ios-nav-drop-panel {
  position: absolute; top: calc(100% + 16px); left: -16px;
  min-width: 286px; padding: 8px;
  border: 1px solid var(--isl-line); border-radius: 20px;
  background: #fff; box-shadow: 0 24px 60px rgba(20, 31, 61, .16);
  opacity: 0; visibility: hidden; transform: translateY(-8px) scale(.97);
  transform-origin: 26px top;
  transition: opacity .2s ease, transform .34s var(--isl-ease), visibility .2s;
}
.ios-nav-drop:hover .ios-nav-drop-panel,
.ios-nav-drop.is-open .ios-nav-drop-panel { opacity: 1; visibility: visible; transform: none; }
.ios-nav-drop-panel a { display: flex; gap: 12px; padding: 10px 12px; border-radius: 13px; color: var(--isl-ink); }
.ios-nav-drop-panel a:hover { background: rgba(35, 55, 236, .06); }
.ios-nav-drop-panel .di {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: 11px; background: rgba(35, 55, 236, .08); color: var(--isl-accent);
}
.ios-nav-drop-panel .di svg { width: 17px; height: 17px; }
.ios-nav-drop-panel .dt { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.ios-nav-drop-panel .dd { display: block; font-size: 12.5px; color: var(--isl-soft); }

.ios-nav-cta { display: flex; align-items: center; gap: 12px; }
.ios-nav-login { color: var(--isl-ink); font-size: 13px; }
.ios-nav-login:hover { color: var(--isl-accent); }
.ios-nav-talk {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 36px; padding: 8px 16px;
  border-radius: 999px; background: var(--isl-ink); color: #fff;
  font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background-color .2s ease, transform .3s var(--isl-ease);
}
.ios-nav-talk svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.ios-nav-talk:hover { background: var(--isl-accent); }

.ios-nav-toggle {
  display: none; place-items: center;
  width: 38px; height: 38px; flex: none;
  border: 0; border-radius: 50%; background: rgba(16, 16, 20, .05); color: var(--isl-ink);
  cursor: pointer;
}
.ios-nav-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Language switch (mounted by i18n.js into .nav-cta). */
.ios-nav .lang-switch {
  display: inline-flex; flex: none; align-items: center; gap: 2px;
  padding: 2px; border: 1px solid rgba(15, 19, 31, .12); border-radius: 999px;
  background: rgba(255, 255, 255, .6);
}
.ios-nav .lang-switch button {
  min-width: 28px; height: 24px; padding: 0 5px;
  border: 0; border-radius: 999px;
  background: transparent; color: rgba(15, 19, 31, .58);
  font: 700 9.5px/1 var(--isl-font); letter-spacing: .04em; cursor: pointer;
}
.ios-nav .lang-switch button:hover { color: var(--isl-ink); }
.ios-nav .lang-switch button.is-active { color: #fff; background: var(--isl-ink); }

/* ------------------------------------------------------------ startup boot
   Reference motion: the complete, full-width island waits just above the
   viewport, then drops and fades in as one piece. */
.ios-nav[data-boot="pending"] .ios-nav-island {
  opacity: 0;
  transform: translate3d(0, calc(-100% - 8px), 0);
  pointer-events: none;
  transition: none;
}

.ios-nav[data-boot="run"] .ios-nav-island {
  animation: iosNavStartupDrop .62s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes iosNavStartupDrop {
  from {
    opacity: 0;
    transform: translate3d(0, calc(-100% - 8px), 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}
/* --------------------------------------------------------------- drawer */
.nav-drawer { display: none; }
.nav-drawer.open { display: block; position: fixed; inset: 0; z-index: 95; }
.nav-drawer .scrim { position: absolute; inset: 0; background: rgba(8, 20, 38, .38); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.nav-drawer .sheet {
  position: absolute; top: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: 6px;
  width: min(84vw, 340px); padding: 22px;
  background: #fff; box-shadow: -24px 0 60px rgba(20, 31, 61, .22);
  font-family: var(--isl-font, "Inter", system-ui, sans-serif);
  animation: islandSheet .42s cubic-bezier(.32, .72, 0, 1);
}
@keyframes islandSheet { from { transform: translateX(24px); opacity: .4; } }
.nav-drawer .sheet .dclose { align-self: flex-end; width: 40px; height: 40px; border: 0; background: none; cursor: pointer; }
.nav-drawer .sheet .dclose svg { width: 22px; height: 22px; margin-inline: auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.nav-drawer .sheet a { padding: 12px 8px; border-radius: 12px; color: #101014; font-size: 17px; font-weight: 500; }
.nav-drawer .sheet a:hover { background: rgba(35, 55, 236, .06); }
.nav-drawer .sheet hr { margin: 10px 0; border: 0; border-top: 1px solid rgba(25, 39, 75, .12); }
.nav-drawer .sheet a.ios-nav-talk { justify-content: center; margin-top: 6px; background: var(--isl-ink); color: #fff; }
.nav-drawer .sheet .lang-switch {
  align-self: flex-start; margin: 10px 0 0 8px;
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px; border: 1px solid rgba(15, 19, 31, .12); border-radius: 999px;
}
.nav-drawer .sheet .lang-switch button {
  min-width: 31px; height: 28px; padding: 0 7px;
  border: 0; border-radius: 999px;
  background: transparent; color: rgba(15, 19, 31, .58);
  font: 700 10px/1 var(--isl-font, "Inter", system-ui, sans-serif); letter-spacing: .04em; cursor: pointer;
}
.nav-drawer .sheet .lang-switch button.is-active { color: #fff; background: #101014; }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .ios-nav-menu { gap: 20px; }
  .ios-nav-cta { gap: 12px; }
  .ios-nav-login { display: none; }
}
@media (max-width: 760px) {
  .ios-nav { --isl-radius: 0 0 20px 20px; --isl-radius-mini: 0 0 16px 16px; --isl-bevel: 14px; }
  .ios-nav-island { min-height: 46px; padding: 5px 9px 5px 16px; gap: 10px; }
  .sparrows-logo-frame { width: 88px; height: 40px; }
  .ios-nav-menu, .ios-nav-talk { display: none; }
  .ios-nav-toggle { display: grid; width: 36px; height: 36px; }
  .ios-nav-cta { gap: 8px; }
  .ios-nav .lang-switch { padding: 2px; }
  .ios-nav .lang-switch button { min-width: 26px; height: 24px; padding-inline: 5px; font-size: 9px; }
  .nav-drawer .sheet a.ios-nav-talk { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
  .ios-nav-island,
  .ios-nav-full,
  .ios-nav-item,
  .ios-nav-drop-panel { transition-duration: .01ms !important; transition-delay: 0s !important; }
  .ios-nav[data-boot="run"] .ios-nav-island { animation: none; }
  .nav-drawer .sheet { animation: none; }
}
