/* Alien Translation Relic Styles */
/* Scoped to work within the main template layout */

/* Font Import */
@import url("https://use.typekit.net/flx3dob.css");

/* ===========================================
   EASY ADJUSTMENT VARIABLES
   Modify these values to quickly adjust the UI
   =========================================== */
:root {
    /* Whale Square Sizes */
    --square-size: 40px;
    --square-size-active: 70px;
    --square-size-inactive: 30px;      /* Size when another square is active */
    --square-border-width: 1px;
    --square-border-color: rgba(255, 255, 255, 0.5);
    --square-border-color-active: rgba(255, 255, 255, 0.9);

    /* Whale Square Label */
    --label-font-size: 12px;
    --label-gap: 15px;
    --label-key-color: #fff;
    --label-value-color: #fff;

    /* Mobile Square Sizes */
    --square-size-mobile: 30px;
    --square-size-active-mobile: 50px;
    --square-size-inactive-mobile: 20px;
    --label-font-size-mobile: 12px;
}

#page-alien-translation .c-canvas-half {
    position: relative;
    font-family: "degular-mono", sans-serif;
    font-weight: 400;
    background: #000;
    overflow: hidden;
}

/* Background Video - Fullscreen */
#background-video,
#background-video-mobile {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -1;
    /* Safari performance fixes */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
}

/* Show desktop video, hide mobile by default */
#background-video-mobile {
    display: none;
}

@media (max-width: 768px) {
    #background-video {
        display: none;
    }
    #background-video-mobile {
        display: block;
    }
}


/* Whale Squares */
#whale-squares {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.whale-square {
    position: absolute;
    width: var(--square-size);
    height: var(--square-size);
    border: var(--square-border-width) solid var(--square-border-color);
    background: transparent;
    transition: width 0.3s ease, height 0.3s ease, border-color 0.3s ease;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    pointer-events: auto;
}

.whale-square.active {
    width: var(--square-size-active);
    height: var(--square-size-active);
    border-color: var(--square-border-color-active);
    background: transparent;
}

/* When container has active class, shrink inactive squares */
#whale-squares.has-active .whale-square:not(.active) {
    width: var(--square-size-inactive);
    height: var(--square-size-inactive);
}

.whale-details {
    position: absolute;
    left: calc(100% + var(--label-gap));
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: var(--label-font-size);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    font-family: "Test Pitch", monospace;
    font-weight: 400;
    line-height: normal;
}

.whale-square.active .whale-details {
    opacity: 1;
}

.whale-details .whale-label {
    display: flex;
    line-height: normal;
}

.whale-details .whale-label-key {
    color: var(--label-key-color);
    display: inline-block;
    min-width: 8ch;
}

.whale-details .whale-label-value {
    color: var(--label-value-color);
}


/* Translator Component
   =====================
   CSS Variables for positioning and sizing the translator interface.

   --translator-width: Overall width of the translator component
   --translator-bottom: Distance from bottom of viewport

   --knob-size: Diameter of the rotatable dial
   --knob-left: Horizontal offset from translator left edge
   --knob-top: Vertical position (centered with translateY(-50%))

   --screen-left: Horizontal offset for translation text area
   --screen-width/height: Dimensions of the text display area
   --screen-top: Vertical position of the screen

   --meter-right: Horizontal offset from right edge for confidence meter
   --meter-bar-width/height: Dimensions of individual meter bars
   --meter-gap: Spacing between meter bars
*/
#translator {
    --translator-width: 700px;
    --translator-bottom: 20px;

    position: absolute;
    bottom: var(--translator-bottom);
    right: 20px;
    z-index: 10;
    width: var(--translator-width);
    height: auto;
    container-type: inline-size;
}

.translator-bg {
    width: 100%;
    height: auto;
    display: block;
}

.category-overlays {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.category-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.knob-container {
    position: absolute;
    top: 52.2%;
    left: 3.57%;
    transform: translateY(-50%);
    width: 22.43%;
    aspect-ratio: 1;
}

.knob {
    width: 100%;
    height: 100%;
    cursor: pointer;
    transition: transform 0.4s ease;
    transform: rotate(-65deg); /* Idle position */
}

/* Knob rotation angles for each category */
/* Order: identity, social, dive, maternal, threat */
.knob[data-rotation="identity"] { transform: rotate(0deg); }
.knob[data-rotation="social"] { transform: rotate(12deg); }
.knob[data-rotation="dive"] { transform: rotate(25deg); }
.knob[data-rotation="maternal"] { transform: rotate(36deg); }
.knob[data-rotation="threat"] { transform: rotate(45deg); }


/* Translation Screen */
.translation-screen {
    position: absolute;
    top: 19.9%;
    left: 39.29%;
    width: 45.43%;
    height: 42.72%;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0.7% 2.14% 1.4% 1.07%;
    overflow: hidden;
}

#translation-text {
    font-family: "automate", monospace;
    font-size: clamp(8px, 3.43cqi, 24px);
    line-height: 1.2;
    color: #40F2CB;
    text-align: left;
    text-transform: uppercase;
    width: 100%;
}

/* Confidence Meter */
.confidence-meter {
    position: absolute;
    top: 63.1%;
    right: 5.29%;
    transform: translateY(-50%);
    width: 7.14%;
    height: 29%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.meter-bars {
    display: flex;
    flex-direction: column;
    gap: 0.57cqi;
    align-items: center;
}

.meter-bar {
    width: 7.14cqi;
    height: 1cqi;
    background: #40787A;
    border-radius: 0.57cqi;
    transition: background 0.05s ease, opacity 0.05s ease;
}

.meter-bar.active {
    background: #40F2CB;
}

/* ====================================================================
   UI INSTRUCTION BOX
   ==================================================================== */

/* Instruction box */
.ui-instruction {
    border: 1px solid #000;
    background-color: #00ff00;
    color: #000;
    padding: 16px 40px 16px 16px;
    margin-top: 14px;
    position: relative;
    line-height: 1.5;
}

.ui-instruction[data-aos=fade-right] {
    opacity: 1;
    transform: scale(1.3) translate3d(-800px, 0, 0) !important;
    transition: all 4.5s cubic-bezier(0.6, 0, 0, 1) !important;
    transition-delay: 2.2s !important;
}

.ui-instruction[data-aos=fade-right].aos-animate {
    transform: scale(1) translate3d(0, 0, 0) !important;
}

.ui-instruction p {
    margin: 0;
    font-size: 13px;
}

.ui-instruction p + p {
    margin-top: 10px;
}

.ui-instruction__close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    line-height: 1;
}

.ui-instruction__close:after {
    content: "\e812";
    position: relative;
    width: 20px;
    height: 20px;
    z-index: 10;
    display: inline-block;
    font-family: fontello;
    font-size: 13px;
    color: #000;
}

/* Category Buttons (clickable areas) */
.category-buttons {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 150;
}

.category-btn {
    position: absolute;
    background: transparent;
    border: none;
    width: 60px;
    height: 18px;
    cursor: pointer;
    pointer-events: auto;
    user-select: none;
    transform-origin: center center;
    /* Debug: uncomment to see hitboxes */
    /* background: rgba(255, 0, 0, 0.5); border: 2px solid red; */
}

.category-btn:hover {
    /* Optional: subtle hover effect */
    /* background: rgba(255, 255, 255, 0.1); */
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #translator {
        --translator-width: 95%;
        max-width: 500px;
    }

    .whale-square {
        width: var(--square-size-mobile);
        height: var(--square-size-mobile);
    }

    .whale-square.active {
        width: var(--square-size-active-mobile);
        height: var(--square-size-active-mobile);
    }

    #whale-squares.has-active .whale-square:not(.active) {
        width: var(--square-size-inactive-mobile);
        height: var(--square-size-inactive-mobile);
    }

    .whale-details {
        font-size: var(--label-font-size-mobile);
    }

    .ui-instruction {
        max-width: 100%;
    }

    .ui-instruction p {
        font-size: 14px;
    }
}
