/* =========================================================================
   AI MAY DAY · events.css
   Scoped: alla klasser har prefix .event-
   Lunarstorm-style chunky pixel-frame med porträtt inbäddat i UI:t.
   ========================================================================= */

/* Pausa CSS-animationer när event-modal är uppe */
body.is-paused .scene *,
body.is-paused .ticker__item {
  animation-play-state: paused !important;
}

/* ----------- OVERLAY ----------- */
.event-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0);
  -webkit-backdrop-filter: blur(0);
          backdrop-filter: blur(0);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  transition: background 250ms ease, backdrop-filter 250ms ease;
}
.event-overlay--visible {
  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}
.event-overlay--closing {
  background: rgba(0, 0, 0, 0);
  -webkit-backdrop-filter: blur(0);
          backdrop-filter: blur(0);
}

/* ----------- SKIP-KNAPP (×) ----------- */
.event-skip {
  position: absolute;
  top: 18px;
  right: 22px;
  appearance: none;
  width: 44px; height: 44px;
  background: #f0e3c0;
  border: 3px solid #1a1208;
  box-shadow: 4px 4px 0 #1a1208;
  font-family: "Trebuchet MS", Tahoma, Verdana, sans-serif;
  font-weight: 900;
  font-size: 26px;
  line-height: 1;
  color: #1a1208;
  cursor: pointer;
  z-index: 210;
  border-radius: 0;
  transition: transform 0.06s ease;
  opacity: 0;
  transform: translateY(-30px);
}
.event-overlay--visible .event-skip { opacity: 1; transform: translateY(0); transition: opacity 220ms ease 400ms, transform 220ms ease 400ms; }
.event-skip:hover { background: #fff4d2; transform: translate(-1px, -1px); box-shadow: 5px 5px 0 #1a1208; }
.event-skip:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #1a1208; }

/* ----------- KORT (samlad ruta för porträtt + dialog) ----------- */
.event-card {
  width: min(960px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  background: #f0e3c0;
  border: 4px solid #1a1208;
  box-shadow: 8px 8px 0 #1a1208;
  font-family: "Trebuchet MS", Tahoma, Verdana, sans-serif;
  color: #1a1208;
  transform: translateY(40px) scale(0.96);
  opacity: 0;
  transition: transform 320ms cubic-bezier(.2,.8,.3,1), opacity 320ms ease;
}
.event-overlay--visible .event-card { transform: translateY(0) scale(1); opacity: 1; }
.event-overlay--closing .event-card { transform: translateY(40px) scale(0.96); opacity: 0; }

.event-card__inner {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 18px;
  padding: 18px;
  align-items: stretch;
}

/* ----------- PORTRÄTT-FRAME ----------- */
.event-portrait-box {
  display: flex;
  align-items: stretch;
}
.event-portrait-frame {
  width: 100%;
  background-color: #2a3132;
  border: 3px solid #1a1208;
  box-shadow: inset 0 0 0 2px rgba(255,240,205,0.06), 4px 4px 0 #1a1208;
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
}
.event-portrait-img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: opacity 220ms ease;
}
.event-portrait-frame::after {
  /* subtil gradient-vinjett för läsbarhet */
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 0%, transparent 70%, rgba(0,0,0,0.4) 100%);
}
.event-portrait-name {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 6px 8px 7px;
  background: rgba(26, 18, 8, 0.85);
  color: #f1c781;
  font-family: "Trebuchet MS", Tahoma, Verdana, sans-serif;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  border-top: 2px solid #1a1208;
  z-index: 2;
}

.event-portrait-frame--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}
.event-portrait-frame--placeholder .event-portrait-img { display: none; }
.event-portrait-frame--placeholder .event-portrait-name {
  position: static;
  background: transparent;
  border: 0;
  font-size: 16px;
  padding: 30px 20px;
  color: #f0e3c0;
}

/* state-byte-blink för känsla av reaktion */
.event-portrait-frame--changing { animation: portrait-react 220ms ease; }
@keyframes portrait-react {
  0% { transform: translateX(0); }
  30% { transform: translateX(-3px) scale(0.985); }
  60% { transform: translateX(2px); }
  100% { transform: translateX(0); }
}

/* ----------- DIALOG-SIDA ----------- */
.event-dialog {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.event-name {
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #b03030;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.08);
  border-bottom: 2px dashed #1a1208;
  padding-bottom: 8px;
}
.event-text {
  font-size: 17px;
  line-height: 1.45;
  font-weight: 500;
  color: #2a1f10;
  flex: 1 0 auto;
}
.event-text em, .event-text i {
  color: #6b4830;
  font-style: italic;
  font-weight: 600;
}

/* ----------- CHOICES ----------- */
.event-choices {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease;
}
.event-choices--visible { opacity: 1; transform: translateY(0); }
.event-choices--hidden { opacity: 0; pointer-events: none; max-height: 0; overflow: hidden; }

.event-choice {
  appearance: none;
  background: #fff4d2;
  border: 3px solid #1a1208;
  box-shadow: 3px 3px 0 #1a1208;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  font-family: inherit;
  color: #1a1208;
  transition: transform 0.06s ease;
  border-radius: 0;
}
.event-choice__num { margin-top: 1px; }
.event-choice:hover { background: #ffeeb0; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 #1a1208; }
.event-choice:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #1a1208; }
.event-choice:focus-visible { outline: 3px solid #d4a55c; outline-offset: 3px; }

.event-choice__num {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #d4a55c;
  border: 2px solid #1a1208;
  font-weight: 900;
  font-size: 13px;
  font-family: "Courier New", Consolas, monospace;
}
.event-choice__label {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.01em;
}

/* ----------- RESULT ----------- */
.event-result {
  margin-top: 4px;
  padding: 12px 14px;
  background: #1a1208;
  color: #f0e3c0;
  border: 3px solid #1a1208;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease;
}
.event-result--visible { opacity: 1; transform: translateY(0); }

.event-unlock {
  font-family: "Courier New", Consolas, monospace;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: #f1c781;
  text-transform: uppercase;
  margin-bottom: 6px;
  border-bottom: 1px dashed rgba(241,199,129,0.4);
  padding-bottom: 4px;
}
.event-result__text {
  font-size: 15px;
  line-height: 1.4;
  font-style: italic;
}
.event-result__effect {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(241,199,129,0.3);
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font-style: normal;
}

/* ----------- PAUSE-BANNER · varselbanner-stil ----------- */
.event-pause-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background:
    repeating-linear-gradient(
      -45deg,
      #ffd57a 0 18px,
      #1a1208 18px 36px
    );
  color: #1a1208;
  border-bottom: 4px solid #1a1208;
  box-shadow: 0 4px 0 rgba(0,0,0,0.4);
  padding: 14px 22px 13px;
  font-family: "Courier New", Consolas, monospace;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  z-index: 5;
  animation: pause-banner-in 0.4s cubic-bezier(.4,1.6,.4,1) both,
             pause-banner-shimmer 2.4s linear infinite;
  text-shadow: 1px 1px 0 #fff4d2;
}
.event-pause-banner > span {
  background: #ffd57a;
  padding: 6px 16px 5px;
  border: 3px solid #1a1208;
  box-shadow: 3px 3px 0 #1a1208;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.event-pause-banner__pip {
  width: 14px; height: 14px;
  background: #b03030;
  border: 2.5px solid #1a1208;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(229, 74, 74, 0.7);
  animation: pause-banner-blink 0.9s steps(2) infinite;
}
@keyframes pause-banner-in {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pause-banner-blink {
  0%, 50%   { opacity: 1; transform: scale(1); }
  51%, 100% { opacity: 0.3; transform: scale(0.8); }
}
@keyframes pause-banner-shimmer {
  from { background-position: 0 0; }
  to   { background-position: 72px 0; }
}
@media (max-width: 720px) {
  .event-pause-banner {
    font-size: 14px;
    letter-spacing: 0.2em;
    padding: 10px 14px 9px;
    gap: 10px;
  }
  .event-pause-banner > span { padding: 4px 10px 3px; gap: 8px; }
  .event-pause-banner__pip { width: 11px; height: 11px; }
}

/* ----------- MOBILE ----------- */
@media (max-width: 720px) {
  .event-card { width: calc(100% - 16px); }
  .event-card__inner {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }
  .event-portrait-box {
    max-height: 32vh;
  }
  .event-portrait-frame {
    min-height: 0;
    height: 32vh;
    max-height: 240px;
  }
  .event-text { font-size: 15px; }
  .event-choice__label { font-size: 13px; }
  .event-skip { width: 38px; height: 38px; font-size: 22px; top: 10px; right: 10px; }
}
