:root {
    color-scheme: dark;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: #05010b;
    color: #0f1419;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 4vw, 3rem);
    position: relative;
    overflow: hidden;
}

.futuristic-pattern {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        145deg,
        rgba(59, 43, 124, 0.9),
        rgba(106, 76, 169, 0.9),
        rgba(155, 108, 214, 0.9)
    );
    filter: url(#advanced-texture);
    z-index: 0;
    overflow: hidden;
}

.texture-filter {
    position: absolute;
    width: 0;
    height: 0;
}

#bg-network {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 0.55;
}

#cv {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

#cv-container {
    position: relative;
    width: min(85vw, calc(85vh * (2000 / 1414)));
    min-width: min(60vw, 1100px);
    aspect-ratio: 2000 / 1414;
    overflow: visible;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
    background: #000;
}

#cv-base {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    user-select: none;
    object-fit: contain;
}

#hotspot-hint {
    margin: 0;
    color: #d7dee7;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    text-align: center;
}

.hotspot {
    position: absolute;
    top: calc(var(--top) * 1%);
    left: calc(var(--left) * 1%);
    width: calc(var(--width) * 1%);
    height: calc(var(--height) * 1%);
    border: none;
    background: rgba(255, 255, 255, 0);
    cursor: pointer;
    padding: 0;
    transition: outline 0.2s ease;
}

.hotspot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0);
    border: 2px solid transparent;
    box-shadow: 0 0 0 rgba(165, 74, 255, 0);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.hotspot:hover::after,
.hotspot:focus-visible::after {
    background: rgba(165, 74, 255, 0.12);
    border-color: rgba(165, 74, 255, 0.9);
    box-shadow: 0 0 12px rgba(165, 74, 255, 0.6);
}

.hotspot:focus-visible {
    outline: 2px solid #5ccfe6;
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

#popup {
    position: fixed;
    inset: 0;
    background: rgba(5, 1, 11, 0.35);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: clamp(2rem, 4vw, 3.5rem);
    z-index: 10;
    backdrop-filter: none;
}

.hidden {
    display: none;
}

#popup.hidden {
    display: none;
}

#popup-content {
    position: relative;
    background: rgba(255, 255, 255, 0.16);
    color: #f5f6fa;
    padding: 2.6rem;
    width: 100%;
    max-width: min(92vw, 520px);
    border-radius: 32px;
    box-shadow:
        0 20px 60px rgba(8, 8, 20, 0.5),
        inset 0 4px 20px rgba(255, 255, 255, 0.25);
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(14px) saturate(160%);
    transform: translateY(2vh);
}

#popup-content::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 32px;
    border: inherit;
    box-shadow: inset -10px -8px 0px -11px rgba(255, 255, 255, 1),
        inset 0px -9px 0px -8px rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.1);
    opacity: 0.75;
    pointer-events: none;
    filter: blur(1px) drop-shadow(10px 4px 6px rgba(0, 0, 0, 0.35)) brightness(115%);
    z-index: -1;
}

#popup-content > * {
    position: relative;
    z-index: 1;
}

#popup-close {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    color: #dcdce3;
    transition: transform 0.2s ease, background 0.2s ease;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

#popup-close:hover,
#popup-close:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.1);
}

#popup-title {
    margin-top: 0;
    margin-bottom: 1.25rem;
    font-size: 1.7rem;
    color: #fefefe;
    letter-spacing: 0.02em;
}

#popup-body {
    font-size: 1rem;
    line-height: 1.7;
    color: rgba(239, 239, 247, 0.95);
}

#popup-body ul {
    padding-left: 1.2rem;
    margin: 0.25rem 0 0;
}

#popup-body li {
    margin-bottom: 0.4rem;
}
}

@media (max-width: 640px) {
    body {
        padding: 1rem;
    }

    #cv-container {
        max-height: none;
    }

    #popup-content {
        padding: 1.5rem;
    }
}

@media print {
    body {
        background: #fff;
    }

    #cv,
    #cv-container,
    #cv-base {
        width: 100%;
        max-width: none;
        box-shadow: none;
    }

    #popup,
    .hotspot,
    #hotspot-hint {
        display: none !important;
    }
}
