/* Benjineering Labs · the glass nav and the apps panel, on every page */

/* The site draws its own colours in light and dark system settings alike;
 * this tells the browser, and dark-mode extensions that look for a site's
 * own scheme, to leave them as designed. */
:root { color-scheme: light only; }
@media (prefers-color-scheme: dark) {
  :root { color-scheme: light only; }
}

/* Benjineering Labs · the studio opening, the glass nav and the apps panel */

@property --glass-density { syntax: "<number>"; inherits: true; initial-value: 1; }
@property --glass-keep { syntax: "<number>"; inherits: true; initial-value: 1; }
@property --glass-hover { syntax: "<percentage>"; inherits: false; initial-value: 0%; }

/* ---------- the material ---------- */
[data-glass] {
  --glass-tint: 20 20 24;
  --glass-thin: 0.16;
  --glass-dense: 0.38;
  --glass-light: 0.33;
  --glass-blur: 7px;
  --glass-alpha: min(0.94, calc(var(--glass-thin) + (var(--glass-dense) - var(--glass-thin)) * var(--glass-density)));
  position: relative;
  isolation: isolate;
  color: rgb(255 255 255 / 0.94);
  background-color: color-mix(in srgb, rgb(var(--glass-tint) / var(--glass-alpha)), rgb(255 255 255) var(--glass-hover));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(calc(1.6 * var(--glass-keep))) brightness(0.8);
  backdrop-filter: blur(var(--glass-blur)) saturate(calc(1.6 * var(--glass-keep))) brightness(0.8);
  box-shadow:
    inset 1.5px 1.5px 1px -1px rgb(255 255 255 / calc(0.95 * var(--glass-light))),
    inset -1.5px -1.5px 1px -1px rgb(255 255 255 / calc(0.55 * var(--glass-light))),
    inset 0 0 0 0.5px rgb(255 255 255 / calc(0.3 * var(--glass-light))),
    0 0 0 0.5px rgb(0 0 0 / 0.5),
    0 6px 24px rgb(0 0 0 / 0.3);
  transition: --glass-density 0.6s cubic-bezier(.215,.61,.355,1), --glass-keep 0.6s cubic-bezier(.215,.61,.355,1), --glass-hover 0.24s cubic-bezier(.215,.61,.355,1);
}
[data-glass]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(farthest-corner at 0% 0%, rgb(255 255 255 / calc(0.3 * var(--glass-light))), transparent 55%);
  box-shadow:
    inset 0 10px 12px -10px rgb(255 255 255 / calc(0.5 * var(--glass-light))),
    inset 10px 0 12px -10px rgb(255 255 255 / calc(0.32 * var(--glass-light))),
    inset 0 -10px 12px -10px rgb(0 0 0 / calc(0.1 * var(--glass-light)));
}
/* The WebGL layer draws the outline and the shadow once it runs. */
[data-glass][data-glass-gl] { box-shadow: inset 1.5px 1.5px 1px -1px rgb(255 255 255 / calc(0.95 * var(--glass-light))), inset -1.5px -1.5px 1px -1px rgb(255 255 255 / calc(0.55 * var(--glass-light))), inset 0 0 0 0.5px rgb(255 255 255 / calc(0.3 * var(--glass-light))); }
[data-glass]:not([data-glass-ready]) { transition: none; }
[data-site-header] [data-glass] { transition: background-color 0.35s ease, --glass-density 0.6s cubic-bezier(.215,.61,.355,1), --glass-keep 0.6s cubic-bezier(.215,.61,.355,1), --glass-hover 0.24s cubic-bezier(.215,.61,.355,1); }
@media (hover: hover) {
  a[data-glass]:hover { --glass-hover: 10%; }
}
@media (prefers-reduced-transparency: reduce), (forced-colors: active) {
  [data-glass] { background-color: rgb(var(--glass-tint)); -webkit-backdrop-filter: none; backdrop-filter: none; outline: 1px solid transparent; }
  [data-glass]::before { display: none; }
}


/* ---------- the glass nav ---------- */
[data-site-header] {
  position: fixed;
  top: 20px;
  left: 50%;
  translate: -50% 0;
  z-index: 60;
  width: min(1160px, calc(100vw - 48px));
}
[data-site-header] .site-nav {
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  height: 60px;
  padding: 0 8px 0 10px;
  border-radius: 30px;
}
.site-nav .brand { white-space: nowrap; display: flex; align-items: center; gap: 10px; justify-self: start; font: 500 15px "Inter", sans-serif; letter-spacing: -0.01em; color: #fff; text-decoration: none; }
.site-nav .brand .mark {
  /* Text and borders, not SVG, so the mark always takes the nav's text colour. */
  display: grid; place-items: center; width: 34px; height: 34px; margin-left: 6px;
  border: 2px solid currentColor; color: inherit;
  font: 700 14px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: -0.06em;
}
.site-nav .nav-links { display: flex; align-items: center; gap: 2px; list-style: none; }
.site-nav .nav-link {
  display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 15px; border-radius: 20px;
  font: 400 15px/1 "Inter", sans-serif; color: rgb(255 255 255 / 0.9); background: transparent; border: 0; cursor: pointer;
  text-decoration: none; transition: background-color 0.2s cubic-bezier(.215,.61,.355,1);
}
.site-nav .nav-link .chev { width: 6px; height: 6px; margin: -3px 0 0 2px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; rotate: 45deg; transition: rotate 0.3s cubic-bezier(.215,.61,.355,1), margin 0.3s ease; }
.site-nav .nav-link[aria-expanded="true"] { background: rgb(255 255 255 / 0.16); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.14); }
.site-nav .nav-link[aria-expanded="true"] .chev { rotate: 225deg; margin-top: 3px; }
@media (hover: hover) { .site-nav:not([data-nav-hover-ready]) .nav-link:hover { background: rgb(255 255 255 / 0.1); } }
.nav-hover {
  position: absolute; top: 0; left: 0; z-index: -1; border-radius: 20px; background: rgb(255 255 255 / 0.1); opacity: 0; pointer-events: none;
  transition: transform 0.22s cubic-bezier(.215,.61,.355,1), width 0.22s cubic-bezier(.215,.61,.355,1), opacity 0.15s ease;
}
.nav-hover[data-instant] { transition: opacity 0.15s ease; }
.nav-hover[data-shown] { opacity: 1; }
.site-nav .nav-actions { justify-self: end; display: flex; align-items: center; gap: 6px; }
.solid-button {
  display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 20px; border-radius: 22px;
  font: 500 14px/1 "Inter", sans-serif; color: #111318; background: rgb(255 255 255 / 0.92); text-decoration: none; white-space: nowrap;
  transition: background-color 0.3s cubic-bezier(.215,.61,.355,1), transform 0.15s ease;
}
@media (hover: hover) { .solid-button:hover { background: rgb(255 255 255 / 0.76); } }
.solid-button:active { transform: scale(0.97); }
.menu-button { display: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: #fff; place-items: center; cursor: pointer; }
.menu-button .bars { display: block; width: 18px; height: 8px; border-top: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; }
.menu-button[aria-expanded="true"] { background: rgb(255 255 255 / 0.16); }
[data-site-header] :where(a, button):focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- the apps panel ---------- */
.apps-panel {
  --pop-y: -14px;
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  translate: -50% 0;
  z-index: 1;
  display: none;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 8px;
  width: min(860px, 100%);
  padding: 8px;
  border-radius: 28px;
}
.apps-panel[data-open] { display: grid; }
.ap-list { display: flex; flex-direction: column; justify-content: center; padding: 14px 6px 14px 10px; }
.ap-row {
  position: relative; display: grid; grid-template-columns: 36px 1fr; column-gap: 14px; align-items: center;
  padding: 12px 12px; border-radius: 18px; color: #fff; text-decoration: none;
}
.ap-row img { width: 36px; height: 36px; border-radius: 9px; grid-row: span 2; }
.ap-name { display: block; font: 400 25px/1.2 "Inter", sans-serif; letter-spacing: -0.025em; }
.ap-line { font: 400 13px/1.4 "Inter", sans-serif; color: rgb(255 255 255 / 0.62); }
/* The app shown in the window is white; the others wait dimmed. */
.ap-row :is(.ap-name, .ap-line, img) { opacity: 0.42; transition: opacity 0.25s ease; }
.ap-row[data-current] :is(.ap-name, .ap-line, img) { opacity: 1; }
.ap-row:focus-visible { outline-offset: -2px; }
.ap-window { position: relative; min-height: 340px; border-radius: 22px; overflow: hidden; background: #15171d; isolation: isolate; }
.ap-layer { position: absolute; inset: 0; overflow: hidden; }
.ap-layer > * { will-change: transform; }
.ap-layer .art { position: absolute; inset: 0; }
.ap-layer .ph { position: absolute; width: 36%; border-radius: 20px; box-shadow: 0 22px 50px rgb(0 0 0 / 0.35); }
.ap-layer .mac { position: absolute; width: 96%; left: 12%; top: 16%; border-radius: 12px; box-shadow: 0 22px 50px rgb(0 0 0 / 0.3); }
.ap-layer .wide { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ap-layer .badge-icon { position: absolute; left: 50%; top: 50%; width: 30%; translate: -50% -50%; border-radius: 22%; box-shadow: 0 18px 44px rgb(0 0 0 / 0.45); }
.tint-sprig { background: linear-gradient(160deg, #e7efe4, #cfdfc9); }
.tint-writual { background: linear-gradient(160deg, #f3efe7, #e2dacb); }
.tint-aerial { background: linear-gradient(160deg, #3a1f3c, #1d1430); }
.tint-narwhal { background: #1a1438; }
.ap-more { display: none; }

.apps-panel[data-content="in"] [data-pop] { animation: pop-move 0.38s cubic-bezier(.34,1.56,.64,1) backwards, pop-look 0.22s cubic-bezier(.19,1,.22,1) backwards; animation-delay: var(--in-delay, 0ms); }
.apps-panel[data-content="out"] [data-pop] { animation: pop-out 0.22s ease both; animation-delay: var(--out-delay, 0ms); }
@keyframes pop-move { from { translate: 0 var(--pop-y); } to { translate: 0 0; } }
@keyframes pop-look { from { opacity: 0; filter: blur(8px); } to { opacity: 1; filter: blur(0); } }
@keyframes pop-out { from { opacity: 1; filter: blur(0); translate: 0 0; } to { opacity: 0; filter: blur(8px); translate: 0 var(--pop-y); } }
@media (prefers-reduced-motion: reduce) { .apps-panel [data-pop] { animation: none !important; } }


/* ---------- light: over the page itself ----------
 * Over the dark studio the nav is dark glass. Everywhere else (below the
 * studio, and on every other page) it is the site's own light: frosted white,
 * ink text, a hairline and the soft shadow the cards use, the ink button. */
[data-site-header] [data-glass],
[data-site-header] :is(.nav-link, .solid-button, .ap-row, .ap-line, .ap-more a) {
  transition: background-color 0.35s ease, color 0.35s ease, box-shadow 0.35s ease, --glass-density 0.6s cubic-bezier(.215,.61,.355,1), --glass-hover 0.24s cubic-bezier(.215,.61,.355,1);
}
[data-site-header].is-light [data-glass] {
  --glass-tint: 255 255 255;
  --glass-alpha: 0.78;
  --glass-blur: 18px;
  color: var(--ink);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  box-shadow: 0 0 0 1px var(--line), var(--shadow);
}
[data-site-header].is-light [data-glass]::before { opacity: 0; }
[data-site-header].is-light .apps-panel { --glass-alpha: 0.94; }
[data-site-header].is-light .site-nav .brand { color: var(--ink); }

[data-site-header].is-light .site-nav .nav-link { color: var(--dim); }
@media (hover: hover) { [data-site-header].is-light .site-nav .nav-link:hover { color: var(--ink); } }
[data-site-header].is-light .site-nav .nav-link[aria-current="page"] { color: var(--ink); }
[data-site-header].is-light .site-nav .nav-link[aria-expanded="true"] { color: var(--ink); background: rgb(23 25 32 / 0.06); box-shadow: inset 0 0 0 1px var(--line); }
[data-site-header].is-light .nav-hover { background: rgb(23 25 32 / 0.05); }
[data-site-header].is-light .solid-button { color: #fff; background: var(--ink); }
@media (hover: hover) { [data-site-header].is-light .solid-button:hover { background: var(--vio); } }
[data-site-header].is-light .menu-button { color: var(--ink); }
[data-site-header].is-light .menu-button[aria-expanded="true"] { background: rgb(23 25 32 / 0.06); }
[data-site-header].is-light :where(a, button):focus-visible { outline-color: var(--vio); }
[data-site-header].is-light .ap-row { color: var(--ink); }
[data-site-header].is-light .ap-line { color: var(--dim); }
[data-site-header].is-light .ap-window { background: #eef0f4; }
[data-site-header].is-light .ap-row img { box-shadow: 0 0 0 1px var(--line); }

/* Pages without the studio start below the fixed nav. */
.page-hero { padding-top: 168px; }

/* ---------- small screens ---------- */
@media (max-width: 880px) {
  .site-nav .nav-links, .nav-hover { display: none; }
  .menu-button { display: grid; }
  [data-site-header] .site-nav { grid-template-columns: 1fr auto; padding-left: 8px; }
  .apps-panel { grid-template-columns: 1fr; width: 100%; }
  .ap-window { display: none; }
  .ap-list { padding: 8px 4px; }
  .ap-name { font-size: 22px; }
  .ap-row :is(.ap-name, .ap-line, img) { opacity: 1; }
  .ap-more { display: grid; gap: 2px; padding: 4px 4px 4px; }
  .ap-more a:not(.solid-button) { padding: 12px 16px; border-radius: 18px; font: 400 17px/1.2 "Inter", sans-serif; color: inherit; text-decoration: none; }
  .ap-more .solid-button { margin-top: 6px; height: 48px; }
}
@media (max-width: 560px) {
  [data-site-header] { top: 14px; width: calc(100vw - 28px); }
  [data-site-header] .site-nav { height: 58px; }
  .nav-actions .solid-button { display: none; }
}
