/* World simulator (js/world-simulator.js, 2026-11-14): word chips on the left, and on the right a stage that takes on
   the chosen words' colours, with the closest work and a short brief. The colours are registered so the light glides
   from one world to the next instead of jumping. */
@property --w1 { syntax: '<color>'; inherits: true; initial-value: #78f7e8; }
@property --w2 { syntax: '<color>'; inherits: true; initial-value: #b99bff; }
@property --w3 { syntax: '<color>'; inherits: true; initial-value: #e9d29a; }

.world-sim-body {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 32px;
  align-items: start;
  max-width: 1120px;
  margin: 0 auto;
}

.world-sim-words { min-width: 0; margin: 0; padding: 0; border: 0; }
.world-sim-words legend {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  padding: 0;
  color: var(--neo-text);
  font-size: 1.125rem;
  font-weight: 700;
}
.world-sim-words legend span { color: var(--neo-gold-light); font-size: .8125rem; font-weight: 600; }
.world-sim-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.world-chip {
  --chip: rgba(120, 247, 232, .3);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 60px;
  padding: 10px 14px 10px 30px;
  border: 1px solid var(--chip);
  background: linear-gradient(225deg, transparent 7.8px, var(--chip) 7.8px, var(--chip) 9.2px, transparent 9.2px), rgba(120, 247, 232, .03);
  color: rgba(232, 240, 239, .86);
  font: inherit;
  font-size: .9375rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease, transform .12s ease;
}
.world-chip [lang="en"] { color: rgba(232, 240, 239, .6); font: 600 .6875rem/1.3 'Chakra Petch', sans-serif; letter-spacing: .16em; }
.world-chip::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border: 1px solid rgba(120, 247, 232, .55);
  transform: rotate(45deg);
  transition: background-color .2s ease, box-shadow .2s ease;
}
.world-chip:hover { --chip: rgba(120, 247, 232, .55); color: #fff; }
.world-chip[aria-pressed="true"] {
  --chip: var(--hue);
  background-color: color-mix(in srgb, var(--hue) 14%, transparent);
  color: #fff;
  box-shadow: inset 0 0 20px color-mix(in srgb, var(--hue) 22%, transparent);
}
.world-chip[aria-pressed="true"] [lang="en"] { color: var(--hue); }
.world-chip[aria-pressed="true"]::before { border-color: var(--hue); background: var(--hue); box-shadow: 0 0 10px var(--hue); }
.world-chip:focus-visible { outline: 2px solid var(--neo-gold-light); outline-offset: -4px; }
.world-chip:active { transform: scale(.98); }

.world-sim-stage {
  --w1: #78f7e8;
  --w2: #b99bff;
  --w3: #e9d29a;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--w1) 45%, transparent);
  background:
    radial-gradient(ellipse 70% 60% at 0% 0%, color-mix(in srgb, var(--w1) 26%, transparent), transparent 70%),
    radial-gradient(ellipse 60% 70% at 100% 100%, color-mix(in srgb, var(--w2) 24%, transparent), transparent 70%),
    radial-gradient(ellipse 50% 40% at 80% 10%, color-mix(in srgb, var(--w3) 16%, transparent), transparent 70%),
    #05090b;
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%);
  transition: --w1 .7s ease, --w2 .7s ease, --w3 .7s ease, border-color .7s ease;
}
/* A band of light sweeps down the stage when the world changes. */
.world-sim-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--w1) 30%, transparent) 50%, transparent);
  background-size: 100% 40%;
  background-repeat: no-repeat;
  background-position: 0 -60%;
  opacity: 0;
  pointer-events: none;
}
html[data-motion="on"] .world-sim-stage.is-shifting::after { animation: world-sim-sweep .7s ease-out; }
@keyframes world-sim-sweep {
  from { opacity: 1; background-position: 0 -60%; }
  to { opacity: 0; background-position: 0 160%; }
}

.world-sim-visual { margin: 0; min-width: 0; }
.world-sim-visual img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid color-mix(in srgb, var(--w1) 40%, transparent);
}
.world-sim-work { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.world-sim-work small { color: var(--neo-gold-light); font: 600 .6875rem/1.4 'Chakra Petch', 'Noto Sans JP', sans-serif; letter-spacing: .16em; }
.world-sim-work strong { color: #fff; font: 700 1.125rem/1.35 'Chakra Petch', 'Noto Sans JP', sans-serif; }
.world-sim-work span { color: rgba(232, 240, 239, .76); font-size: .875rem; }

.world-sim-readout { display: flex; flex-direction: column; min-width: 0; }
.world-sim-code { margin: 0; color: var(--w1); font: 600 .75rem/1.4 'Chakra Petch', sans-serif; letter-spacing: .2em; transition: color .7s ease; }
.world-sim-name { margin: 6px 0 16px; color: #fff; font-size: 1.375rem; font-weight: 700; line-height: 1.4; }
.world-sim-readout dl { display: grid; gap: 10px; margin: 0 0 20px; }
.world-sim-readout dl div { display: grid; grid-template-columns: 4.5em minmax(0, 1fr); gap: 8px; padding-bottom: 10px; border-bottom: 1px solid rgba(232, 240, 239, .12); }
.world-sim-readout dt { color: var(--neo-gold-light); font-size: .8125rem; font-weight: 600; line-height: 1.6; }
.world-sim-readout dd { margin: 0; color: rgba(244, 251, 250, .92); font-size: .9375rem; line-height: 1.6; }
.world-sim-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: auto; }
.world-sim-consult { min-height: 48px; }
.world-sim-note { margin: 20px auto 0; max-width: 1120px; color: rgba(232, 240, 239, .66); font-size: .8125rem; text-align: center; }

@media (max-width: 960px) {
  .world-sim-body { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 600px) {
  .world-sim-stage { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px; }
  .world-sim-name { font-size: 1.25rem; }
  .world-sim-actions { flex-direction: column; align-items: stretch; text-align: center; }
  .world-sim-consult { justify-content: center; }
}
@media (max-width: 360px) {
  .world-chip { padding-right: 10px; font-size: .875rem; }
}
