/* =========================================================================
   FutureChoice.AI — Data Explorer (prototype)
   Lozenge height = 40px, half = 20px → consistent corner radius.
   ========================================================================= */

:root {
  --sim-control-height: 32px;
  --sim-radius: 8px;           /* locked-in radius for everything */
}

.sim {
  margin: 0 var(--gutter--dynamic) var(--gutter--dynamic);
  padding-top: 120px;
  flex: 1 0 auto;
}

/* Outer dark-grey container, square corners, 64px inner padding.
   aspect-ratio: 16/9 acts as a *minimum* — content can grow taller than that
   and the box expands. justify-content: flex-start keeps content top-aligned. */
.sim__shell {
  background: #1a1a1a;
  border-radius: 0;
  padding: 64px;
  display: flex;
  flex-direction: column;
  gap: calc(var(--unit) * 8);
  aspect-ratio: 16 / 9;
  justify-content: flex-start;
}
@media (max-width: 799px) {
  .sim__shell { padding: calc(var(--unit) * 6); aspect-ratio: auto; }
}

/* ---------- Intro ---------- */
.sim__intro {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gutter--dynamic);
}
@media (min-width: 800px) {
  .sim__intro { grid-template-columns: 1fr 1fr; }
}
.sim__title { display: block; }
.sim__lede__hint { color: var(--color_black--130); margin-top: 1em; }
.sim__lede__hint .t { color: var(--color_black--130); }
.sim__lede__cta { margin-top: 1em; color: var(--color_black--130); }
.sim__lede__cta .t { color: var(--color_black--130); }

/* ---------- Results block: world card + randomise button stacked, 8px gap ---------- */
.sim__results-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sim__randomise[hidden] { display: none; }

.sim__randomise {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 calc(var(--unit) * 5);
  height: var(--sim-control-height);
  max-height: var(--sim-control-height);
  background: var(--color_black--120);
  border: 0;
  border-radius: var(--sim-radius);
  color: var(--color_white);
  cursor: none;
  transition: background-color .2s linear;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.sim__randomise:hover { background: var(--color_black--140); color: var(--color_black); }
.sim__randomise__label { font-size: 16px; line-height: 21px; letter-spacing: .2px; }
.sim__randomise__label .t { font-size: 16px; line-height: 21px; letter-spacing: .2px; }
.sim__randomise__icon  { display: inline-flex; align-items: center; height: 14px; }
.sim__randomise__icon svg { display: block; width: 14px; height: 14px; }

/* ---------- Lozenge choice grid ---------- */
.sim__choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: calc(var(--unit) * 2);
  align-items: start;          /* don't stretch siblings to match a tall lozenge */
}
@media (min-width: 800px) {
  .sim__choices { grid-template-columns: repeat(4, 1fr); }
}

.sim__choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: calc(var(--unit) * 2);
  min-width: 0;
}

/* Player label sits flush-left to the lozenge edge. */
.sim__choice__label {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--unit) * 2);
  color: var(--color_white);
  padding-left: 0;
}
.sim__choice__dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--dot, var(--color_white));
}

.sim__choice__btn {
  display: block;
  width: 100%;
  padding: calc(var(--unit) * 1.5) calc(var(--unit) * 7) calc(var(--unit) * 1.5) calc(var(--unit) * 4);
  background: var(--color_black--120);
  border: 0;
  border-radius: var(--sim-radius);
  text-align: left;
  cursor: none;
  transition: background-color .2s linear, color .2s linear;
  position: relative;
  font: inherit;
  color: inherit;
  min-height: var(--sim-control-height);
}
.sim__choice__btn:hover { background: var(--color_black--140); color: var(--color_black); }
.sim__choice__btn:hover .sim__choice__value,
.sim__choice__btn:hover .sim__choice__chevron { color: var(--color_black); }

/* Open and selected → creamy bg, black text for adequate contrast. */
.sim__choice.--open  .sim__choice__btn,
.sim__choice.--selected .sim__choice__btn {
  background: var(--color_black--140);
  color: var(--color_black);
}
.sim__choice.--open  .sim__choice__value,
.sim__choice.--selected .sim__choice__value,
.sim__choice.--open  .sim__choice__chevron,
.sim__choice.--selected .sim__choice__chevron { color: var(--color_black); }

.sim__choice__value {
  display: block;
  color: var(--color_white);
  font-size: 16px;
  line-height: 21px;
  letter-spacing: .2px;
  white-space: normal;
}
.sim__choice__value.--placeholder { color: var(--color_white); opacity: .55; }

.sim__choice__chevron {
  position: absolute;
  right: calc(var(--unit) * 3);
  top: 16px;                        /* half of 32px lozenge height */
  transform: translateY(-50%);
  color: var(--color_white);
  transition: transform .2s ease, color .2s linear;
  font-size: 9px;
  line-height: 1;
  opacity: .85;
}
.sim__choice.--open .sim__choice__chevron { transform: translateY(-50%) rotate(180deg); }

.sim__choice__menu {
  position: absolute;
  top: calc(100% + var(--unit));
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--color_black--120);
  border-radius: var(--sim-radius);
  list-style: none;
  margin: 0;
  padding: calc(var(--unit) * 1);
  max-height: calc(var(--unit) * 80);
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.6);
}
.sim__choice__menu[hidden] { display: none; }
.sim__choice__menu li {
  padding: calc(var(--unit) * 2) calc(var(--unit) * 3);
  border-radius: calc(var(--sim-radius) - 4px);
  cursor: none;
  transition: background-color .15s linear, color .15s linear;
  font-size: 16px;
  line-height: 21px;
  letter-spacing: .2px;
  color: var(--color_white);
}
.sim__choice__menu li:hover,
.sim__choice__menu li.--is-selected {
  background: var(--color_black--140);
  color: var(--color_black);
}

/* ---------- Outcome panels — 14px grey, no role label ---------- */
.sim__outcomes {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gutter--dynamic);
}
@media (min-width: 800px) {
  .sim__outcomes { grid-template-columns: repeat(4, 1fr); }
}
.sim__outcome { min-width: 0; }
.sim__outcome p {
  white-space: pre-line;
  color: var(--color_black--130);
  font-size: 14px;
  line-height: 18px;
}
.sim__outcome p + p { margin-top: .8em; }

/* Caret while typing */
.sim__outcome p.--typing::after,
.sim__global__changes dt.--typing::after,
.sim__global__changes dd.--typing::after,
.sim__global__body p.--typing::after {
  content: '';
  display: inline-block;
  width: .5em;
  height: 1em;
  margin-left: 2px;
  vertical-align: -2px;
  background: currentColor;
  opacity: .8;
  animation: simBlink 0.6s steps(1) infinite;
}
@keyframes simBlink { 50% { opacity: 0; } }

/* ---------- Global outcome — pastel-tinted card, drawer animation, 50/50 split ---------- */
.sim__global {
  background: var(--color_white);
  color: var(--color_black);
  border-radius: var(--sim-radius);
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  transform-origin: top center;
  transform: scaleY(0);
  opacity: 0;
  transition: transform .45s cubic-bezier(.4, 0, .2, 1), opacity .1s ease, background-color .3s linear;
  overflow: hidden;
}
.sim__global.--open { transform: scaleY(1); opacity: 1; }
/* Knocked-back state: while the card is being re-rendered, dim it so the
   user feels the previous future is no longer valid. */
.sim__global.--open.--dimmed { opacity: .15; }
@media (min-width: 800px) {
  .sim__global { grid-template-columns: 1fr 1fr; gap: 24px; }
}

/* Pastel tints per sentiment — extrapolated from the sentiment chip colours,
   then lightened so they sit closer to white. */
.sim__global.--positive { background: #F2FFF5; }
.sim__global.--neutral  { background: #ffffff; }
.sim__global.--negative { background: #FFF2F8; }

.sim__global__changes { display: flex; flex-direction: column; gap: calc(var(--unit) * 2); min-width: 0; }
.sim__global__changes h3 {
  font-size: 14px;
  line-height: 18px;
  font-weight: 700;
  margin: 0;
}

.sim__global__changes dl { margin: 0; padding: 0; }
.sim__global__changes .change {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: calc(var(--unit) * 4);
  padding: calc(var(--unit) * 2) 0;
  border-top: 1px solid rgba(0, 0, 0, .08);
}
.sim__global__changes .change:last-child { border-bottom: 1px solid rgba(0, 0, 0, .08); }
.sim__global__changes dt {
  font-size: 14px; line-height: 18px;
  color: var(--color_black);
}
.sim__global__changes dd {
  font-size: 14px; line-height: 18px;
  color: var(--color_black--130);
  margin: 0;
  text-align: right;
}

.sim__global__body { white-space: pre-line; min-width: 0; }
.sim__global__body p + p { margin-top: 1em; }
/* Lock the world card body to --large's 28/30 size — no further uplift at 1680+. */
@media (min-width: 1680px) {
  .sim__global__body .t.--large {
    font-size: 28px;
    line-height: 30px;
  }
}

.sim__global__sentiment {
  display: inline-flex;
  align-items: center;
  margin-top: calc(var(--unit) * 4);
  padding: calc(var(--unit) * 1) calc(var(--unit) * 3);
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 1px;
  width: fit-content;
  font-size: 14px;
  line-height: 18px;
}
.sim__global__sentiment .t { font-size: 14px; line-height: 18px; }
.sim__global__sentiment.--positive { background: #01F44E; color: var(--color_black); }
.sim__global__sentiment.--neutral  { background: var(--color_black--140); color: var(--color_black); }
.sim__global__sentiment.--negative { background: var(--color_red); color: var(--color_white); }

@media (max-width: 799px) {
  .sim__global { padding: calc(var(--unit) * 8); }
}
