/* ============================================
   IP GATE: the password wall on protected case studies.
   The real content is encrypted in the page and only injected
   by js/ip-gate.js after the right password is entered.
   Colours come from each page's own --fx-* palette.
   ============================================ */

/* How far the gate slides up over the bottom of the hero (the glass pane) */
.fx-page {
    --ip-overlap: clamp(200px, 22vw, 400px);
}

.ip-gate {
    position: relative;
    z-index: 2;
    /* The stage (one screen tall) plus a short stretch where the modal holds in place */
    min-height: calc(var(--ip-overlap) * 0.5 + 100vh + 25vh);
    margin-top: calc(-1 * var(--ip-overlap));
    padding: calc(var(--ip-overlap) * 0.5) 16px 0;
    /* Clear at the top so the pane shows through, solid by the end of the hero */
    background: linear-gradient(to bottom, transparent, var(--fx-night) var(--ip-overlap));
    color: var(--fx-on-green);
    /* clip, not hidden: hidden would make this a scroll box and break the sticky modal */
    overflow: hidden;
    overflow: clip;
    isolation: isolate;
}

/* Locked hero: stand-in screens in the glass pane, laid out like the real
   screenshots (side, main, side). Plain shapes only, no real content. */
.ip-ghost-shots {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1.45fr 1fr;
    gap: clamp(16px, 2.4vw, 40px);
    align-items: end;
    opacity: 0.1;
}

.ip-ghost-shots i {
    display: block;
    height: clamp(170px, 19vw, 340px);
    border-radius: 14px 14px 0 0;
    background:
        /* table-like rows (no window bar: hero screens have no window chrome) */
        repeating-linear-gradient(to bottom, #eef0f5 0 1px, transparent 1px 22px) 16px 36px / calc(100% - 32px) 100% no-repeat,
        linear-gradient(#e9ebf1, #e9ebf1) 16px 18px / 40% 8px no-repeat,
        #f7f8fb;
    box-shadow: 0 -10px 40px -18px rgba(0, 0, 0, 0.45);
}

.ip-ghost-shots i:nth-child(2) {
    height: clamp(230px, 27vw, 470px);
}

/* Design system pages show one wide stack instead of three screens */
.fx-showcase--art .ip-ghost-shots {
    grid-template-columns: 1fr;
    width: min(100%, 1240px);
    margin: 0 auto;
}

.fx-showcase--art .ip-ghost-shots i:not(:nth-child(2)) {
    display: none;
}

@media (max-width: 900px) {
    .ip-ghost-shots { grid-template-columns: 1fr; }
    .ip-ghost-shots i:not(:nth-child(2)) { display: none; }
}

/* Blurred stand-in for the hidden case study: fake blocks, no real content */
.ip-gate__ghost {
    position: absolute;
    inset: var(--ip-overlap) 0 0;
    z-index: -2;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    padding: 64px clamp(16px, 6vw, 96px);
    opacity: 0.55;
    pointer-events: none;
}

.ip-gate__ghost span {
    border-radius: 18px;
    background: linear-gradient(140deg,
            color-mix(in srgb, var(--fx-green) 80%, white 8%),
            color-mix(in srgb, var(--fx-green-deep, var(--fx-night)) 90%, transparent));
}

.ip-gate__ghost span:nth-child(1) { grid-column: span 2; height: 38vh; }
.ip-gate__ghost span:nth-child(2) { height: 38vh; }
.ip-gate__ghost span:nth-child(3) { height: 22vh; }
.ip-gate__ghost span:nth-child(4) { grid-column: span 2; height: 22vh; }
.ip-gate__ghost span:nth-child(5) { grid-column: span 3; height: 30vh; }

/* Glow orbs, like the reference: give the glass something to bend */
.ip-gate::before,
.ip-gate::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    pointer-events: none;
}

.ip-gate::before {
    width: 70vmax;
    height: 70vmax;
    left: 55%;
    top: 30%;
    border: 2px solid color-mix(in srgb, var(--fx-brass-light, #fff) 55%, transparent);
    box-shadow: 0 0 60px color-mix(in srgb, var(--fx-brass-light, #fff) 35%, transparent),
        inset 0 0 60px color-mix(in srgb, var(--fx-brass-light, #fff) 20%, transparent);
}

.ip-gate::after {
    width: 140vw;
    height: 40vh;
    left: -20vw;
    bottom: -26vh;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--fx-brass-light, #fff) 45%, transparent), transparent);
    filter: blur(20px);
}

/* The veil that blurs everything behind the modal */
.ip-gate__veil {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: color-mix(in srgb, var(--fx-night) 45%, transparent);
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    /* The glass fades in over the pane instead of starting with a hard edge */
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 calc(var(--ip-overlap) * 0.7));
    mask-image: linear-gradient(to bottom, transparent, #000 calc(var(--ip-overlap) * 0.7));
}

/* The modal: sticks in view while the gate scrolls past */
/* A screen-tall box that pins to the viewport and centres the modal in it.
   The modal starts below the pane (never over the hero) and stays centred
   whatever height its text wraps to, on phones and desktops alike. */
.ip-stage {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    display: grid;
    place-items: center;
    padding: 72px 0 24px; /* keeps the modal clear of the nav */
}

.ip-modal {
    width: min(100%, 460px);
    padding: 28px 28px 26px;
    border-radius: 22px;
    background:
        radial-gradient(120% 90% at 50% 120%, color-mix(in srgb, var(--fx-brass-light, #fff) 22%, transparent), transparent 60%),
        linear-gradient(160deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    font-family: var(--fx-sans);
}

.ip-modal__badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--fx-on-green-muted, rgba(255, 255, 255, 0.75));
}

.ip-modal__badge i {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: color-mix(in srgb, var(--fx-brass-light, #fff) 30%, rgba(255, 255, 255, 0.1));
    color: #fff;
}

.ip-modal__badge svg {
    width: 16px;
    height: 16px;
}

.ip-modal h2 {
    margin: 18px 0 10px;
    font-family: var(--fx-sans);
    font-size: clamp(1.35rem, 2.6vw, 1.6rem);
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
}

.ip-modal p {
    margin: 0 0 20px;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--fx-on-green-muted, rgba(255, 255, 255, 0.78));
}

.ip-modal p a {
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

.ip-modal form {
    display: flex;
    gap: 8px;
}

.ip-modal input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    font: inherit;
    font-size: 0.95rem;
}

.ip-modal input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.ip-modal input:focus-visible,
.ip-modal button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.ip-modal button {
    padding: 12px 18px;
    border-radius: 12px;
    border: 0;
    background: #fff;
    color: var(--fx-night);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.ip-modal button:hover { transform: translateY(-1px); }
.ip-modal button:disabled { opacity: 0.6; cursor: progress; transform: none; }

.ip-modal__msg {
    min-height: 1.3em;
    margin: 10px 0 0 !important;
    font-size: 0.85rem !important;
    color: #ffb4b4 !important;
}

.ip-modal.is-wrong {
    animation: ip-shake 0.4s ease;
}

@keyframes ip-shake {
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

@media (max-width: 560px) {
    .ip-modal { padding: 22px 18px 20px; }
    .ip-modal form { flex-direction: column; }
    .ip-gate__ghost { grid-template-columns: 1fr; }
    .ip-gate__ghost span { grid-column: auto !important; }
}

@media (prefers-reduced-motion: reduce) {
    .ip-modal.is-wrong { animation: none; }
}

/* Lite mode: no live blur, just a dark overlay and a solid panel */
html.lite-fx .ip-gate__veil {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(5, 6, 14, 0.82);
}

html.lite-fx .ip-modal {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: color-mix(in srgb, var(--fx-night) 92%, #fff 6%);
}

html.lite-fx .ip-gate::after { filter: none; }
