/* 
  The Human Cost of Modern Commerce
  Somber memorial-style web map.
  Design intent: low-saturation, reflective visual hierarchy; avoid spectacle while preserving legibility.
*/

:root{
  --bg:#11110f;
  --panel:#1a1917;
  --panel-2:#22201d;
  --ink:#f1eee8;
  --muted:#b9b0a4;
  --quiet:#776f66;
  --line:#403a34;
  --land:#242321;
  --land-stroke:#53504a;
  --injury:#c6a765;
  --injury-soft:rgba(198,167,101,.23);
  --fatal:#6f1e1e;
  --fatal-ring:#d8c2a0;
  --focus:#e6d2a6;
  --shadow:0 18px 55px rgba(0,0,0,.42);
  --font-ui: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-title: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

*{box-sizing:border-box}
html,body{height:100%; margin:0; background:var(--bg); color:var(--ink); font-family:var(--font-ui);}
body{overflow:hidden;}

a{color:var(--focus)}
button,input,select{font:inherit}

#app{
  height:100vh;
  display:grid;
  grid-template-rows:auto 1fr auto;
  background:
    radial-gradient(circle at 22% 16%, rgba(198,167,101,.08), transparent 28%),
    linear-gradient(180deg,#151412 0%,#0d0d0c 100%);
}

.masthead{
  z-index:10;
  padding:20px clamp(18px,3vw,42px) 8px;
  pointer-events:none;
}
.eyebrow{
  margin:0 0 5px;
  color:var(--muted);
  letter-spacing:.13em;
  text-transform:uppercase;
  font-size:11px;
}
h1{
  font-family:var(--font-title);
  font-weight:700;
  letter-spacing:-.025em;
  line-height:1.05;
  margin:0;
  font-size:clamp(30px,4.2vw,64px);
}
.dek{
  color:#d4cdc2;
  margin:8px 0 0;
  font-size:clamp(14px,1.3vw,18px);
  max-width:900px;
}

.map-shell{
  position:relative;
  min-height:0;
  overflow:hidden;
  margin:0 clamp(10px,2vw,26px) 0;
  border:1px solid rgba(230,210,166,.12);
  border-radius:5px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.018), transparent),
    #121210;
  box-shadow:var(--shadow);
}

#map{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  z-index:1;
  cursor:grab;
  touch-action:none;
}
#map:active{cursor:grabbing}
.map-root{transform-origin:0 0;}

.graticule{
  fill:none;
  stroke:rgba(255,255,255,.045);
  stroke-width:.7;
}

.state{
  fill:var(--land);
  stroke:var(--land-stroke);
  stroke-width:.55;
  vector-effect:non-scaling-stroke;
}
.state-boundary{
  fill:none;
  stroke:rgba(202,195,181,.23);
  stroke-width:.55;
  vector-effect:non-scaling-stroke;
}

.incident{
  pointer-events:all;
  cursor:pointer;
  transition:opacity .18s ease, r .18s ease, stroke-width .18s ease;
}
.incident.injury{
  fill:var(--injury);
  stroke:rgba(20,18,16,.62);
  stroke-width:.55;
}
.incident.fatality{
  fill:var(--fatal);
  stroke:var(--fatal-ring);
  stroke-width:.95;
}
.incident:hover,
.incident:focus{
  stroke:#fff2cf;
  stroke-width:2.2;
}

.pulse-ring{
  fill:none;
  stroke:var(--fatal-ring);
  stroke-width:1.3;
  opacity:.0;
  pointer-events:none;
}
.pulse-ring.active{
  animation:fatalPulse 2.8s ease-out infinite;
}
@keyframes fatalPulse{
  0%{opacity:.72; r:4}
  78%{opacity:.05; r:22}
  100%{opacity:0; r:26}
}

.loading{
  position:absolute;
  z-index:40;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  background:rgba(20,19,17,.92);
  border:1px solid rgba(230,210,166,.17);
  border-radius:5px;
  padding:12px 18px;
  color:var(--muted);
  display:flex;
  gap:10px;
  align-items:center;
  box-shadow:var(--shadow);
}
.loader-dot{
  width:10px;
  height:10px;
  border-radius:50%;
  background:var(--injury);
  animation:blink 1.1s ease-in-out infinite;
}
@keyframes blink{50%{opacity:.25}}

.victims-panel{
  position:absolute;
  top:18px;
  right:18px;
  z-index:20;
  width:min(370px, calc(100% - 36px));
  color:var(--ink);
  background:rgba(26,25,23,.91);
  border:1px solid rgba(230,210,166,.16);
  border-radius:5px;
  box-shadow:var(--shadow);
  backdrop-filter:blur(10px);
}
.panel-toggle{
  position:absolute;
  right:10px;
  top:10px;
  z-index:2;
  width:30px;
  height:30px;
  border-radius:999px;
  border:1px solid rgba(230,210,166,.18);
  color:var(--ink);
  background:rgba(255,255,255,.035);
  cursor:pointer;
  display:grid;
  place-items:center;
  line-height:1;
}
.panel-content{padding:19px 18px 17px}
.victims-panel h2{
  margin:0 42px 4px 0;
  font-family:var(--font-title);
  font-weight:500;
  font-size:27px;
}
.panel-note{
  margin:0 0 14px;
  color:var(--muted);
  font-size:13px;
  line-height:1.35;
}
.victims-panel.collapsed{
  width:108px;
}
.victims-panel.collapsed .panel-content{
  padding:14px 42px 14px 14px;
}
.victims-panel.collapsed .panel-content > *:not(h2){
  display:none;
}
.victims-panel.collapsed h2{
  margin:0;
  font-size:18px;
}

.counter-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-bottom:14px;
}
.counter{
  background:var(--panel-2);
  border:1px solid rgba(255,255,255,.06);
  border-radius:5px;
  padding:11px 12px 10px;
}
.counter.total{grid-column:span 2}
.count{
  display:block;
  font-size:31px;
  line-height:1;
  font-weight:650;
  letter-spacing:-.04em;
}
.counter.fatal .count{color:#e6d2a6}
.label{
  display:block;
  margin-top:4px;
  color:var(--muted);
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.08em;
}

.symbol-row{
  display:grid;
  grid-template-columns:auto 1fr auto 1fr;
  align-items:center;
  gap:7px;
  color:#d7d0c6;
  font-size:13px;
  margin:6px 0 13px;
}
.swatch{
  display:inline-block;
  width:14px;
  height:14px;
  border-radius:50%;
}
.swatch.injury{background:var(--injury); box-shadow:0 0 0 5px var(--injury-soft)}
.swatch.fatality{background:var(--fatal); border:1px solid var(--fatal-ring)}

.filters{
  display:flex;
  gap:15px;
  color:var(--muted);
  font-size:13px;
  margin-bottom:15px;
}
.filters label{cursor:pointer}
.filters input{accent-color:#a78952}

.time-controls{
  border-top:1px solid rgba(255,255,255,.08);
  padding-top:14px;
}
.date-line{
  display:flex;
  justify-content:space-between;
  color:var(--muted);
  font-size:13px;
  margin-bottom:7px;
}
.date-line strong{color:var(--ink)}
#time-slider{
  width:100%;
  accent-color:#b29358;
}
.button-row{
  display:flex;
  gap:8px;
  margin-top:11px;
}
button{
  border:1px solid rgba(230,210,166,.18);
  color:var(--ink);
  background:rgba(255,255,255,.04);
  border-radius:5px;
  padding:8px 12px;
  cursor:pointer;
  display:inline-grid;
  place-items:center;
  line-height:1;
}
button:hover{background:rgba(255,255,255,.08)}
button.primary{
  background:#d9c28e;
  color:#1a1711;
  border-color:#d9c28e;
  font-weight:700;
}
.speed-label{
  display:flex;
  align-items:center;
  justify-content:space-between;
  color:var(--muted);
  margin-top:12px;
  font-size:13px;
}
select{
  color:var(--ink);
  background:#171614;
  border:1px solid rgba(230,210,166,.18);
  border-radius:5px;
  padding:6px 9px;
}
.interaction-hint{
  color:#d8c893;
  background:rgba(216,194,160,.08);
  border:1px solid rgba(216,194,160,.14);
  border-radius:5px;
  font-size:12px;
  line-height:1.35;
  margin:11px 0 0;
  padding:8px 10px;
}

.record-card{
  position:absolute;
  left:18px;
  bottom:18px;
  z-index:22;
  width:min(430px, calc(100% - 36px));
  background:rgba(24,23,21,.96);
  border:1px solid rgba(230,210,166,.16);
  border-radius:5px;
  padding:18px;
  box-shadow:var(--shadow);
  backdrop-filter:blur(10px);
}
.close-card,.close-modal{
  position:absolute;
  top:10px;
  right:10px;
  width:30px;
  height:30px;
  padding:0;
  display:grid;
  place-items:center;
  line-height:1;
  border-radius:999px;
}
.record-card h3{
  margin:0 42px 3px 0;
  font-family:var(--font-title);
  font-weight:500;
  font-size:24px;
}
.record-card .meta{
  color:var(--muted);
  margin:0 0 10px;
  font-size:13px;
}
.record-card p{
  color:#ded8cf;
  line-height:1.45;
  margin:9px 0;
}
.record-card dl{
  display:grid;
  grid-template-columns:96px 1fr;
  gap:4px 10px;
  font-size:13px;
  margin:12px 0 0;
}
.record-card dt{color:var(--muted)}
.record-card dd{margin:0;color:#efe8dc}

.sources-button{
  position:absolute;
  left:18px;
  top:18px;
  z-index:21;
  background:rgba(26,25,23,.88);
  box-shadow:var(--shadow);
  border-radius:999px;
}

.page-footer{
  z-index:10;
  padding:8px clamp(18px,3vw,42px) 14px;
  color:#9d958b;
  font-size:12px;
}
.page-footer p{margin:0}

.modal{
  position:fixed;
  inset:0;
  z-index:100;
  background:rgba(0,0,0,.58);
  display:grid;
  place-items:center;
  padding:20px;
}
.modal[hidden]{display:none}
.modal-card{
  position:relative;
  width:min(720px,100%);
  max-height:min(82vh,720px);
  overflow:auto;
  background:#1a1917;
  color:var(--ink);
  border:1px solid rgba(230,210,166,.18);
  border-radius:5px;
  box-shadow:var(--shadow);
  padding:26px;
}
.modal-card h2{
  font-family:var(--font-title);
  font-size:30px;
  font-weight:500;
  margin:0 40px 12px 0;
}
.modal-card p{
  color:#d6cec3;
  line-height:1.55;
}
code{
  background:rgba(255,255,255,.06);
  padding:.1em .35em;
  border-radius:5px;
}


.filter-loading{
  color:#d8c893;
  font-size:12px;
  letter-spacing:.02em;
  margin-left:auto;
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.filter-loading[hidden]{display:none}
.filter-loading::before{
  content:"";
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--injury);
  animation:blink 1.1s ease-in-out infinite;
}

.rotate-message{
  display:none;
}

@media (max-width:760px) and (orientation:portrait){
  #app{display:none}
  body{overflow:hidden}
  .rotate-message{
    display:grid;
    position:fixed;
    inset:0;
    z-index:200;
    place-items:center;
    padding:22px;
    background:
      radial-gradient(circle at 30% 20%, rgba(198,167,101,.08), transparent 32%),
      #11110f;
    color:var(--ink);
  }
  .rotate-card{
    max-width:360px;
    border:1px solid rgba(230,210,166,.18);
    background:rgba(26,25,23,.94);
    border-radius:5px;
    padding:20px;
    box-shadow:var(--shadow);
    text-align:center;
  }
  .rotate-card strong{
    display:block;
    font-size:20px;
    margin-bottom:8px;
  }
  .rotate-card p{
    margin:0;
    color:var(--muted);
    line-height:1.45;
  }
}

@media (max-width:760px){
  body{overflow:auto}
  #app{height:100svh}
  .masthead{padding-top:14px}
  .victims-panel{top:10px;right:10px;width:calc(100% - 20px)}
  .victims-panel.collapsed{width:103px}
  .counter-grid{grid-template-columns:1fr}
  .counter.total{grid-column:auto}
  .record-card{bottom:64px}
  .sources-button{left:10px;top:10px}
}

