@import url('weather-effects.css');

/* --- Material Design 3 Styling --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #141218; /* M3 background */
    color: #E6E0E9; /* M3 on-background */
    padding: 1rem;
    min-height: 100vh;
    display: grid;
    grid-template-rows: 1fr auto;
}

@media (min-width: 768px) { body { padding: 1.5rem; } }
@media (min-width: 1024px) { body { padding: 2rem; } }

.main-grid-container {
    height: 100%;
    min-height: 0;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .main-grid-container {
        grid-template-columns: 2fr 1fr 2fr;
        gap: 2rem;
        grid-template-rows: 1fr;
    }
    .main-grid-container> :nth-child(1) { grid-column: 1; }
    .main-grid-container> :nth-child(2) { grid-column: 2; }
    .main-grid-container> :nth-child(3) { grid-column: 3; }
    .bus-column, .weather-column { grid-column-end: span 1; }
}

.card {
    background-color: #211F26; /* M3 surface */
    padding: 1.5rem; /* M3 cards have generous padding */
    border-radius: 28px; /* M3 typical large rounded corner */
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15); /* Soft tonal elevation shadow */
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid #4A4458; /* M3 outline variant */
}

.card-title {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 500;
    color: #D0BCFF; /* M3 primary */
}

.iframe-container { margin-top: 1rem; flex-grow: 1; }
.bus-iframe {
    width: 100%; height: 100%; border: 0; border-radius: 16px;
}

#clock-1, #clock-2, .clock-box {
    font-size: 1.5rem;
    font-weight: 500;
    background-color: #4F378B; /* M3 primary container */
    color: #EADDFF; /* M3 on-primary container */
    padding: 0.25rem 1rem;
    border-radius: 16px; /* M3 chip typically 16px or full */
    width: auto;
    min-width: 6rem;
    text-align: center;
}

.weather-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    height: 100%;
}

.weather-block { text-align: center; }
.weather-block>div { margin-top: 1.5rem; }
.weather-block>div:first-child { margin-top: 0; }

.weather-city {
    font-size: 1.875rem;
    font-weight: 500;
    color: #E6E0E9;
}

#temp-grimstad, #temp-kristiansand, #temp-arendal, .weather-temp {
    font-size: 4.5rem;
    font-weight: 700;
    color: #FFB4AB; /* M3 error/warm tone */
}

.weather-temp-cold { color: #A8C7FA !important; /* M3 distinct cold tone */ }

#log-box {
    width: 100%; max-width: 24rem;
    background-color: #2B2930; /* M3 surface container high */
    padding: 1rem; border-radius: 16px;
    font-family: 'Roboto Mono', monospace; font-size: 0.75rem; color: #CAC4D0;
    height: 6rem; overflow-y: auto;
}

.ticker-wrapper { width: 100%; margin-top: 1.5rem; }
@media (min-width: 1024px) { .ticker-wrapper { margin-top: 2rem; } }

.ticker-bar {
    background-color: #2B2930; /* M3 surface container high */
    padding: 1rem 1.25rem;
    border-radius: 24px;
    display: flex; align-items: center; gap: 1.5rem;
}

.tag {
    color: #381E72; /* on primary */
    font-weight: 700; padding: 0.5rem 1rem; border-radius: 16px;
    flex-shrink: 0; font-size: 1.125rem;
}

.nrk-tag { background-color: #A8C7FA; color: #062E6F; } /* M3 custom blue container */
#nrk-headline {
    flex-grow: 1; color: #E6E0E9;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin: 0; font-size: 1.25rem; padding: 0.5rem;
}
.vg-tag { background-color: #FFB4AB; color: #690005; } /* M3 custom red container */
#vg-headline {
    flex-grow: 1; color: #E6E0E9;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin: 0; font-size: 1.25rem; padding: 0.5rem;
}

.footer { text-align: center; color: #938F99; font-size: 0.875rem; margin-top: 1rem; }
.footer span { color: #FFB4AB; }

.bus-list { margin-top: 1rem; flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.bus-item {
    display: flex; align-items: center; padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #4A4458;
}
.bus-item:last-child { border-bottom: none; }

.bus-line {
    background-color: #D0BCFF; color: #381E72;
    font-weight: 700; padding: 0.25rem 0.75rem; border-radius: 12px;
    margin-right: 1rem; min-width: 3.5rem; text-align: center;
}
.bus-dest {
    flex-grow: 1; font-size: 1.125rem; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 0.5rem;
}
.bus-time { font-weight: 700; color: #EADDFF; font-size: 1.25rem; white-space: nowrap; }
.bus-time.realtime { color: #A8C7FA; }

#clock-main {
    font-size: 6rem; font-weight: 700; color: #E6E0E9;
    line-height: 1; margin-bottom: 2rem; font-variant-numeric: tabular-nums;
}

.weather-icon { height: 2.5rem; width: 2.5rem; vertical-align: middle; margin-left: 0.5rem; display: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.ticker-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 1024px) { .ticker-grid { grid-template-columns: 1fr 1fr; gap: 2rem; } }

.weather-temp-wrapper { position: relative; display: inline-block; margin-top: -0.5rem; }
.weather-bg-icon {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 9rem; height: 9rem; opacity: 0.4; z-index: 0; display: none;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.1));
}
#temp-grimstad, #temp-kristiansand, #temp-arendal, #temp-hovag, .weather-temp { position: relative; z-index: 10; }
.weather-row { display: flex; flex-direction: column; align-items: center; margin-top: 1.5rem; }