/* ========================================================================
   GLOBAL DESIGN TOKENS
   ======================================================================== */
:root {
    /* Colors */
    --text-main: #ffffff;
    --text-soft: #fff7e6;
    --text-warm: #f5f1e8;

    --day-color: #e69b0e;
    --date-color: #ffddb0;

    --gold-light: #ffedc9;
    --gold-mid: #e2b46f;
    --gold-deep: #e8810b;

    --glass-bg: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.28);
    --glass-dark-bg: rgba(31, 32, 35, 0.252);

    /* Shadows */
    --shadow-strong: 0 8px 30px rgba(0, 0, 0, 0.35);
    --shadow-light: 0 2px 6px rgba(0, 0, 0, 0.4);

    /* Animation */
    --fade-duration: 0.7s;
    --slide-distance: 25px;

    /* Map */
    --map-blur: 4px;

    /* Layout */
    --card-width: 165px;
}

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

html,
body {
    color: var(--text-main);
    font-family: "Playfair Display", serif;
    overflow-x: hidden;
    background: transparent !important;
}

svg {
    max-width: 100px;
    max-height: 100px;
}

/* ========================================================================
   BACKGROUND LAYER (City Background)
   ======================================================================== */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: var(--hero-img);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -10;
}

/* ========================================================================
   FULLSCREEN LOADING OVERLAY
   ======================================================================== */
#loadingOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 1.6rem;
    opacity: 0;
    pointer-events: none;

    transition: opacity 0.4s ease;
}

#loadingOverlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ========================================================================
   HERO SECTION
   ======================================================================== */
.hero {
    min-height: 100vh;
    display: grid;
    place-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Background layers */
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: none;
    z-index: -3;
}

.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
            rgba(0, 0, 0, 0.25) 0%,
            rgba(0, 0, 0, 0.35) 40%,
            rgba(0, 0, 0, 0.4) 100%);
    z-index: -2;
}

.hero-content {
    max-width: 900px;
    padding: 0 20px;
    display: grid;
    gap: 28px;
    justify-items: center;
    z-index: 10;
}

.hero-title {
    font-size: clamp(3.8rem, 6vw, 5.2rem);
    font-weight: 700;
    text-shadow: 0 6px 34px rgba(0, 0, 0, 0.65);
}

.hero-sub {
    font-size: clamp(1.35rem, 2.4vw, 1.7rem);
    color: #f3e7d4;
    text-shadow: 0 3px 20px rgba(0, 0, 0, 0.7);
}

/* Inner fade */
.hero-inner-fade {
    transition: opacity 1.4s ease;
}

.hero-inner-fade.fade-out {
    opacity: 0;
}

/* ========================================================================
   ANIMATION
   ======================================================================== */
.weather-animate {
    opacity: 0;
    transform: translateY(var(--slide-distance));
    animation: fadeSlideIn var(--fade-duration) ease forwards;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(var(--slide-distance));
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================================================
   CONTROLS
   ======================================================================== */
.controls {
    display: flex;
    gap: 16px;
    padding: 18px 26px;

    background: var(--glass-dark-bg);
    border: 1.5px solid var(--glass-border);
    border-radius: 18px;
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow-strong);

    align-items: center;
    justify-content: center;
}

.controls select {
    background: rgba(255, 255, 255, 0.18);
    border: 1.4px solid rgba(255, 255, 255, 0.35);
    border-radius: 12px;

    padding: 12px 16px;
    min-width: 240px;

    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.controls option {
    background: #000;
    color: white;
}

.btn-gold {
    background: linear-gradient(180deg, rgba(255, 221, 160, 0.85), rgba(255, 184, 77, 0.9));
    color: #3a290f;
    padding: 0.85em 2em;
    font-weight: 700;
    border-radius: 14px;
    cursor: pointer;
    transition: 0.3s;
    border: none;
}

.btn-gold:hover {
    transform: translateY(-3px);
}

/* ========================================================================
   FORECAST SECTION + TITLES
   ======================================================================== */
.forecast-section {
    padding: 60px 20px 80px;
    max-width: 1200px;
    margin: auto;
    background: transparent;
}

.forecast-heading {
    margin-top: 40px;
    margin-bottom: 25px;

    font-size: 3.5rem;
    font-weight: 700;
    text-align: center;

    background: linear-gradient(180deg, var(--gold-light), var(--gold-mid) 55%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;

    background-clip: text;
    color: transparent;

    letter-spacing: 0.5px;
}

.forecast-subtitle {
    font-size: 3rem;
    font-weight: 500;
    color: #10bfe2;
    text-align: center;
}

/* ========================================================================
   WEATHER GRID
   ======================================================================== */
.forecast-grid {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    padding: 20px;
    justify-content: center;
    width: 100%;
}

/* ========================================================================
   WEATHER CARDS
   ======================================================================== */
.weather-card {
    width: var(--card-width);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);

    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-strong);

    border-radius: 22px;
    padding: 22px 18px;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Day / Date */
.w-day {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--day-color);
    text-shadow: var(--shadow-light);
}

.w-date {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--date-color);
}

/* Icon */
.w-icon {
    font-size: 3rem;
    line-height: 1;
    margin: 6px 0 4px;
}

/* Temperature */
.w-temp {
    font-size: 3.4rem;
    font-weight: 700;
    color: var(--text-soft);
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
}

.w-temp sup {
    font-size: 1.4rem;
    opacity: 0.8;
}

/* Condition text */
.w-cond {
    font-size: 1.13rem;
    font-weight: 500;
    line-height: 1.3rem;
    text-align: center;
    padding: 0 5px;
}

/* High / Low */
.w-hilo {
    font-size: 0.95rem;
    color: #ffe8bd;
}

/* Extra weather info */
.w-extra {
    font-size: 0.95rem;
    line-height: 1.2rem;
    color: rgba(255, 255, 255, 0.85);
}

.w-extra div {
    white-space: nowrap;
}

/* ========================================================================
   MAP STYLING
   ======================================================================== */
.map-container {
    margin: 35px auto 0;
    max-width: 900px;
    height: 340px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.map-container::before {
    content: "";
    position: absolute;
    inset: 0;
    backdrop-filter: blur(var(--map-blur));
    background: rgba(0, 0, 0, 0.25);
    z-index: -1;
}

/* ========================================================================
   FOOTER
   ======================================================================== */
.footer {
    text-align: center;
    padding: 40px 0;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-top: 12px;
}

.footer-links i {
    font-size: 1.5rem;
    color: rgb(231, 169, 14);
    transition: 0.3s;
}

.footer-links i:hover {
    color: #f7d39b;
}

/* ========================================================================
   iPHONE / SAFARI FIXES (does not override your design)
   ======================================================================== */

/* 1. Fix background image not showing on iOS */
@supports (-webkit-touch-callout: none) {
    body::before {
        position: fixed;
        background-attachment: scroll !important;
        /* iOS cannot do fixed backgrounds */
    }
}

/* 2. Fix Safari breaking blur glass background */
@supports (-webkit-backdrop-filter: none) or (backdrop-filter: none) {

    .controls,
    .weather-card,
    .map-container::before {
        -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px);
    }
}

/* 3. Fix forecast grid horizontal scroll on iPhone */
@media (max-width: 768px) {
    .forecast-grid {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 18px;
    }

    .weather-card {
        min-width: 175px;
        /* prevent tiny squished cards */
        flex-shrink: 0;
    }
}

/* 4. Fix pinch-zoom increasing font sizes on iPhone */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    html {
        -webkit-text-size-adjust: 100%;
    }
}

/* 5. Fix map overflow on small iPhone screens */
@media (max-width: 480px) {
    .map-container {
        height: 260px;
        border-radius: 16px;
    }
}

/* ========================================================================
   END OF FILE
   ======================================================================== */