/* 数値を高さで見せる地図 — 統計の読みもの。生成りの地、黒の太い見出し、数字は細長い欧文。柱は橙から臙脂へ */
:root{
  /* 小さい文字（--sub）は、地（#f4f1eb）と選択中の行（#e6e1d6）の両方で 4.5:1 以上 */
  --bg:#f4f1eb; --bg-2:#e6e1d6; --ink:#141414; --sub:#55504a; --line:#cfc8ba; --hot:#b5301c; --navy:#0f6b7c; --side:448px;
  --f-jp:"Noto Sans JP","Hiragino Sans","Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif;
  --f-num:"Barlow Condensed","Noto Sans JP","Hiragino Sans",sans-serif;
  --ease:cubic-bezier(.2,.8,.2,1);
}
*,*::before,*::after{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:400 14px/1.8 var(--f-jp);-webkit-font-smoothing:antialiased;overflow:hidden;line-break:strict;overflow-wrap:anywhere}
button{font:inherit;color:inherit;cursor:pointer}
a{color:inherit}
[hidden]{display:none!important}
:focus-visible{outline:3px solid var(--ink);outline-offset:2px}

/* 並びは、左に地図・右に欄。HTML は欄（見出し・表）が先なので、置く列を指定する */
.app{display:grid;grid-template-columns:minmax(0,1fr) var(--side);grid-template-rows:minmax(0,1fr);height:100vh;height:100dvh}
.stage{grid-column:1;grid-row:1;position:relative;min-width:0;overflow:hidden;background:#e9e5dd}
.map{position:absolute;inset:0}
.maplibregl-map{font:inherit}
.maplibregl-canvas{outline:0}
.maplibregl-canvas:focus-visible{outline:3px solid var(--ink);outline-offset:-3px;box-shadow:inset 0 0 0 6px #fff}
.maplibregl-ctrl-attrib{font:400 11px/1.6 var(--f-jp);background:rgba(244,241,235,.95)!important;color:var(--sub)}
.maplibregl-ctrl-attrib a{color:var(--ink)}
.maplibregl-ctrl-group{border-radius:0;box-shadow:0 0 0 1.5px var(--ink)!important;background:var(--bg)}
.maplibregl-ctrl-group button{width:34px;height:34px}
/* 拡大・縮小・方位のフォーカス枠（MapLibre 既定の青は、この地の上で 3:1 に届かない） */
.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:none;outline:3px solid var(--ink);outline-offset:-3px}
.maplibregl-ctrl-attrib .shore{display:block}
.maplibregl-ctrl-group button+button{border-top:1px solid var(--line)}
.maplibregl-cooperative-gesture-screen{font:700 14px/1.6 var(--f-jp);background:rgba(20,20,20,.72)}
/* 背景のタイルが取れないときの知らせ（地図の下の中央。左下の案内バーと出典の上） */
.netnote{position:absolute;left:50%;bottom:132px;z-index:3;display:flex;align-items:center;gap:6px 12px;flex-wrap:wrap;justify-content:center;width:max-content;max-width:calc(100% - 24px);margin:0;padding:9px 12px 9px 14px;transform:translateX(-50%);background:var(--ink);color:#fff;font:700 12px/1.6 var(--f-jp);letter-spacing:.04em}
.netnote button{flex:none;height:30px;padding:0 11px;border:1.5px solid #fff;border-radius:0;background:transparent;color:#fff;font:700 11.5px/1 var(--f-jp);letter-spacing:.06em}
.netnote button:hover{background:#fff;color:var(--ink)}
.netnote button:focus-visible{outline-color:#fff}
.nomap{position:absolute;inset:0;z-index:3;display:grid;place-items:center;margin:0;padding:32px;text-align:center;color:var(--ink);background:repeating-linear-gradient(135deg,transparent 0 13px,rgba(20,20,20,.05) 13px 14px)}

/* ---- 地図の上 ---- */
.legend{position:absolute;left:16px;top:16px;z-index:2;width:232px;padding:11px 14px 10px;background:rgba(244,241,235,.96);border:1.5px solid var(--ink);pointer-events:none}
.legend p{margin:0}
.legend__ttl{display:flex;align-items:baseline;justify-content:space-between;gap:8px;font:700 12.5px/1.3 var(--f-jp);letter-spacing:.04em}
.legend__ttl small{font:400 10.5px/1.3 var(--f-jp);color:var(--sub);white-space:nowrap}
.legend__bar{height:12px;margin:8px 0 5px;background:linear-gradient(90deg,#f3dfb4,#f2b25c 25%,#e9782f 50%,#c33a22 75%,#7d1626);border:1px solid rgba(20,20,20,.55)}
.legend__ends{display:flex;justify-content:space-between;font:500 14px/1 var(--f-num);letter-spacing:.02em;color:var(--ink)}
.view{position:absolute;left:16px;top:108px;z-index:2;display:flex;gap:6px}
.view button{height:34px;padding:0 12px;border:1.5px solid var(--ink);border-radius:0;background:var(--bg);font:700 11.5px/1 var(--f-jp);letter-spacing:.06em;transition:background .25s,color .25s}
.view button:hover{background:var(--bg-2)}
.view button[aria-pressed="true"]{background:var(--ink);color:var(--bg)}
.tip{position:absolute;left:0;top:0;z-index:4;padding:7px 11px 8px;background:var(--ink);color:#fff;font:700 12.5px/1.3 var(--f-jp);letter-spacing:.06em;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .2s}
.tip.is-on{opacity:1}
.tip small{display:block;margin-top:3px;font:400 11px/1.3 var(--f-jp);letter-spacing:.04em}
.flag{padding:5px 10px 6px;background:var(--navy);color:#fff;font:700 12.5px/1 var(--f-jp);letter-spacing:.1em;white-space:nowrap;box-shadow:0 0 0 2px #fff;pointer-events:none}
.flag::after{content:"";position:absolute;left:50%;bottom:-8px;width:2px;height:8px;margin-left:-1px;background:var(--navy);box-shadow:0 0 0 1px #fff}

/* ---- 右の欄 ---- */
.side{grid-column:2;grid-row:1;position:relative;z-index:3;display:flex;flex-direction:column;min-height:0;background:var(--bg);border-left:1.5px solid var(--ink)}
.brand{padding:26px 32px 18px}
.brand__name{display:flex;align-items:center;gap:12px;margin:0;font:900 12px/1 var(--f-jp);letter-spacing:.2em;color:var(--hot)}
.brand__name span{padding-left:12px;border-left:1px solid var(--line);font:500 11px/1 var(--f-jp);letter-spacing:.1em;color:var(--sub)}
.brand__ttl{margin:14px 0 0;font:900 31px/1.3 var(--f-jp);letter-spacing:.03em;font-feature-settings:"palt"}
.brand__lead{margin:10px 0 0;font-size:12.5px;line-height:1.85;color:var(--sub)}
.panel{display:flex;flex-direction:column;flex:1;min-height:0}
.tabs{display:grid;grid-template-columns:repeat(3,auto);justify-content:start;gap:0;padding:0 32px;border-bottom:1.5px solid var(--ink)}
.tab{position:relative;height:40px;margin-right:4px;padding:0 14px;border:1.5px solid var(--ink);border-bottom:0;border-radius:0;background:transparent;font:700 12.5px/1 var(--f-jp);letter-spacing:.04em;color:var(--sub);white-space:nowrap;transition:background .25s var(--ease),color .25s var(--ease)}
.tab:hover{color:var(--ink);background:var(--bg-2)}
.tab[aria-pressed="true"]{background:var(--ink);color:var(--bg)}
.tab:focus-visible{outline-offset:-5px;outline-color:var(--hot)}
.tab[aria-pressed="true"]:focus-visible{outline-color:#fff}   /* 黒い地の上では白い枠にする（朱は 3:1 に届かない） */

.focus{position:relative;flex:none;padding:13px 32px 13px;border-bottom:1px solid var(--line);border-left:5px solid transparent;transition:border-color .3s var(--ease),background .3s var(--ease)}
.focus.is-town{border-left-color:var(--navy);background:var(--bg-2)}
.focus__name{display:flex;align-items:baseline;flex-wrap:wrap;gap:2px 12px;margin:0;padding-right:112px}
.focus__name b{font:900 19px/1.3 var(--f-jp);letter-spacing:.06em}
.focus__name span{font-size:11px;line-height:1.4;color:var(--sub);letter-spacing:.04em}
.focus__dl{display:grid;grid-template-columns:repeat(4,auto);justify-content:space-between;gap:0 10px;margin:8px 0 0}
.focus__dl dt{font-size:10.5px;line-height:1.4;letter-spacing:.06em;color:var(--sub);white-space:nowrap}
.focus__dl dd{margin:1px 0 0;font-size:10.5px;line-height:1.2;color:var(--sub);white-space:nowrap}
.focus__dl dd b{margin-right:2px;font:600 22px/1.1 var(--f-num);letter-spacing:.01em;color:var(--ink)}
.focus__clear{position:absolute;right:32px;top:12px;height:26px;padding:0 9px;border:1px solid var(--ink);border-radius:0;background:var(--bg);font:500 10.5px/1 var(--f-jp);letter-spacing:.04em}
.focus__clear:hover{background:var(--ink);color:var(--bg)}

/* 表を飛ばすリンク（キーボードで来たときだけ出る） */
.skip{flex:none;display:block;height:0;overflow:hidden;font:700 12px/1.4 var(--f-jp);letter-spacing:.06em}
.skip:focus-visible{height:auto;margin:8px 32px 0;padding:7px 12px;background:var(--ink);color:#fff;outline-offset:2px}
.rank{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--line) transparent}
table{width:100%;border-collapse:collapse;table-layout:fixed}
caption{padding:10px 32px 6px;text-align:left;font-size:11px;line-height:1.5;letter-spacing:.04em;color:var(--sub)}
thead th{position:sticky;top:0;z-index:1;padding:5px 0 6px;background:var(--bg);border-bottom:1px solid var(--ink);font:700 10.5px/1.3 var(--f-jp);letter-spacing:.08em;text-align:left;color:var(--sub)}
.c-no{width:64px;padding-left:32px!important}
.c-name{width:118px}
.c-val{padding-right:32px!important}
thead .c-val{text-align:right}
tbody tr{border-bottom:1px solid var(--line);cursor:pointer;transition:background .2s var(--ease)}
tbody tr:hover{background:rgba(20,20,20,.05)}
tbody tr.is-on{background:var(--bg-2);box-shadow:inset 5px 0 0 var(--navy)}
tbody td,tbody th{padding:0;height:34px;vertical-align:middle;text-align:left;font-weight:400}
tbody .c-no{font:500 15px/1 var(--f-num);color:var(--sub)}
tbody .c-name button{display:block;width:100%;height:34px;padding:0;border:0;background:transparent;text-align:left;font:700 13px/1 var(--f-jp);letter-spacing:.04em;white-space:nowrap}
tbody .c-name button:focus-visible{outline-offset:-2px}
tbody .c-val{position:relative}
tbody .c-val .v{position:relative;z-index:1;display:block;text-align:right;font:600 17px/34px var(--f-num);letter-spacing:.02em}
/* 棒は数字の下に細く敷く（数字は地の色の上で読む） */
tbody .c-val::before{content:"";position:absolute;left:0;right:32px;bottom:4px;height:4px;background:rgba(20,20,20,.07)}
tbody .c-val i{position:absolute;left:0;right:32px;bottom:4px;height:4px;background:linear-gradient(var(--c),var(--c)) no-repeat left/var(--w) 100%}

/* 左下の案内バーは地図の側にあるので、ここは下まで使う */
.foot{flex:none;padding:11px 32px 14px;border-top:1.5px solid var(--ink);font-size:10.5px;line-height:1.7;color:var(--sub)}
.foot p{margin:0}
.foot p:first-child{color:var(--ink);font-weight:500}
.foot .shore{display:none}   /* 海岸線の出所は、地図の出典の欄に出している。スマホ（縦向き）だけ、ここに出す */

.is-nomap .legend,.is-nomap .view,.is-nomap .netnote,.no-js .legend,.no-js .view,.no-js .tabs,.no-js .focus,.no-js .rank,.no-js .skip{display:none}

/* ---- 出典は、左下の案内バーに重ねない。広い画面では案内バーの右に収め、狭い画面では案内バーより上へ上げる ---- */
.maplibregl-ctrl-bottom-right{max-width:calc(100% - 424px)}
@media (max-width:1340px){
  .maplibregl-ctrl-bottom-right{bottom:58px;max-width:none}
}
/* ---- 幅が狭い PC ---- */
@media (max-width:1180px){
  :root{--side:388px}
  .brand{padding:22px 24px 16px}
  .brand__ttl{font-size:26px}
  .tabs,.focus{padding-left:24px;padding-right:24px}
  .tab{padding:0 10px;font-size:12px}
  .focus__clear{right:24px}
  caption{padding-left:24px;padding-right:24px}
  .c-no{width:52px;padding-left:24px!important}
  .c-name{width:108px}
  .c-val{padding-right:24px!important}
  tbody .c-val::before,tbody .c-val i{right:24px}
  .foot{padding-left:24px;padding-right:24px}
  .focus__dl dd b{font-size:20px}
}
@media (max-width:940px){
  :root{--side:340px}
  .legend{width:196px;padding:9px 11px 8px}
  .legend__ttl small{display:none}
  .view{top:96px}
  .focus__dl{grid-template-columns:repeat(2,1fr);gap:6px 10px}
  .tab{padding:0 8px;font-size:11.5px;letter-spacing:0}
}
/* ---- 高さの低い画面：右の欄をまるごとスクロールさせる ---- */
@media (max-height:720px){
  .brand{padding-top:18px;padding-bottom:12px}
  .brand__ttl{margin-top:9px;font-size:22px;line-height:1.3}
  .brand__ttl br{display:none}
  .brand__lead{margin-top:6px;font-size:12px;line-height:1.7}
  .focus{padding-top:9px;padding-bottom:9px}
}
@media (max-height:560px){
  .side{display:block;overflow-y:auto;overscroll-behavior:contain}
  .panel{display:block}
  .rank{overflow:visible}
  thead th{position:static}
  .brand__ttl{font-size:18px}
  .brand__lead{display:none}
  .legend{left:10px;top:10px}
  .view{left:10px;top:88px}
}

/* ---- スマホ（縦向き）：ふつうにページを送る。地図は2本の指で動かす ---- */
@media (max-width:820px) and (min-height:561px){
  html,body{height:auto}
  body{overflow:auto}
  .app{display:flex;flex-direction:column;height:auto;padding-bottom:70px}   /* 下は案内バーの分 */
  .side,.panel{display:contents}
  .brand{order:1;padding:22px 18px 14px}
  .brand__ttl{font-size:27px}
  .brand__ttl br{display:inline}
  .tabs{order:2;padding:0 18px}
  .tab{padding:0 11px;font-size:12px}
  .stage{order:3;height:min(60vh,480px);height:min(60svh,480px);border-bottom:1.5px solid var(--ink)}
  .focus{order:4;padding:12px 18px}
  .focus__clear{right:18px}
  .focus__dl{grid-template-columns:repeat(4,auto)}
  .focus__dl dd b{font-size:19px}
  .skip{order:5}
  .skip:focus-visible{margin:8px 18px 0}
  .rank{order:5;overflow:visible;flex:none}
  .netnote{bottom:auto;top:118px}   /* 凡例と、拡大・縮小のボタンの下 */
  .maplibregl-ctrl-attrib .shore{display:none}   /* 小さい地図を覆うので、ここでは下の出典（.foot）で出す */
  .foot .shore{display:inline}
  /* 地図を描けないとき：地図の枠をたたみ、説明のすぐ下に数値と表を出す */
  .is-nomap .stage,.no-js .stage{height:auto}
  .is-nomap .nomap,.no-js .nomap{position:static}
  thead th{position:static}
  caption{padding-left:18px;padding-right:18px}
  .c-no{width:48px;padding-left:18px!important}
  .c-name{width:112px}
  .c-val{padding-right:18px!important}
  tbody .c-val::before,tbody .c-val i{right:18px;bottom:6px}
  tbody td,tbody th{height:40px}
  tbody .c-name button{height:40px}
  tbody .c-val .v{line-height:40px}
  .foot{order:6;padding:12px 18px 0;border-top:1.5px solid var(--ink)}
  .legend{left:8px;top:8px;width:180px;padding:8px 10px 7px}
  .legend__ttl small{display:none}
  .view{left:8px;top:auto;bottom:42px}   /* 出典（2行）の上 */
  .tip{display:none}
  .maplibregl-ctrl-top-right .maplibregl-ctrl{margin:8px 8px 0 0}
  .maplibregl-ctrl-bottom-right{bottom:0}
}
@media (max-width:400px){
  .focus__dl{grid-template-columns:repeat(2,1fr);gap:6px 10px}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{transition-duration:.01ms!important;animation-duration:.01ms!important}
}
