/* The island: a floating pill that morphs into a card.
   Collapsed it is [mark] [Menu] [Request Demo]. Open it is a nav list beside a
   still that changes with the item under the cursor, and the bar stays put. */

.island {
  position: fixed;
  z-index: 90;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - var(--gut));
}
.island[data-dock='top']    { top: clamp(0.75rem, 2vh, 1.5rem); }
.island[data-dock='bottom'] { bottom: clamp(0.75rem, 2vh, 1.5rem); }

.island__shell {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow:
    0 1px 0 0 rgba(246, 235, 217, 0.08) inset,
    0 18px 50px -12px rgba(0, 0, 0, 0.7);
  will-change: width, border-radius;
}
.island[data-dock='bottom'] .island__shell { flex-direction: column-reverse; }

/* ---- the bar ---- */
.island__bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  flex: none;
}

.island__brand {
  display: flex;
  align-items: center;
  margin-inline-end: 0.5rem;
}
.island__brand svg { width: 22px; height: 22px; flex: none; }

.island__toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--r-pill);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--muted);
  transition: color var(--d-fast) var(--e-out), background-color var(--d-fast) var(--e-out);
}
@media (hover: hover) { .island__toggle:hover { color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent); } }

/* Two bars that become the open slate's stick when the menu opens. */
.island__icon { width: 14px; height: 10px; position: relative; flex: none; }
.island__icon i {
  position: absolute;
  left: 0; right: 0;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
  transition: transform var(--d) var(--e-slate);
  transform-origin: 2px 50%;
}
.island__icon i:first-child { top: 1px; }
.island__icon i:last-child  { bottom: 1px; }
.island.is-open .island__icon i:first-child { transform: rotate(-22deg) translateY(-1px); }
.island.is-open .island__icon i:last-child  { transform: rotate(0deg); }

.island__cta { padding: 0.72em 1.15em; font-size: var(--t-sm); }

/* ---- the panel ---- */
.island__panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 1rem;
  padding: 1rem;
  align-items: stretch;
}
.island--ready .island__panel { height: 0; overflow: hidden; padding-block: 0; }

.island__list { display: flex; flex-direction: column; justify-content: center; gap: 0.1rem; }

.island__link {
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--t-xl);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: color-mix(in srgb, var(--text) 55%, transparent);
  padding: 0.12em 0;
  transition: color var(--d-fast) var(--e-out);
}
.island__link:focus-visible, .island__link.is-active { color: var(--text); }
@media (hover: hover) { .island__link:hover { color: var(--text); } }

.island__minor {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 1rem;
}
.island__minor a { font-size: var(--t-sm); color: var(--muted); }
@media (hover: hover) { .island__minor a:hover { color: var(--text); } }

/* ---- the language pair -------------------------------------------------
   Two names rather than a switch with one label on it: a switch reading
   "عربي" has to be understood by someone who cannot read it, which is exactly
   the person reaching for it. Both are always shown and the current one is
   lit, so the control says which language you are in and what the other one
   is at the same time.

   It sits on the bar beside the menu, not inside it. Changing language is not
   somewhere you navigate to, and a reader who cannot read the page should not
   have to open a panel labelled in that language to find the way out. */
.island__lang {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  flex: none;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--text) 7%, transparent);
}
.island__lang-btn {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  line-height: 1;
  padding: 0.42rem 0.5rem;
  border-radius: var(--r-pill);
  color: var(--faint);
  transition: color var(--d-fast) var(--e-out), background-color var(--d-fast) var(--e-out);
}
/* The Arabic name is set in the Arabic face, whatever the page is in. */
.island__lang-btn[lang='ar'] { font-family: var(--display); letter-spacing: 0; font-size: 0.8rem; padding-block: 0.3rem; }
.island__lang-btn.is-on { color: var(--on-primary); background: var(--primary); }
@media (hover: hover) {
  .island__lang-btn:not(.is-on):hover { color: var(--text); }
}

/* ---- the still ---- */
.island__still {
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-deep);
  min-height: 190px;
  isolation: isolate;
}
.island__still figure {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity var(--d) var(--e-out), transform var(--d-slow) var(--e-out);
}
.island__still figure.is-on { opacity: 1; transform: scale(1); }
.island__still svg { width: 100%; height: 100%; }

.island__caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 1.6rem 0.9rem 0.8rem;
  background: linear-gradient(to top, rgba(11, 11, 11, 0.92), transparent);
  font-size: var(--t-xs);
  color: var(--muted);
}
.island__caption b { font-family: var(--mono); font-weight: 500; color: var(--faint); letter-spacing: 0.1em; }

/* ---- small screens: the still goes on top, the list under it ---- */
@media (max-width: 720px) {
  .island { width: calc(100vw - var(--gut)); }
  .island__panel { grid-template-columns: 1fr; }
  .island__still { min-height: 150px; order: -1; }
  .island__link { font-size: var(--t-lg); }
}
@media (max-width: 420px) {
  .island__toggle-label { display: none; }
  .island__toggle { padding: 0.6rem 0.75rem; }
  /* The bar is carrying one more control than it used to. The language pair
     keeps both names — it is the one thing here that cannot be shortened
     without defeating it — so the room comes from around them. */
  .island__lang-btn { padding-inline: 0.4rem; }
  .island__cta { padding: 0.72em 0.9em; }
  .island__bar { gap: 0.35rem; padding-inline-start: 0.6rem; }
}

/* After 40px of scroll the island tightens, so it reads as chrome, not content. */
.island.is-stuck .island__shell { box-shadow: 0 22px 60px -14px rgba(0, 0, 0, 0.8); }

/* No JS: the panel is simply open, and the toggle is pointless so it goes. */
.island:not(.island--ready) .island__toggle { display: none; }
