/* Premiere modal (layout/premiere.php, js/premiere.js): the northern gates at dusk, the wordmark and a carved
   countdown, heroes marching to the gate past its guardians on 8.60 grass, then the improvements as parchment
   cards with an inventory slot each. Same materials as medieval.css: oak rim with a gold hairline, bronze
   filigree corners, leather title bar with title caps, parchment with grain, gold-leaf and leather buttons. */
.vp { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 14px; }
.vp[hidden] { display: none; }
body.vp-locked { overflow: hidden; }
.vp-backdrop { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, #1a0f2ccc, #05030af2 75%); backdrop-filter: blur(3px); animation: vp-fade .4s ease-out both; }

.vp-box {
  --oak: #24170d; --oak-2: #3a2614; --gold: #c79a4b; --gold-hi: #f1d595; --parch: #f0e3c6; --ink: #3a2616;
  /* The frame never scrolls (corners, X and the oak rim stay put); .vp-scroll scrolls inside it. */
  position: relative; display: flex; flex-direction: column; width: min(780px, 100%); max-height: calc(100svh - 28px); overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, #fffaea99, transparent 70%),
    radial-gradient(ellipse 70% 80% at 100% 100%, #c8a76a33, transparent 70%),
    repeating-linear-gradient(0deg, #7a55280a 0 1px, transparent 1px 3px), var(--parch);
  box-shadow: 0 0 0 1px var(--oak), 0 0 0 3px var(--gold), 0 0 0 4px #0d0804, 0 0 0 9px var(--oak-2), 0 0 0 10px #0d0804,
    0 0 0 11px #9c733388, 0 30px 80px -10px #000, 0 0 120px #c79a4b33;
  animation: vp-in .55s cubic-bezier(.16, 1, .3, 1) both;
}
.vp-box:focus { outline: none; }
.vp-scroll { min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: none; }
.vp-scroll::-webkit-scrollbar { display: none; }
.vp-corner { position: absolute; z-index: 6; width: 46px; height: 46px; background: center / contain no-repeat; pointer-events: none; filter: drop-shadow(0 2px 2px #000a); }
.vp-corner.tl { left: 0; top: 0; background-image: url('../assets/corner-tl.svg'); }
.vp-corner.tr { right: 0; top: 0; background-image: url('../assets/corner-tr.svg'); }
.vp-corner.bl { left: 0; bottom: 0; background-image: url('../assets/corner-bl.svg'); }
.vp-corner.br { right: 0; bottom: 0; background-image: url('../assets/corner-br.svg'); }

.vp-x {
  position: absolute; top: 14px; right: 14px; z-index: 7; width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer; color: #f6dd9c; font: 900 22px/1 Georgia, serif; text-shadow: 0 1px 0 #000;
  background: radial-gradient(circle at 50% 35%, #5a3a1d, #24170d 70%);
  box-shadow: 0 0 0 1px #0d0804, 0 0 0 3px #c79a4b, 0 0 0 4px #0d0804, 0 4px 10px #000a;
  transition: transform .2s cubic-bezier(.16, 1, .3, 1), filter .2s;
}
.vp-x:hover, .vp-x:focus-visible { transform: rotate(90deg) scale(1.06); filter: brightness(1.2); outline: none; }

/* ---------- hero: the gates at dusk ---------- */
.vp-hero { position: relative; overflow: hidden; display: grid; justify-items: center; padding: 14px 16px 0; text-align: center; isolation: isolate; }
.vp-sky { position: absolute; inset: -4%; z-index: -3; background: url('../assets/northern-gates.webp') 50% 38% / cover; will-change: transform; animation: vp-drift 40s ease-in-out infinite alternate; }
.vp-hero::after { content: ''; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background: radial-gradient(ellipse 60% 55% at 50% 42%, #0a061433, transparent 70%), linear-gradient(180deg, #0a0614aa, transparent 30%, transparent 62%, #0a061499 84%); }
.vp-glow { position: absolute; z-index: -2; left: 50%; bottom: 52px; width: 70%; height: 120px; transform: translateX(-50%); pointer-events: none;
  background: radial-gradient(ellipse at 50% 100%, #ff9a3c55, transparent 70%); mix-blend-mode: screen; animation: vp-breathe 4s ease-in-out infinite; }
.vp-embers { position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .85;
  background-image: radial-gradient(circle, #ffb24a 0 1.2px, transparent 2px), radial-gradient(circle, #ff7a2a 0 1px, transparent 2px), radial-gradient(circle, #ffe08a 0 1px, transparent 2px);
  background-size: 110px 140px, 160px 120px, 90px 170px; background-position: 10px 160px, 70px 90px, 30px 40px;
  animation: vp-embers 9s linear infinite; }
.vp-mark { width: min(300px, 70%); height: auto; margin: -6px 0 2px; filter: drop-shadow(0 6px 14px #000c) drop-shadow(0 0 22px #c79a4b44); animation: vp-rise .9s .1s cubic-bezier(.16, 1, .3, 1) both; }
.vp-kicker { margin: 0; font: 900 12px/1.2 'Cinzel', Georgia, serif; letter-spacing: .32em; text-transform: uppercase; color: #ffcf7a; text-shadow: 0 1px 0 #000, 0 0 12px #ff8a2a88; }
.vp-hero h2 { margin: 4px 0 10px; font: 900 clamp(22px, 4.4vw, 32px)/1.1 'Cinzel', Georgia, serif; letter-spacing: .04em; color: #fbe7ae;
  text-shadow: 0 2px 0 #24170d, 0 3px 10px #000, 0 0 24px #c79a4b66; animation: vp-rise .9s .2s cubic-bezier(.16, 1, .3, 1) both; }

.vp-clock { display: flex; align-items: flex-start; gap: 10px; animation: vp-rise .9s .3s cubic-bezier(.16, 1, .3, 1) both; }
.vp-digit { display: grid; justify-items: center; gap: 10px; }
.vp-digit b {
  display: grid; place-items: center; min-width: 58px; height: 52px; padding: 0 6px;
  font: 900 30px/1 'Cinzel', Georgia, serif; color: #fbe7ae; text-shadow: 0 2px 0 #000, 0 0 12px #c79a4b88; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #4a3019, #24170d 60%, #160d05);
  box-shadow: 0 0 0 1px #0d0804, 0 0 0 3px #c79a4b, 0 0 0 4px #0d0804, inset 0 2px 6px #000c, inset 0 -1px 0 #f1d59533, 0 8px 16px #000a;
}
.vp-digit i { font: 700 10px/1 'Martel', Georgia, serif; font-style: normal; letter-spacing: .12em; text-transform: uppercase; color: #f1d595; text-shadow: 0 1px 0 #000; }
.vp-colon { padding-top: 11px; font: 900 26px/1 'Cinzel', Georgia, serif; color: #f1d595; text-shadow: 0 2px 0 #000; animation: vp-blink 1s steps(2) infinite; }
.vp-zone { margin: 14px 0 0; font: 700 12px/1.3 'Martel', Georgia, serif; color: #f0e3c6; text-shadow: 0 1px 0 #000, 0 0 8px #000; }
.vp [data-vp-opened] { display: none; }
.vp.is-open [data-vp-opened] { display: revert; }
.vp.is-open [data-vp-closed] { display: none; }
.vp.is-open .vp-hero h2 { font-size: clamp(24px, 5vw, 36px); }

/* the road: 8.60 grass under the painting, heroes marching east to the gate, guardians beside it */
.vp-road {
  position: relative; width: calc(100% + 32px); height: 76px; margin: 12px -16px 0;
  background: linear-gradient(180deg, #0a061400, #0a0614 0) 0 0 / 100% 12px no-repeat, url('../../../images/items/generated/4526.gif') 0 12px / 64px repeat-x;
  image-rendering: pixelated;
  box-shadow: inset 0 14px 10px -2px #0a0614cc, inset 0 -6px 10px #0008, 0 1px 0 #0d0804, 0 2px 0 #9c7333, 0 3px 0 #0d0804;
}
.vp-road::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 14px; background: linear-gradient(180deg, transparent, #2d4a1c88); }
.vp-hero-walk {
  position: absolute; bottom: 4px; left: -70px; width: 64px; height: 64px; background: 0 0 / 192px 64px no-repeat; image-rendering: pixelated;
  filter: drop-shadow(0 3px 2px #000a);
  animation: vp-walk .6s steps(3) infinite, vp-march 20s linear infinite;
  animation-delay: calc(var(--i) * -.13s), calc(var(--i) * -4s);
}
.vp-guard { position: absolute; bottom: 4px; width: 64px; height: 64px; image-rendering: pixelated; filter: drop-shadow(0 4px 3px #000c); }
.vp-guard.g1 { right: 9%; z-index: 2; }
.vp-guard.g2 { right: calc(9% + 84px); bottom: 6px; z-index: 1; }
/* Heroes fade into the gate light before the guardians, never walking through them. */
.vp-road { --stop: calc(91% - 250px); }
.vp-hero-walk { z-index: 3; }

/* ---------- after 17:00: the gates have opened ---------- */
.vp.is-open .vp-glow { width: 90%; height: 170px; background: radial-gradient(ellipse at 50% 100%, #ffc56a88, transparent 70%); }
.vp.is-open .vp-embers { opacity: 1; }
.vp-open-lead { margin: 0 0 12px; font: italic 700 14px/1.4 Georgia, serif; color: #f6e6c4; text-shadow: 0 1px 0 #000, 0 0 10px #000; }
.vp.is-open .vp-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: min(640px, 100%); margin: 0; padding: 0; list-style: none; counter-reset: none; }
.vp-steps li {
  position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; align-items: center; padding: 10px 10px 10px 12px; text-align: left;
  background: linear-gradient(180deg, #4a3019f2, #24170df2); box-shadow: 0 0 0 1px #0d0804, 0 0 0 2px #9c7333, 0 0 0 3px #0d0804, inset 0 1px 0 #f1d59533, 0 8px 16px #000a;
  animation: vp-rise .7s cubic-bezier(.16, 1, .3, 1) both;
}
.vp-steps li:nth-child(2) { animation-delay: .1s; }
.vp-steps li:nth-child(3) { animation-delay: .2s; }
.vp-steps .vp-copy strong { color: #fbe7ae; text-shadow: 0 1px 0 #000; }
.vp-steps .vp-copy span { color: #e6d4ae; }
.vp-seal {
  position: absolute; left: -9px; top: -9px; z-index: 1; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  font: 900 12px/1 'Cinzel', Georgia, serif; color: #24170d; background: linear-gradient(180deg, #fbe7ae, #c79a4b);
  box-shadow: 0 0 0 1px #0d0804, 0 2px 4px #000a;
}
/* the open gate at the end of the road: a column of warm light the heroes walk into */
.vp-gate { position: absolute; right: 2%; bottom: 0; width: 170px; height: 150%; pointer-events: none; filter: blur(2px);
  background: radial-gradient(ellipse 45% 85% at 50% 100%, #fffbe8, #ffd98acc 30%, #ffb24a55 55%, transparent 75%); mix-blend-mode: screen; animation: vp-breathe 3s ease-in-out infinite; }
.vp.is-open .vp-road { --stop: calc(96% - 120px); }

/* ---------- title bar and body ---------- */
.vp-bar {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; padding: 9px 14px 11px;
  font: 800 17px/1.2 'Martel', Georgia, serif; letter-spacing: .01em; color: var(--gold-hi); text-shadow: 0 1px 0 #000; text-align: center;
  background: repeating-linear-gradient(90deg, #ffffff05 0 1px, transparent 1px 4px), linear-gradient(180deg, #5a3a1d, #3a2614 45%, #24170d);
  box-shadow: inset 0 1px 0 #f1d59540, inset 0 -1px 0 #0d0804, inset 0 -3px 0 #9c7333, inset 0 -4px 0 #0d0804;
}
.vp-bar::before, .vp-bar::after {
  content: ''; flex: 0 1 70px; height: 16px;
  background: url('../assets/title-cap.svg') right center / 40px 16px no-repeat, linear-gradient(90deg, transparent, #d4a24c) left center / calc(100% - 38px) 1.4px no-repeat;
}
.vp-bar::after { transform: scaleX(-1); }
.vp-body { padding: 14px 18px 18px; }
.vp-lead { margin: 0 0 12px; text-align: center; font: italic 14.5px/1.5 Georgia, serif; color: #4a2a14; }

.vp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.vp-grid li {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; padding: 9px 10px;
  background: linear-gradient(180deg, #fbf3df, #efe0bd); box-shadow: 0 0 0 1px #c5a877, inset 0 1px 0 #fff9, 0 2px 0 #24170d22;
  animation: vp-card .5s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(.35s + var(--i) * .05s);
  transition: box-shadow .2s;
}
.vp-grid li:hover { box-shadow: 0 0 0 1px #9c7333, inset 0 1px 0 #fff9, 0 8px 14px -6px #24170d88; }
.vp-slot {
  position: relative; display: grid; place-items: center; width: 40px; height: 40px; margin: 2px;
  background: radial-gradient(circle at 50% 40%, #4a3a2a, #1f160d);
  box-shadow: 0 0 0 1px #0d0804, 0 0 0 2px #9c7333, inset 0 0 8px #000a; transition: box-shadow .2s;
}
.vp-slot img { width: 32px; height: 32px; image-rendering: pixelated; transition: transform .25s cubic-bezier(.16, 1, .3, 1); }
.vp-grid li:hover .vp-slot { box-shadow: 0 0 0 1px #0d0804, 0 0 0 2px #f1d595, inset 0 0 8px #000a, 0 0 12px #f1d59599; }
.vp-grid li:hover .vp-slot img { transform: translateY(-3px) scale(1.12); }
.vp-copy { display: grid; gap: 2px; min-width: 0; }
.vp-copy strong { font: 800 13.5px/1.2 'Martel', Georgia, serif; color: #24170d; }
.vp-copy span { font-size: 11.5px; line-height: 1.4; color: #4a3626; }

.vp-premium {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px 0 0; padding: 8px 12px;
  font: 700 13px/1.35 'Martel', Georgia, serif; color: #f0e3c6; text-shadow: 0 1px 0 #000;
  background: linear-gradient(180deg, #0a1324ee, #0a1324f5), url('../assets/northern-gates.webp') center 70% / cover;
  box-shadow: 0 0 0 1px #0d0804, 0 0 0 3px #9c7333, 0 0 0 4px #0d0804;
}
.vp-premium b { color: #fbe7ae; }
.vp-premium img { flex: none; image-rendering: pixelated; animation: vp-bob 2.4s ease-in-out infinite; }

.vp-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 16px; }
.vp-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 20px; text-decoration: none;
  font: 800 13.5px/1.2 'Martel', Georgia, serif; letter-spacing: .02em; color: #f6dd9c;
  background: linear-gradient(180deg, #4a3019, #2c1c0e 60%, #1f140a);
  box-shadow: 0 0 0 1px #0d0804, 0 0 0 2px #9c7333, 0 0 0 3px #0d0804, inset 0 1px 0 #f1d59533, 0 4px 8px -3px #000a;
  transition: filter .15s, transform .15s cubic-bezier(.16, 1, .3, 1);
}
.vp-btn.gold { color: #24170d; background: linear-gradient(180deg, #fbe7ae, #e1b867 45%, #b98a3c);
  box-shadow: 0 0 0 1px #0d0804, 0 0 0 2px #7a5420, 0 0 0 3px #0d0804, inset 0 1px 0 #fff9, inset 0 -2px 0 #8a5f2299, 0 4px 8px -3px #000a, 0 0 18px #f1d59566; }
.vp-btn:hover { color: #fbe7ae; filter: brightness(1.12); transform: translateY(-1px); }
.vp-btn.gold:hover { color: #24170d; }
.vp-btn:focus-visible { outline: 2px solid #f1d595; outline-offset: 4px; }

@keyframes vp-fade { from { opacity: 0; } }
@keyframes vp-in { from { opacity: 0; transform: translateY(24px) scale(.96); } }
@keyframes vp-rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes vp-card { from { opacity: 0; transform: translateY(10px); } }
@keyframes vp-drift { from { transform: translate3d(-2%, 0, 0); } to { transform: translate3d(2%, -1%, 0); } }
@keyframes vp-breathe { 50% { opacity: .55; } }
@keyframes vp-embers { to { background-position: 40px -20px, 20px -110px, 60px -130px; } }
@keyframes vp-blink { 50% { opacity: .35; } }
@keyframes vp-bob { 50% { transform: translateY(-3px); } }
@keyframes vp-walk { to { background-position: -192px 0; } }
@keyframes vp-march { 0% { left: -70px; opacity: 0; } 5% { opacity: 1; } 66% { opacity: 1; } 76% { left: var(--stop); opacity: 0; } 100% { left: var(--stop); opacity: 0; } }

@media (max-width: 700px) {
  .vp { padding: 0; }
  .vp-box { max-height: 100svh; width: 100%; box-shadow: 0 0 0 1px var(--oak), 0 0 0 3px var(--gold); }
  .vp-corner { width: 34px; height: 34px; }
  .vp-grid { grid-template-columns: 1fr; gap: 6px; }
  .vp-grid li { padding: 7px 9px; }
  .vp-digit b { min-width: 50px; height: 46px; font-size: 26px; }
  .vp-colon { padding-top: 9px; }
  .vp-mark { width: min(240px, 72%); }
  .vp-body { padding: 12px 12px 16px; }
  .vp-bar { font-size: 15px; }
  .vp-bar::before, .vp-bar::after { flex-basis: 26px; background-size: 26px 12px, 0 0; }
  .vp-guard.g2 { display: none; }
  .vp-road { --stop: calc(91% - 150px); }
  .vp.is-open .vp-steps { grid-template-columns: 1fr; gap: 12px; padding: 0 8px; }
  .vp-clock { gap: 6px; }
  .vp-actions .vp-btn { flex: 1 1 100%; }
}
@media (min-width: 701px) and (max-width: 820px) { .vp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) {
  .vp *, .vp *::before, .vp-backdrop, .vp-box { animation: none !important; }
  .vp-hero-walk { left: calc(var(--i) * 13% + 4%); }
}
