/* EU5 event and decision pages: the game's event window (in_game/gui/eventwindow.gui) and decision window
   (decisionwindow.gui) drawn with the game's own textures (scripts/eventwin.mjs -> img/eventwin/ui/), beside a list
   of the page's events. Sizes follow the gui files at the window's 2x texture density: a 540x220 picture, 514x36
   option buttons, the title in a cartouche with gold flourishes, text boxes with corner ornaments. Colours are the
   game's swatches (gfx/interface/colors) and text colours (gui/textformatting.gui). The window stays dark in the
   light theme too: it is the game's own. docs/events.md */
.evx { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 26px; margin: 10px 0 10px; align-items: start; }
.evx-list { position: sticky; top: calc(var(--evtop, 108px) + 6px); height: calc(100vh - var(--evtop, 108px) - 16px); min-height: 420px; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.evx-tools { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; padding: 10px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.evx-tools input { grid-column: 1 / -1; width: 100%; font: inherit; font-size: 15px; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--bg); color: var(--ink); }
.evx-tools select, .evx-look select { font: inherit; font-size: 14px; padding: 4px 6px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--bg); color: var(--ink); min-width: 0; }
.evx-tools .shown { align-self: center; font-size: 13px; color: var(--muted); white-space: nowrap; }
.evx-rows { flex: 1; overflow: auto; overscroll-behavior: contain; }
.evr { display: grid; grid-template-columns: 48px minmax(0, 1fr); grid-template-rows: auto auto; gap: 1px 10px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.evr:hover { background: var(--panel-2); text-decoration: none; color: var(--ink); }
.evr > img, .evr-np { grid-row: 1 / span 2; width: 48px; height: 32px; object-fit: cover; border: 1px solid #7d6339; background: #262018; display: block; }
.evr-t { font-weight: 600; font-size: 14.5px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evr-s { font-size: 12.5px; color: var(--muted); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evr[data-d="1"] { padding-left: 24px; } .evr[data-d="2"] { padding-left: 38px; } .evr[data-d="3"] { padding-left: 52px; } .evr[data-d="4"], .evr[data-d="5"] { padding-left: 66px; }
.evr:not([data-d="0"]) .evr-t::before { content: '\21B3\00a0'; color: var(--muted); font-weight: 400; }
.evr.cur { background: #2b2317; color: #f0d999; }
.evr.cur .evr-s { color: #c9bd9b; }
.evr[hidden] { display: none; }
.evx-bar { display: none; }
.evx.js .evx-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; position: sticky; top: var(--evtop, 108px); z-index: 6; background: var(--bg); padding: 8px 0; margin: 0 0 4px; }
.evx-bar button { font: 600 15px var(--body); padding: 5px 14px; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line-2); border-radius: 6px; cursor: pointer; }
.evx-bar button:hover { border-color: var(--ac); }
.evx-bar [data-evpos] { min-width: 64px; text-align: center; font-size: 14px; color: var(--muted); }
.evx-look { font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; }
.evx-keys { margin-left: auto; font-size: 13px; color: var(--muted); }
.evx .evx-back { display: none; }
.evx-view { min-width: 0; min-height: calc(100vh - var(--evtop, 108px) - 16px); container-type: inline-size; }
.evs { display: grid; gap: 40px; }
.evx.js .evs > .ev:not(.cur) { display: none; }
.ev { display: grid; grid-template-columns: minmax(0, 580px) minmax(0, 1fr); gap: 0 30px; align-items: start; scroll-margin-top: calc(var(--evtop, 110px) + 64px); }
.ev-side { padding-top: 34px; font-size: 15px; min-width: 0; }
.ev-side > p { margin: 0 0 6px; }
.ev-side .gametext ul.prose { margin: 0 0 14px; padding-left: 20px; font-size: 14.5px; }
ul.ev-meta { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
ul.ev-meta li { margin: 0; }
ul.ev-meta code.cmd { white-space: nowrap; }
@container (max-width: 980px) {
  .ev { grid-template-columns: minmax(0, 580px); }
  .ev-side { padding-top: 16px; }
}
@media (max-width: 1100px) { .evx { grid-template-columns: 300px minmax(0, 1fr); gap: 18px; } }
@media (max-width: 760px) {
  .evx { grid-template-columns: minmax(0, 1fr); }
  .evx-list { position: static; height: auto; min-height: 0; }
  .evx-rows { overflow: visible; }
  .evx.js.open .evx-list { display: none; }
  .evx.js:not(.open) .evx-view { display: none; }
  .evx .evx-back { display: inline-block; }
  .evx-keys { display: none; }
  .evx.js .evx-bar { position: static; }
  .evx-view { min-height: 0; }
}

/* ---------- the event window */
.ew { position: relative; margin: 34px 0 0; padding: 22px 20px 16px; color: #dbdbba; font: 400 15px/1.5 'Noto Serif', Georgia, serif; font-stretch: 87.5%;
  background: url(img/eventwin/ui/floral.webp) 0 0 / 50px auto repeat, linear-gradient(180deg, rgba(117, 91, 54, .45) 0, rgba(117, 91, 54, .12) 260px, rgba(0, 0, 0, 0) 520px), #1a140c;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .55), 0 0 0 1px rgba(0, 0, 0, .6); }
.ew::before { content: ''; position: absolute; inset: 0; pointer-events: none; border: 6px solid transparent; border-image: url(img/eventwin/ui/frame.webp) 12 / 6px stretch; }
.ew a { color: #fae0a6; }
.ew.hidden { padding: 16px 20px; margin-top: 0; font-style: italic; color: #b3b3b3; }
.ew.hidden p { margin: 0; }
/* the title: a dark cartouche over the top edge, a gold line on it, a flourish at each top corner */
.ew-head { position: relative; display: flex; justify-content: center; margin: -56px 0 16px; }
.ew-t { position: relative; margin: 0; min-width: 260px; max-width: min(595px, 100%); padding: 12px 70px 10px; text-align: center; color: #f0d999; font: 600 23px/1.25 'Noto Serif', Georgia, serif; font-stretch: 87.5%; text-shadow: 0 2px 3px #000, 0 0 8px rgba(0, 0, 0, .8);
  border: solid transparent; border-width: 0 20px; border-image: url(img/eventwin/ui/title.webp) 0 40 fill / 0 20px stretch; }
.ew-t::before { content: ''; position: absolute; left: -20px; right: -20px; top: -2px; height: 26px; background: url(img/eventwin/ui/line.webp) center top / 100% 52px no-repeat; pointer-events: none; }
.ew-t::after { content: ''; position: absolute; top: -6px; left: -40px; width: 56px; height: 46px; background: url(img/eventwin/ui/flourish.webp) center / contain no-repeat; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .7)); pointer-events: none; }
.ew-t > span::after { content: ''; position: absolute; top: -6px; right: -40px; width: 56px; height: 46px; background: url(img/eventwin/ui/flourish.webp) center / contain no-repeat; transform: scaleX(-1); filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .7)); pointer-events: none; }
/* the picture: 540x220, the dark shade over it, the expedition frame round it */
.ew-pic { position: relative; aspect-ratio: 540 / 220; overflow: hidden; background: #262018; box-shadow: 0 3px 10px rgba(0, 0, 0, .6); }
.ew-pic > img { position: absolute; left: 0; top: 0; width: 100%; height: auto; display: block; }
.ew-pic > img.ew-ly { height: auto; }
.ew-pic::before { content: ''; position: absolute; inset: 0; z-index: 2; background: url(img/eventwin/ui/shade.webp) center / 100% 100% no-repeat; opacity: .9; pointer-events: none; }
.ew-pic::after { content: ''; position: absolute; inset: 0; z-index: 3; border: 25px solid transparent; border-image: url(img/eventwin/ui/picframe.webp) 100 / 25px stretch; pointer-events: none; }
/* the expedition window (expeditions_event_window): wood inside a gold frame with cut corners, the title on a cloth banner */
.ew.ex { isolation: isolate; background: none; box-shadow: none; border: 25px solid transparent; border-image: url(img/eventwin/ui/exframe.webp) 50 fill / 25px stretch; padding: 8px 2px 0; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .55)); }
.ew.ex::before { inset: -25px; z-index: -1; border: 25px solid transparent; border-image: url(img/eventwin/ui/exinner.webp) 50 fill / 25px stretch; }
.ew.ex .ew-head { margin-top: -64px; }
.ew.ex .ew-t { min-width: 351px; padding: 14px 60px 24px; border-width: 0 50px; border-image: url(img/eventwin/ui/exhead.webp) 0 100 fill / 0 50px stretch; }
.ew.ex .ew-t::before, .ew.ex .ew-t::after, .ew.ex .ew-t > span::after { display: none; }
.ew.ex .ew-pic::before { opacity: .6; }
@media (max-width: 760px) { .ew.ex .ew-t { min-width: 0; padding: 10px 30px 20px; border-width: 0 34px; border-image-width: 0 34px; } }
/* text boxes: bg_brown with cloth, the dark edge mask, the gold corner ornaments */
.ew-box { position: relative; margin: 16px 0 0; padding: 14px 24px; background: #2a2117; border: 10px solid transparent; border-image: url(img/eventwin/ui/box.webp) 20 fill / 10px round; }
.ew-box::before { content: ''; position: absolute; inset: -6px; border: 6px solid transparent; border-image: url(img/eventwin/ui/boxmask.webp) 12 fill / 6px stretch; pointer-events: none; }
.ew-box::after { content: ''; position: absolute; inset: -12px; border: 17px solid transparent; border-image: url(img/eventwin/ui/corner.webp) 35 / 17px stretch; pointer-events: none; }
.ew-box p { position: relative; z-index: 1; margin: 0 0 10px; }
.ew-box p:last-child { margin-bottom: 0; }
.ew-d { max-height: 352px; overflow: auto; }
.ew-h { max-height: 160px; overflow: auto; font-style: italic; font-size: 13px; color: #b3b3b3; text-shadow: 1px 2px 2px rgba(0, 0, 0, .3); }
/* the options: the game's diamond-ended buttons, what each does under it like the game's tooltip */
.ew-opts { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.ew-o { margin: 0; }
.ew-btn { position: relative; display: flex; align-items: center; justify-content: center; min-height: 36px; padding: 4px 34px; text-align: center; color: #f0ebd9; font: 400 15px/1.25 'Noto Serif', Georgia, serif; font-stretch: 87.5%; text-shadow: 0 1px 2px #000;
  border: solid transparent; border-width: 0 14px; border-image: url(img/eventwin/ui/btn.webp) 0 28 fill / 0 14px stretch; }
.ew-o:hover .ew-btn { border-image-source: url(img/eventwin/ui/btn-hover.webp); }
.ew-hm { position: absolute; left: 0; top: 50%; width: 26px; height: 26px; transform: translateY(-50%); }
.ew-fx, .ew-if { margin: 4px 8px 0; padding: 6px 12px 8px; background: rgba(12, 10, 7, .9); border: 1px solid #4b3d26; font-size: 14px; line-height: 1.45; color: #dbdbba; }
.ew-fx ul.prose, .ew-if ul.prose { margin: 0; padding-left: 18px; max-width: none; }
.ew-fx ul.prose ul { padding-left: 16px; }
.ew-fx li { margin: 1px 0; }
.ew-fx.none { color: #9a9483; font-style: italic; }
.ew-if { border-color: #5a3a26; }
.ew-if .gametext { margin-top: 2px; }
.ew-fx .pic, .ew-if .pic, .ev-side .pic { vertical-align: -5px; margin-right: 3px; }
@media (max-width: 760px) {
  .ew { padding: 18px 10px 12px; }
  .ew-head { margin-top: -50px; }
  .ew-t { font-size: 19px; padding: 10px 40px 8px; min-width: 0; }
  .ew-t::after { left: -30px; width: 44px; height: 36px; }
  .ew-t > span::after { right: -30px; width: 44px; height: 36px; }
  .ew-pic::after { border-width: 16px; border-image-width: 16px; }
  .ew-box { padding: 10px 12px; }
  .ew-btn { font-size: 14px; padding: 4px 26px; }
}

/* ---------- the decision window (basic_priority_dialog): dark blue header, the ornate frame, the content box */
.dw { position: relative; max-width: 600px; margin: 18px 0 22px; padding: 0 0 18px; color: #dbdbba; font: 400 15px/1.5 'Noto Serif', Georgia, serif; font-stretch: 87.5%;
  background: url(img/eventwin/ui/floral.webp) 0 0 / 50px auto repeat, linear-gradient(180deg, rgba(117, 91, 54, .4) 0, rgba(0, 0, 0, 0) 420px), #1a140c; box-shadow: 0 6px 22px rgba(0, 0, 0, .55); }
.dw::after { content: ''; position: absolute; inset: -4px; background: url(img/eventwin/ui/decframe.webp) center / 100% 100% no-repeat; pointer-events: none; }
.dw a { color: #fae0a6; }
.dw-t { margin: 0; padding: 26px 70px 16px; text-align: center; color: #f0d999; font: 600 22px/1.25 'Noto Serif', Georgia, serif; font-stretch: 87.5%; text-shadow: 0 2px 3px #000; background: url(img/eventwin/ui/dechead.webp) center top / 100% 100% no-repeat; position: relative; }
.dw-t::before, .dw-t::after { content: ''; position: absolute; top: 4px; width: 50px; height: 40px; background: url(img/eventwin/ui/flourish.webp) center / contain no-repeat; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .7)); }
.dw-t::before { left: 6px; }
.dw-t::after { right: 6px; transform: scaleX(-1); }
.dw-in { position: relative; z-index: 1; margin: 6px 20px 0; padding: 14px 20px; border: 6px solid transparent; border-image: url(img/eventwin/ui/decinframe.webp) 12 / 6px stretch; background: url(img/eventwin/ui/decinner.webp) center / 100% 100%; }
.dw .ew-pic { aspect-ratio: 500 / 220; }
.dw-d { text-align: center; margin: 14px 0 0; }
.dw-d p { margin: 0 0 8px; }
.dw .ew-box { margin-top: 14px; }
.dw-opts { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.dw-opts li { margin: 0; }
.dw-btn { display: flex; align-items: center; justify-content: center; min-height: 30px; padding: 3px 20px; color: #f0ebd9; text-shadow: 0 1px 2px #000; border: solid transparent; border-width: 0 7px; border-image: url(img/eventwin/ui/rbtn.webp) 0 14 fill / 0 7px stretch; }
.dw-opts li:hover .dw-btn { border-image-source: url(img/eventwin/ui/rbtn-hover.webp); }
@media (max-width: 760px) { .dw-in { margin: 6px 8px 0; padding: 10px 8px; } .dw-t { font-size: 19px; padding: 22px 46px 12px; } }

.dwrap { display: grid; grid-template-columns: minmax(0, 600px) minmax(0, 1fr); gap: 0 34px; align-items: start; margin: 6px 0 10px; }
.dside { padding-top: 18px; min-width: 0; }
@media (max-width: 960px) { .dwrap { grid-template-columns: minmax(0, 600px); } .dside { padding-top: 0; } }

/* the namespace table: a few of each namespace's pictures */
.evstrip { white-space: nowrap; }
.evstrip img { width: 48px; height: 32px; object-fit: cover; margin-right: 3px; border: 1px solid #7d6339; vertical-align: middle; }
