/* November sale pop-up.
   One file, shared by NX Tech November and Digital Shack v3. It reads each
   site's own tokens, so the button type and the blue come from whichever site
   it lands on.

   The panel is the campaign poster itself, the same artwork that goes out on
   social, with a navy bar under it carrying the one action. The poster was
   compressed from a 1.4MB PNG to a 71KB WebP for the web; the original stays
   in C:\NX\social\2026-11 November Sale for posting.

   Edit this in C:\NX\NX Tech November\src\styles\ and copy it to
   C:\NX\nx website november\src\styles\. The two must stay identical. */

.promo[open] {
  --promo-navy:  var(--navy, var(--ink, #0A1826));
  --promo-blue:  var(--nx-blue, var(--nx, #42B5F7));
  --promo-body:  var(--font-body, var(--font, system-ui));
  --promo-ease:  cubic-bezier(.23, 1, .32, 1);
  /* The poster is 4:5. The panel is sized off the shorter of the two axes so
     the artwork is never cropped and the bar is always reachable: width first,
     then whatever height is left once the bar and the page padding are out. */
  --promo-bar:   4.75rem;

  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  padding: 1.25rem;
  border: 0;
  background: transparent;
  overflow: auto;
  overscroll-behavior: contain;
}

.promo::backdrop {
  background: rgba(10, 24, 38, .62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* 32rem, not the 25rem it started at: the poster carries its own type, so the
   artwork wants every pixel the viewport will spare. On a tall screen the
   width cap decides; on a short one the height term takes over and the panel
   shrinks to keep the bar on screen. */
.promo-panel {
  position: relative;
  width: min(32rem, 100%, (100dvh - var(--promo-bar) - 2.5rem) * 0.8);
  border-radius: 14px;
  overflow: hidden;
  background: var(--promo-navy);
  box-shadow: 0 32px 80px rgba(10, 24, 38, .45), 0 2px 8px rgba(10, 24, 38, .2);
}

/* The artwork. width and height are on the tag so nothing reflows when it
   lands, which matters when the panel opens a second after the page does. */
.promo-art {
  position: relative;
  display: block;
  line-height: 0;
}

.promo-art img {
  display: block;
  width: 100%;
  height: auto;
}

/* A redundant click target over the poster, for the people who will tap the
   advert rather than the button. Out of the accessibility tree on purpose:
   the button below is the real control, and a second link carrying the whole
   alt text as its name would only be read out twice. */
.promo-hit {
  position: absolute;
  inset: 0;
}

.promo-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  padding: .95rem 1rem;
  background: var(--promo-navy);
}

.promo-cta {
  display: inline-block;
  padding: .7rem 1.6rem;
  border-radius: 999px;
  background: var(--promo-blue);
  color: var(--promo-navy);
  font-family: var(--promo-body);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 160ms var(--promo-ease), background-color 160ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .promo-cta:hover { background: #FFFFFF; }
}

.promo-cta:active { transform: scale(.97); }

.promo-dismiss {
  padding: .4rem .2rem;
  border: 0;
  background: none;
  font-family: var(--promo-body);
  font-size: .875rem;
  line-height: 1.2;
  color: rgba(255, 255, 255, .72);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: .2em;
  white-space: nowrap;
}

.promo-dismiss:hover { color: #FFFFFF; }

/* Close control. 44px target over the poster's top right corner, carrying a
   filled navy disc: a bare glyph on the blue paper was almost invisible, and
   the way out of a pop-up is the one control that must never be hunted for. */
.promo-close {
  position: absolute;
  top: .3rem;
  right: .3rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: #FFFFFF;
  cursor: pointer;
  transition: transform 160ms var(--promo-ease);
}

.promo-close::before {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--promo-navy);
  box-shadow: 0 2px 10px rgba(10, 24, 38, .45);
  transition: background-color 160ms ease;
}

.promo-close svg { position: relative; width: 15px; height: 15px; }
.promo-close:active { transform: scale(.94); }

@media (hover: hover) and (pointer: fine) {
  .promo-close:hover::before { background: #000000; }
}

/* The two sites name their screen reader utility differently, so the
   component carries its own. */
.promo-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.promo :is(a, button):focus-visible {
  outline: 3px solid #FFFFFF;
  outline-offset: 3px;
}

/* Scoped past the rule above, which otherwise wins on specificity and put a
   wide white ring on the artwork. The offset pulls it onto the navy disc. */
.promo .promo-close:focus-visible {
  outline: 3px solid #FFFFFF;
  outline-offset: -7px;
}

.promo .promo-hit:focus-visible { outline: 0; }

/* Entry. Modals keep a centred origin: there is no trigger to grow from.
   Exit is quicker than entry, because by then the decision is made. */
.promo[open] .promo-panel { animation: promo-in 260ms var(--promo-ease) both; }
.promo[open]::backdrop     { animation: promo-fade 260ms ease both; }
.promo.is-closing .promo-panel { animation: promo-out 160ms ease-in both; }
.promo.is-closing::backdrop    { animation: promo-fade 160ms ease reverse both; }

@keyframes promo-in {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: none; }
}

@keyframes promo-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: scale(.98); }
}

@keyframes promo-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Reduced motion keeps the fade, which explains where the panel came from,
   and drops the movement. */
@media (prefers-reduced-motion: reduce) {
  .promo[open] .promo-panel,
  .promo.is-closing .promo-panel {
    animation: promo-fade 160ms ease both;
  }
}

/* Short and wide, a laptop in landscape: the bar stacks nothing, the panel
   just gets narrower, which the width formula above already handles. Below
   this the dialog scrolls rather than crushing the artwork. */
@media (max-height: 30rem) {
  .promo[open] { padding: .75rem; align-items: start; }
  .promo-panel { width: min(25rem, 100%); }
}
