/* =============================================
   cococha - 河川水位・洪水情報サービス
   style.css
   © 2025 株式会社ヒューマニティドットジャパン
   ============================================= */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Noto Sans JP', 'Zen Kaku Gothic New', sans-serif;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
}
a { text-decoration: none; transition: color 0.2s, opacity 0.2s; }
a:hover { opacity: 0.75; }
img { max-width: 100%; display: block; }

/* ---- CSS Variables: Light Theme ---- */
[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-alt: #edf2f9;
  --surface: #ffffff;
  --surface-2: #f0f4fa;
  --border: #d4e0f0;
  --text: #1a2a3a;
  --text-muted: #5a6a7a;
  --text-light: #8a9aaa;
  --accent: #1a6fcc;
  --accent-2: #0ea5e9;
  --header-bg: rgba(255,255,255,0.95);
  --header-shadow: 0 2px 20px rgba(26,111,204,0.1);
  --hero-from: #0c3566;
  --hero-to: #1a6fcc;
  --wave-color: rgba(255,255,255,0.15);
  --card-shadow: 0 2px 16px rgba(26,111,204,0.08);
  --card-shadow-hover: 0 6px 28px rgba(26,111,204,0.18);
}

/* ---- CSS Variables: Dark Theme ---- */
[data-theme="dark"] {
  --bg: #0a0f1a;
  --bg-alt: #0f1624;
  --surface: #141e2e;
  --surface-2: #1a2540;
  --border: #243352;
  --text: #e8f0fc;
  --text-muted: #8ba0c0;
  --text-light: #5a7090;
  --accent: #4d9de0;
  --accent-2: #60c7f5;
  --header-bg: rgba(10,15,26,0.97);
  --header-shadow: 0 2px 20px rgba(0,0,0,0.5);
  --hero-from: #050c1a;
  --hero-to: #0d2a5a;
  --wave-color: rgba(77,157,224,0.12);
  --card-shadow: 0 2px 16px rgba(0,0,0,0.3);
  --card-shadow-hover: 0 6px 28px rgba(77,157,224,0.2);
}

/* ---- Theme colors ---- */
body { background: var(--bg); color: var(--text); }

/* =============================================
   HEADER
   ============================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--header-shadow);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
}
.logo-icon { font-size: 1.5rem; }
.logo-text {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.header-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.nav-link {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s;
}
.nav-link:hover, .nav-link.active {
  background: var(--surface-2);
  color: var(--accent);
  opacity: 1;
}
.header-controls { display: flex; gap: 8px; }
.theme-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
}
.theme-toggle:hover { background: var(--surface); transform: rotate(20deg); }
[data-theme="light"] .theme-icon-dark,
[data-theme="dark"] .theme-icon-light { display: none; }

/* =============================================
   HERO
   ============================================= */
.hero {
  position: relative;
  background: linear-gradient(135deg, var(--hero-from) 0%, var(--hero-to) 100%);
  padding: 80px 20px 60px;
  overflow: hidden;
  text-align: center;
  color: #fff;
}
.hero-bg { position: absolute; inset: 0; overflow: hidden; }
.wave {
  position: absolute;
  bottom: -10px;
  left: -20%;
  width: 140%;
  height: 80px;
  border-radius: 50%;
  background: var(--wave-color);
  animation: waveAnim 6s ease-in-out infinite;
}
.wave2 { animation-delay: -2s; bottom: -20px; opacity: 0.7; }
.wave3 { animation-delay: -4s; bottom: -30px; opacity: 0.4; }
@keyframes waveAnim {
  0%, 100% { transform: translateX(-5%) scaleY(1); }
  50% { transform: translateX(5%) scaleY(1.15); }
}
.hero-content { position: relative; z-index: 1; }
.hero-title {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.3);
}
.hero-desc {
  font-size: 1.1rem;
  opacity: 0.85;
  margin-bottom: 16px;
}
.hero-update {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 100px;
  padding: 6px 18px;
  font-size: 0.8rem;
  opacity: 0.9;
}

/* PAGE HERO */
.page-hero {
  background: linear-gradient(135deg, var(--hero-from) 0%, var(--hero-to) 100%);
  padding: 50px 20px 40px;
  text-align: center;
  color: #fff;
}
.page-hero--warning { background: linear-gradient(135deg, #1a0a2e 0%, #4a1060 100%); }
.page-hero-content h1 {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 900;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin-bottom: 8px;
}
.page-hero-content p { opacity: 0.8; }

/* =============================================
   ALERT BANNER
   ============================================= */
.alert-banner {
  background: linear-gradient(90deg, #7f1d1d, #ef4444);
  color: #fff;
  padding: 12px 20px;
  animation: alertPulse 2s ease-in-out infinite;
}
@keyframes alertPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}
.alert-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-icon { font-size: 1.2rem; animation: shake 0.5s infinite; }
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

/* =============================================
   MAIN / CONTAINER
   ============================================= */
.site-main { padding: 32px 0 60px; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container--narrow { max-width: 800px; }

/* =============================================
   STATS
   ============================================= */
.stats-section { margin-bottom: 40px; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  box-shadow: var(--card-shadow);
  border: 2px solid transparent;
  transition: all 0.3s;
  animation: fadeInUp 0.5s ease both;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--card-shadow-hover); }
.stat-danger { border-color: #ef4444; }
.stat-warning { border-color: #f97316; }
.stat-caution { border-color: #f59e0b; }
.stat-safe { border-color: var(--accent); }
.stat-num {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 900;
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 6px;
}
.stat-danger .stat-num { color: #ef4444; }
.stat-warning .stat-num { color: #f97316; }
.stat-caution .stat-num { color: #f59e0b; }
.stat-safe .stat-num { color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

/* =============================================
   SECTION TITLES
   ============================================= */
.section-title {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: 2px;
}

/* =============================================
   REGION TABS
   ============================================= */
.region-section { margin-bottom: 0; }
.region-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}
.region-tab {
  padding: 8px 16px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Noto Sans JP', sans-serif;
}
.region-tab:hover { border-color: var(--accent); color: var(--accent); }
.region-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* =============================================
   WARNINGS
   ============================================= */
.warnings-section, .warnings-full-section { margin-bottom: 48px; }
.warnings-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.warnings-header .section-title { margin-bottom: 0; flex: 1; }

.loading-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.warnings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.warning-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
  border-left: 5px solid transparent;
  transition: all 0.3s;
  animation: fadeInUp 0.4s ease both;
}
.warning-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.warning-card.lv5 { border-left-color: #7c2d12; background: linear-gradient(135deg, var(--surface), rgba(127,29,18,0.08)); }
.warning-card.lv4 { border-left-color: #ef4444; }
.warning-card.lv3 { border-left-color: #f97316; }
.warning-card.lv2 { border-left-color: #f59e0b; }

.wc-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.wc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-weight: 900;
  font-size: 0.75rem;
  font-family: 'Zen Kaku Gothic New', sans-serif;
  flex-shrink: 0;
}
.lv5 .wc-badge { background: #7c2d12; color: #fff; }
.lv4 .wc-badge { background: #ef4444; color: #fff; }
.lv3 .wc-badge { background: #f97316; color: #fff; }
.lv2 .wc-badge { background: #f59e0b; color: #fff; }

.wc-title { font-weight: 700; font-size: 1rem; color: var(--text); line-height: 1.3; }
.wc-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; }
.wc-body { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.wc-time { font-size: 0.75rem; color: var(--text-light); margin-top: 8px; }

.no-warnings {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.no-warnings-icon { font-size: 3rem; margin-bottom: 12px; }

/* =============================================
   PREFECTURE GRID
   ============================================= */
.prefectures-section { margin-bottom: 48px; }
.pref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.pref-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pref-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--card-shadow); }
.pref-card.has-warning { border-left: 4px solid #f97316; }
.pref-card.has-danger { border-left: 4px solid #ef4444; }
.pref-name { font-weight: 700; font-size: 0.875rem; color: var(--text); }
.pref-status { font-size: 0.72rem; color: var(--text-muted); }
.pref-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  margin-left: auto;
  margin-top: -20px;
}
.pref-dot.warning { background: #f97316; }
.pref-dot.danger { background: #ef4444; animation: blink 1s ease-in-out infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* =============================================
   LEVEL CARDS
   ============================================= */
.info-section { margin-bottom: 48px; }
.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.level-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  box-shadow: var(--card-shadow);
  border-top: 4px solid transparent;
}
.level-5 { border-top-color: #7c2d12; }
.level-4 { border-top-color: #ef4444; }
.level-3 { border-top-color: #f97316; }
.level-2 { border-top-color: #f59e0b; }
.level-badge {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  margin-bottom: 6px;
}
.level-5 .level-badge { color: #7c2d12; }
.level-4 .level-badge { color: #ef4444; }
.level-3 .level-badge { color: #f97316; }
.level-2 .level-badge { color: #f59e0b; }
.level-name { font-weight: 700; font-size: 0.9rem; margin-bottom: 6px; color: var(--text); }
.level-action {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 100px;
  display: inline-block;
}

/* =============================================
   FILTER BAR (Warning page)
   ============================================= */
.filter-bar {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--card-shadow);
}
.filter-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-group label { font-weight: 700; font-size: 0.875rem; color: var(--text-muted); white-space: nowrap; }
.filter-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn {
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Noto Sans JP', sans-serif;
}
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.filter-btn.lv5.active { background: #7c2d12; border-color: #7c2d12; }
.filter-btn.lv4.active { background: #ef4444; border-color: #ef4444; }
.filter-btn.lv3.active { background: #f97316; border-color: #f97316; }
.filter-btn.lv2.active { background: #f59e0b; border-color: #f59e0b; color: #333; }

/* =============================================
   TABLE (Warning page)
   ============================================= */
.table-wrapper {
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}
.warning-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.warning-table thead {
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
}
.warning-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.warning-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.warning-table tbody tr:hover { background: var(--surface-2); }
.warning-table td {
  padding: 12px 16px;
  color: var(--text);
  vertical-align: middle;
}
.tbl-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.tbl-lv5 { background: #7c2d12; color: #fff; }
.tbl-lv4 { background: #ef4444; color: #fff; }
.tbl-lv3 { background: #f97316; color: #fff; }
.tbl-lv2 { background: #f59e0b; color: #333; }
.tbl-link {
  color: var(--accent);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* =============================================
   MAP PAGE
   ============================================= */
.map-legend {
  display: flex;
  gap: 20px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.legend-dot { width: 12px; height: 12px; border-radius: 50%; }
.lv5dot { background: #ef4444; }
.lv3dot { background: #f97316; }
.lv2dot { background: #f59e0b; }

/* =============================================
   ABOUT PAGE
   ============================================= */
.about-section { padding: 40px 0; }
.about-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 20px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
}
.about-card h2 {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 14px;
  color: var(--accent);
}
.about-card p, .about-card li { color: var(--text-muted); line-height: 1.8; }
.about-list { padding-left: 20px; }
.about-list li { margin-bottom: 6px; }
.about-card a { color: var(--accent); }

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 40px 20px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}
.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.footer-logo .logo-text { font-size: 1.2rem; }
.footer-desc { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 16px; }
.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.footer-links a { color: var(--text-muted); font-size: 0.875rem; }
.footer-links a:hover { color: var(--accent); }
.footer-source, .footer-corp {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-bottom: 4px;
}
.footer-source a, .footer-corp a { color: var(--text-light); }
.footer-source a:hover, .footer-corp a:hover { color: var(--accent); }

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
  .header-inner { padding: 0 14px; }
  .nav-link { padding: 5px 10px; font-size: 0.8rem; }
  .hero { padding: 56px 16px 48px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .warnings-grid { grid-template-columns: 1fr; }
  .pref-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .warning-table th:nth-child(5),
  .warning-table td:nth-child(5) { display: none; }
  .region-tabs { gap: 6px; }
  .region-tab { padding: 6px 12px; font-size: 0.8rem; }
}

@media (max-width: 480px) {
  .logo-sub { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-num { font-size: 2rem; }
  .level-grid { grid-template-columns: repeat(2, 1fr); }
  .warning-table th:nth-child(3),
  .warning-table td:nth-child(3) { display: none; }
}
