/**
 * 3D Interactive Desk Portfolio - Styles
 * Main stylesheet for UI components and overlays
 */

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: #000;
}

/* === CANVAS CONTAINER === */
#canvas-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* === LOADING SCREEN === */
#loading {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    background:
        radial-gradient(ellipse 80% 60% at 50% 100%, rgba(255, 166, 87, 0.09), transparent 70%),
        radial-gradient(ellipse 90% 70% at 50% 40%, #14181f 0%, #0a0c10 100%);
    text-align: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading.loading-hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 24px;
}

.loading-eyebrow {
    color: rgba(255, 255, 255, 0.35);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.45em;
    text-transform: uppercase;
    margin-bottom: 18px;
    margin-left: 0.45em; /* offset trailing letter-spacing so text is optically centered */
    animation: loadingRise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.loading-title {
    color: #f4f1ec;
    font-size: clamp(40px, 7vw, 68px);
    font-weight: 200;
    letter-spacing: 0.08em;
    line-height: 1.1;
    margin-bottom: 34px;
}

.loading-title span {
    display: inline-block;
    animation: loadingRise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.loading-title span:nth-child(1) { animation-delay: 0.05s; }
.loading-title span:nth-child(2) { animation-delay: 0.10s; }
.loading-title span:nth-child(3) { animation-delay: 0.15s; }
.loading-title span:nth-child(4) { animation-delay: 0.20s; }
.loading-title span:nth-child(5) { animation-delay: 0.25s; }
.loading-title span:nth-child(6) { animation-delay: 0.30s; }
.loading-title span:nth-child(7) { animation-delay: 0.35s; }
.loading-title span:nth-child(8) { animation-delay: 0.40s; }

.loading-track {
    width: min(220px, 60vw);
    height: 2px;
    border-radius: 1px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin-bottom: 22px;
    animation: loadingRise 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.5s both;
}

.loading-shimmer {
    width: 40%;
    height: 100%;
    border-radius: 1px;
    background: linear-gradient(90deg, transparent, #ffb972, transparent);
    animation: loadingSweep 1.6s ease-in-out infinite;
}

.loading-status {
    color: rgba(255, 255, 255, 0.45);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.12em;
    animation: loadingRise 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.6s both;
}

.loading-status::after {
    content: '';
    display: inline-block;
    width: 1.2em;
    text-align: left;
    animation: loadingEllipsis 1.8s steps(4, jump-none) infinite;
}

@keyframes loadingRise {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loadingSweep {
    0% { transform: translateX(-260%); }
    100% { transform: translateX(360%); }
}

@keyframes loadingEllipsis {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75%, 100% { content: '...'; }
}

@media (prefers-reduced-motion: reduce) {
    .loading-eyebrow,
    .loading-title span,
    .loading-track,
    .loading-status {
        animation: none;
    }

    .loading-shimmer {
        animation-duration: 3.2s;
    }
}

/* === INFO PANEL === */
#info-panel {
    display: none;
}

/* === CLOSE BUTTON === */
#close-btn {
    display: none;
}

/* === INSTRUCTIONS === */
#instructions {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 16px;
    z-index: 10;
    animation: fadeIn 2s ease;
    pointer-events: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}



/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    #info-panel {
        max-width: 90%;
        padding: 20px;
    }

    #info-panel h2 {
        font-size: 24px;
    }

    #info-panel h3 {
        font-size: 18px;
    }

    #instructions {
        font-size: 14px;
        padding: 10px 20px;
        bottom: 20px;
    }
}

@media (max-width: 480px) {
    #instructions {
        font-size: 12px;
        padding: 8px 15px;
    }
}

/* === PORTRAIT ORIENTATION OVERLAY === */
#rotate-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #1a1a2e;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.rotate-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    animation: rotateContent 3s ease-in-out 2s forwards;
}

.phone-icon {
    width: 60px;
    height: 105px;
    animation: rotatePhone 3s ease-in-out 2s forwards;
}

.phone-icon svg {
    width: 100%;
    height: 100%;
}

.rotate-text {
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.rotate-subtext {
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
}

.rotate-enable-btn {
    display: none;
    margin-top: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    cursor: pointer;
}

/* Shown only on iOS 13+, where DeviceOrientationEvent requires an explicit
   gesture-triggered permission grant before it will fire. */
body.needs-orientation-permission .rotate-enable-btn {
    display: inline-block;
}

/* Phone rotates from portrait (0deg) to landscape (90deg) */
@keyframes rotatePhone {
    0%, 30% {
        transform: rotate(0deg);
    }
    70%, 100% {
        transform: rotate(90deg);
    }
}

/* Entire content block rotates so user follows along */
@keyframes rotateContent {
    0%, 30% {
        transform: rotate(0deg);
    }
    70%, 100% {
        transform: rotate(90deg);
    }
}

/* Only show overlay on portrait mobile screens */
@media screen and (max-width: 768px) and (orientation: portrait) {
    #rotate-overlay {
        display: flex;
    }
}

/* Orientation lock keeps the layout in portrait even once the device is
   physically turned sideways -- deviceorientation detects that real tilt
   (see js/systems/orientation.js) and dismisses the overlay early. */
body.physical-landscape #rotate-overlay {
    display: none !important;
}
