/* ---------- colours (same family as kokogecko.dev) ---------- */
:root {
    --sky-top: #5c94fc;
    --sky-bottom: #a4c8ff;
    --ink: #2b2a33;
    --white: #ffffff;
    --red: #e63b43;
    --yellow: #ffd23f;
    --green: #43b047;
    --brick: #c84c0c;
    --blue: #2f6fe0;
    --hot: #e63b43;
    --warm: #f5a623;
    --cool: #43b047;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Nunito", "Battambang", system-ui, sans-serif;
    color: var(--ink);
    background: var(--brick);
}

.sky {
    position: relative;
    min-height: calc(100vh - 48px);
    background: linear-gradient(var(--sky-top), var(--sky-bottom));
    padding: 0 16px 60px;
    overflow: hidden;
}

/* brick ground at the bottom */
.ground {
    height: 48px;
    border-top: 10px solid var(--green);
    background:
        repeating-linear-gradient(90deg, transparent 0 46px, var(--ink) 46px 48px),
        repeating-linear-gradient(0deg, transparent 0 22px, var(--ink) 22px 24px),
        var(--brick);
}

/* clouds sit BEHIND everything (z-index 0) */
.cloud {
    position: absolute;
    z-index: 0;
    background: var(--white);
    border-radius: 999px;
    opacity: .9;
}
.cloud::before, .cloud::after {
    content: "";
    position: absolute;
    background: var(--white);
    border-radius: 50%;
}
.cloud::before { width: 50%; height: 140%; left: 15%; bottom: 30%; }
.cloud::after  { width: 35%; height: 110%; right: 15%; bottom: 35%; }
.c1 { width: 120px; height: 36px; top: 90px;  left: 6%; }
.c2 { width: 160px; height: 46px; top: 220px; right: 8%; }
.c3 { width: 90px;  height: 28px; top: 420px; left: 70%; }

/* everything real sits ABOVE the clouds */
main, nav { position: relative; z-index: 1; }

.box {
    background: var(--white);
    border: 4px solid var(--ink);
    border-radius: 12px;
    box-shadow: 6px 6px 0 var(--ink);
}

.pixel-title, .badge, .btn, .topbar, label, th small, .label, .big {
    /* Press Start 2P has no Khmer glyphs, so Battambang must be the fallback */
    font-family: "Press Start 2P", "Battambang", monospace;
}

/* ---------- login ---------- */
.login-wrap {
    max-width: 380px;
    margin: 0 auto;
    padding-top: 12vh;
    text-align: center;
}
.badge {
    display: inline-block;
    background: var(--ink);
    color: var(--yellow);
    font-size: .7rem;
    padding: 8px 12px;
    margin: 0;
}
.pixel-title {
    font-size: clamp(2.6rem, 14vw, 4.5rem);
    color: var(--white);
    margin: 16px 0 28px;
    text-shadow: 4px 4px 0 var(--red), 8px 8px 0 var(--ink);
}
.login-box {
    padding: 24px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
label { font-size: .6rem; margin-top: 8px; }
input {
    font: inherit;
    font-size: 1rem;
    padding: 10px 12px;
    border: 3px solid var(--ink);
    border-radius: 8px;
    outline: none;
}
input:focus { border-color: var(--red); }
.error {
    color: var(--red);
    font-weight: 800;
    margin: 6px 0 0;
}
.btn {
    margin-top: 16px;
    padding: 14px;
    font-size: .8rem;
    color: var(--white);
    background: var(--red);
    border: 4px solid var(--ink);
    border-radius: 8px;
    box-shadow: 4px 4px 0 var(--ink);
    cursor: pointer;
}
.btn:active { transform: translate(4px, 4px); box-shadow: none; }

/* ---------- dashboard ---------- */
.topbar {
    max-width: 820px;
    margin: 0 auto;
    padding: 18px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: .65rem;
    color: var(--white);
    text-shadow: 2px 2px 0 var(--ink);
}
.topbar .logo { color: var(--yellow); font-size: .8rem; }
.topbar a { color: var(--white); }

.dash { max-width: 820px; margin: 0 auto; }

.hero {
    padding: 22px;
    margin: 12px 0 24px;
    text-align: center;
    border-top-width: 12px;
}
.hero.hot  { border-top-color: var(--hot); }
.hero.warm { border-top-color: var(--warm); }
.hero.cool { border-top-color: var(--cool); }
.hero .label { font-size: .6rem; margin: 0; }
.hero .big { font-size: clamp(2.4rem, 12vw, 3.6rem); margin: 14px 0; }
.hero .khmer { margin: 0; font-weight: 700; }

.notice { padding: 12px 16px; margin: 0 0 20px; font-weight: 800; }

.table-box { padding: 8px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 10px 8px;
    font-size: .85rem;
    border-bottom: 3px solid var(--ink);
}
th small { font-size: .45rem; color: #777; }
td {
    padding: 8px;
    border-bottom: 1px dashed #ccc;
    font-weight: 600;
    white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
td.t { font-weight: 800; }
.khmer { font-family: "Battambang", sans-serif; }

/* chance bar */
.bar {
    position: relative;
    width: 110px;
    height: 22px;
    border: 2px solid var(--ink);
    border-radius: 6px;
    background: #eee;
    overflow: hidden;
}
.bar span { position: absolute; inset: 0 auto 0 0; }
.bar.hot  span { background: var(--hot); }
.bar.warm span { background: var(--warm); }
.bar.cool span { background: var(--cool); }
.bar b {
    position: relative;
    display: block;
    text-align: center;
    font-size: .75rem;
    line-height: 18px;
    color: var(--ink);
}

.updated {
    text-align: center;
    color: var(--white);
    text-shadow: 1px 1px 0 var(--ink);
    font-weight: 800;
    margin-top: 20px;
}

/* phones: hide cloud + humidity columns */
@media (max-width: 560px) {
    .opt { display: none; }
    .bar { width: 80px; }
}


/* ---------- menu page: two big buttons ---------- */
.menu { text-align: center; padding-top: 4vh; }
.menu-title {
    margin: 0 0 22px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    text-shadow: 2px 2px 0 var(--ink);
}
.big-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 120px;          /* big target for big thumbs */
    margin: 0 0 22px;
    background: var(--white);
    color: var(--ink);
    text-decoration: none;
    border: 4px solid var(--ink);
    border-top-width: 14px;
    border-radius: 12px;
    box-shadow: 6px 6px 0 var(--ink);
    font-size: 2rem;
    font-weight: 700;
}
.big-btn small { font-family: "Press Start 2P", "Battambang", monospace; font-size: .6rem; }
.big-btn.today    { border-top-color: var(--warm); }
.big-btn.tomorrow { border-top-color: var(--sky-top); }
.big-btn:active   { transform: translate(6px, 6px); box-shadow: none; }

/* ---------- forecast page: title + Back / Refresh ---------- */
.day-title {
    margin: 6px 0 16px;
    font-size: 1.9rem;
    color: var(--white);
    text-shadow: 2px 2px 0 var(--ink);
}
.day-title small {
    display: block;
    font-family: "Press Start 2P", "Battambang", monospace;
    font-size: .6rem;
    margin-top: 6px;
}
.btn-row { display: flex; gap: 14px; margin: 0 0 22px; }
.btn-row .btn {
    flex: 1;
    margin: 0;
    display: block;
    text-align: center;
    text-decoration: none;
    font-family: "Battambang", "Press Start 2P", monospace;
    font-size: 1.1rem;
    font-weight: 700;
}
.btn.alt { background: var(--blue); }
.hero.summary .khmer { font-size: 1.2rem; }
.label .khmer { font-size: 1.2rem; font-weight: 700; }  /* pixel-size Khmer is unreadable; give it its own size */


/* ---------- animations ---------- */

/* rain: fixed layer over the whole screen, drops fall forever */
.rain { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.rain i {
    position: absolute;
    top: -30px;
    left: var(--x);                 /* set per drop in day.html */
    width: 4px;
    height: 14px;
    background: rgba(255, 255, 255, .75);
    animation: fall var(--speed) linear var(--delay) infinite;
}
@keyframes fall { to { transform: translateY(110vh); } }

/* clouds drift slowly left <-> right */
.cloud { animation: drift 14s ease-in-out infinite alternate; }
.c2 { animation-duration: 19s; animation-direction: alternate-reverse; }
.c3 { animation-duration: 23s; }
@keyframes drift { from { transform: translateX(-24px); } to { transform: translateX(24px); } }

/* cards pop up one after another when a page opens */
.dash > * { animation: pop .45s ease-out backwards; }
.dash > :nth-child(2) { animation-delay: .08s; }
.dash > :nth-child(3) { animation-delay: .16s; }
.dash > :nth-child(4) { animation-delay: .24s; }
.dash > :nth-child(5) { animation-delay: .32s; }
@keyframes pop {
    from { opacity: 0; transform: translateY(16px) scale(.96); }
}

/* chance bars fill up from empty (only "from" is written, so it ends at the real width) */
.bar span { animation: fill .8s ease-out .35s backwards; }
@keyframes fill { from { width: 0; } }

/* a high chance of rain throbs gently */
.hero.hot .big { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.07); } }

/* buttons lift when you point at them */
.big-btn, .btn { transition: transform .12s; }
.big-btn:hover, .btn-row .btn:hover { transform: translateY(-4px); }

/* anyone who asked their phone for less motion gets none */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .rain { display: none; }
}
