/* The shared site bar (site/templates/site-bar.html), for the home page and every signed-out
   site page, and its index (Help and Hosting in large type). Night print values
   (Shared/Pool/Kit/Design/NightTokens.swift). Prefix .sb- (the bar) and .ix- (the index).
   Faces come from the page's own stylesheet (home.css or night.css); both declare Geist.
   The marketing index is plain black and type: no dot texture, no lit objects, no bead edge, so
   it never reads as the host console's sheets. */

.sb {
  --sb-ink: #F4F4F2; --sb-soft: #C9C9C5; --sb-quiet: #9A9A96; --sb-line: #2A2A28;
  --sb-silver: #B4B4BE;
  --sb-ease: cubic-bezier(0.2, 0.7, 0.2, 1); /* night.css --nt-ease */
  --sb-font: "Geist", -apple-system, system-ui, sans-serif;
}

/* A soft shade under the words (not blended), so the inverted words land on dark and read as
   near white over any photo instead of a mid tone. Gone while the index is open. */
.sb-fade {
  position: fixed; inset: 0 0 auto 0; height: 120px; z-index: 19; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.55) 45%, rgba(0, 0, 0, 0));
  transition: opacity 0.18s ease;
}

/* The row: no ground, inverts against whatever is under it. 57px tall with 22px gaps: the exact
   box and spacing of the home page's original bar, so the closed bar does not move a pixel. */
.sb-row {
  position: fixed; inset: 0 0 auto 0; z-index: 23; height: 57px; box-sizing: border-box;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 0 24px; mix-blend-mode: difference; pointer-events: none; font-family: var(--sb-font);
}
.sb a, .sb button { -webkit-tap-highlight-color: transparent; }
.sb-row a, .sb-row button { pointer-events: auto; }
.sb-name { color: var(--sb-ink); text-decoration: none; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.sb-nav { display: flex; align-items: center; gap: 40px; }
.sb-words { display: flex; align-items: center; gap: 22px; margin: 0; padding: 0; list-style: none; }
.sb-word {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0; border: 0; background: none;
  color: var(--sb-ink); font: 600 15px/1 var(--sb-font); text-decoration: none; cursor: pointer;
}
.sb-word:hover { opacity: 0.75; }
.sb-caret::after {
  content: ""; width: 5px; height: 5px; margin-top: -3px;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg); transition: transform 0.18s var(--sb-ease), margin 0.18s var(--sb-ease);
}
.sb-caret.is-lead::after { transform: rotate(-135deg); margin-top: 3px; }
html.sb-open .sb-row { mix-blend-mode: normal; }
html.sb-open .sb-fade, html.sb-open .sb-solid-cover { opacity: 0; }
html.sb-open .sb-nav .sb-word { opacity: 0.62; }
html.sb-open .sb-nav .sb-word:hover, html.sb-open .sb-nav .sb-word:focus-visible,
html.sb-open .sb-trigger.is-lead { opacity: 1; }
.sb-menu-key { display: none; }

/* ---------------- the index ---------------- */
/* Bigger than a dropdown, never full screen: 65% of the viewport, at least 440px, and always
   140px short of the bottom so the page shows below it. It sits from the top, under the row. */
.ix {
  position: fixed; inset: 0 0 auto 0; z-index: 22; box-sizing: border-box;
  height: min(max(440px, 65vh), calc(100vh - 140px));
  background: #000; color: var(--sb-ink); font-family: var(--sb-font); -webkit-font-smoothing: antialiased;
  border-bottom: 1px solid var(--sb-line);
  visibility: hidden; opacity: 0; transform: translateY(-14px);
  transition: opacity 0.16s ease, transform 0.22s var(--sb-ease), visibility 0s linear 0.22s;
}
.ix.is-open { visibility: visible; opacity: 1; transform: none; transition: opacity 0.2s ease, transform 0.22s var(--sb-ease), visibility 0s; }
/* The way back: the page below, dimmed, no blur. Moving into it, or clicking it, closes. */
.ix-veil {
  position: fixed; inset: 0; z-index: 21; background: rgba(0, 0, 0, 0.45);
  visibility: hidden; opacity: 0; transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}
html.sb-open .ix-veil { visibility: visible; opacity: 1; transition: opacity 0.2s ease, visibility 0s; }

.ix-in {
  position: relative; box-sizing: border-box; height: 100%; max-width: 1320px; margin: 0 auto;
  padding: 96px 48px 48px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) clamp(180px, 15vw, 240px);
  column-gap: 48px; align-items: start;
}
.ix-keys, .ix-more { display: none; }
.ix-group { transition: opacity 0.2s ease; min-width: 0; }
.ix[data-lead="help"] .ix-group[data-group="hosting"],
.ix[data-lead="hosting"] .ix-group[data-group="help"] { opacity: 0.42; }
.ix-group:hover, .ix-group:focus-within { opacity: 1 !important; }
.ix-name { margin: 0 0 12px; color: var(--sb-quiet); font-size: 15px; font-weight: 500; }
.ix ul { margin: 0; padding: 0; list-style: none; }
.ix-link {
  display: flex; align-items: center; min-height: calc(var(--ix-size) * 1.45);
  color: var(--sb-silver); text-decoration: none; outline: none;
  font-size: var(--ix-size); font-weight: 600; line-height: 1.05; letter-spacing: -0.03em;
}
.ix { --ix-size: clamp(26px, 2.6vw, 42px); }
.ix-link span { padding: 2px 0; }
.ix-link:hover span, .ix-link:focus-visible span {
  color: #fff;
  background-image: linear-gradient(100deg, #cfd4db 0%, #cfd4db 42%, #ffffff 50%, #cfd4db 58%, #cfd4db 100%);
  background-size: 300% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: ix-sheen 1.4s ease-out 1 both;
}
@keyframes ix-sheen { from { background-position: 100% 0; } to { background-position: 0% 0; } }
.ix-link:focus-visible span { outline: 2px solid var(--sb-ink); outline-offset: 4px; border-radius: 4px; }
/* the rows arrive once per open, a few ms apart */
.ix.is-in .ix-link { animation: ix-in 0.36s var(--sb-ease) both; animation-delay: calc(var(--i, 0) * 22ms + 40ms); }
@keyframes ix-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.ix-app { display: flex; flex-direction: column; align-items: center; gap: 18px; margin-top: 8px; color: var(--sb-ink); text-decoration: none; }
.ix-ball { position: relative; display: block; width: 100%; aspect-ratio: 1; }
.ix-ball img, .ix-ball video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.ix-ball img { mix-blend-mode: lighten; transition: opacity 0.4s ease; }
/* both layers blend with lighten (it drops the black square), so the still must leave while the spin plays */
.ix-ball:has(video.is-on) img { opacity: 0; }
.ix-ball video { opacity: 0; transition: opacity 0.4s ease; mix-blend-mode: lighten; }
.ix-ball video.is-on { opacity: 1; }
.ix-word { display: block; width: 62%; }
.ix-word svg { display: block; width: 100%; height: auto; }
.ix-app:focus-visible { outline: 2px solid var(--sb-ink); outline-offset: 6px; border-radius: 12px; }
.ix-close {
  position: absolute; right: 24px; top: 64px; min-height: 44px; padding: 0 4px; border: 0; background: none; cursor: pointer;
  color: var(--sb-quiet); font: 500 15px var(--sb-font);
}
.ix-close:hover, .ix-close:focus-visible { color: var(--sb-ink); }

/* short windows: tighter rows so the index still fits its height */
@media (max-height: 760px) and (min-width: 761px) { .ix { --ix-size: clamp(24px, 2.4vw, 34px); } .ix-in { padding-top: 80px; } }
@media (max-width: 1100px) and (min-width: 761px) { .ix-in { padding: 88px 32px 40px; column-gap: 32px; } }

/* ---------------- phones: Menu opens the index as a tall sheet ---------------- */
@media (max-width: 760px) {
  .sb-nav { display: none; }
  .sb-menu-key { display: inline-flex; }
  .ix { height: calc(100vh - 96px); height: calc(100svh - 96px); overflow-y: auto; overscroll-behavior: contain; }
  .ix-in { display: flex; flex-direction: column; align-items: stretch; gap: 28px; height: auto; padding: 72px 24px 32px; }
  .ix-keys { display: flex; flex-direction: column; gap: 12px; }
  .ix-key, .ix-key2 { display: flex; align-items: center; justify-content: center; min-height: 52px; border-radius: 16px; font-size: 17px; font-weight: 600; text-decoration: none; }
  .ix-key { background: var(--sb-ink); color: #000; }
  .ix-key2 { border: 1px solid var(--sb-line); color: var(--sb-ink); }
  .ix-more { display: block; }
  .ix-group { opacity: 1 !important; }
  .ix { --ix-size: 26px; }
  .ix-app, .ix-close { display: none; }
}
html.sb-locked { overflow: hidden; }

/* ---- once a page without the home hero has scrolled, the words get a solid black backing, so
   body text never shows through them (the home hero keeps its groundless bar) ---- */
.sb-solid-cover {
  position: fixed; inset: 0 0 auto 0; height: 72px; z-index: 19; pointer-events: none; opacity: 0;
  background: linear-gradient(to bottom, #000 57px, rgba(0, 0, 0, 0));
  transition: opacity 0.2s ease;
}
html.sb-solid .sb-solid-cover { opacity: 1; }
html.sb-open.sb-solid .sb-solid-cover { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .ix, .ix.is-open, .ix-veil, html.sb-open .ix-veil { transform: none; transition: visibility 0s; }
  .ix.is-in .ix-link, .ix-link:hover span, .ix-link:focus-visible span { animation: none; }
  .ix-link:hover span, .ix-link:focus-visible span { -webkit-text-fill-color: #fff; background: none; }
  .ix-group, .sb-caret::after, .sb-fade, .sb-solid-cover, .ix-ball video { transition: none; }
}
