/* Weerstation Kaulille - current weather page (index.html): tiles, graphs, header status row */

.topbar {
    padding-bottom: 14px;
}

.stamp {
    padding: 0 0 14px;
    font-size: .95rem;
    opacity: .92;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nowwx {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
}

.nowwx[hidden] {
    display: none;
}

.nowwx svg.main {
    width: 46px;
    height: 46px;
    display: block;
}

.nowwx svg.wind {
    width: 24px;
    height: 24px;
}

.stamp .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7dffb0;
    box-shadow: 0 0 0 3px rgba(125,255,176,.3);
}

.stamp .dot.stale {
    background: #ff6b60;
    box-shadow: 0 0 0 3px rgba(255,107,96,.35);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 16px;
}

.tile {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.span2 {
    grid-column: span 2;
}

@media (min-width: 1200px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 640px) {
    .span2 {
        grid-column: span 1;
    }
}

.th {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ico {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--blue-soft);
    color: var(--blue);
    display: grid;
    place-items: center;
    flex: none;
}

.ico svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.th h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--blue-dark);
}

.big {
    font-size: 2.7rem;
    font-weight: 650;
    line-height: 1;
    letter-spacing: -1px;
}

.big small {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--muted);
    margin-left: 4px;
    letter-spacing: 0;
}

.trend {
    width: .72em;
    height: .72em;
    margin-left: 10px;
    vertical-align: -.06em;
    fill: none;
    stroke: var(--blue);
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.trend.flat {
    stroke: var(--muted);
}

.muted {
    color: var(--muted);
}

.t {
    font-size: .8rem;
    color: var(--muted);
    margin-left: 4px;
    font-variant-numeric: tabular-nums;
}

/* min / max bar */

.range {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .95rem;
}

.range .lo b {
    color: var(--cold);
}

.range .hi b {
    color: var(--warm);
}

.range .lo,
.range .hi {
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.range .hi {
    text-align: right;
}

.range .lo span,
.range .hi span {
    color: var(--muted);
    font-size: .72rem;
}

.range .lo em,
.range .hi em {
    font-style: normal;
    color: var(--muted);
    font-size: .8rem;
}

.bar {
    position: relative;
    flex: 1;
    height: 8px;
    border-radius: 999px;
    min-width: 40px;
    background: linear-gradient(90deg, rgba(42,111,219,.35), rgba(160,160,190,.25) 50%, rgba(224,88,79,.35));
}

.bar i {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--blue);
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(18,48,79,.35);
    transform: translate(-50%, -50%);
}

/* temperature category under the min / max bar */

.tcatrow {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
    font-size: .85rem;
    font-weight: 650;
}

.tcatrow span {
    color: var(--tc);
}

/* pressure scale: low (purple) to high (orange), normal range outlined */

.pscale {
    margin: 4px 0 2px;
}

.pscale .track {
    position: relative;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, #6b5bc9 0%, #a9a2e0 25%, #cfd8e4 37%, #cfd8e4 63%, #f0c28c 75%, #d9772b 100%);
}

.pscale .norm {
    position: absolute;
    top: -4px;
    bottom: -4px;
    box-sizing: border-box;
    border-radius: 6px;
    border: 2px solid rgba(18, 48, 79, .35);
}

.pscale .track i {
    position: absolute;
    top: 50%;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--pc);
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(18, 48, 79, .4);
    transform: translate(-50%, -50%);
}

.pscale .lbl {
    position: relative;
    height: 14px;
    margin-top: 7px;
    font-size: .72rem;
    color: var(--muted);
}

.pscale .lbl span {
    position: absolute;
    top: 0;
}

.pscale .lbl span:first-child {
    left: 0;
}

.pscale .lbl span:last-child {
    right: 0;
}

.pscale .lbl span:nth-child(2) {
    color: var(--ink);
    transform: translateX(-50%);
}

.pscale .pword {
    margin-top: 8px;
    font-size: .95rem;
    font-weight: 650;
    color: var(--pc);
}

/* wind */

.wind {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
}

.rose {
    flex: 0 0 250px;
    max-width: 100%;
    margin: 0 auto;
}

.rose svg {
    width: 100%;
    height: auto;
    display: block;
}

.facts {
    flex: 1 1 160px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fact {
    background: #f4f8fd;
    border-radius: 12px;
    padding: 10px 14px;
}

.fact .l {
    font-size: .74rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .6px;
}

.fact .v {
    font-size: 1.35rem;
    font-weight: 600;
    margin-top: 2px;
}

.fact .v small {
    font-size: .85rem;
    color: var(--muted);
    font-weight: 500;
}

/* rain */

.rainbody {
    display: flex;
    gap: 18px;
    align-items: stretch;
}

.gauge {
    flex: 0 0 96px;
}

.gauge svg {
    width: 100%;
    height: auto;
    display: block;
}

.rainfacts {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}

/* compact rows in the rain tile: stacked in a narrow column, label left and value right when there is room */

.rainfacts {
    container-type: inline-size;
}

.rainfacts .frow {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1px;
    padding: 7px 12px;
}

.rainfacts .frow .l {
    font-size: .68rem;
}

.rainfacts .frow .v {
    margin-top: 0;
    font-size: 1.15rem;
    white-space: nowrap;
}

.rainfacts .frow .t {
    font-size: .78rem;
}

@container (min-width: 200px) {
    .rainfacts .frow {
        grid-template-columns: 1fr auto;
        align-items: baseline;
        gap: 8px;
        padding: 8px 12px;
    }

    .rainfacts .frow .vv {
        text-align: right;
    }

    .rainfacts .frow .v {
        font-size: 1.1rem;
    }
}

/* sun */

.sunbody {
    display: flex;
    gap: 18px;
}

.sunleft {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status {
    font-size: .9rem;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f4f8fd;
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 600;
}

.status svg {
    width: 34px;
    height: 34px;
    flex: none;
}

.vbar {
    position: relative;
    width: 10px;
    border-radius: 999px;
    background: linear-gradient(0deg, rgba(42,111,219,.25), rgba(245,166,35,.55));
    margin: 9px 14px 9px 9px;
}

.vbar i {
    position: absolute;
    left: 50%;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--sun);
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(18,48,79,.35);
    transform: translate(-50%, 50%);
}

.vlab {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: .75rem;
    color: var(--muted);
    text-align: left;
    padding: 0;
}

.vlab b {
    color: var(--ink);
    font-size: .95rem;
}

/* sun path */

.path svg {
    width: 100%;
    height: auto;
    display: block;
}

.mini {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.mini .fact {
    padding: 8px 10px;
}

.mini .fact .l {
    font-size: .62rem;
    letter-spacing: .3px;
    white-space: nowrap;
}

.mini .fact .v {
    font-size: 1.05rem;
}

/* moon */

.moonbody {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.moontop {
    display: flex;
    align-items: flex-start;
    gap: 18px;
}

.moontimes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.moontimes .fact {
    padding: 8px 12px;
}

.moontimes .fact .v {
    font-size: 1.15rem;
}

.moonphase {
    flex: 1 1 0;
    min-width: 0;
    max-width: 200px;
    min-height: 120px; /* same height as .moondisc */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.moondisc {
    flex: 0 0 120px;
    height: 120px;
    border-radius: 22px;
    background: linear-gradient(160deg, #1c2f4a, #0c1a2d);
    box-shadow: 0 4px 14px rgba(18,48,79,.2);
    overflow: hidden;
}

.moondisc svg {
    display: block;
    width: 100%;
    height: 100%;
}

table.tot {
    width: 100%;
    border-collapse: collapse;
    font-size: .95rem;
}

table.tot td {
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}

table.tot tr:last-child td {
    border-bottom: 0;
}

table.tot td:last-child {
    text-align: right;
    font-weight: 600;
}

/* rain gauge overflow */

.spill-dome {
    animation: spillbob 1.6s ease-in-out infinite;
}

.spill-flow {
    animation: spillflow .7s linear infinite;
}

.spill-drop,
.spill-ripple {
    transform-box: fill-box;
    transform-origin: center;
}

.spill-drop {
    animation: spilldrop 1.1s ease-in infinite;
    opacity: 0;
}

.spill-drop.d2 {
    animation-delay: .55s;
    animation-name: spilldrop2;
}

.spill-ripple {
    animation: spillripple 1.1s ease-out infinite;
}

@keyframes spillbob {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-1.2px);
    }
}

@keyframes spillflow {
    to {
        stroke-dashoffset: -12;
    }
}

@keyframes spilldrop {
    0% {
        transform: translate(0, 0);
        opacity: 0;
    }

    15% {
        opacity: 1;
    }

    100% {
        transform: translate(-7px, 70px);
        opacity: 0;
    }
}

@keyframes spilldrop2 {
    0% {
        transform: translate(0, 0);
        opacity: 0;
    }

    15% {
        opacity: 1;
    }

    100% {
        transform: translate(-3px, 110px);
        opacity: 0;
    }
}

@keyframes spillripple {
    0% {
        transform: scale(.4);
        opacity: .9;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .spill-dome,
    .spill-flow,
    .spill-drop,
    .spill-ripple {
        animation: none;
    }

    .spill-drop {
        opacity: 0;
    }
}

/* clickable tiles + graph section */

.tile.clickable {
    cursor: pointer;
    transition: box-shadow .15s, transform .15s;
    outline: none;
}

.tile.clickable:hover {
    box-shadow: 0 2px 4px rgba(18,48,79,.08), 0 10px 24px rgba(42,111,219,.18);
    transform: translateY(-2px);
}

.tile.clickable:focus-visible {
    box-shadow: 0 0 0 3px rgba(42,111,219,.45), var(--shadow);
}

.tile.selected {
    box-shadow: 0 0 0 2px var(--blue), 0 10px 24px rgba(42,111,219,.18);
}

.graphs {
    margin-top: 24px;
}

.graphhead {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.graphhead h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--blue-dark);
    margin-right: auto;
}

.graphnav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-top: 12px;
}

#param-toggle {
    flex-wrap: wrap;
    max-width: 100%;
}

.toggle[hidden],
.dayfield[hidden] {
    display: none;
}

.toggle {
    display: inline-flex;
    background: var(--blue-soft);
    border-radius: 999px;
    padding: 3px;
}

.toggle button {
    flex: none;
    white-space: nowrap;
    border: 0;
    background: transparent;
    color: var(--blue-dark);
    font: inherit;
    font-size: .9rem;
    padding: 6px 16px;
    border-radius: 999px;
    cursor: pointer;
}

.toggle button.on {
    background: var(--blue);
    color: #fff;
    font-weight: 600;
}

.dayfield {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .9rem;
    color: var(--muted);
}

.dayfield input {
    font: inherit;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 5px 8px;
    background: #fff;
}

#graph-container {
    width: 100%;
    height: 600px;
}

@media (max-width: 640px) {
    #param-toggle {
        border-radius: 22px;
    }

    #param-toggle button {
        flex: 1 1 auto;
    }

    #graph-container {
        height: 480px;
    }
}

/* daily summary: range of the day as the outlined box, normal range as two ticks */

.pscale .norm.day {
    min-width: 10px;
    border-color: rgba(18, 48, 79, .6);
    background: rgba(255, 255, 255, .35);
}

.pscale .ntick {
    position: absolute;
    top: 100%;
    width: 2px;
    height: 4px;
    margin: 2px 0 0 -1px;
    border-radius: 1px;
    background: var(--muted);
}

.pscale .pword {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.pscale .legend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .72rem;
    font-weight: 500;
    color: var(--muted);
}

.pscale .swatch {
    width: 14px;
    height: 8px;
    box-sizing: border-box;
    border-radius: 3px;
    border: 2px solid rgba(18, 48, 79, .6);
}

.hscale .track {
    background: linear-gradient(90deg, #e9c98b 0%, #d5dfeb 50%, #5b94dc 100%);
}

/* with a range box (or on the pressure scale) the value is a slim vertical marker, so it cannot hide a narrow box */

.pscale.ranged .track i,
.pscale.slim .track i {
    box-sizing: content-box;
    width: 3px;
    height: 20px;
    border: 2px solid #fff;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(18, 48, 79, .35);
}

/* WBGT heat-stress tile */

.wscale .ticks {
    position: relative;
    height: 14px;
    margin-top: 6px;
    font-size: .72rem;
    color: var(--muted);
}

.wscale .ticks span {
    position: absolute;
    transform: translateX(-50%);
}

.wnote {
    margin-top: 10px;
    font-size: .75rem;
    line-height: 1.3;
}

/* feels-like (wind chill) line under the temperature */

.feels {
    margin: 6px 0 2px;
    font-size: .9rem;
    color: var(--muted);
}

.feels b {
    color: var(--ink);
    font-weight: 600;
}

/* own rain forecast tile */

.fctext {
    font-size: 1.25rem;
    font-weight: 650;
    line-height: 1.25;
    color: var(--ink);
}

.fchead {
    margin-bottom: 6px;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.fcrow {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: 2px 10px;
    margin-bottom: 9px;
    font-size: .9rem;
}

.fcrow span {
    color: var(--muted);
}

.fcrow b {
    font-weight: 650;
}

.fcbar {
    grid-column: 1 / -1;
    height: 8px;
    border-radius: 999px;
    background: var(--blue-soft);
    overflow: hidden;
}

.fcbar i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #6aa6f0, var(--blue));
}

.fccold {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #eef4fb;
    color: var(--blue-dark);
    font-size: .8rem;
    line-height: 1.35;
}
