/* ============================================================
   SBLOB — Surface Carousel + Astrolabio + Lock-in
   Flusso: Swipe laterale → Touch & Hold → Drag icone →
           Transizione verticale → Long press lock-in
   ============================================================ */

/* --- SURFACE STAGE --- */
.surface-stage {
    position: fixed;
    top: 56px; /* header height */
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    background: #111;
    touch-action: pan-y;
    user-select: none;
}

.surface-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.surface-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: transform;
}
.surface-slide.active {
    transform: translateX(0);
}
.surface-slide.prev {
    transform: translateX(-100%);
}
.surface-slide.next {
    transform: translateX(100%);
}

/* Card full-screen */
.surface-card {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    color: #eee;
    overflow: hidden;
}
.surface-img {
    flex: 1 1 55%;
    min-height: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}
.surface-img::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to top, #1a1a1a, transparent);
}
.surface-body {
    flex: 0 0 auto;
    padding: 16px 20px 28px;
    max-height: 45%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.surface-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.78em;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.surface-domain { color: #4dabf7; }
.surface-date { color: #888; }
.surface-title {
    font-size: 1.35em;
    line-height: 1.25;
    margin: 0 0 8px;
    color: #fff;
    font-weight: 700;
}
.surface-abstract {
    font-size: 0.92em;
    line-height: 1.45;
    color: #bbb;
    margin: 0 0 14px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.surface-source {
    display: inline-block;
    padding: 9px 18px;
    background: #4dabf7;
    color: #fff !important;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
    transition: background 0.2s;
}
.surface-source:hover { background: #339af0; }

.surface-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #888;
}
.surface-empty h2 { color: #bbb; font-size: 1.4em; }

/* Hint & indicator */
.surface-hint {
    position: absolute;
    bottom: 14px;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255,255,255,0.45);
    font-size: 0.78em;
    letter-spacing: 0.5px;
    pointer-events: none;
    transition: opacity 0.4s;
}
.surface-hint.hidden { opacity: 0; }

.surface-indicator {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    pointer-events: none;
}
.surface-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    transition: background 0.3s;
}
.surface-dot.active { background: #4dabf7; }

/* --- ASTROLABIO --- */
#sblob-astrolabio {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10100;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.82);
    touch-action: none;
    user-select: none;
}
#sblob-astrolabio.visible { display: flex; }

.astrolabio-hint {
    position: absolute;
    top: 10%;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255,255,255,0.7);
    font-size: 0.88em;
    letter-spacing: 0.5px;
    pointer-events: none;
}

.astrolabio-arc {
    position: relative;
    width: 320px;
    height: 320px;
    margin-top: -60px;
}

.astrolabio-icon {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    left: 50%;
    top: 50%;
    margin-left: -30px;
    margin-top: -30px;
    will-change: transform;
}
.astrolabio-icon.hovered,
.astrolabio-icon:active {
    transform: scale(1.22);
    box-shadow: 0 0 0 5px rgba(255,255,255,0.25), 0 8px 28px rgba(0,0,0,0.45);
}
.astrolabio-icon .icon-label {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.55em;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    opacity: 0;
    transition: opacity 0.2s;
}
.astrolabio-icon.hovered .icon-label,
#sblob-astrolabio.show-labels .astrolabio-icon .icon-label {
    opacity: 1;
}

.astrolabio-utilities {
    position: absolute;
    bottom: 8%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 28px;
}
.astrolabio-util {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 10px 18px;
    border-radius: 24px;
    font-size: 0.85em;
    font-family: inherit;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}
.astrolabio-util:hover { background: rgba(255,255,255,0.2); }

/* --- DEPTH TRANSITION --- */
.depth-layer {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10050;
    display: none;
    pointer-events: none;
}
.depth-layer.visible {
    display: block;
    pointer-events: auto;
}
.depth-card {
    position: absolute;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    color: #eee;
    transform: translateY(100%);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.depth-card.enter {
    transform: translateY(0);
}
.depth-card.exit {
    transform: translateY(-40%);
    opacity: 0;
    transition: transform 0.35s ease, opacity 0.35s ease;
}
.depth-card .surface-img { flex: 1 1 50%; }
.depth-card .surface-body { flex: 0 0 auto; padding: 16px 20px 24px; }

.depth-hint {
    position: absolute;
    bottom: 14px;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255,255,255,0.45);
    font-size: 0.78em;
    pointer-events: none;
}

/* --- LOCK-IN --- */
#sblob-lockin {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10200;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.75);
}
#sblob-lockin.visible { display: flex; }

.lockin-content {
    background: #fff;
    padding: 28px 24px;
    border-radius: 14px;
    max-width: 340px;
    width: 86%;
    text-align: center;
    box-shadow: 0 14px 50px rgba(0,0,0,0.35);
    animation: lockinPop 0.35s ease;
}
.lockin-content h3 {
    margin: 0 0 8px;
    font-size: 1.2em;
    color: #222;
}
.lockin-content p {
    margin: 0 0 16px;
    color: #666;
    font-size: 0.9em;
}
.lockin-content input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1em;
    margin-bottom: 14px;
}
.lockin-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.lockin-actions button {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.95em;
    font-family: inherit;
    cursor: pointer;
    border: 0;
}
#lockin-close {
    background: #f0f0f0;
    color: #444;
}
#lockin-confirm {
    background: #111;
    color: #fff;
}

@keyframes lockinPop {
    from { transform: scale(0.92); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* Progress ring for long press */
.longpress-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.longpress-ring.active {
    opacity: 1;
}
.longpress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.longpress-ring circle {
    fill: none;
    stroke: rgba(255,255,255,0.35);
    stroke-width: 4;
}
.longpress-ring circle.progress {
    stroke: #4dabf7;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 339.292;
    transition: stroke-dashoffset 3s linear;
}
.longpress-ring.active circle.progress {
    stroke-dashoffset: 0;
}

/* Hide standard layout on home */
body.home-page .corpo {
    margin-top: 0;
    padding: 0;
}
body.home-page .header {
    background: rgba(0,0,0,0.25);
    box-shadow: none;
    backdrop-filter: blur(6px);
}
body.home-page .header-search input {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.2);
    color: #fff;
}
body.home-page .header-search input::placeholder { color: rgba(255,255,255,0.5); }

@media (max-width: 480px) {
    .surface-title { font-size: 1.15em; }
    .surface-abstract { font-size: 0.88em; -webkit-line-clamp: 3; }
    .astrolabio-arc { width: 260px; height: 260px; }
    .astrolabio-icon { width: 50px; height: 50px; font-size: 1.5em; margin-left: -25px; margin-top: -25px; }
}
