/* ==========================================================================
   Theme Name: GeneratePress Child
   Template: generatepress
   ========================================================================== */

html { scroll-behavior: smooth; }
    
:root {
    --bg-body: linear-gradient(135deg, #e0f2fe 0%, #ffffff 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --hero-bg: #f8f9fa;
    --forecast-bg: #ffffff;
    --weather-current-bg: #f0f8ff;
    --border-color: #e9ecef;
    --border-current: #cce5ff;
    --text-main: #212529;
    --text-muted: #6c757d;
    --text-blue: #0d6efd;
    --shadow: 0 4px 6px rgba(0,0,0,0.02);
    --chart-bg: transparent;
}

body.dark-mode {
    --bg-body: linear-gradient(135deg, #0f172a 0%, #121212 100%);
    --card-bg: rgba(30, 30, 30, 0.95);
    --hero-bg: #252525;
    --forecast-bg: #2a2a2a;
    --weather-current-bg: #1a2634;
    --border-color: #333333;
    --border-current: #2c3e50;
    --text-main: #f8f9fa;
    --text-muted: #adb5bd;
    --text-blue: #6ea8fe;
    --shadow: 0 4px 6px rgba(0,0,0,0.3);
    --chart-bg: transparent;
}

body {
    background: var(--bg-body);
    background-attachment: fixed;
    min-height: 100vh;
    margin: 0;
    color: var(--text-main);
}

/* --- Mukautetut leveyden hallinnat eri sivupohjille --- */
.page-template-page-electricity-dashboard .dashboard-wrapper { 
    max-width: 1920px; width: 100%; box-sizing: border-box; margin: 40px auto; padding: 0 20px; font-family: system-ui, -apple-system, sans-serif; 
}
.page-template-template-sisalto .dashboard-wrapper { 
    max-width: 900px; margin: 40px auto; padding: 0 20px; position: relative; font-family: system-ui, -apple-system, sans-serif; 
}
.dashboard-wrapper { 
    max-width: 1920px; width: 100%; box-sizing: border-box; margin: 40px auto; padding: 0 20px; font-family: system-ui, -apple-system, sans-serif; 
}

.dashboard-card { 
    width: 100%; box-sizing: border-box; background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px; padding: 30px; margin-bottom: 30px; box-shadow: var(--shadow); color: var(--text-main); transition: background-color 0.3s, border-color 0.3s; 
}

/* Pakotetaan GeneratePressin pääsäiliöt täyteen leveyteen */
.site.grid-container { max-width: 100% !important; width: 100% !important; }
.site-content { padding: 0 !important; }
#content { margin: 0 !important; padding: 0 !important; }

.dashboard-card h2 { margin-top: 0; font-size: 2.2rem; font-weight: bold; text-align: center !important; margin-bottom: 20px; color: var(--text-main); line-height: 1.2; letter-spacing: -0.5px; }
.chart-description { text-align: center !important; color: var(--text-muted); font-size: 0.95rem; margin-top: -15px; margin-bottom: 20px; display: block; width: 100%; }

/* --- TIIVISTETTY JA HARMONISOITU HERO-KORTTI --- */
.hero-card { 
    background-color: var(--hero-bg); 
    text-align: center !important;
    border-top: 5px solid #0d6efd; 
    /* HIENOSÄÄTÖ: Lisätty hieman happea (12px -> 18px), jotta kortti ei näytä tukehtuvan */
    padding: 18px 20px 14px 20px !important;
    position: relative; 
}

.custom-top-bar { 
    display: grid; 
    grid-template-columns: 1fr auto 1fr; 
    align-items: center; 
    width: 100%;
    /* HIENOSÄÄTÖ: Kasvatettu väliä (2px -> 8px) logon ja otsikon välillä */
    margin-bottom: 8px !important;
}

/* Valikon asemointi ja tyylit */
.menu-container { justify-self: start; position: relative; z-index: 1000; }
.hamburger-btn { background: var(--card-bg); border: 1px solid var(--border-color); color: var(--text-main); padding: 8px 12px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); transition: 0.3s; }
.hamburger-btn:hover { border-color: var(--text-blue); background-color: var(--weather-current-bg); }
.dropdown-menu { position: absolute; top: 120%; left: 0; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); display: flex; flex-direction: column; width: 200px; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.2s ease; }
.dropdown-menu.active { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu a { padding: 12px 20px; color: var(--text-main); text-decoration: none; font-weight: 600; border-bottom: 1px solid var(--border-color); text-align: left; }
.dropdown-menu a:last-child { border-bottom: none; }
.dropdown-menu a:hover { background: var(--weather-current-bg); color: var(--text-blue); }

/* Otsikon ja logon linjaus */
.site-header-custom { display: flex; align-items: center; justify-content: center; gap: 15px; flex-wrap: nowrap; margin-bottom: 0; }
.main-logo { height: 75px; width: auto; display: block; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.08)); }
.site-title { font-size: 4rem; font-weight: 900; margin: 0; background: linear-gradient(135deg, #0d6efd, #0dcaf0); -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-transform: uppercase; letter-spacing: 1px; }

/* Tumman tilan nappi */
.theme-toggle-btn { justify-self: end; background: var(--card-bg); border: 1px solid var(--border-color); color: var(--text-main); padding: 8px 15px; border-radius: 20px; cursor: pointer; font-size: 0.9rem; font-weight: bold; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow); transition: 0.3s; position: static; }
.theme-toggle-btn:hover { border-color: #0d6efd; }

/* Taso 1: Otsikko / Tagline (Lopullinen symmetria- ja merkkiviilaus) */
.site-tagline { 
    color: var(--text-main);
    font-weight: 700; 
    /* VIILAUS: Kohtuullistettu koko ja tiukennettu välistys, jotta leveys matchaa täydellisesti logon kanssa */
    font-size: 2.25rem !important;
    margin: 0 auto 6px auto !important; 
    text-align: center !important; 
    width: 100%;
    display: block; 
    line-height: 1.2 !important; 
    letter-spacing: -0.7px !important; /* Puristaa laatikon sivut täydelliseen linjaan */
}

.hero-card p { 
    text-align: center; 
    color: var(--text-main);
    /* HIENOSÄÄTÖ: Kasvatettu väliä (6px -> 12px) ennen pientä hintatekstiä */
    margin: 0 auto 12px auto !important; 
    font-size: 1.0rem !important; 
    font-weight: 500;
    max-width: 750px;
}
.price-label { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: -10px; font-weight: bold; text-align: center !important; width: 100%; display: block; }
.price-display { 
    font-size: 2.6rem !important;
    font-weight: 900; 
    color: var(--text-main); 
    margin: 5px 0 5px 0 !important;
    line-height: 1; 
    letter-spacing: -1px; 
    text-align: center !important; 
    width: 100%; 
    display: block; 
}
.price-display strong { font-size: 2.6rem !important; font-weight: 900; color: var(--text-main); }

/* --- SÄÄN SÄÄDÖT --- */
.weather-controls { display: flex; gap: 10px; justify-content: center; margin-bottom: 25px; flex-wrap: wrap; }
.search-container { position: relative; display: inline-block; width: 220px; }
.weather-input { padding: 12px 15px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 1rem; width: 100%; box-sizing: border-box; background-color: var(--card-bg); color: var(--text-main); }
.suggestions-box { position: absolute; top: 100%; left: 0; right: 0; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; max-height: 250px; overflow-y: auto; z-index: 1000; box-shadow: var(--shadow); display: none; margin-top: 5px; }
.suggestion-item { padding: 12px 15px; cursor: pointer; text-align: left; border-bottom: 1px solid var(--border-color); font-size: 0.95rem; color: var(--text-main); }
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background-color: var(--weather-current-bg); color: var(--text-blue); }

.weather-btn { padding: 12px 20px; background-color: #0d6efd; color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; transition: 0.2s; }
.weather-btn:hover { background-color: #0b5ed7; }
.weather-btn-secondary { background-color: #6c757d; }
.weather-btn-secondary:hover { background-color: #5c636a; }

/* --- SÄÄKORTIT --- */
.weather-current { display: flex; justify-content: space-around; align-items: center; background-color: var(--weather-current-bg); border-radius: 12px; padding: 25px; margin-bottom: 20px; flex-wrap: wrap; gap: 20px; border: 1px solid var(--border-current); }
.weather-forecast { display: flex; gap: 15px; flex-wrap: wrap; }
.forecast-card { flex: 1; min-width: 130px; background-color: var(--forecast-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 15px; text-align: center; cursor: pointer; transition: 0.2s; box-shadow: var(--shadow); }
.active-forecast-card { border: 2px solid var(--text-blue) !important; background-color: var(--weather-current-bg) !important; box-shadow: 0 0 0 1px var(--text-blue), var(--shadow) !important; }
.forecast-card[data-active="true"] { border: 2px solid var(--text-blue) !important; background-color: var(--weather-current-bg) !important; box-shadow: 0 0 0 1px var(--text-blue), var(--shadow) !important; }
.forecast-card:hover { transform: translateY(-3px); border-color: #0d6efd; }

/* --- TUNTIENNUSTE JA RULLAUS --- */
.hourly-forecast-container { margin-top: 30px; border-top: 1px solid var(--border-color); padding-top: 20px; }
.hourly-wrapper { display: flex; overflow-x: auto; gap: 12px; padding-bottom: 15px; scrollbar-width: thin; scrollbar-color: var(--text-muted) var(--forecast-bg); }
.hourly-wrapper::-webkit-scrollbar { height: 8px; }
.hourly-wrapper::-webkit-scrollbar-track { background: var(--forecast-bg); border-radius: 4px; }
.hourly-wrapper::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }
.hourly-card { min-width: 80px; flex-shrink: 0; background-color: var(--forecast-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 12px 8px; text-align: center; }
.hourly-time { font-size: 0.9rem; font-weight: bold; color: var(--text-main); margin-bottom: 8px; }
.hourly-temp { font-size: 1.2rem; font-weight: bold; color: var(--text-main); }
.hourly-wind { font-size: 0.8rem; color: var(--text-blue); margin-top: 8px; font-weight: bold; }

.chart-container-wrapper { background-color: var(--chart-bg); border-radius: 8px; padding: 10px; transition: 0.3s; }
.loading-text { text-align: center; color: var(--text-muted); font-style: italic; margin: 20px 0; }

/* --- SISÄLTÖSIVUN TYYLIT --- */
.content-card { background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px; padding: 50px; box-shadow: var(--shadow); line-height: 1.7; }
.article-body h1 { font-size: 2.8rem; margin-bottom: 25px; color: var(--text-main); font-weight: 800; line-height: 1.2; text-align: center; }
.article-body p { margin-bottom: 1.6rem; font-size: 1.15rem; color: var(--text-main); }
.article-body h2 { font-size: 1.8rem; margin-top: 40px; margin-bottom: 15px; border-left: 4px solid var(--text-blue); padding-left: 15px; }

/* --- ALAPALKKI --- */
.site-footer-custom { text-align: center; padding: 40px 20px; margin-top: 20px; border-top: 1px solid var(--border-color); color: var(--text-muted); font-size: 0.9rem; }
.site-footer-custom a { color: var(--text-blue); text-decoration: none; font-weight: 600; }
.site-footer-custom a:hover { text-decoration: underline; }

/* KORJAUS: Piilotetaan VAIN oletustekstit, EI koko footer-vaippaa, jotta oma koodimme pääsee näkyviin */
.site-info { display: none !important; }

/* --- PREMIUM-OMINAISUUDEN OHITUS: Piilotetaan artikkelien kategoriat ja kommenttilinkit --- */
.cat-links,
.comments-link,
footer.entry-meta {
    display: none !important;
}

/* --- LUKUALUEEN KAVENNUS JA KESKITYS (Pakotetaan ylätason kääreet) --- */

/* 1. Muutetaan ylin säiliö (#page) flex-laatikoksi, joka pakottaa kaiken keskelle */
body.single-post #page,
body.page-template-default #page {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
}

/* 2. Määritetään itse lukualueelle haluttu 1100px leveys */
body.single-post .site-content,
body.page-template-default .site-content {
    max-width: 1100px !important;
    width: 100% !important;
    margin: 40px auto !important;
    padding: 0 20px !important;
    flex: 1 1 auto !important; /* Estää kutistumisen */
}

/* 3. Nollataan kaikki teeman omat vanhat leijumat sisältä */
body.single-post #primary,
body.page-template-default #primary,
body.single-post .site-main,
body.page-template-default .site-main {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 auto !important;
    float: none !important;
    display: block !important;
}

/* 4. Kortin tyylit ja valkoinen tausta (Sama kuin aiemmin) */
body.single-post .inside-article,
body.page-template-default .inside-article {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 50px;
    box-shadow: var(--shadow);
    line-height: 1.7;
}

/* 5. Leipätekstin koko ja kuvien sovittaminen korttiin */
body.single-post .inside-article p,
body.page-template-default .inside-article p {
    font-size: 1.15rem;
    margin-bottom: 1.6rem;
}

body.single-post .inside-article img,
body.page-template-default .inside-article img {
    border-radius: 8px;
    max-width: 100%;
    height: auto;
    margin-bottom: 20px;
}

/* ==========================================================================
   RESPONSIVISUUS (MOBIILI)
   ========================================================================== */
@media (max-width: 768px) {
    .dashboard-wrapper { margin: 15px auto; padding: 0 10px; }
    .dashboard-card { padding: 15px; border-radius: 12px; }
    .dashboard-card h2 { font-size: 1.5rem; }
    .content-card { padding: 30px 20px; }
    .article-body h1 { font-size: 2rem; }
    
    .hero-card { padding: 15px !important; }
    .custom-top-bar { grid-template-columns: auto 1fr auto; gap: 8px; margin-bottom: 8px !important; }
    
    .site-header-custom { gap: 10px; }
    .main-logo { height: 45px; }
    .site-title { font-size: 2.2rem; }
    .site-tagline { font-size: 1.5rem !important; } 
    .price-display { font-size: 2.0rem !important; }
    .price-display strong { font-size: 2.0rem !important; }
    
    #themeText { display: none; }
    .theme-toggle-btn { padding: 8px 12px; }
    
    .weather-controls { flex-direction: column; align-items: stretch; }
    .weather-input { width: 100%; }
    .search-container { width: 100%; }
    .weather-forecast { flex-direction: column; }
    .chart-container-wrapper > div { min-height: 350px; height: auto !important; }
    /* Artikkelikortin tiivistys puhelimella */
    body.single-post .inside-article,
    body.page-template-default .inside-article {
        padding: 30px 20px;
    }
    body.single-post .site-content,
    body.page-template-default .site-content {
        margin: 20px auto !important;
    }
}

/* Poistetaan 7 päivän sääennusteen ja aurinkoaikojen oletuslaatikot lopullisesti */
div[class*="forecast"] span,
div[class*="forecast"] kbd,
div[class*="forecast"] code,
div[class*="sun"] span,
div[class*="sun"] kbd,
div[class*="sun"] code {
    background-color: transparent !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    border-bottom: none !important;
    padding: 0 4px !important;
    margin: 0 !important;
    border-radius: 0 !important;
}