:root {
    --mini-tx: 0px;
    --mini-ty: 0px;
}

/* SPS Nuremberg 2025 promo modal - index-only styles (no style.css edits) */
#sps-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .7); /* 70% opacity background */
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: none;
    z-index: 15000;
    opacity: 0;
    transition: opacity .45s ease
}

#sps-modal-overlay.open {
    opacity: 1
}

#sps-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(.96);
    width: min(92vw, 960px);
    max-height: 86vh;
    overflow: auto;
    display: none;
    z-index: 15010;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(14, 131, 208, .88) 0%, rgba(10, 120, 210, .88) 100%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    backdrop-filter: blur(8px) saturate(140%);
    box-shadow: 0 24px 80px -24px rgba(0, 0, 0, .55), 0 10px 28px -10px rgba(0, 0, 0, .35);
    border: 1px solid rgba(255, 255, 255, .12);
    padding: 28px clamp(18px, 3vw, 44px) 34px;
    font-family: Inter, system-ui, Segoe UI, Arial, sans-serif;
    opacity: 0;
    transition: opacity .45s ease, transform .5s cubic-bezier(.25, .8, .3, 1), border-radius .5s ease;
    /* center contents vertically */
    /* Removed flex centering to avoid conflict with inline display from JS */
}

#sps-modal {
    pointer-events: none
}

#sps-modal.open {
    pointer-events: auto
}

#sps-modal.open {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1)
}

#sps-modal.morph-to-mini, #sps-modal.from-mini {
    transform: translate(-50%, -50%) translate(var(--mini-tx, 0px), var(--mini-ty, 0px)) scale(.16);
    border-radius: 50%;
}

/* Faster transition used only during minimize */
#sps-modal.fast-morph {
    transition: opacity .3s ease, transform .35s cubic-bezier(.25, .9, .3, 1), border-radius .35s ease;
}

#sps-modal .sps-close {
    display: none
}

/* not closable via X per requirement */
#sps-modal .sps-body {
    text-align: center;
    /* center inner elements */
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 0 auto; /* ensure horizontal centering within modal */
}

@media (max-width: 640px) {
    #sps-modal {
        top: 50%;
        width: min(94vw, 560px);
        padding: 22px 16px 26px;
        border-radius: 16px;
    }

    #sps-modal .sps-body {
        gap: 10px;
    }

    #sps-mini-btn {
        left: 12px;
        bottom: 16px;
        width: 52px;
        height: 52px
    }
}

/* Prevent page scroll when modal is open */
html.modal-open, body.modal-open { overflow: hidden !important; }

/* Mid-size screens: condense modal to avoid vertical/horizontal scrollbars (e.g., ~1272px width) */
@media (max-width: 1360px) and (min-width: 981px) {
  #sps-modal { width: min(88vw, 900px); max-height: 82vh; padding: 22px clamp(16px, 2.5vw, 32px) 26px; }
  #sps-modal h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.2rem); line-height: 1.05; margin: 6px 0 12px; }
  #sps-modal h2 { font-size: clamp(1.2rem, 0.95rem + 1.4vw, 1.9rem); margin: 0 0 8px; }
  #sps-modal p  { font-size: clamp(0.98rem, 0.92rem + 0.35vw, 1.18rem); line-height: 1.55; }
  #sps-modal .sps-where { font-size: clamp(1.05rem, 0.95rem + .7vw, 1.6rem); gap: .4rem; }
  #sps-modal .sps-cta a { padding: 14px 22px; font-size: clamp(1rem, 0.95rem + .35vw, 1.2rem); border-radius: 10px; }
}

/* Slightly smaller laptops/tablets landscape */
@media (max-width: 980px) and (min-width: 641px) {
  #sps-modal { width: 92vw; max-height: 80vh; padding: 20px 16px 24px; }
  #sps-modal h1 { font-size: clamp(1.9rem, 1.3rem + 3.2vw, 2.8rem); }
  #sps-modal h2 { font-size: clamp(1.1rem, 0.9rem + 1.3vw, 1.6rem); }
  #sps-modal p  { font-size: clamp(0.96rem, 0.9rem + 0.35vw, 1.1rem); }
  #sps-modal .sps-where { font-size: clamp(1rem, 0.9rem + .7vw, 1.45rem); }
  #sps-modal .sps-cta a { padding: 12px 20px; font-size: clamp(0.98rem, 0.9rem + .35vw, 1.1rem); }
}

/* Height-based aggressive condensation (short viewports) */
@media (max-height: 780px) {
  #sps-modal { max-height: 94vh; padding: 18px clamp(16px, 2vw, 28px) 22px; overflow: hidden; }
  #sps-modal h1 { font-size: clamp(1.9rem, 1.3rem + 2.8vw, 3rem); margin: 4px 0 8px; line-height: 1.04; }
  #sps-modal h2 { font-size: clamp(1.05rem, 0.9rem + 1.1vw, 1.6rem); margin: 0 0 4px; }
  #sps-modal p { font-size: clamp(.9rem, .85rem + .35vw, 1.05rem); line-height: 1.45; }
  #sps-modal .sps-where { font-size: clamp(.95rem, .85rem + .6vw, 1.35rem); margin: .6rem 0 .9rem; line-height:1.3; }
  #sps-modal .sps-cta a { padding: 12px 20px; font-size: clamp(.92rem, .85rem + .35vw, 1.05rem); }
}

/* Condensed state applied by JS if dynamic scaling required */
#sps-modal.sps-condensed { overflow: hidden; }
#sps-modal.sps-condensed .sps-body { will-change: transform; transition: transform .35s ease; }
/* Slight horizontal padding reduction when condensed */
#sps-modal.sps-condensed { padding-left: clamp(14px, 2vw, 26px); padding-right: clamp(14px, 2vw, 26px); }

/* Enforce no horizontal overflow inside modal content */
#sps-modal .sps-body { max-width: 100%; overflow-x: hidden; }
#sps-modal p, #sps-modal .sps-where { word-break: normal; overflow-wrap: anywhere; }

/* When JS opens modal, add a helper class to HTML/BODY to prevent background scroll */
/* Note: script already sets body.style.overflow='hidden'; this is a CSS backup */

#sps-modal h2 {
    margin: 0 0 12px;
    font-weight: 800;
    font-size: clamp(1.3rem, 1rem + 1.8vw, 2.2rem);
    letter-spacing: .1px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .2)
}

#sps-modal h1 {
    margin: 8px 0 16px;
    font-weight: 900;
    line-height: 1.02;
    letter-spacing: .2px;
    font-size: clamp(2.2rem, 1.6rem + 3.8vw, 3.8rem);
    text-shadow: 0 3px 16px rgba(0, 0, 0, .25)
}

#sps-modal p {
    margin: .55rem 0;
    font-size: clamp(1.02rem, .95rem + .4vw, 1.28rem);
    line-height: 1.6;
    opacity: .97
}

#sps-modal .sps-where {
    margin: .9rem 0 1.2rem;
    font-size: clamp(1.15rem, 1.02rem + .9vw, 1.8rem);
    line-height: 1.35;
    display: flex;
    align-items: center;
    gap: .5rem;
    justify-content: center
}

#sps-modal .sps-where .pin {
    font-size: 1.4em;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35))
}

#sps-modal .sps-cta {
    margin-top: 18px;
    display: flex;
    justify-content: center
}

#sps-modal .sps-cta a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 800;
    font-size: clamp(1.05rem, 1rem + .4vw, 1.35rem);
    padding: 16px 28px;
    border-radius: 12px;
    background: #b9eb5f;
    color: #0a2d4f;
    box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .65);
    transition: transform .25s ease, box-shadow .25s ease
}

#sps-modal .sps-cta a:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .7)
}

#sps-mini-btn {
    position: fixed; /* ensure positioned for pseudo-elements */
    left: 16px;
    bottom: 22px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: none;
    z-index: 15020;
    overflow: visible; /* ensure chip can expand outside */
    /* Seamless wavy overlay (tile) over brand gradient */
    background-image:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cdefs%3E%3Cfilter id='f' x='-10%25' y='-10%25' width='120%25' height='120%25'%3E%3CfeGaussianBlur stdDeviation='1.6'/%3E%3C/filter%3E%3Cg id='lines' fill='none' stroke='white' stroke-opacity='.9' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M0 32 C 16 8, 48 56, 64 32'/%3E%3Cpath d='M0 22 C 16 -2, 48 46, 64 22'/%3E%3Cpath d='M0 42 C 16 18, 48 66, 64 42'/%3E%3C/g%3E%3C/defs%3E%3Cg filter='url(%23f)'%3E%3Cuse href='%23lines' transform='translate(-64,0)'/%3E%3Cuse href='%23lines'/%3E%3Cuse href='%23lines' transform='translate(64,0)'/%3E%3C/g%3E%3C/svg%3E"),
      linear-gradient(135deg, #00eaff 0%, #00b3ff 45%, #b9eb5f 100%);
    background-repeat: repeat-x, no-repeat;
    background-size: 64px 64px, 100% 100%;
    background-position: 0 50%, 50% 50%;
    /* Draw wave lines normally on top of the gradient for best contrast */
    background-blend-mode: normal, normal;
    animation: spsWavePos 10s linear infinite; /* slower, seamless loop */
    will-change: background-position;
    color: #fff;
    border: none;
    box-shadow: 0 10px 28px -10px rgba(0, 0, 0, .6);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    letter-spacing: .5px;
    transition: transform .35s ease, box-shadow .35s ease, opacity .3s ease;
}

#sps-mini-btn::after {
    content: "";
    position: absolute;
    inset: -25%;
    background: radial-gradient(40% 40% at 30% 30%, rgba(255,255,255,.22), rgba(255,255,255,0) 60%);
    mix-blend-mode: overlay;
    filter: blur(3px);
    opacity: .10; /* very subtle highlight so wavy lines are clear */
    transform: translate(-12%, -12%) rotate(0deg);
    animation: spsShine 8s ease-in-out infinite;
    pointer-events: none;
}

#sps-mini-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px -12px rgba(0, 0, 0, .65);
}

#sps-mini-btn span {
    display: none
}

/* Hover chip that slides out of the toggle button */
#sps-mini-btn::before {
    content: "SPS Nuremberg 2025";
    position: absolute;
    top: 50%;
    left: calc(100% + 10px);
    height: 100%; /* match button height */
    max-width: 70vw;
    display: inline-flex;
    align-items: center;
    padding: 0 16px;
    border-radius: 9999px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(3, 34, 81, 0.96);
    /*border: 1px solid rgba(255,255,255,.18);*/
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    letter-spacing: .2px;
    box-shadow: 0 10px 28px -10px rgba(0,0,0,.55);
    z-index: -1; /* render under the toggle button to look like it emerges from beneath */
    pointer-events: none; /* avoid flicker and keep hover on button */
    /* animation state */
    transform-origin: left center; /* emerge from under the button */
    transform: translate(-10px, -50%) scaleX(0.9); /* start tucked just under the button edge */
    clip-path: inset(0 92% 0 0 round 9999px); /* reveal left->right */
    opacity: 0;
    transition: transform .34s ease-out, opacity .2s ease-out, clip-path .34s ease-out;
}

#sps-mini-btn:hover::before,
#sps-mini-btn:focus::before,
#sps-mini-btn:focus-visible::before {
    clip-path: inset(0 0 0 0 round 9999px);
    opacity: 1;
    transform: translate(0, -50%) scaleX(1);
}

/* Smooth, continuous gradient travel for first (stripes) layer; base stays static */
@keyframes spsWave {
    0%   { background-position: 0% 50%, 50% 50%; }
    100% { background-position: 100% 50%, 50% 50%; }
}

/* Shimmer path that slowly glides and rotates for a wave-like crest */
@keyframes spsShine {
    0%   { transform: translate(-12%, -12%) rotate(0deg); }
    25%  { transform: translate(10%, -6%) rotate(90deg); }
    50%  { transform: translate(12%, 12%) rotate(180deg); }
    75%  { transform: translate(-8%, 10%) rotate(270deg); }
    100% { transform: translate(-12%, -12%) rotate(360deg); }
}

@keyframes spsWavePos {
    0%   { background-position: 0 50%, 50% 50%; }
    100% { background-position: 64px 50%, 50% 50%; }
}
