/* สถานการณ์น้ำ — /water/ (The World Ready) */

.water-page .poll-results-hero {
  margin-bottom: 20px;
}

/* —— Share bar (เหมือน pm25-widget.css แต่แยกไฟล์เพราะหน้านี้ไม่โหลด pm25-widget.css) —— */
.weather-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid var(--twro-line, rgba(255, 255, 255, 0.14));
  border-radius: 12px;
  background: var(--twro-ink2, rgba(255, 255, 255, 0.04));
}

.weather-share-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--twro-mute, #8aa0bc);
  margin-right: 4px;
}

.weather-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--twro-line, rgba(255, 255, 255, 0.14));
  background: var(--twro-ink3, rgba(255, 255, 255, 0.06));
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.weather-share-btn:hover {
  border-color: var(--twro-gold, #e8c05a);
  background: var(--twro-quote-bg, rgba(232, 192, 90, 0.08));
}

.weather-share-btn.is-copied {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.15);
}

.weather-share-btn svg,
.weather-share-btn .news-share-svg {
  width: 18px;
  height: 18px;
}

.weather-share-btn .news-share-icon--ok {
  display: none;
}

.weather-share-btn.is-copied .news-share-icon--default {
  display: none;
}

.weather-share-btn.is-copied .news-share-icon--ok {
  display: inline-flex;
}

html[data-twro-theme="light"] .weather-share {
  background: #f8fafc;
  border-color: #e2e8f0;
}

html[data-twro-theme="light"] .weather-share-btn {
  background: #fff;
  border-color: #e2e8f0;
}

.water-empty {
  padding: 16px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--twro-mute, #8aa0bc);
}

/* —— Summary strip —— */
.water-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 20px 0 28px;
}

.water-summary__item {
  padding: 16px 18px;
  border-radius: var(--twro-radius, 16px);
  border: 1px solid var(--twro-line, rgba(255, 255, 255, 0.1));
  background: linear-gradient(160deg, rgba(42, 74, 114, 0.5), rgba(30, 53, 88, 0.85));
  box-shadow: var(--twro-shadow, 0 6px 24px rgba(8, 24, 48, 0.22));
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.water-summary__item--danger { border-left: 4px solid #ef4444; }
.water-summary__item--info { border-left: 4px solid #3b82f6; }

.water-summary__value {
  font-size: 1.6rem;
  font-weight: 800;
  font-family: var(--twro-mono, monospace);
  color: var(--twro-cream, #f4efe6);
  line-height: 1;
}

.water-summary__value small {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--twro-mute);
}

.water-summary__label {
  font-size: 0.76rem;
  color: var(--twro-mute, #8aa0bc);
  font-weight: 600;
}

/* —— Jump nav — sticky floating panel (ลิงก์ลัดไปแต่ละหัวข้อ) —— */
.water-jumpnav {
  position: sticky;
  top: 68px;
  z-index: 40;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 8px;
  margin: 0 0 20px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--twro-line, rgba(255, 255, 255, 0.12));
  background: color-mix(in srgb, var(--twro-ink2, #12233a) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  scrollbar-width: thin;
}

.water-jumpnav::-webkit-scrollbar {
  height: 4px;
}

.water-jumpnav a {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--twro-line, rgba(255, 255, 255, 0.12));
  background: rgba(255, 255, 255, 0.04);
  color: var(--twro-cream, #f4efe6);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.water-jumpnav a:hover {
  border-color: rgba(232, 192, 90, 0.45);
  background: rgba(232, 192, 90, 0.12);
  color: var(--twro-gold-light, #ffe9a8);
  text-decoration: none;
}

.water-jumpnav a.is-active {
  border-color: var(--twro-gold, #e8c05a);
  background: rgba(232, 192, 90, 0.2);
  color: var(--twro-gold-light, #ffe9a8);
}

@media (min-width: 900px) {
  .water-jumpnav {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

/* —— Section headings —— */
.water-section {
  margin: 36px 0;
  scroll-margin-top: 150px;
}

.water-sources,
.twro-faq {
  scroll-margin-top: 150px;
}

.water-section__head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 16px;
}

.water-section__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.water-section__title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--twro-cream, #f4efe6);
}

.water-section__sub {
  margin: 0;
  font-size: 0.86rem;
  color: var(--twro-mute, #8aa0bc);
}

.water-section__share-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--twro-line, rgba(255, 255, 255, 0.14));
  background: var(--twro-ink3, rgba(255, 255, 255, 0.06));
  color: var(--twro-mute, #8aa0bc);
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.water-section__share-more:hover {
  border-color: var(--twro-gold, #e8c05a);
  background: var(--twro-quote-bg, rgba(232, 192, 90, 0.08));
  color: var(--twro-gold-light, #ffe9a8);
  text-decoration: none;
}

/* —— Thailand dam map —— */
.water-map {
  padding: 20px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(160deg, rgba(28, 52, 88, 0.6), rgba(12, 26, 46, 0.9));
  margin-bottom: 24px;
}

.water-map__head {
  margin-bottom: 10px;
}

.water-map__title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--twro-cream, #f4efe6);
}

.water-map__note {
  margin: 2px 0 0;
  font-size: 0.76rem;
  color: var(--twro-mute, #8aa0bc);
}

.water-thmap {
  display: block;
  width: 100%;
  max-width: 460px;
  height: auto;
  margin: 0 auto;
}

.water-thmap__outline {
  fill: rgba(120, 170, 255, 0.14);
  stroke: rgba(180, 205, 255, 0.5);
  stroke-width: 2;
  stroke-linejoin: round;
}

.water-thmap__dot {
  stroke: rgba(8, 18, 34, 0.7);
  stroke-width: 1.5;
}

.water-thmap__label {
  font-size: 11px;
  font-weight: 700;
  fill: rgba(230, 238, 250, 0.95);
  font-family: var(--twro-font, inherit);
  paint-order: stroke;
  stroke: rgba(8, 18, 34, 0.85);
  stroke-width: 3px;
  stroke-linejoin: round;
}

html[data-twro-theme="light"] .water-map {
  background: linear-gradient(160deg, #f1f5f9, #fff);
  border-color: rgba(15, 23, 42, 0.1);
}

html[data-twro-theme="light"] .water-map__title {
  color: #1e293b;
}

html[data-twro-theme="light"] .water-thmap__outline {
  fill: rgba(37, 99, 235, 0.08);
  stroke: rgba(37, 99, 235, 0.35);
}

html[data-twro-theme="light"] .water-thmap__label {
  fill: rgba(30, 41, 59, 0.92);
  stroke: rgba(255, 255, 255, 0.9);
}

/* —— Regions / dam cards —— */
.water-regions {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.water-region__title {
  margin: 0 0 10px;
  padding-left: 12px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--twro-gold-light, #ffe9a8);
  border-left: 3px solid rgba(232, 192, 90, 0.55);
}

.water-region__count {
  font-weight: 600;
  color: var(--twro-mute);
  font-size: 0.8rem;
}

.water-region__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.water-card {
  padding: 20px 20px 18px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(240, 244, 248, 0.96));
  box-shadow: 0 10px 30px rgba(8, 24, 48, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  text-align: center;
}

.water-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
}

.water-card__river {
  font-size: 0.68rem;
  font-weight: 600;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.water-card__level {
  flex-shrink: 0;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--water-color, #22c55e);
  white-space: nowrap;
}

.water-card__name {
  margin: 6px 0 0;
  font-size: 1rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.3;
}

.water-card__orb-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 16px 0 14px;
}

.water-card__orb {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--water-color, #22c55e) 55%, #fff), var(--water-color, #22c55e));
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--water-color, #22c55e) 12%, transparent), 0 8px 22px color-mix(in srgb, var(--water-color, #22c55e) 45%, transparent);
}

.water-card__pct {
  font-size: 2.1rem;
  font-weight: 800;
  font-family: var(--twro-mono, monospace);
  color: #1e293b;
  line-height: 1;
}

.water-card__pct small {
  font-size: 1.1rem;
  font-weight: 700;
  color: #64748b;
}

.water-card__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding-top: 14px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.water-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.water-stat__ico {
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.water-stat__label {
  font-size: 0.62rem;
  font-weight: 600;
  color: #94a3b8;
}

.water-stat__value {
  font-size: 0.8rem;
  font-weight: 800;
  color: #1e293b;
  font-family: var(--twro-mono, monospace);
}

.water-stat__value small {
  font-size: 0.62rem;
  font-weight: 600;
  color: #94a3b8;
  font-family: inherit;
}

/* —— Highlights (top/bottom reservoirs) —— */
.water-highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

.water-highlight h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--twro-cream, #f4efe6);
}

/* —— Tables —— */
.water-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.water-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.water-table th,
.water-table td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  white-space: nowrap;
}

.water-table th {
  color: var(--twro-mute);
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.03);
}

.water-table tbody tr:last-child td {
  border-bottom: none;
}

.water-table__pct {
  font-weight: 700;
  font-family: var(--twro-mono, monospace);
}

.water-badge {
  font-weight: 700;
  font-size: 0.78rem;
}

/* —— Accordions —— */
.water-accordions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.water-accordion {
  border: 1px solid var(--twro-line, rgba(255, 255, 255, 0.1));
  border-radius: 12px;
  background: var(--twro-ink2, rgba(18, 35, 54, 0.6));
  padding: 0 16px;
}

.water-accordion summary {
  cursor: pointer;
  font-weight: 700;
  padding: 14px 0;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--twro-cream, #f4efe6);
}

.water-accordion summary::-webkit-details-marker {
  display: none;
}

.water-accordion summary::after {
  content: "+";
  color: var(--twro-gold, #c9a962);
  flex-shrink: 0;
}

.water-accordion[open] summary::after {
  content: "\2013";
}

.water-accordion > .water-table-wrap,
.water-accordion > .water-highlight-grid {
  margin-bottom: 14px;
}

.water-rain-top--compact {
  margin: 4px 0 14px;
  gap: 8px;
}

.water-rain-top--compact .water-rain-row__name {
  font-size: 0.8rem;
}

.water-accordion__name {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.water-accordion__name .water-region__count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--twro-mute, #8aa0bc);
}

.water-accordion__meta {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.water-mini-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  color: var(--chip-color, #22c55e);
  background: color-mix(in srgb, var(--chip-color, #22c55e) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--chip-color, #22c55e) 40%, transparent);
}

.water-minibar {
  display: inline-flex;
  width: 110px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.water-minibar i {
  display: block;
  height: 100%;
}

@media (max-width: 720px) {
  .water-accordion summary {
    flex-wrap: wrap;
  }

  .water-accordion__meta {
    justify-content: flex-start;
    width: 100%;
    order: 3;
  }

  .water-minibar {
    width: 100%;
  }
}

/* —— Rainfall bars —— */
.water-rain-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.water-rain-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr 90px;
  align-items: center;
  gap: 12px;
}

.water-rain-row__name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--twro-cream, #f4efe6);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.water-rain-row__prov {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--twro-mute);
}

.water-rain-row__mm {
  text-align: right;
  font-weight: 800;
  font-family: var(--twro-mono, monospace);
}

.water-rain-row__mm small {
  font-weight: 600;
  font-size: 0.7rem;
}

.water-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.water-bar__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--water-color, #22c55e);
  transition: width 0.3s ease;
}

.water-bar--rain {
  height: 12px;
}

/* —— Legend —— */
.water-legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
  margin-top: 20px;
}

.water-legend div {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

/* —— Sources / references —— */
.water-sources {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--twro-line, rgba(255, 255, 255, 0.1));
}

.water-sources__title {
  font-size: 0.85rem;
  color: var(--twro-mute);
  margin: 0 0 10px;
}

.water-sources__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 0.82rem;
}

.water-sources__list a {
  color: var(--twro-gold-light, #ffe9a8);
  text-decoration: none;
}

.water-sources__list a:hover {
  text-decoration: underline;
}

/* —— Responsive —— */
@media (max-width: 640px) {
  .water-rain-row {
    grid-template-columns: 1fr 60px;
    grid-template-areas: "name mm" "bar bar";
  }

  .water-rain-row__name { grid-area: name; }
  .water-rain-row__mm { grid-area: mm; }
  .water-bar--rain { grid-area: bar; }
}

/* —— Light theme —— */
html[data-twro-theme="light"] .water-summary__item {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.1);
}

html[data-twro-theme="light"] .water-jumpnav {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(15, 23, 42, 0.1);
}

html[data-twro-theme="light"] .water-jumpnav a {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.12);
  color: #1e293b;
}

html[data-twro-theme="light"] .water-jumpnav a:hover {
  color: #92650f;
}

html[data-twro-theme="light"] .water-jumpnav a.is-active {
  border-color: #b45309;
  background: rgba(180, 83, 9, 0.14);
  color: #92650f;
}

html[data-twro-theme="light"] .water-section__share-more {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.15);
  color: #92650f;
}

html[data-twro-theme="light"] .water-summary__value,
html[data-twro-theme="light"] .water-section__title,
html[data-twro-theme="light"] .water-rain-row__name,
html[data-twro-theme="light"] .water-accordion summary {
  color: #1e293b;
}

html[data-twro-theme="light"] .water-table th {
  background: #f8fafc;
}

html[data-twro-theme="light"] .water-table td,
html[data-twro-theme="light"] .water-table th {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

html[data-twro-theme="light"] .water-table-wrap {
  border-color: rgba(15, 23, 42, 0.1);
}

html[data-twro-theme="light"] .water-accordion {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.1);
}

html[data-twro-theme="light"] .water-region__title {
  color: #92650f;
  border-left-color: rgba(146, 101, 15, 0.4);
}

html[data-twro-theme="light"] .water-legend div {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.08);
  color: #1e293b;
}

html[data-twro-theme="light"] .water-sources__list a {
  color: #92650f;
}
