/* ==========================================================================
   Homepage tool theater ("Try every tool"), see js/tools-showcase.js
   One live tool at a time, filling the screen below the fixed nav.
   ========================================================================== */

.np-showcase {
    position: relative;
    z-index: auto;                       /* no stacking context: lets the theater sit above the ribbon */
    padding: 90px 0 10px;
    background: linear-gradient(180deg, #2d3748 0%, #1d2133 35%, #151826 100%);
}
#LuckyTool {
    padding-top: 120px;
    background: linear-gradient(180deg, #151826 0%, #1b1530 45%, #151826 100%);
}
.np-showcase .title { color: #fff; }
.np-showcase > p {
    max-width: 680px;
    padding: 24px 20px 36px;
    color: #c9cddd;
}

.np-theater {
    --np-bar: 62px;
    position: relative;
    z-index: 3;                          /* the ribbon passes behind it */
    display: flex;
    flex-direction: column;
    height: calc(100vh - 64px);
    height: calc(100dvh - 64px);
    min-height: 520px;
    background: #1a1c2b;
    text-align: left;
    scroll-margin-top: 64px;
    box-shadow: 0 -30px 60px -40px rgba(233, 18, 112, .6), 0 30px 60px -30px #000;
}
.np-theater.np-th-is-full { height: 100vh; min-height: 0; }
.np-theater-lucky {                      /* the surprise tool: a little shorter */
    height: min(calc(100vh - 64px), 860px);
    height: min(calc(100dvh - 64px), 860px);
}
.np-th-shuffle i { transition: transform .5s cubic-bezier(.16, 1, .3, 1); }
.np-th-shuffle:hover i { transform: rotate(180deg); }

/* ---- placeholder before the tool list arrives ---- */
.np-th-placeholder {
    flex: 1;
    display: grid;
    place-items: center;
    color: #8f96b8;
    font-size: 14px;
    letter-spacing: .08em;
    text-transform: uppercase;
    background: linear-gradient(100deg, rgba(255, 255, 255, .02) 30%, rgba(255, 255, 255, .06) 50%, rgba(255, 255, 255, .02) 70%) 0 0 / 300% 100%;
    animation: np-shimmer 1.6s linear infinite;
}
@keyframes np-shimmer { to { background-position: -150% 0; } }
.np-th-fallback { margin: auto; }
.np-th-fallback a { color: #fff; font-weight: 600; }

/* ---- control bar ---- */
.np-th-bar {
    position: relative;
    z-index: 6;
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--np-bar);
    padding: 0 12px;
    background: rgba(13, 15, 26, .96);
}
.np-th-bar::after {                      /* thin logo-coloured rule under the bar */
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, #e91270, #8b0fa3 40%, #4a6bb5 75%, #21dede);
}
.np-th-bar button,
.np-th-bar a {
    font-family: inherit;
    color: #dfe3f5;
    cursor: pointer;
}
.np-th-step,
.np-th-full {
    flex: none;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .04);
    transition: background .2s, border-color .2s, transform .2s;
}
.np-th-step:hover,
.np-th-full:hover { background: rgba(233, 18, 112, .18); border-color: rgba(233, 18, 112, .6); }
.np-th-step:active { transform: scale(.94); }

.np-th-pick {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: 340px;
    height: 46px;
    padding: 0 12px 0 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .05);
    text-align: left;
    transition: background .2s, border-color .2s;
}
.np-th-pick:hover,
.np-th-pick[aria-expanded="true"] { border-color: rgba(233, 18, 112, .6); background: rgba(255, 255, 255, .08); }
.np-th-icon {
    flex: none;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    font-size: 15px;
    color: #fff;
    background: linear-gradient(135deg, #e91270, #8b0fa3 55%, #4a6bb5);
}
.np-th-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}
.np-th-meta small {
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #8f96b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.np-th-meta b {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.np-th-bar em,
.np-th-tile em {
    font-style: normal;
    font-size: 9px;
    font-weight: 700;
    vertical-align: 2px;
    padding: 2px 6px;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, #667eea, #764ba2);
}
.np-th-caret { font-size: 11px; opacity: .6; transition: transform .25s; }
.np-th-pick[aria-expanded="true"] .np-th-caret { transform: rotate(180deg); }
.np-th-count {
    flex: none;
    font-size: 12px;
    color: #8f96b8;
    font-variant-numeric: tabular-nums;
}
.np-th-desc {
    flex: 1;
    min-width: 0;
    margin: 0 !important;
    padding: 0 6px !important;
    text-align: left !important;
    font-size: 13px;
    color: #9aa1c0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.np-th-open {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: #fff !important;
    background: linear-gradient(135deg, #e91270, #8b0fa3);
    box-shadow: 0 8px 20px -10px rgba(233, 18, 112, .9);
}
.np-th-open i { font-size: 11px; }

/* ---- the stage: one live tool ---- */
.np-th-stage {
    position: relative;
    flex: 1;
    min-height: 0;
}
.np-th-stage iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #2a2d3f;
}
.np-th-loading {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #1d1f31;
    transition: opacity .45s, visibility 0s .45s;
}
.np-th-loading img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    filter: blur(8px) brightness(.5);
    transform: scale(1.06);
}
.np-th-loading img:not([src]) { display: none; }
.np-th-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: #fff;
    font-size: 15px;
    letter-spacing: .04em;
}
.np-th-spinner i {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0 25%, #e91270, #8b0fa3, #21dede);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
    animation: np-spin-th .9s linear infinite;
}
@keyframes np-spin-th { to { transform: rotate(360deg); } }
.np-th-ready .np-th-loading { opacity: 0; visibility: hidden; }

/* ---- picker ---- */
.np-th-picker {
    position: absolute;
    top: var(--np-bar);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    background: rgba(15, 17, 29, .97);
    animation: np-th-in .3s cubic-bezier(.16, 1, .3, 1);
}
.np-th-picker[hidden] { display: none; }
@keyframes np-th-in { from { opacity: 0; transform: translateY(-10px); } }
.np-th-picker-head {
    flex: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    color: #8f96b8;
}
.np-th-picker-head input {
    flex: 1;
    min-width: 0;
    height: 42px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .05);
    color: #fff;
    font: inherit;
    font-size: 15px;
    outline: none;
}
.np-th-picker-head input:focus { border-color: rgba(233, 18, 112, .7); }
.np-th-close {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: transparent;
    color: #dfe3f5;
    cursor: pointer;
}
.np-th-picker-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px 20px 28px;
}
.np-th-cat[hidden] { display: none; }
.np-th-cat h4 {
    margin: 22px 0 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #9aa1c0;
}
.np-th-cat h4 i { color: #e91270; margin-right: 6px; }
.np-th-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
}
.np-th-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .08);
    background: rgba(255, 255, 255, .03);
    color: #fff;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    transition: transform .25s cubic-bezier(.16, 1, .3, 1), border-color .2s, background .2s;
}
.np-th-tile[hidden] { display: none; }
.np-th-tile:hover { transform: translateY(-3px); border-color: rgba(233, 18, 112, .55); background: rgba(255, 255, 255, .06); }
.np-th-tile.np-th-active { border-color: #e91270; box-shadow: 0 0 0 1px #e91270, 0 10px 26px -12px rgba(233, 18, 112, .9); }
.np-th-tile img,
.np-th-tile-icon {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    border-radius: 8px;
    margin-bottom: 6px;
    object-fit: cover;
    object-position: top center;
    background: #1d1f31;
}
.np-th-tile-icon {
    display: grid;
    place-items: center;
    font-size: 34px;
    background: radial-gradient(circle at 30% 20%, rgba(233, 18, 112, .35), transparent 55%), radial-gradient(circle at 80% 90%, rgba(74, 107, 181, .5), transparent 60%), #1d1f31;
}
.np-th-tile b { font-size: 14px; font-weight: 600; }
.np-th-tile small {
    font-size: 12px;
    line-height: 1.35;
    color: #9aa1c0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- the page ribbon plugs into the socket (netpack-motion.js sets np-dockable / np-docked):
        the theater powers on, a flash runs along its top edge, the bar's rule charges up ---- */
.np-dockable .np-th-stage { opacity: .45; transition: opacity .9s .25s; }
.np-dockable.np-docked .np-th-stage,
.np-th-is-full .np-th-stage { opacity: 1; }
.np-dockable .np-th-bar::after {
    transform-origin: var(--np-sock, 80px) 50%;
    transform: scaleX(0);
    transition: transform 1.1s cubic-bezier(.16, 1, .3, 1) .1s;
}
.np-dockable.np-docked .np-th-bar::after,
.np-th-is-full .np-th-bar::after { transform: none; }
.np-theater::before {
    content: '';
    position: absolute;
    z-index: 7;
    top: -1px;
    left: 0;
    right: 0;
    height: 3px;
    pointer-events: none;
    opacity: 0;
    transform-origin: var(--np-sock, 80px) 50%;
    background: linear-gradient(90deg, transparent, #21dede calc(var(--np-sock, 80px) - 300px), #e91270 calc(var(--np-sock, 80px) - 60px),
        #fff var(--np-sock, 80px), #e91270 calc(var(--np-sock, 80px) + 160px), #8b0fa3 calc(var(--np-sock, 80px) + 500px), #21dede 85%, transparent);
    box-shadow: 0 0 18px rgba(233, 18, 112, .8);
}
.np-docked::before { animation: np-dock-flash 1.3s cubic-bezier(.16, 1, .3, 1); }
@keyframes np-dock-flash {
    from { opacity: 1; transform: scaleX(0); }
    55%  { opacity: 1; }
    to   { opacity: 0; transform: none; }
}
.np-th-icon { transition: box-shadow .6s; }
.np-docked .np-th-icon {
    animation: np-plug .9s cubic-bezier(.16, 1, .3, 1);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .25), 0 0 16px rgba(233, 18, 112, .75);
}
@keyframes np-plug {
    from { transform: scale(1.45); box-shadow: 0 0 0 0 rgba(255, 95, 162, .9), 0 0 40px 12px rgba(233, 18, 112, .9); }
    40%  { box-shadow: 0 0 0 12px rgba(255, 95, 162, 0), 0 0 30px 6px rgba(233, 18, 112, .8); }
}

/* ---- smaller screens: keep the tool as big as possible ---- */
@media (max-width: 1100px) {
    .np-th-desc { visibility: hidden; }
}
@media (max-width: 700px) {
    .np-theater { --np-bar: 56px; }
    .np-th-bar { gap: 6px; padding: 0 8px; }
    .np-th-step, .np-th-full { width: 36px; height: 36px; }
    .np-th-pick { flex: 1; max-width: none; height: 42px; }
    .np-th-count, .np-th-desc { display: none; }
    .np-th-open { width: 36px; height: 36px; padding: 0; justify-content: center; }
    .np-th-open span { display: none; }
    .np-th-picker-head, .np-th-picker-body { padding-left: 12px; padding-right: 12px; }
    .np-th-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .np-th-placeholder, .np-th-spinner i { animation: none; }
    .np-th-picker { animation: none; }
    .np-docked::before, .np-docked .np-th-icon { animation: none; }
}
