/**
 * Weather App Styles
 * SINTEF Weather Display Application
 *
 * This file contains all custom styles for the weather display.
 * Based on SINTEF design system with Utopia fluid responsive design.
 */

/* ============================================
   UTOPIA FLUID RESPONSIVE DESIGN
   ============================================ */

/* Utopia Fluid Typography - Reduced scale */
:root {
    /* Typography Scale */
    --step--2: clamp(0.65rem, 0.5vw + 0.55rem, 0.7rem);
    --step--1: clamp(0.78rem, 0.65vw + 0.66rem, 0.88rem);
    --step-0: clamp(0.94rem, 0.8vw + 0.79rem, 1.06rem);
    --step-1: clamp(1.13rem, 1vw + 0.94rem, 1.27rem);
    --step-2: clamp(1.35rem, 1.25vw + 1.13rem, 1.52rem);
    --step-3: clamp(1.62rem, 1.55vw + 1.35rem, 1.83rem);
    --step-4: clamp(1.94rem, 1.95vw + 1.62rem, 2.19rem);
    --step-5: clamp(2.33rem, 2.4vw + 1.94rem, 2.63rem);

    /* Spacing Scale */
    --space-3xs: clamp(0.25rem, 0.2vw + 0.2rem, 0.28rem);
    --space-2xs: clamp(0.47rem, 0.4vw + 0.39rem, 0.53rem);
    --space-xs: clamp(0.69rem, 0.6vw + 0.59rem, 0.78rem);
    --space-s: clamp(0.94rem, 0.8vw + 0.79rem, 1.06rem);
    --space-m: clamp(1.41rem, 1.2vw + 1.19rem, 1.59rem);
    --space-l: clamp(1.88rem, 1.6vw + 1.58rem, 2.13rem);
    --space-xl: clamp(2.81rem, 2.4vw + 2.38rem, 3.19rem);
    --space-2xl: clamp(3.75rem, 3.2vw + 3.17rem, 4.25rem);
    --space-3xl: clamp(5.63rem, 4.8vw + 4.75rem, 6.38rem);

    /* SINTEF Brand Colors */
    --sintef-blue: #003c65;
    --sintef-green: #14b978;
    --sintef-light-green: #6fcf97;
    --sintef-beige: #EBEBE6;
    --sintef-gold: #C89B14;
}

/* ============================================
   FONTS
   ============================================ */

/* Import Lato with multiple weights */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap');

/* ============================================
   BASE STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Lato', 'Calibri', Arial, sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: var(--space-l) var(--space-xl);
    gap: var(--space-l);
}

/* Twemoji styling for converted emoji images */
img.emoji {
    height: 1em;
    width: 1em;
    margin: 0 0.05em 0 0.1em;
    vertical-align: -0.1em;
    display: inline-block;
}

/* ============================================
   LOGO
   ============================================ */

.logo {
    z-index: 100;
    flex-shrink: 0;
}

.logo-img {
    display: block;
    height: 120px;
    width: auto;
}

/* ============================================
   WEATHER HEADLINE
   ============================================ */

#weather-headline {
    z-index: 10;
    color: var(--sintef-blue);
    max-width: min(90%, 50ch); /* Optimal lesbarhet: max 50 tegn per linje */
    flex-shrink: 0;
    opacity: 0;
    transform: translateY(30px);
}

/* Main temperature range - larger text */
#weather-headline .temp-range {
    font-size: var(--step-3);
    font-weight: 400;
    line-height: 1.2;
    margin-bottom: var(--space-xs);
}

/* Supporting info lines - smaller text */
#weather-headline .current-conditions,
#weather-headline .precipitation-forecast,
#weather-headline .cloud-forecast {
    font-size: var(--step-1);
    font-weight: 400;
    line-height: 1.4;
    margin-bottom: var(--space-3xs);
    opacity: 0.9;
}

/* Animation class */
#weather-headline.animate-in {
    animation: fadeSlideUp 0.8s ease-out forwards;
}

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

/* Light text for dark backgrounds */
body.dark-bg #weather-headline {
    color: #cdfae1;
}

/* Keep strong tags as regular weight too */
#weather-headline strong {
    font-weight: 400 !important;
}

/* ============================================
   WEATHER CONTAINER
   ============================================ */

.weather-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding-left: var(--space-xl);
    pointer-events: none;
}

/* ============================================
   INFO BOX ("Visste du at...")
   ============================================ */

#info-box {
    position: relative;
    z-index: 10;
    background: var(--sintef-beige);
    padding: var(--space-m) var(--space-l);
    border-radius: 1rem;
    max-width: min(600px, 65ch); /* Optimal lesbarhet for løpende tekst */
    box-shadow: 0 0 0.625rem 0 rgba(0, 0, 0, 0.16);
    opacity: 0;
    transform: translateY(30px);
    pointer-events: auto;
    margin-top: var(--space-2xl); /* Ekstra margin for å skape avstand til værmeldingen */
}

/* Animation class with delay */
#info-box.animate-in {
    animation: fadeSlideUp 0.8s ease-out 0.3s forwards;
}

#info-box h2 {
    color: var(--sintef-blue);
    font-size: var(--step-2);
    font-weight: 700;
    margin-bottom: var(--space-s);
    line-height: 1.3;
}

#info-box a {
    color: var(--sintef-blue);
    text-decoration: underline;
    pointer-events: none;
    cursor: default;
}

/* Media container for images and videos */
#info-media {
    margin-top: var(--space-s);
    margin-bottom: var(--space-m);
    width: 100%;
}

.info-media-youtube {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0.5rem;
    overflow: hidden;
}

.info-media-image {
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    display: block;
}

.northwind-footer {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    margin-top: var(--space-m);
}

.northwind-logo-bottom {
    height: clamp(35px, 4.5vh, 60px);
    width: auto;
    flex-shrink: 0;
}

.northwind-url {
    font-size: var(--step-0);
    color: var(--sintef-blue);
    font-weight: 400;
    white-space: nowrap;
}

#info-text {
    color: var(--sintef-blue);
    font-size: var(--step-0);
    line-height: 1.56;
    font-weight: 400;
}

.loading {
    color: #999;
}

/* ============================================
   ANIMATION LAYERS
   ============================================ */

.animation-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
}

/* SOL */
.sun-animation {
    background: linear-gradient(to bottom, var(--sintef-blue) 0%, var(--sintef-beige) 100%);
}

.sun {
    position: absolute;
    top: 15%;
    right: 20%;
    width: 120px;
    height: 120px;
    background: #FFD700;
    border-radius: 50%;
    box-shadow: 0 0 60px rgba(255, 215, 0, 0.6);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* REGN */
.rain-animation {
    background: linear-gradient(to bottom, var(--sintef-blue) 0%, var(--sintef-beige) 100%);
}

.rain {
    position: absolute;
    width: 2px;
    height: 40px;
    background: linear-gradient(to bottom, transparent, #cdfae1);
    animation: fall linear infinite;
}

@keyframes fall {
    from {
        transform: translateY(-100px);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    to {
        transform: translateY(100vh);
        opacity: 1;
    }
}

/* VIND */
.wind-animation {
    background: linear-gradient(to bottom, var(--sintef-blue) 0%, var(--sintef-beige) 100%);
}

.leaf {
    position: absolute;
    font-size: var(--step-3);
    animation: blow linear infinite;
    opacity: 0;
}

@keyframes blow {
    0% {
        transform: translateX(-100px) rotate(0deg);
        opacity: 0;
    }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% {
        transform: translateX(calc(100vw + 100px)) rotate(720deg);
        opacity: 0;
    }
}

/* SNØ */
.snow-animation {
    background: linear-gradient(to bottom, #DDBFD3 0%, var(--sintef-beige) 100%);
}

.snowflake {
    position: absolute;
    color: white;
    font-size: 20px;
    animation: snowfall linear infinite;
}

@keyframes snowfall {
    from {
        transform: translateY(-100px) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 1;
    }
}

/* OVERSKYET */
.cloudy-animation {
    background: linear-gradient(to bottom, var(--sintef-blue) 0%, var(--sintef-beige) 100%);
}

.cloud {
    position: absolute;
    font-size: 80px;
    opacity: 0.6;
    left: -100px;
    animation: drift linear infinite;
}

@keyframes drift {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(calc(100vw + 200px));
    }
}

/* ============================================
   TEST CONTROLS (Development only)
   ============================================ */

/* Menu container wrapper */
.menu-wrapper {
    position: fixed;
    top: var(--space-s);
    right: var(--space-s);
    z-index: 201;
}

/* Hamburger button */
.hamburger-menu {
    width: 50px;
    height: 50px;
    background: rgba(0, 60, 101, 0.3);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    opacity: 0;
}

.menu-wrapper:hover .hamburger-menu {
    background: rgba(0, 60, 101, 0.9);
    opacity: 1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hamburger-menu span {
    display: block;
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Test controls panel */
.test-controls {
    position: absolute;
    top: 60px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2xs);
    background: rgba(0, 60, 101, 0.95);
    padding: var(--space-s);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.3s ease;
}

.menu-wrapper:hover .test-controls {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.test-controls button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: var(--space-xs) var(--space-s);
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Lato', 'Calibri', Arial, sans-serif;
    font-size: var(--step--1);
    transition: all 0.2s;
    min-width: 100px;
    text-align: left;
}

.test-controls button:hover {
    background: rgba(20, 185, 120, 0.5);
    transform: translateX(-3px);
}

.test-controls button.active {
    background: var(--sintef-green);
}
