/* Liquid glass.
 *
 * One material for everything that floats: the stage's document, the brief,
 * the prompt chips and the directory cards. A translucent fill over a strong
 * backdrop blur, a bright specular rim along the top edge that fades out
 * towards the bottom, and a long soft shadow. Nothing is opaque, so the light
 * pools behind keep showing through and the page reads as one room.
 *
 * Loaded after studio/workspace/depth so equal-specificity rules win.
 */
:root {
  --glass-fill: linear-gradient(
    160deg,
    #ffffffcc 0%,
    #ffffff99 45%,
    #ffffffb3 100%
  );
  --glass-rim: linear-gradient(
    180deg,
    #ffffff 0%,
    #ffffff66 35%,
    #ffffff1a 70%,
    #ffffff4d 100%
  );
  --glass-blur: blur(26px) saturate(180%);
  --glass-shadow:
    0 1px 1px #1d1f3a0a, 0 12px 24px -12px #1d1f3a1f,
    0 40px 80px -40px #1d1f3a40;
  --glass-sheen: radial-gradient(
    120% 70% at 20% 0%,
    #ffffffb3,
    transparent 55%
  );
  --glass-ink: var(--fg);
}
:root[data-theme="dark"] {
  --glass-fill: linear-gradient(
    160deg,
    #ffffff1f 0%,
    #ffffff0a 45%,
    #ffffff12 100%
  );
  --glass-rim: linear-gradient(
    180deg,
    #ffffff66 0%,
    #ffffff1f 30%,
    #ffffff08 70%,
    #ffffff1a 100%
  );
  --glass-shadow:
    0 1px 1px #0006, 0 16px 32px -16px #0009, 0 50px 90px -40px #000c;
  --glass-sheen: radial-gradient(
    120% 70% at 20% 0%,
    #ffffff1f,
    transparent 55%
  );
}

/* The rim is a gradient border drawn with a mask, so it can be brighter at
   the top than the bottom the way light catches a real glass edge. */
.catalogue-card,
.tile {
  position: relative;
}
.surface-backing::after,
.depth-chip::before,
.catalogue-card::before,
.cat-example::before,
.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--glass-rim);
  mask:
    linear-gradient(#000 0 0) content-box exclude,
    linear-gradient(#000 0 0);
  pointer-events: none;
  border: 0;
}

/* ----------------------------------------------------------------- stage */

.surface-backing {
  background: var(--glass-sheen), var(--glass-fill);
  backdrop-filter: var(--glass-blur);
  border-color: transparent;
  box-shadow: var(--glass-shadow);
}
.scene-enabled .surface-backing {
  border-radius: 24px;
}
.scene-enabled .brief-ticket:before {
  background: var(--glass-sheen), var(--glass-fill);
  backdrop-filter: var(--glass-blur);
  border: 1px solid transparent;
  border-radius: 18px;
  box-shadow: var(--glass-shadow);
  outline: 1px solid color-mix(in srgb, #fff 30%, transparent);
  outline-offset: -1px;
}
:root[data-theme="dark"] .scene-enabled .brief-ticket:before {
  outline-color: #ffffff1f;
}

/* A soft beam from above lands wherever the cast is standing. It is the one
   dramatic light in the room, and it moves with the story. */
.depth {
  --cast-x: calc(64% - min(1, var(--pos, 0)) * 36%);
}
.depth-beam {
  top: -8%;
  bottom: 8%;
  width: 52vw;
  left: calc(var(--cast-x) - 26vw);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--beam) 70%, transparent) 0%,
    color-mix(in srgb, var(--beam) 25%, transparent) 45%,
    transparent 85%
  );
  clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
  filter: blur(28px);
  --beam: #ffffff;
  opacity: 0.85;
  mix-blend-mode: soft-light;
  transition: left 600ms cubic-bezier(0.22, 1, 0.36, 1);
}
:root[data-theme="dark"] .depth-beam {
  --beam: #c9d2ff;
  opacity: 0.16;
  mix-blend-mode: screen;
}

/* ------------------------------------------------------------------ chips */

/* Prompt suggestions and skills: the things you would actually see in a
   BotBento chat, floating as glass. */
.depth-chip {
  gap: 9px;
  padding: 7px 12px 7px 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--glass-ink);
  background: var(--glass-sheen), var(--glass-fill);
  backdrop-filter: var(--glass-blur);
  border: 0;
  box-shadow: var(--glass-shadow);
}
.depth-chip[data-kind="skill"] {
  padding-left: 9px;
}
.depth-chip > span {
  white-space: nowrap;
}
.depth-chip svg {
  width: 18px;
  height: 18px;
  padding: 3px;
  box-sizing: content-box;
  border-radius: 999px;
  background: color-mix(in srgb, var(--id, var(--fg)) 16%, transparent);
}
.chip-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  object-fit: cover;
  object-position: 50% 45%;
  background: color-mix(in srgb, var(--id, var(--fg)) 22%, transparent);
  flex: none;
}
.depth-chip kbd {
  font: inherit;
  font-size: 11px;
  line-height: 1;
  padding: 4px 6px;
  margin-left: 2px;
  border-radius: 7px;
  color: var(--muted);
  background: color-mix(in srgb, var(--fg) 7%, transparent);
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--fg) 12%, transparent);
}
.chip-dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 2px;
}
.chip-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--id, var(--muted));
  animation: chip-typing 1.2s infinite ease-in-out;
}
.chip-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.chip-dots i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes chip-typing {
  0%,
  60%,
  100% {
    opacity: 0.25;
    translate: 0 0;
  }
  30% {
    opacity: 1;
    translate: 0 -2px;
  }
}

/* Chips around the lower sections: always present, very quiet, and drifting
   against the page at their own depth. */
.ground-inner {
  position: relative;
}
.head-chips {
  position: absolute;
  top: -12px;
  right: 0;
  width: min(44%, 520px);
  height: 230px;
  pointer-events: none;
}
.head-chips .depth-chip {
  opacity: 0.9;
  scale: 1;
  translate: 0 calc(var(--gy, 0) * var(--rate) * 1px);
  transition: none;
}
.head-chips [data-slot="a"] {
  --rate: -0.05;
  right: 6%;
  top: 8%;
}
.head-chips [data-slot="b"] {
  --rate: 0.04;
  right: 36%;
  top: 46%;
}
.head-chips [data-slot="c"] {
  --rate: -0.09;
  right: 0;
  top: 78%;
  opacity: 0.6;
  filter: blur(0.8px);
}
@media (max-width: 1080px) {
  .head-chips {
    display: none;
  }
}

/* --------------------------------------------------------------- phones */

@media (max-width: 760px) {
  /* The brief belongs to the document, not the hero: on a phone it waited at
     the bottom of the opening screen and sat on top of the cast. It now
     arrives with the document instead. */
  .scene-enabled .brief-ticket {
    opacity: var(--arrival, 0);
  }
  /* Two prompts stay on the opening screen, where the brief used to be. */
  .depth-chips {
    display: block;
  }
  .depth-chip:not([data-b="0"]),
  .depth-chip[data-slot="c"] {
    display: none;
  }
  .depth-chip[data-b="0"][data-slot="a"] {
    left: 5%;
    top: 49%;
  }
  .depth-chip[data-b="0"][data-slot="b"] {
    left: auto;
    right: 5%;
    top: 86%;
  }
  .depth-beam {
    width: 110vw;
    left: -5vw;
  }
}

/* ------------------------------------------------------------- catalogue */

.catalogue-pair {
  gap: 20px;
}
.catalogue-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  background: var(--glass-sheen), var(--glass-fill);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  transition:
    translate 420ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 420ms cubic-bezier(0.22, 1, 0.36, 1);
}
.catalogue-card:hover,
.catalogue-card:focus-visible {
  translate: 0 -4px;
  border-color: transparent;
}
.cat-body {
  padding: 22px clamp(22px, 2.6vw, 32px) clamp(24px, 3vw, 32px);
}
.cat-visual {
  position: relative;
  height: clamp(220px, 22vw, 280px);
  overflow: hidden;
  background:
    radial-gradient(
      60% 70% at 50% 110%,
      color-mix(in srgb, var(--id) 28%, transparent),
      transparent 70%
    ),
    radial-gradient(
      40% 50% at 85% 0%,
      color-mix(in srgb, var(--id) 14%, transparent),
      transparent 70%
    );
  border-bottom: 1px solid var(--edge);
}

/* Plugins: tools as glass tiles, loosely stacked like apps on a desk. */
.tile-field {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 84px);
  grid-auto-rows: 84px;
  gap: 18px;
  place-content: center;
  transition:
    translate 520ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 420ms ease,
    filter 420ms ease;
}
.tile {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border-radius: 22px;
  background: var(--glass-sheen), var(--glass-fill);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  transition: translate 520ms cubic-bezier(0.22, 1, 0.36, 1);
}
.tile svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: var(--id-text);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
:root[data-theme="dark"] .tile svg {
  stroke: var(--id);
}
.tile em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}
.tile[data-tile="1"] { translate: 6px 10px; rotate: -4deg; }
.tile[data-tile="2"] { translate: 0 -8px; }
.tile[data-tile="3"] { translate: -6px 6px; rotate: 4deg; }
.tile[data-tile="4"] { translate: 8px -4px; rotate: 3deg; }
.tile[data-tile="5"] { translate: 0 8px; }
.tile[data-tile="6"] { translate: -8px -6px; rotate: -3deg; }
.tile.mini {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  translate: none;
  rotate: none;
}
.tile.mini svg {
  width: 18px;
  height: 18px;
}

/* Bots: the three templates standing together. */
.bot-row {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(8px, 2vw, 24px);
  padding-bottom: 26px;
  transition:
    translate 520ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 420ms ease,
    filter 420ms ease;
}
.bot-row figure {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 10px;
}
.bot-row img {
  width: clamp(84px, 9vw, 120px);
  height: auto;
  filter: drop-shadow(0 16px 14px #0003);
  transition: translate 520ms cubic-bezier(0.22, 1, 0.36, 1);
}
.bot-row figure:nth-child(2) img {
  width: clamp(96px, 10.5vw, 138px);
}
.bot-row figcaption {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--fg);
  background: var(--glass-fill);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}

/* The example: what one plugin or one bot actually looks like in use. It
   rises over the visual on hover or keyboard focus. */
.cat-example {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--glass-sheen), var(--glass-fill);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  opacity: 0;
  translate: 0 24px;
  scale: 0.98;
  transition:
    opacity 380ms ease,
    translate 520ms cubic-bezier(0.22, 1, 0.36, 1),
    scale 520ms cubic-bezier(0.22, 1, 0.36, 1);
}
.ex-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 15px;
}
.ex-title img {
  border-radius: 999px;
}
.ex-state {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--id-text);
  background: color-mix(in srgb, var(--id) 16%, transparent);
}
.cat-example dl {
  display: grid;
  gap: 6px;
  margin: 0;
}
.cat-example dl > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
.cat-example dt {
  color: var(--muted);
}
.cat-example dd {
  margin: 0;
  color: var(--fg);
  display: flex;
  gap: 4px;
}
.cat-example dd img {
  border-radius: 999px;
  background: color-mix(in srgb, var(--fg) 8%, transparent);
}
.ex-message {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
}
.ex-meta {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

@media (hover: hover) {
  .catalogue-card:is(:hover, :focus-visible) .cat-example {
    opacity: 1;
    translate: 0 0;
    scale: 1;
  }
  .catalogue-card:is(:hover, :focus-visible) :is(.tile-field, .bot-row) {
    translate: 0 -34px;
    opacity: 0.55;
    filter: blur(2px);
  }
  .catalogue-card:is(:hover, :focus-visible) .tile:nth-child(odd) {
    translate: -10px -6px;
  }
  .catalogue-card:is(:hover, :focus-visible) .tile:nth-child(even) {
    translate: 10px 6px;
  }
}
/* Touch has no hover, so the example simply sits under the visual. */
@media (hover: none) {
  .cat-visual {
    height: auto;
    display: grid;
    padding: 20px;
    gap: 16px;
  }
  .tile-field,
  .bot-row {
    position: relative;
    inset: auto;
    padding-bottom: 0;
  }
  .tile-field {
    grid-template-columns: repeat(3, 72px);
    grid-auto-rows: 72px;
    gap: 12px;
  }
  .cat-example {
    position: relative;
    inset: auto;
    opacity: 1;
    translate: none;
    scale: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chip-dots i {
    animation: none;
    opacity: 0.6;
  }
  .head-chips .depth-chip,
  .catalogue-card,
  .cat-example,
  .tile-field,
  .bot-row,
  .tile,
  .depth-beam {
    transition: none;
    translate: none;
  }
}
