/* POPNIX Flood - น้ำท่วมถนน (section #roads + หมุดบนแผนที่ + chip ใน hero) ใช้ token สีจาก water.css เท่านั้น
   ระดับ: lv-flood (> 10 ซม.) = crit, lv-slight (5-10 ซม.) = warn, lv-dry = ok, lv-off = off */
.lv-flood { --c: var(--crit); } .lv-slight { --c: var(--warn); } .lv-dry { --c: var(--ok); } .lv-off { --c: var(--off); }

/* ---------- hero chip ---------- */
.rw-pill { display: inline-flex; align-items: center; gap: 10px; margin-top: 8px; padding: 6px 14px 6px 12px; font-size: .95rem; border-radius: 999px; color: var(--strong) !important; text-decoration: none;
    background: var(--glass); border: 1px solid color-mix(in srgb, var(--c) 45%, var(--glass-line)); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    transition: border-color .4s var(--ease), transform .5s var(--ease); }
.rw-pill > i:first-child { color: var(--c); }
.rw-pill > i:last-child { color: var(--muted); font-size: .85em; transition: transform .5s var(--ease); }
.rw-pill:hover > i:last-child { transform: translate(2px, 2px); }
.rw-pill:active { transform: scale(.98); }
.rw-pill[hidden] { display: none; }

/* ---------- section: sticky summary + card grid ---------- */
.rw-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 40px; align-items: start; }
.rw-side { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 22px; }
.rw-big { display: flex; align-items: flex-end; gap: 14px; }
.rw-big b { font-size: clamp(4rem, 8vw, 6.2rem); line-height: .9; font-weight: 700; letter-spacing: -.03em; color: var(--c, var(--crit)); }
.rw-big span { color: var(--strong); font-size: 1.15rem; font-weight: 600; line-height: 1.3; padding-bottom: 6px; }
.rw-big small { display: block; color: var(--muted); font-weight: 400; font-size: .92rem; }
.rw-scale { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rw-scale li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.rw-scale li > i { width: 10px; height: 10px; border-radius: 2px; transform: rotate(45deg); background: var(--c); }
.rw-scale span { color: var(--text); } .rw-scale small { color: var(--faint); margin-left: 4px; }
.rw-scale b { font-size: 1.25rem; font-weight: 600; color: var(--strong); }
.rw-side .search { max-width: none; flex: 0 0 auto; }
.rw-note { font-size: .88rem; color: var(--muted); max-width: 40ch; }
.rw-head { color: var(--muted); font-size: .95rem; margin-bottom: 14px !important; min-height: 1.6em; }
.is-stale .rw-head { color: var(--warn); font-weight: 600; }
.is-stale .rw-big b { color: var(--muted); }

.rw-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.rw-card { width: 100%; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 14px; align-items: stretch; text-align: left; cursor: pointer;
    padding: 14px 16px 14px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--core); color: var(--text); box-shadow: var(--inset);
    transition: transform .5s var(--ease), border-color .35s var(--ease), box-shadow .5s var(--ease); }
.rw-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 50%, transparent); box-shadow: var(--inset), 0 12px 26px -18px var(--shadow-c); }
.rw-card:active { transform: scale(.985); }
.rw-card.lv-dry, .rw-card.lv-off { background: var(--shell); }
.js .rw-card.enter { animation: rowIn .7s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 30ms); }
.rw-gauge { position: relative; border-radius: 6px; min-height: 64px; overflow: hidden;
    background: linear-gradient(to top, transparent calc(100% / 6 - 1px), var(--line-2) calc(100% / 6 - 1px), var(--line-2) calc(100% / 6), transparent calc(100% / 6)),
                linear-gradient(to top, transparent calc(100% / 3 - 1px), var(--line-2) calc(100% / 3 - 1px), var(--line-2) calc(100% / 3), transparent calc(100% / 3)), var(--line); }
.rw-gauge i { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--h, 0) * 100%); background: var(--c); border-radius: 6px 6px 0 0; }
.rw-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rw-tag { align-self: flex-start; padding: 1px 9px; border-radius: 6px; font-size: .78rem; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.rw-name { color: var(--strong); font-weight: 600; font-size: 1.05rem; line-height: 1.4; }
.rw-body small { display: block; color: var(--muted); font-size: .86rem; line-height: 1.4; }
.rw-depth { text-align: right; white-space: nowrap; align-self: center; }
.rw-depth b { display: block; font-size: 2.1rem; line-height: 1; font-weight: 700; color: var(--c); letter-spacing: -.02em; }
.rw-card.lv-dry .rw-depth b, .rw-card.lv-off .rw-depth b { color: var(--muted); }
.rw-depth small { color: var(--muted); font-size: .82rem; }
.rw-depth em { display: block; margin-top: 6px; font-style: normal; font-size: .8rem; font-weight: 600; }
.rw-depth em.up { color: var(--rise); } .rw-depth em.down { color: var(--fall); }
.rw-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 20px; border-radius: var(--r-core);
    border: 1px dashed var(--line-2); color: var(--muted); text-align: center; }
.rw-empty i { font-size: 2rem; color: var(--ok); opacity: .8; }
.rw-empty p { max-width: 40ch; }
.rw-more { grid-column: 1 / -1; display: flex; justify-content: center; padding-top: 6px; }
.rw-more button { border: 1px solid var(--line-2); background: transparent; color: var(--strong); border-radius: 999px; padding: 9px 20px; cursor: pointer; transition: border-color .3s var(--ease); }
.rw-more button:hover { border-color: var(--accent); }
.sk-card { height: 104px; border-radius: 20px; background: linear-gradient(90deg, var(--line) 0%, var(--line-2) 50%, var(--line) 100%); background-size: 220% 100%; animation: sk 1.5s var(--ease) infinite; }

/* ---------- map: หมุดสี่เหลี่ยมข้าวหลามตัด (คลองเป็นวงกลม) ---------- */
.rw-pin { background: none; border: 0; }
.rw-pin i { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--off)); box-shadow: 0 0 0 1.5px var(--core);
    transform: translate(-50%, -50%) rotate(45deg); transition: width .4s var(--ease), height .4s var(--ease), background-color .4s var(--ease), opacity .4s var(--ease); }
.rw-pin.lv-dry i { opacity: .75; }
.rw-pin.lv-slight i { width: 11px; height: 11px; }
.rw-pin.lv-flood i { width: 13px; height: 13px; box-shadow: 0 0 0 1.5px var(--core), 0 0 0 5px color-mix(in srgb, var(--crit) 25%, transparent); }
.rw-pin.lv-off i { width: 6px; height: 6px; opacity: .5; }
.rw-legend { align-items: center; margin-top: 8px; }
.rw-legend b { color: var(--strong); font-weight: 600; }
.rw-sq { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 2px; background: var(--c); transform: rotate(45deg); }
.legend .rw-sq { border-radius: 2px; }
.rw-toggle { margin-left: auto; border: 1px solid var(--line-2); background: transparent; color: var(--text); border-radius: 999px; padding: 4px 12px; font-size: .86rem; cursor: pointer; }
.rw-toggle:hover { border-color: var(--accent); }

@media (max-width: 900px) {
    .rw-grid { grid-template-columns: 1fr; gap: 22px; }
    .rw-side { display: contents; }   /* ให้การ์ดขึ้นมาก่อนหมายเหตุบนจอเล็ก */
    .rw-main { order: 2; } .rw-note { order: 3; max-width: none; }
}
@media (max-width: 640px) {
    .rw-cards { grid-template-columns: 1fr; }
    .rw-big b { font-size: 4rem; }
    .rw-card { padding: 12px 14px 12px 12px; gap: 12px; }
    .rw-depth b { font-size: 1.8rem; }
    .rw-toggle { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .js .rw-card.enter, .sk-card { animation: none !important; }
    .rw-pin i, .rw-card { transition: none; }
}
