/* The document editor menu bar: the dark glass menu bar of Lindwell, a made-up documents app, on a black page.
   One panel (.panel) is every menu: GSAP moves it, sizes it and scales it from the item it belongs to; inside it the
   pages of the four menus sit on top of each other and only one is on. The folders of Move to are a second panel.
   The selection pill and the bar's pill are layers of their own, moved by springs in the script. */
:root {
  --page: #000000;            /* the page */
  --glass-top: rgba(44, 44, 54, 0.74);   /* the glass, at the top */
  --glass-bottom: rgba(22, 22, 28, 0.84); /* the glass, at the bottom */
  --edge: rgba(255, 255, 255, 0.075);    /* the 1px edge of the glass */
  --ink: #f2f2f5;             /* the words */
  --soft: rgba(242, 242, 245, 0.7);      /* the words at rest */
  --muted: #8b8b98;           /* the shortcuts */
  --accent: #9184ff;          /* the accent: the mark, the checks, the safe triangle */
  --accent-2: #4f7dff;        /* the second light under the glass */
  --red: #ff6262;             /* Delete */
  --red-solid: #f2474b;       /* the Delete button of the question */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 10px;
  overflow: hidden;
}

/* the whole piece: the bar on top, room under it for the menus, the toast at the bottom */
.app {
  position: relative;
  width: min(94vw, 580px);
  height: min(92vh, 384px);
  opacity: 0;
}

/* the light under the glass: two soft clouds that drift slowly, so the blur of the glass has something to bend */
.app__glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.app__glow-a,
.app__glow-b {
  position: absolute;
  border-radius: 50%;
  filter: blur(46px);
}

.app__glow-a {
  left: 18%;
  top: 18%;
  width: 44%;
  height: 44%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 52%, transparent), transparent);
  animation: drift-a 14s ease-in-out infinite alternate;
}

.app__glow-b {
  left: 44%;
  top: 34%;
  width: 40%;
  height: 40%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent-2) 36%, transparent), transparent);
  animation: drift-b 17s ease-in-out infinite alternate;
}

@keyframes drift-a {
  to { transform: translate(14%, 10%) scale(1.08); }
}

@keyframes drift-b {
  to { transform: translate(-16%, -6%) scale(0.92); }
}

/* the glass, for the bar, the panels and the toast */
.bar,
.panel,
.toast {
  background: linear-gradient(180deg, var(--glass-top), var(--glass-bottom));
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 1px 1px rgba(0, 0, 0, 0.5),
    0 10px 22px -10px rgba(0, 0, 0, 0.7),
    0 30px 60px -24px rgba(0, 0, 0, 0.8);
}

/* ---------------------------------------------------------------- the bar */
.bar {
  position: absolute;
  left: 0;
  right: 0;
  width: max-content;
  margin: 0 auto;
  top: clamp(4px, 2vh, 14px);
  z-index: 3;
  display: flex;
  align-items: center;
  height: 42px;
  padding: 0 7px;
  border-radius: 13px;
  white-space: nowrap;
}

.bar__mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 6px;
  border-radius: 8px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 100%, #ffffff 18%), color-mix(in srgb, var(--accent) 70%, #1b1440));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 2px 8px -2px color-mix(in srgb, var(--accent) 60%, transparent);
}

.bar__mark svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.bar__items {
  position: relative;
  display: flex;
  gap: 1px;
}

.bar__pill {
  position: absolute;
  left: 0;
  top: 7px;
  width: 40px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.075));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  opacity: 0;
  pointer-events: none;
}

.bar__item {
  position: relative;
  z-index: 1;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--soft);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.005em;
  cursor: default;
  transition: color 0.18s;
  -webkit-tap-highlight-color: transparent;
}

.bar__item.is-on {
  color: var(--ink);
}

@media (hover: hover) {
  .bar__item:hover {
    color: var(--ink);
  }
}

.bar__item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.bar__doc {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  padding: 0 6px 0 14px;
  height: 20px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12.5px;
}

.bar__doc-cloud {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bar__doc-tick {
  stroke: var(--accent);
}

@media (max-width: 430px) {
  .bar__doc {
    display: none;
  }
}

/* ---------------------------------------------------------------- the panels */
.panel {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  width: 210px;
  height: 200px;
  border-radius: 14px;
  overflow: hidden;
  will-change: transform;
}

.panel[hidden],
.panel[hidden] .page.is-on {
  display: block;
  visibility: hidden;
}

.panel--sub {
  z-index: 5;
}

/* the light on the glass: brighter at the top edge, with a whisper of grain */
.panel__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 34%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  background-size: auto, 120px 120px;
  opacity: 0.55;
  mix-blend-mode: soft-light;
}

.page {
  position: absolute;
  left: 0;
  top: 0;
  padding: 6px;
  min-width: 212px;
  width: max-content;
  visibility: hidden;
}

.page.is-on {
  visibility: visible;
}

.page--sub {
  position: relative;
  min-width: 182px;
}

/* the selection pill: one layer under the rows, moved by a spring */
.pill {
  position: absolute;
  left: 6px;
  top: 0;
  width: 100px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.07));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  opacity: 0;
  pointer-events: none;
  transition: background 0.2s, box-shadow 0.2s;
}

.pill.is-red {
  background: linear-gradient(180deg, color-mix(in srgb, var(--red) 26%, transparent), color-mix(in srgb, var(--red) 16%, transparent));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--red) 30%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--red) 22%, transparent);
}

.row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  height: clamp(26px, 7vh, 30px);
  padding: 0 10px;
  border-radius: 8px;
  color: var(--soft);
  font-size: 13.5px;
  outline: none;
  cursor: default;
  transition: color 0.16s;
  -webkit-tap-highlight-color: transparent;
}

.row.is-on {
  color: var(--ink);
}

.row:focus-visible {
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 70%, transparent);
}

.row__icon {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
  opacity: 0.86;
}

.row__label {
  flex: 1 1 auto;
}

.row__keys {
  margin-left: 26px;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  transition: color 0.16s;
}

.row.is-on .row__keys {
  color: color-mix(in srgb, var(--ink) 62%, var(--muted));
}

.row__chev {
  width: 14px;
  height: 14px;
  margin-left: 26px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.row.is-on .row__chev {
  stroke: var(--ink);
}

/* the checks of View and of the folders */
.row__tick path,
.row__mark path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.row__tick {
  stroke: var(--accent);
  stroke-width: 1.7;
  opacity: 1;
}

.row__mark {
  width: 14px;
  height: 14px;
  margin-left: 20px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rule {
  display: block;
  height: 1px;
  margin: 4px 8px;
  background: rgba(255, 255, 255, 0.07);
}

/* Delete, and the question that takes its row */
.row--danger,
.row--danger.is-on {
  color: var(--red);
}

.row--danger .row__keys {
  color: color-mix(in srgb, var(--red) 55%, var(--muted));
}

.ask {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px 0 10px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
}

.ask__q {
  margin-right: 8px;
  color: var(--ink);
  font-size: 13px;
}

.ask.is-short .ask__long {
  display: none;
}

.ask__btn {
  height: 22px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: default;
}

.ask__btn--red {
  background: linear-gradient(180deg, color-mix(in srgb, var(--red-solid) 100%, #ffffff 14%), var(--red-solid));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 2px 8px -2px color-mix(in srgb, var(--red-solid) 70%, transparent);
  color: #ffffff;
  font-weight: 600;
}

/* ---------------------------------------------------------------- the safe triangle */
.safe {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 4;
}

.safe polygon {
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
  stroke: color-mix(in srgb, var(--accent) 42%, transparent);
  stroke-width: 1;
  stroke-dasharray: 2.5 3;
  opacity: 0;
}

/* ---------------------------------------------------------------- the toast */
.toast {
  position: absolute;
  left: 0;
  right: 0;
  width: max-content;
  margin: 0 auto;
  bottom: clamp(2px, 1.5vh, 10px);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 6px 0 12px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 13px;
  opacity: 0;
  visibility: hidden;
}

.toast__icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast__icon path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.toast.is-red .toast__icon {
  stroke: var(--red);
}

.toast__undo {
  height: 26px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s;
}

@media (hover: hover) {
  .toast__undo:hover {
    background: rgba(255, 255, 255, 0.13);
  }
}

.toast__undo:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- the pilot's pointer */
.hand {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 9;
  width: 20px;
  height: 20px;
  margin: -2px 0 0 -4px;
  fill: #ffffff;
  stroke: #0b0b0e;
  stroke-width: 1.3;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .app__glow-a,
  .app__glow-b {
    animation: none;
  }
}
