/* css/components.css — cards, modal, command palette, companions, interactive components */

/* =======================================================================
   6.4 & 6.12 PROJECT CARDS
   ======================================================================= */
.card {
  flex: 0 0 clamp(320px, calc((100vw - 8vw - 48px) / 3), 440px);
  width: clamp(320px, calc((100vw - 8vw - 48px) / 3), 440px);
  scroll-snap-align: start;
  position: relative;
  transition: transform .5s var(--ease), outline-color .3s ease;
  outline: 1px solid transparent;
  outline-offset: -1px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

@media (max-width: 1024px) {
  .card {
    flex: 0 0 clamp(300px, calc((100vw - 8vw - 24px) / 2), 400px);
    width: clamp(300px, calc((100vw - 8vw - 24px) / 2), 400px);
  }
}
@media (max-width: 640px) {
  .card {
    flex: 0 0 85vw;
    width: 85vw;
  }
}

.card:hover {
  transform: translateY(-8px) scale(1.012);
  outline-color: var(--red);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 59, 48, 0.4), 0 0 35px rgba(255, 59, 48, 0.16);
}
.card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 2px;
  background: radial-gradient(360px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 59, 48, 0.16), transparent 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
  z-index: 5;
}
.card:hover::after {
  opacity: 1;
}
.card:hover .card__media {
  border-color: rgba(255, 59, 48, 0.45);
}
.card:hover .card__title {
  color: #fff;
  text-shadow: 0 0 14px rgba(255, 59, 48, 0.4);
  transform: translateX(2px);
}
.card:hover .card__n {
  text-shadow: 0 0 16px var(--red);
  transform: scale(1.06);
}
.card:hover .card__meta {
  color: #e2e8f0;
}
.card:hover .card__arrow {
  color: var(--red);
  transform: translate(4px, -4px) rotate(45deg);
}

.card__media {
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  background: linear-gradient(135deg, #2a1114, #10131c);
  background-image: radial-gradient(60% 80% at 20% 0%, rgba(255, 59, 48, .25), transparent),
                    radial-gradient(60% 80% at 100% 100%, rgba(59, 130, 255, .18), transparent);
  border: 1px solid var(--line);
}

.card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .8s var(--ease);
}
.card:hover .card__img {
  transform: scale(1.05);
}

/* Fallback card look when static JPG is missing */
.card__initials {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--f-display);
  font-size: 130px;
  line-height: 1;
  color: #fff;
  opacity: .12;
  user-select: none;
  pointer-events: none;
}
.card__stack {
  position: absolute;
  left: 12px;
  bottom: 8px;
  font: 500 10px/1.3 var(--f-ui);
  color: var(--muted);
  user-select: none;
  pointer-events: none;
}
.card__tag {
  position: absolute;
  left: 10px;
  top: 10px;
  font: 800 9px/1 var(--f-ui);
  text-transform: uppercase;
  padding: 4px 7px;
  background: rgba(0, 0, 0, .6);
  border-left: 2px solid var(--red);
  color: #fff;
  border-radius: 1px;
  z-index: 2;
}

/* Bespoke Card Posters */
.card__poster {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  background: #0c0f17;
  font-family: var(--f-mono);
  user-select: none;
  transition: transform .6s var(--ease), filter .6s var(--ease);
}
.card:hover .card__poster {
  transform: scale(1.02);
  filter: brightness(1.08);
}
.card__poster--yulya {
  background: radial-gradient(circle at 85% 15%, rgba(88, 101, 242, .25), transparent 60%), linear-gradient(145deg, #0e111a, #07090e);
  border-top: 1px solid rgba(88, 101, 242, .3);
}
.card__poster--yulya-studio {
  background: radial-gradient(circle at 15% 85%, rgba(255, 59, 48, .2), transparent 60%), linear-gradient(145deg, #110e1a, #07090e);
  border-top: 1px solid rgba(255, 59, 48, .3);
}
.card__poster--learnexa {
  background: radial-gradient(circle at 50% 10%, rgba(16, 185, 129, .2), transparent 60%), linear-gradient(145deg, #0b1414, #07090e);
  border-top: 1px solid rgba(16, 185, 129, .3);
}
.card__poster--yulya-models {
  background: radial-gradient(circle at 80% 80%, rgba(245, 158, 11, .2), transparent 60%), linear-gradient(145deg, #14120c, #07090e);
  border-top: 1px solid rgba(245, 158, 11, .3);
}
.card__poster--desktop-ai-companion {
  background: radial-gradient(circle at 50% 50%, rgba(56, 189, 248, .22), transparent 70%), linear-gradient(145deg, #09131a, #07090e);
  border-top: 1px solid rgba(56, 189, 248, .3);
}
.card__poster--yulya-landing {
  background: radial-gradient(circle at 20% 20%, rgba(255, 59, 48, .3), transparent 65%), linear-gradient(145deg, #19090b, #07090e);
  border-top: 1px solid var(--red);
}
.card__poster--mascot-website {
  background: radial-gradient(circle at 70% 30%, rgba(168, 85, 247, .25), transparent 60%), linear-gradient(145deg, #140d1a, #07090e);
  border-top: 1px solid rgba(168, 85, 247, .3);
}
.card__poster--textlink {
  background: radial-gradient(circle at 30% 70%, rgba(14, 165, 233, .2), transparent 60%), linear-gradient(145deg, #0a1118, #07090e);
  border-top: 1px solid rgba(14, 165, 233, .3);
}
.card__poster--yulya-api {
  background: radial-gradient(circle at 85% 85%, rgba(34, 197, 94, .2), transparent 60%), linear-gradient(145deg, #09150e, #07090e);
  border-top: 1px solid rgba(34, 197, 94, .3);
}
.card__poster--graphic-design {
  background: linear-gradient(135deg, #1a0505 0%, #0d0d0f 50%, #200808 100%);
  border-top: 1px solid var(--red);
}
.card__poster--brand-identity {
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, .08), transparent 60%), linear-gradient(145deg, #121318, #08090d);
  border-top: 1px solid rgba(255, 255, 255, .2);
}

.poster__head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 8.5px;
  margin-bottom: 6px;
}
.poster__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}
.card__poster .poster__title {
  color: #64748b;
  letter-spacing: .05em;
  font-size: 8.5px;
}
.poster__badge {
  font-size: 7.5px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  padding: 2px 5px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.poster__bot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}
.poster__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  margin: 4px 0;
}
.poster__avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #5865f2;
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(88, 101, 242, .5);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.card:hover .poster__avatar {
  transform: scale(1.1);
  box-shadow: 0 0 24px rgba(88, 101, 242, .9), 0 0 0 4px rgba(88, 101, 242, .3);
}
.poster__avatar--lg {
  width: 44px;
  height: 44px;
  font-size: 16px;
  box-shadow: 0 0 16px rgba(88, 101, 242, .6);
}
.card:hover .poster__avatar--lg {
  transform: scale(1.08);
  box-shadow: 0 0 28px rgba(88, 101, 242, .95), 0 0 0 5px rgba(88, 101, 242, .35);
}
.poster__msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.poster__sender {
  font-size: 9px;
  font-weight: 700;
  color: #5865f2;
}
.poster__bubble {
  font-size: 8.5px;
  color: #cbd5e1;
  background: rgba(0, 0, 0, .4);
  padding: 4px 8px;
  border-radius: 3px;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.poster__waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 48px;
  margin: 10px auto;
  padding: 8px 16px;
  background: rgba(0, 0, 0, .3);
  border-radius: 4px;
  border: 1px solid rgba(88, 101, 242, .2);
  transition: border-color .3s ease, box-shadow .3s ease;
}
.card:hover .poster__waveform {
  border-color: rgba(88, 101, 242, .55);
  box-shadow: 0 0 24px rgba(88, 101, 242, .25);
}
.poster__waveform i {
  width: 4px;
  height: 25%;
  background: #5865f2;
  border-radius: 2px;
  transform-origin: center;
  transition: transform .25s ease;
}
.poster__waveform i:nth-child(even) { height: 60%; background: #00f0ff; }
.poster__waveform i:nth-child(3n) { height: 95%; background: var(--red); }
.poster__waveform i:nth-child(4n) { height: 40%; background: #34d399; }

@keyframes waveformPulse {
  0% {
    transform: scaleY(0.2);
    filter: brightness(0.8);
  }
  100% {
    transform: scaleY(1.25);
    filter: brightness(1.35);
  }
}
.card:hover .poster__waveform i {
  animation: waveformPulse .65s ease-in-out infinite alternate;
}
.card:hover .poster__waveform i:nth-child(1) { animation-delay: 0.04s; }
.card:hover .poster__waveform i:nth-child(2) { animation-delay: 0.22s; }
.card:hover .poster__waveform i:nth-child(3) { animation-delay: 0.11s; }
.card:hover .poster__waveform i:nth-child(4) { animation-delay: 0.38s; }
.card:hover .poster__waveform i:nth-child(5) { animation-delay: 0.18s; }
.card:hover .poster__waveform i:nth-child(6) { animation-delay: 0.44s; }
.card:hover .poster__waveform i:nth-child(7) { animation-delay: 0.08s; }
.card:hover .poster__waveform i:nth-child(8) { animation-delay: 0.31s; }
.card:hover .poster__waveform i:nth-child(9) { animation-delay: 0.24s; }
.card:hover .poster__waveform i:nth-child(10) { animation-delay: 0.41s; }
.card:hover .poster__waveform i:nth-child(11) { animation-delay: 0.14s; }
.card:hover .poster__waveform i:nth-child(12) { animation-delay: 0.35s; }
.card:hover .poster__waveform i:nth-child(13) { animation-delay: 0.27s; }
.card:hover .poster__waveform i:nth-child(14) { animation-delay: 0.47s; }
.card:hover .poster__waveform i:nth-child(15) { animation-delay: 0.09s; }
.card:hover .poster__waveform i:nth-child(16) { animation-delay: 0.29s; }
.poster__chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: auto;
}
.poster__chip {
  font-size: 8px;
  color: #94a3b8;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .08);
  padding: 2px 5px;
  border-radius: 2px;
}
.poster__head-left {
  display: flex;
  align-items: center;
  gap: 6px;
}
.poster__head-tabs {
  display: flex;
  gap: 4px;
  align-items: center;
}
.poster__tab {
  font-size: 7.5px;
  font-family: var(--f-mono);
  color: var(--muted);
  padding: 1px 5px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  transition: all .2s ease;
}
.poster__tab.is-active,
.poster__tab.active,
.active {
  color: #38bdf8;
  background: rgba(56, 189, 248, .12);
  border-color: rgba(56, 189, 248, .35);
  font-weight: 600;
}
.poster__ide {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin: 8px 0;
  flex: 1;
}
.poster__code {
  flex: 1.1;
  font-size: 8px;
  line-height: 1.6;
  color: #cbd5e1;
  background: rgba(0, 0, 0, .45);
  padding: 8px 10px;
  border-radius: 3px;
  border-left: 2px solid var(--red);
  display: block;
  overflow: hidden;
}
.poster__ln {
  color: #475569;
  margin-right: 6px;
  font-family: var(--f-mono);
  user-select: none;
}
.poster__kw { color: #f43f5e; }
.poster__fn { color: #38bdf8; }
.poster__str { color: #34d399; }
.poster__p { color: #f59e0b; }
.poster__n { color: #a855f7; }
.poster__stage {
  flex: 0.9;
  position: relative;
  min-height: 80px;
  background: #07090e;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.poster__grid {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0, transparent 9px, rgba(255, 59, 48, .12) 10px),
              repeating-linear-gradient(90deg, transparent 0, transparent 9px, rgba(56, 189, 248, .12) 10px);
}
.poster__radar {
  position: absolute;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px dashed rgba(0, 240, 255, .35);
  pointer-events: none;
  animation: radarSweep 4s linear infinite;
  transition: border-color .3s ease;
}
.card:hover .poster__radar {
  animation-duration: 1.8s;
  border-color: rgba(0, 240, 255, .8);
}
.poster__reticle {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(0, 240, 255, .5);
  border-radius: 50%;
  pointer-events: none;
}
.poster__craft {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid #00f0ff;
  transform: rotate(45deg);
  box-shadow: 0 0 10px #00f0ff;
  z-index: 2;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.card:hover .poster__craft {
  transform: rotate(45deg) scale(1.25);
  box-shadow: 0 0 20px #00f0ff, 0 0 40px rgba(0, 240, 255, .55);
}
.poster__sun {
  position: absolute;
  bottom: -15px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(to top, #ff3b30, #ffb020);
  filter: drop-shadow(0 0 12px rgba(255, 59, 48, .7));
}
.poster__telemetry {
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 7px;
  font-family: var(--f-mono);
  color: #38bdf8;
  background: rgba(0, 0, 0, .75);
  padding: 2px 5px;
  border-radius: 2px;
  border: 1px solid rgba(56, 189, 248, .25);
  letter-spacing: .05em;
  white-space: nowrap;
  z-index: 3;
}
.poster__match {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0;
  flex: 1;
}
.poster__card {
  flex: 1;
  background: rgba(0, 0, 0, .45);
  border: 1px solid rgba(16, 185, 129, .2);
  padding: 10px 12px;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color .3s ease, box-shadow .3s ease, transform .3s var(--ease);
}
.card:hover .poster__card {
  border-color: rgba(16, 185, 129, .5);
  box-shadow: 0 0 20px rgba(16, 185, 129, .2);
}
.poster__sub {
  font-size: 7px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.poster__card b {
  font-size: 9.5px;
  color: #34d399;
  font-weight: 700;
}
.poster__swap {
  font-size: 16px;
  color: #38bdf8;
  font-weight: bold;
  display: inline-block;
  transition: transform .45s var(--ease), color .3s ease, text-shadow .3s ease;
}
.card:hover .poster__swap {
  transform: rotate(180deg) scale(1.25);
  color: #34d399;
  text-shadow: 0 0 12px rgba(52, 211, 153, .7);
}
.poster__models {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
  flex: 1;
  justify-content: center;
}
.poster__chart {
  height: 48px;
  width: 100%;
}
.poster__svg {
  width: 100%;
  height: 100%;
}
.poster__cmd {
  font-size: 8.5px;
  color: #fbbf24;
  background: rgba(0, 0, 0, .5);
  padding: 5px 8px;
  border-radius: 2px;
  font-family: var(--f-mono);
}
.poster__graph {
  position: relative;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0;
  flex: 1;
}
.poster__node {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}
.poster__node--center {
  width: 26px;
  height: 26px;
  font-size: 9px;
  font-weight: 800;
  color: #000;
  background: #00f0ff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 0 12px #00f0ff;
}
.poster__node--1 { top: 12px; left: 24%; }
.poster__node--2 { bottom: 12px; left: 30%; }
.poster__node--3 { top: 18px; right: 26%; }
.poster__link {
  position: absolute;
  height: 1px;
  background: rgba(56, 189, 248, .35);
  z-index: 1;
}
.poster__link--1 { width: 48px; top: 22px; left: 30%; transform: rotate(-25deg); }
.poster__link--2 { width: 44px; bottom: 24px; left: 34%; transform: rotate(35deg); }
.poster__link--3 { width: 52px; top: 28px; right: 30%; transform: rotate(-15deg); }
.poster__showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 8px 0;
  flex: 1;
}
.poster__glowtext {
  font-family: var(--f-display);
  font-size: 44px;
  font-weight: 900;
  letter-spacing: .08em;
  color: #fff;
  text-shadow: 0 0 25px rgba(255, 59, 48, .9);
  line-height: 1;
}
.poster__subtext {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .15em;
  color: var(--muted);
  text-transform: uppercase;
}
.card__poster .poster__btn {
  font-size: 8.5px;
  font-weight: 700;
  color: #fff;
  background: var(--red);
  padding: 4px 10px;
  border-radius: 2px;
  margin-top: 4px;
}
.poster__mascot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 0;
  flex: 1;
}
.poster__botface {
  width: 56px;
  height: 42px;
  border-radius: 12px;
  background: #1f142e;
  border: 2px solid #a855f7;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(168, 85, 247, .5);
}
.poster__eyes {
  width: 30px;
  height: 8px;
  border-radius: 4px;
  background: #00f0ff;
  box-shadow: 0 0 8px #00f0ff;
}
.poster__mascotstat {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .12em;
  color: #c084fc;
  text-transform: uppercase;
}
.poster__textlink {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
  flex: 1;
}
.poster__urlbox {
  font-size: 13px;
  color: #fff;
  background: rgba(0, 0, 0, .5);
  border: 1px dashed rgba(14, 165, 233, .6);
  padding: 8px 18px;
  border-radius: 4px;
}
.poster__urlbox b { color: #38bdf8; }
.poster__tagline {
  font-size: 8px;
  color: var(--muted);
  letter-spacing: .06em;
}
.poster__api {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
  flex: 1;
  justify-content: center;
}
.poster__endpoint {
  font-size: 11px;
  color: #fff;
  font-weight: 700;
  background: rgba(0, 0, 0, .5);
  border: 1px solid rgba(34, 197, 94, .25);
  padding: 8px 12px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.poster__method {
  font-size: 8px;
  font-weight: 800;
  color: #22c55e;
  background: rgba(34, 197, 94, .15);
  padding: 2px 5px;
  border-radius: 2px;
}
.poster__json {
  font-size: 8.5px;
  color: #94a3b8;
  padding-left: 8px;
}
.poster__swiss {
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 10px 0;
  flex: 1;
}
.poster__swisstop {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .14em;
  color: var(--red);
}
.poster__swissbig {
  font-family: var(--f-display);
  font-size: 52px;
  font-weight: 900;
  line-height: 0.9;
  color: #fff;
  letter-spacing: -0.02em;
}
.card__poster .poster__brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 10px 0;
  flex: 1;
  justify-content: center;
}
.poster__swatches {
  display: flex;
  gap: 8px;
}
.poster__color {
  flex: 1;
  height: 24px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, .15);
}
.poster__color--1 { background: #ff3b30; }
.poster__color--2 { background: #00f0ff; }
.poster__color--3 { background: #0d1117; }
.poster__color--4 { background: #f3f4f6; }
.poster__specimen {
  font-size: 8px;
  color: #94a3b8;
  letter-spacing: .08em;
}
.poster__generic {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.card__row {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-top: 14px;
}
.card__n {
  font-family: var(--f-display);
  font-size: 34px;
  line-height: 1;
  color: var(--red);
}
.card__txt {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.card__title {
  font-family: var(--f-body);
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card__title mark {
  background: transparent;
  color: var(--accent);
  font-weight: 900;
}
.card__meta {
  font: 500 10px/1.2 var(--f-ui);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.card__arrow {
  font-size: 18px;
  color: var(--muted);
  transition: color .2s ease, transform .2s var(--ease);
}
.card:hover .card__arrow {
  color: var(--red);
  transform: translate(3px, -3px);
}

/* =======================================================================
   6.12 CINEMA MODAL (#modal)
   ======================================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 80);
  background: rgba(0, 0, 0, .88);
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  transition: opacity .35s ease;
}
.modal.is-open {
  display: flex;
  opacity: 1;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
}

.modal__box {
  position: relative;
  width: min(1080px, 92vw);
  max-height: 90vh;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 2;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .8);
}

.modal__media {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  position: relative;
  overflow: hidden;
}
.modal__media img, .modal__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal__content {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal__title {
  font-family: var(--f-display);
  font-size: clamp(32px, 4vw, 56px);
  text-transform: uppercase;
  line-height: .95;
  color: #fff;
}
.modal__meta {
  font: 700 11px/1 var(--f-ui);
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--accent);
}
.modal__desc {
  font: 400 15px/1.6 var(--f-body);
  color: var(--text-2);
  max-width: 760px;
}
.modal__stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.modal__stack span {
  font: 600 10px/1 var(--f-ui);
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 2px;
}
.modal__actions {
  display: flex;
  gap: 14px;
  margin-top: 12px;
}
.modal__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .6);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background .2s ease, transform .2s ease;
}
.modal__close:hover {
  background: var(--red);
  transform: scale(1.05);
}

.modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,.6);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background .2s ease;
}
.modal__nav:hover {
  background: var(--red);
}
.modal__prev { left: 20px; }
.modal__next { right: 20px; }

/* =======================================================================
   6.12 COMMAND PALETTE (#palette)
   ======================================================================= */
.palette {
  position: fixed;
  inset: 0;
  z-index: var(--z-palette, 90);
  background: rgba(0, 0, 0, .75);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.palette.is-open {
  display: flex;
}

.palette__box {
  width: min(640px, 92vw);
  background: rgba(16, 18, 22, .92);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .8);
  display: flex;
  flex-direction: column;
}

.palette__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.palette__prompt {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-weight: 700;
  color: var(--red);
  font-size: 15px;
}
.palette__input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 14px;
  outline: none;
}
.palette__input::placeholder {
  color: var(--dim);
}

.palette__list {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
}
.palette__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background .15s ease;
}
.palette__item:hover, .palette__item.is-active {
  background: rgba(255, 255, 255, .05);
  border-left-color: var(--red);
  color: #fff;
}
.palette__item-sub {
  font-size: 11px;
  color: var(--muted);
}

.palette__footer {
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--dim);
}

/* =======================================================================
   7.13 IDLE COMPANIONS
   ======================================================================= */
.companion {
  position: absolute;
  width: 22px;
  height: 22px;
  pointer-events: none;
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.55));
  transition: transform .1s linear;
}
.companion svg {
  width: 22px;
  height: 22px;
}
