/* =============================
   cocojam — style.css
   ============================= */

/* --- Variables --- */
:root {
  --bg:        #ffffff;
  --bg2:       #f7f7f5;
  --bg3:       #efefeb;
  --card:      #ffffff;
  --border:    rgba(0,0,0,0.09);
  --border2:   rgba(0,0,0,0.18);
  --txt:       #1a1a18;
  --txt2:      #5c5c58;
  --txt3:      #9a9a94;
  --accent:    #e05a28;
  --accent-bg: #fdf1ec;
  --accent-dk: #c04418;
  --jam-red:   #e03030;
  --jam-yellow:#e0a020;
  --jam-green: #28a050;
  --jam-red-bg:   #fdeaea;
  --jam-yel-bg:   #fdf5e0;
  --jam-grn-bg:   #eaf5ee;
  --nav-bg:    rgba(255,255,255,0.94);
  --footer-bg: #18181a;
  --footer-txt:#a0a09a;
  --shadow:    0 1px 4px rgba(0,0,0,0.07);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.10);
  --radius:    10px;
  --radius-sm: 6px;
}

[data-theme="dark"] {
  --bg:        #16161a;
  --bg2:       #1e1e22;
  --bg3:       #26262c;
  --card:      #1e1e22;
  --border:    rgba(255,255,255,0.08);
  --border2:   rgba(255,255,255,0.16);
  --txt:       #eeeee8;
  --txt2:      #a0a09a;
  --txt3:      #606060;
  --accent:    #ff7040;
  --accent-bg: #271a14;
  --accent-dk: #ff9060;
  --jam-red:   #ff5050;
  --jam-yellow:#ffb830;
  --jam-green: #40c060;
  --jam-red-bg:   #2a1414;
  --jam-yel-bg:   #261e08;
  --jam-grn-bg:   #0e2016;
  --nav-bg:    rgba(22,22,26,0.94);
  --footer-bg: #0e0e10;
  --footer-txt:#606060;
  --shadow:    0 1px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
}

/* --- Reset --- */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html { scroll-behavior:smooth; }
body {
  font-family:'Hiragino Sans','Noto Sans JP','Yu Gothic UI',sans-serif;
  background:var(--bg);
  color:var(--txt);
  line-height:1.6;
  transition:background .3s,color .3s;
  min-height:100vh;
}
a { color:inherit; text-decoration:none; }
ul { list-style:none; }
button { cursor:pointer; font-family:inherit; }

/* --- Nav --- */
.nav {
  position:sticky; top:0; z-index:200;
  background:var(--nav-bg);
  border-bottom:0.5px solid var(--border);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
}
.nav-inner {
  max-width:1200px; margin:0 auto; padding:0 20px;
  height:56px; display:flex; align-items:center; gap:20px;
}
.nav-logo {
  font-size:19px; font-weight:800; letter-spacing:-0.5px;
  color:var(--accent); flex-shrink:0;
}
.nav-links {
  display:flex; gap:2px; flex:1;
  overflow-x:auto; scrollbar-width:none;
}
.nav-links::-webkit-scrollbar { display:none; }
.nav-link {
  white-space:nowrap; font-size:13px; padding:6px 12px;
  border-radius:20px; color:var(--txt2); transition:all .2s;
}
.nav-link:hover,.nav-link.active { background:var(--bg3); color:var(--txt); }
.nav-right { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.icon-btn {
  width:34px; height:34px; border-radius:50%;
  border:0.5px solid var(--border); background:var(--bg3);
  color:var(--txt2); font-size:16px;
  display:flex; align-items:center; justify-content:center;
  transition:all .2s;
}
.icon-btn:hover { border-color:var(--border2); color:var(--txt); }
.ham-btn { display:none; }

/* mobile menu */
.mobile-menu {
  display:none; position:fixed; top:56px; left:0; right:0; bottom:0;
  background:var(--bg); z-index:190; padding:20px; overflow-y:auto;
}
.mobile-menu.open { display:block; }
.mobile-menu a {
  display:block; padding:14px 0;
  border-bottom:0.5px solid var(--border);
  font-size:15px; color:var(--txt2);
}
.mobile-menu a:hover { color:var(--txt); }

/* --- Hero --- */
.hero {
  background:var(--bg2);
  border-bottom:0.5px solid var(--border);
  padding:52px 20px 44px; text-align:center;
}
.hero-badge {
  display:inline-block; font-size:11px; font-weight:700;
  letter-spacing:.1em; text-transform:uppercase;
  color:var(--accent); background:var(--accent-bg);
  border:0.5px solid var(--accent); border-radius:20px;
  padding:3px 12px; margin-bottom:16px;
}
.hero h1 {
  font-size:clamp(26px,5vw,44px); font-weight:800;
  letter-spacing:-1px; line-height:1.15; margin-bottom:12px;
}
.hero h1 span { color:var(--accent); }
.hero-sub {
  font-size:14px; color:var(--txt2);
  max-width:480px; margin:0 auto 28px;
}
.hero-stats { display:flex; justify-content:center; gap:40px; flex-wrap:wrap; }
.stat-num { display:block; font-size:26px; font-weight:800; color:var(--accent); }
.stat-lbl { font-size:11px; color:var(--txt3); }

/* --- Layout --- */
.container { max-width:1200px; margin:0 auto; padding:0 20px; }
.main-layout {
  display:grid; grid-template-columns:1fr 300px;
  gap:32px; padding:36px 0 64px;
}

/* --- Section header --- */
.sec-head {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:16px;
}
.sec-title {
  font-size:15px; font-weight:700;
  display:flex; align-items:center; gap:8px;
}
.sec-title::before {
  content:''; display:inline-block;
  width:3px; height:15px;
  background:var(--accent); border-radius:2px;
}
.sec-meta { font-size:11px; color:var(--txt3); }

/* --- Map container --- */
#map {
  width:100%; height:520px;
  border-radius:var(--radius);
  border:0.5px solid var(--border);
  overflow:hidden;
  background:var(--bg3);
}

/* --- Legend --- */
.legend {
  display:flex; gap:16px; flex-wrap:wrap;
  margin-bottom:16px;
}
.legend-item {
  display:flex; align-items:center; gap:6px;
  font-size:12px; color:var(--txt2);
}
.legend-dot {
  width:12px; height:12px; border-radius:50%;
  flex-shrink:0;
}
.dot-red    { background:var(--jam-red); }
.dot-yellow { background:var(--jam-yellow); }
.dot-green  { background:var(--jam-green); }
.dot-gray   { background:var(--txt3); }

/* --- Stats list --- */
.stats-list { display:flex; flex-direction:column; gap:6px; }
.stat-item {
  display:flex; align-items:center; justify-content:space-between;
  background:var(--card); border:0.5px solid var(--border);
  border-radius:var(--radius-sm); padding:10px 14px;
  font-size:13px; transition:all .2s; cursor:pointer;
}
.stat-item:hover { border-color:var(--border2); }
.stat-item-left { display:flex; align-items:center; gap:10px; }
.stat-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.stat-name { font-weight:500; }
.stat-road { font-size:11px; color:var(--txt3); }
.stat-val { font-size:13px; font-weight:700; }

/* --- Filter tabs --- */
.filter-tabs {
  display:flex; gap:8px; margin-bottom:16px;
  overflow-x:auto; scrollbar-width:none; padding-bottom:2px;
}
.filter-tabs::-webkit-scrollbar { display:none; }
.ftab {
  white-space:nowrap; font-size:12px;
  padding:5px 14px; border-radius:20px;
  border:0.5px solid var(--border);
  background:var(--card); color:var(--txt2);
  transition:all .2s; flex-shrink:0;
}
.ftab:hover { border-color:var(--accent); color:var(--accent); }
.ftab.active {
  background:var(--accent); color:#fff;
  border-color:var(--accent); font-weight:600;
}

/* --- Sidebar --- */
.sidebar { display:flex; flex-direction:column; gap:20px; }
.sidebar-card {
  background:var(--card); border:0.5px solid var(--border);
  border-radius:var(--radius); padding:16px;
}
.sidebar-card-title {
  font-size:13px; font-weight:700; margin-bottom:12px;
  display:flex; align-items:center; gap:6px;
}

/* status summary */
.status-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.status-card {
  border-radius:var(--radius-sm); padding:12px;
  text-align:center;
}
.status-card.red    { background:var(--jam-red-bg); }
.status-card.yellow { background:var(--jam-yel-bg); }
.status-card.green  { background:var(--jam-grn-bg); }
.status-card.gray   { background:var(--bg3); }
.status-num {
  font-size:22px; font-weight:800; display:block; margin-bottom:2px;
}
.status-card.red    .status-num { color:var(--jam-red); }
.status-card.yellow .status-num { color:var(--jam-yellow); }
.status-card.green  .status-num { color:var(--jam-green); }
.status-card.gray   .status-num { color:var(--txt3); }
.status-lbl { font-size:10px; color:var(--txt3); font-weight:500; }

/* related */
.related-links { display:flex; flex-direction:column; gap:6px; }
.related-link {
  display:flex; align-items:center; gap:8px;
  padding:8px 10px; border-radius:var(--radius-sm);
  border:0.5px solid var(--border);
  font-size:12px; color:var(--txt2); transition:all .2s;
}
.related-link:hover { border-color:var(--border2); color:var(--txt); }

/* --- About section --- */
.about-section {
  background:var(--bg2); border-top:0.5px solid var(--border);
  padding:48px 20px;
}
.about-grid {
  display:grid; grid-template-columns:repeat(3,1fr);
  gap:20px; margin-top:28px;
}
.about-card {
  background:var(--card); border:0.5px solid var(--border);
  border-radius:var(--radius); padding:20px;
}
.about-icon { font-size:24px; margin-bottom:10px; }
.about-card h3 { font-size:14px; font-weight:700; margin-bottom:6px; }
.about-card p { font-size:13px; color:var(--txt2); line-height:1.6; }

/* --- Knowledge page --- */
.knowledge-grid {
  display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
  gap:20px; margin-top:20px;
}
.knowledge-card {
  background:var(--card); border:0.5px solid var(--border);
  border-radius:var(--radius); padding:20px;
}
.knowledge-card h3 { font-size:14px; font-weight:700; margin-bottom:8px; }
.knowledge-card p { font-size:13px; color:var(--txt2); line-height:1.7; }
.knowledge-card .kc-icon { font-size:28px; margin-bottom:10px; }

/* --- History page --- */
.history-notice {
  background:var(--accent-bg); border:0.5px solid var(--accent);
  border-radius:var(--radius); padding:14px 18px;
  font-size:13px; color:var(--txt2); margin-bottom:24px;
}
.history-notice strong { color:var(--accent); }
.area-grid {
  display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr));
  gap:12px;
}
.area-card {
  background:var(--card); border:0.5px solid var(--border);
  border-radius:var(--radius); padding:14px 16px;
  transition:all .2s; cursor:pointer;
}
.area-card:hover { border-color:var(--border2); box-shadow:var(--shadow); }
.area-card-name { font-size:14px; font-weight:700; margin-bottom:4px; }
.area-card-meta { font-size:12px; color:var(--txt3); }
.area-bar-track {
  margin-top:8px; height:4px; background:var(--bg3); border-radius:2px; overflow:hidden;
}
.area-bar-fill {
  height:100%; border-radius:2px; transition:width .6s ease;
}

/* --- Footer --- */
.footer {
  background:var(--footer-bg);
  color:var(--footer-txt);
  padding:40px 20px 24px;
  border-top:0.5px solid rgba(255,255,255,0.06);
}
.footer-inner { max-width:1200px; margin:0 auto; }
.footer-top {
  display:grid; grid-template-columns:1fr 1fr 1fr;
  gap:32px; margin-bottom:32px;
}
.footer-logo { font-size:20px; font-weight:800; color:#fff; letter-spacing:-0.5px; margin-bottom:8px; }
.footer-desc { font-size:12px; line-height:1.7; }
.footer-col h4 { font-size:12px; font-weight:700; color:#fff; margin-bottom:10px; }
.footer-col a {
  display:block; font-size:12px; color:var(--footer-txt);
  padding:3px 0; transition:color .2s;
}
.footer-col a:hover { color:#fff; }
.footer-bottom {
  border-top:0.5px solid rgba(255,255,255,0.08);
  padding-top:20px;
  display:flex; justify-content:space-between; align-items:center;
  flex-wrap:wrap; gap:8px; font-size:11px;
}

/* --- Loading / Error --- */
.loading-state, .error-state {
  padding:60px 20px; text-align:center;
  color:var(--txt3); font-size:14px;
}
.spinner {
  width:32px; height:32px; border:3px solid var(--border);
  border-top-color:var(--accent); border-radius:50%;
  animation:spin .8s linear infinite; margin:0 auto 12px;
}
@keyframes spin { to { transform:rotate(360deg); } }

/* --- Responsive --- */
@media(max-width:900px) {
  .main-layout { grid-template-columns:1fr; }
  .sidebar { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
  .about-grid { grid-template-columns:1fr 1fr; }
  .footer-top { grid-template-columns:1fr 1fr; }
}
@media(max-width:640px) {
  .nav-links { display:none; }
  .ham-btn { display:flex; }
  .hero { padding:36px 16px 32px; }
  .hero-stats { gap:24px; }
  .main-layout { padding:24px 0 48px; }
  #map { height:380px; }
  .sidebar { grid-template-columns:1fr; }
  .about-grid { grid-template-columns:1fr; }
  .footer-top { grid-template-columns:1fr; }
}
