/* The feature bento grid with the neighbouring cards that make way: the features of Nimbra, an invented analytics app,
   on a deep ink page. Every tile has two layers of light driven by CSS variables from script.js: the 1px edge
   (::before, a radial gradient masked to the ring) and a soft glow inside (::after). The tile under the pointer gets
   both; its neighbours only catch the reflected light on the edge that faces it. The tiles move with springs written
   as inline transforms; the live pieces inside are animated by GSAP. */
:root {
  --page: #07080c;            /* the page */
  --page-glow: rgba(120, 104, 255, 0.16); /* the soft violet haze at the top of the page */
  --card: #0f1016;            /* the body of a tile, bottom */
  --card-top: #15161f;        /* the body of a tile, top */
  --edge: rgba(255, 255, 255, 0.075); /* the edge of a tile at rest */
  --ink: #eceef5;             /* the words */
  --muted: #8b8fa3;           /* the small words */
  --faint: rgba(255, 255, 255, 0.06); /* rules and empty tracks */
  --accent: #8f80ff;          /* the light, the chart, the AI */
  --accent-soft: #c9c1ff;     /* the light where it is brightest */
  --mint: #4fdcb2;            /* good news: uptime, growth */
  --amber: #f3b35c;           /* the one incident */
  --ring: 200px;              /* the size of the light on the edge (script.js rewrites it) */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

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

body {
  min-height: 100svh;
  background:
    radial-gradient(70% 55% at 50% -8%, var(--page-glow), transparent 70%),
    radial-gradient(40% 40% at 8% 108%, rgba(79, 220, 178, 0.06), transparent 70%),
    var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  font-variation-settings: 'wdth' 100;
  -webkit-font-smoothing: antialiased;
}

/* a fine grain over everything, so the dark never looks flat */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

.bento {
  --head: 92px;
  width: min(100%, 760px);
}

.bento__head {
  height: var(--head);
  padding-bottom: 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: center;
  opacity: 0;
}

.bento__eyebrow {
  margin: 0 0 6px;
  font-size: 11.5px;
  font-weight: 560;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

.bento__title {
  margin: 0;
  font-size: clamp(20px, 3.4vw, 28px);
  font-weight: 620;
  font-variation-settings: 'wdth' 92;
  letter-spacing: -0.02em;
}

/* ---------------------------------------------------------------- the grid */
.grid {
  --gap: 10px;
  --row: clamp(86px, calc((100vh - 32px - var(--head) - 2 * var(--gap)) / 3), 150px);
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, var(--row));
  gap: var(--gap);
}

.tile--rev { grid-column: 1 / 3; grid-row: 1 / 3; }
.tile--ask { grid-column: 3 / 5; grid-row: 1; }
.tile--up { grid-column: 3; grid-row: 2; }
.tile--team { grid-column: 4; grid-row: 2; }
.tile--fun { grid-column: 1 / 5; grid-row: 3; }

.tile {
  --mx: 50%;
  --my: 50%;
  --ga: 0;                  /* the light on the edge, 0 to 1 */
  --sa: 0;                  /* the glow inside, 0 to 1 */
  --o: 1;                   /* how bright the contents are */
  position: relative;
  min-width: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--card-top), var(--card));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 1px 1px rgba(0, 0, 0, 0.5),
    0 10px 24px -12px rgba(0, 0, 0, 0.8),
    0 34px 60px -34px rgba(0, 0, 0, 0.7),
    0 0 46px -10px rgba(143, 128, 255, calc(var(--sa) * 0.32));
  outline: none;
  cursor: default;
  opacity: 0;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}

/* the 1px edge: a resting hairline plus the light at the pointer, masked to the ring */
.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background:
    radial-gradient(calc(var(--ring) * 0.5) circle at var(--mx) var(--my), rgba(255, 255, 255, calc(var(--ga) * 0.95)), rgba(201, 193, 255, calc(var(--ga) * 0.7)) 30%, transparent 80%),
    radial-gradient(var(--ring) circle at var(--mx) var(--my), rgba(143, 128, 255, calc(var(--ga) * 0.75)), transparent 70%),
    linear-gradient(rgba(143, 128, 255, calc(var(--sa) * 0.3)), rgba(143, 128, 255, calc(var(--sa) * 0.3))),
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), var(--edge) 40%, rgba(255, 255, 255, 0.035));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
}

/* the glow inside, only on the tile under the pointer */
.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(calc(var(--ring) * 1.25) circle at var(--mx) var(--my), rgba(143, 128, 255, calc(var(--sa) * 0.2)), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.tile:focus-visible::before {
  background: linear-gradient(var(--accent-soft), var(--accent-soft));
}

.tile__body {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: clamp(12px, 1.8vw, 18px);
  opacity: var(--o);
}

.tile__label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 11.5px;
  font-weight: 520;
  color: var(--muted);
  transition: color 0.4s ease;
}

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

.tile__big {
  margin: 4px 0 0;
  font-size: clamp(18px, 2.6vw, 24px);
  font-weight: 620;
  font-variation-settings: 'wdth' 90;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.tile__of {
  font-size: 0.62em;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  padding: 3px 7px 3px 4px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  vertical-align: 0.35em;
}

.chip svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chip--up {
  color: var(--mint);
  background: rgba(79, 220, 178, 0.1);
  box-shadow: inset 0 0 0 1px rgba(79, 220, 178, 0.16);
}

/* ---------------------------------------------------------------- revenue */
.rev__num {
  margin: 6px 0 0;
  font-size: clamp(24px, 4.4vw, 38px);
  font-weight: 640;
  font-variation-settings: 'wdth' 88;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rev__chart {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-top: 10px;
}

.rev__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.rev__grid {
  fill: none;
  stroke: var(--faint);
  stroke-width: 1;
  stroke-dasharray: 2 4;
  vector-effect: non-scaling-stroke;
}

.rev__line {
  fill: none;
  stroke: rgba(236, 238, 245, 0.32);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.rev__hot {
  fill: none;
  stroke: var(--accent-soft);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 5px rgba(143, 128, 255, 0.75));
}

/* the data point at Oct 28 sits at 262 / 300 across and 38 / 120 down */
.rev__cross {
  position: absolute;
  left: 87.33%;
  top: 31.67%;
  bottom: 0;
  width: 1px;
  background: linear-gradient(rgba(201, 193, 255, 0.55), transparent);
  transform-origin: 50% 0;
  transform: scaleY(0);
}

.rev__dot {
  position: absolute;
  left: calc(87.33% - 4.5px);
  top: calc(31.67% - 4.5px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2.5px var(--card-top), 0 0 0 3.5px rgba(201, 193, 255, 0.6);
  transform: scale(0);
}

.rev__tip {
  position: absolute;
  right: calc(12.67% - 16px);
  bottom: calc(68.33% + 12px);
  display: flex;
  flex-direction: column;
  padding: 6px 9px;
  border-radius: 9px;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  background: rgba(24, 25, 36, 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), 0 8px 18px -8px rgba(0, 0, 0, 0.9);
  opacity: 0;
}

.rev__tip b {
  font-size: 12.5px;
  font-weight: 620;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- the AI */
.spark {
  width: 13px;
  height: 13px;
  fill: var(--accent);
  transition: fill 0.4s ease;
}

.tile.is-on .spark {
  fill: var(--accent-soft);
}

.ask__field {
  position: relative;
  margin-top: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

/* a short beam that runs round the field while the AI thinks */
.ask__beam {
  --ang: 0deg;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--ang), transparent 0 62%, rgba(143, 128, 255, 0.9) 82%, #fff 88%, transparent 94%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0;
}

.ask__q {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ask__out {
  position: relative;
  margin-top: 9px;
  min-height: 30px;
}

.ask__skel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 4px;
}

.ask__skel i {
  display: block;
  height: 6px;
  width: 86%;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.05));
}

.ask__skel i + i {
  width: 54%;
}

.ask__a {
  position: relative;
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
}

.ask__a span {
  display: inline-block;
  opacity: 0;
}

/* ---------------------------------------------------------------- uptime */
.up__bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  margin-top: auto;
  height: clamp(16px, 4.2vh, 28px);
}

.up__bars i {
  flex: 1;
  height: 100%;
  border-radius: 2px;
  background: var(--mint);
  opacity: 0.38;
  transform-origin: 50% 100%;
  transition: opacity 0.45s ease;
}

.up__bars i.is-off {
  background: var(--amber);
}

.tile.is-on .up__bars i {
  opacity: 0.92;
}

/* ---------------------------------------------------------------- seats */
.team__row {
  display: flex;
  margin-top: auto;
  padding-left: 6px;
}

.face {
  display: grid;
  place-items: center;
  width: clamp(22px, 3.4vw, 28px);
  height: clamp(22px, 3.4vw, 28px);
  margin-left: -4px;
  border-radius: 50%;
  letter-spacing: -0.02em;
  font-size: 9px;
  font-weight: 640;
  color: #0b0c10;
  background: linear-gradient(150deg, hsl(var(--h) 80% 82%), hsl(var(--h) 60% 64%));
  box-shadow: 0 0 0 2px var(--card), 0 4px 8px -3px rgba(0, 0, 0, 0.8);
}

.face--more {
  color: var(--ink);
  background: #22232e;
  transition: background 0.4s ease;
}

.tile.is-on .face--more {
  background: var(--accent);
}

/* ---------------------------------------------------------------- funnel */
.fun__cols {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(4px, 0.8vw, 8px);
  margin-top: 8px;
}

.fun__col {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto 1fr;
  column-gap: 6px;
  align-items: baseline;
  min-height: 0;
}

.fun__col b {
  font-size: 13px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.fun__col small {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* each step is a block as wide as its column, filled from the bottom */
.fun__bar {
  position: relative;
  grid-column: 1 / 3;
  grid-row: 2;
  align-self: stretch;
  margin-top: 6px;
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.fun__bar i {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(201, 193, 255, 0.95), rgba(143, 128, 255, 0.55) 60%, rgba(143, 128, 255, 0.25));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  opacity: 0.42;
  transform-origin: 50% 100%;
  transition: opacity 0.4s ease;
}

.tile.is-on .fun__bar i {
  opacity: 1;
}

/* ---------------------------------------------------------------- the pointer of the walk */
.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -5px;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
  fill: #fff;
  stroke: #0b0c10;
  stroke-width: 1.3;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.55));
}

/* ---------------------------------------------------------------- narrow: two columns, the head goes */
@media (max-width: 560px) {
  .grid {
    --gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tile--rev { grid-column: 1; grid-row: 1 / 3; }
  .tile--ask { grid-column: 2; grid-row: 1; }
  .tile--up { grid-column: 2; grid-row: 2; }
  .tile--team { grid-column: 1; grid-row: 3; }
  .tile--fun { grid-column: 2; grid-row: 3; }
  .tile { border-radius: 15px; }
  .tile__body { padding: 11px; }
  .tile__label { font-size: 10.5px; }
  .face { margin-left: -2px; }
  .team__row { padding-left: 2px; }
  .rev__num { font-size: clamp(20px, 7vw, 28px); }
  .chip { display: flex; width: max-content; margin: 6px 0 0; font-size: 10px; }
  .ask__field { margin-top: 7px; padding: 5px 8px; font-size: 11px; }
  .ask__out { margin-top: 6px; }
  .ask__a { font-size: 10.5px; line-height: 1.35; }
  .fun__cols { gap: 4px; margin-top: 6px; }
  .fun__col b { font-size: 10px; }
  .fun__col small { display: none; }
  .fun__bar { margin-top: 4px; border-radius: 5px; }
  .rev__tip { font-size: 9.5px; padding: 4px 7px; }
  .rev__tip b { font-size: 11px; }
}

@media (max-height: 520px), (max-width: 420px) {
  .bento { --head: 0px; }
  .bento__head { display: none; }
}
