/* India digital twin — control-tower map */

.tw-wrap {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 24px;
}
.tw {
  --tw-bg: rgba(11, 143, 168, 0.82);
  --tw-line: rgba(255, 255, 255, 0.09);
  --tw-text: #e3f6fa;
  --tw-mute: rgba(222, 245, 249, 0.6);
  --tw-faint: rgba(222, 245, 249, 0.4);
  position: relative;
  border-radius: 24px;
  border: 1px solid var(--tw-line);
  background: #0b8fa8;
  overflow: hidden;
  box-shadow: 0 60px 140px -50px rgba(47, 220, 255, 0.45);
  color: var(--tw-text);
  font-family: var(--font, "Source Sans 3", system-ui, sans-serif);
}

@keyframes x-ping { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); } 80%, 100% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } }

/* Placement inside the original home ontology block */
.aw-twin-head { margin: 56px 0 20px; }
.aw-ontology .tw { margin: 0 0 48px; }

/* Scene tabs */
.tw__scenes {
  display: flex;
  gap: 6px;
  padding: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--tw-line);
  background: rgba(255, 255, 255, 0.02);
}
.tw__scenes::-webkit-scrollbar { display: none; }
.tw__scenes button {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--tw-mute);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.tw__scenes button span { font: 600 13.5px/1.1 var(--font, "Source Sans 3", system-ui, sans-serif); white-space: nowrap; }
.tw__scenes button em { font: 500 10.5px/1 "IBM Plex Mono", ui-monospace, monospace; font-style: normal; letter-spacing: 0.06em; text-transform: uppercase; color: var(--tw-faint); }
.tw__scenes button:hover { color: #fff; background: rgba(255, 255, 255, 0.04); }
.tw__scenes button[aria-selected="true"] {
  color: #fff;
  background: rgba(49, 221, 255, 0.1);
  border-color: rgba(49, 221, 255, 0.35);
}
.tw__scenes button[aria-selected="true"] em { color: #7ae9ff; }

/* Stage */
.tw__stage { position: relative; height: clamp(560px, 78vh, 820px); }
.tw__map { position: absolute; inset: 0; }
.tw__map canvas { outline: none; }
.tw__map .maplibregl-ctrl-attrib { background: rgba(11, 143, 168, 0.7) !important; font-size: 10px; }
.tw__map .maplibregl-ctrl-attrib a { color: rgba(222, 245, 249, 0.6) !important; }
.tw__err { position: absolute; inset: 0; display: grid; place-items: center; color: var(--tw-mute); }

.tw__title,
.tw__legend,
.tw__panel,
.tw__bar {
  position: absolute;
  z-index: 2;
  background: var(--tw-bg);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--tw-line);
  border-radius: 16px;
}

.tw__title { top: 16px; left: 16px; max-width: min(440px, calc(100% - 32px)); padding: 16px 18px; pointer-events: none; }
.tw__badge {
  display: inline-flex; align-items: center; gap: 7px;
  font: 500 10.5px/1 "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: #34d399;
}
.tw__badge i { width: 7px; height: 7px; border-radius: 50%; background: #34d399; animation: x-ping 2s infinite; }
.tw__title h3 { margin: 10px 0 6px; font: 600 clamp(17px, 1.6vw, 21px)/1.2 var(--font, "Source Sans 3", system-ui, sans-serif); letter-spacing: -0.02em; color: #fff; }
.tw__title p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--tw-mute); }

.tw__legend {
  top: 16px; right: 372px;
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  max-width: 360px;
  padding: 10px 14px;
  font-size: 12px; color: var(--tw-mute);
}
.tw__legend span { display: inline-flex; align-items: center; gap: 7px; }
.tw__legend i { width: 10px; height: 10px; border-radius: 3px; }
.tw__legend .tw-grad { gap: 8px; }
.tw__legend .tw-grad i { width: 120px; height: 8px; border-radius: 99px; }
.tw__legend em { font-style: normal; }

/* Right control-tower panel */
.tw__panel {
  top: 16px; right: 16px; bottom: 16px;
  width: 340px;
  padding: 18px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.tw-p__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.tw-p__id { font: 500 12px/1 "IBM Plex Mono", ui-monospace, monospace; color: var(--tw-faint); }
.tw-p__status {
  padding: 6px 10px; border-radius: 999px;
  font: 600 12px/1 var(--font, "Source Sans 3", system-ui, sans-serif);
  background: rgba(49, 221, 255, 0.14); color: #7ae9ff;
}
.tw-p__status[data-state="loading"], .tw-p__status[data-state="cross-dock"] { background: rgba(251, 191, 36, 0.14); color: #fbbf24; }
.tw-p__status[data-state="delivered"], .tw-p__status[data-state="closed"] { background: rgba(52, 211, 153, 0.14); color: #34d399; }

.tw-p__stops { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 0; }
.tw-p__stops li { position: relative; display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 8px 0 14px; }
.tw-p__stops li:not(:last-child)::after {
  content: ""; position: absolute; left: 6px; top: 26px; bottom: -6px; width: 2px;
  background: rgba(255, 255, 255, 0.1);
}
.tw-p__stops li[data-state="done"]::after { background: #31ddff; }
.tw-p__stops i {
  width: 14px; height: 14px; margin-top: 2px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25); background: #0b8fa8;
}
.tw-p__stops li[data-state="done"] i { background: #31ddff; border-color: #31ddff; }
.tw-p__stops li[data-state="active"] i { border-color: #fbbf24; box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.2); }
.tw-p__stops b { display: block; font: 600 14px/1.25 var(--font, "Source Sans 3", system-ui, sans-serif); color: #fff; }
.tw-p__stops span { display: block; margin-top: 3px; font-size: 12px; color: var(--tw-faint); }
.tw-p__stops time { font: 500 11.5px/1.6 "IBM Plex Mono", ui-monospace, monospace; color: var(--tw-mute); }

.tw-p__kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.tw-p__kpis > div { padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--tw-line); }
.tw-p__kpis span { display: block; font-size: 11.5px; color: var(--tw-faint); margin-bottom: 6px; }
.tw-p__kpis b { font: 600 22px/1 var(--font, "Source Sans 3", system-ui, sans-serif); letter-spacing: -0.03em; color: #fff; font-variant-numeric: tabular-nums; }
.tw-p__kpis em { margin-left: 4px; font-style: normal; font-size: 11.5px; color: var(--tw-faint); }

.tw-p__label { margin: 0 0 8px; font: 500 10.5px/1 "IBM Plex Mono", ui-monospace, monospace; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tw-faint); }
.tw-p__text { margin: 0 0 16px; font-size: 13.5px; line-height: 1.55; color: var(--tw-mute); }
.tw-p__log { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 2px; }
.tw-p__log li {
  display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: start;
  padding: 9px 8px; border-radius: 8px;
  font-size: 12.5px; line-height: 1.4; color: var(--tw-mute);
  animation: tw-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.tw-p__log li.is-empty { grid-template-columns: 1fr; }
.tw-p__log li:first-child { background: rgba(49, 221, 255, 0.08); color: #fff; }
.tw-p__log i { width: 8px; height: 8px; margin-top: 4px; border-radius: 2px; }
.tw-p__log time { font: 500 11px/1.5 "IBM Plex Mono", ui-monospace, monospace; color: var(--tw-faint); }
@keyframes tw-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.tw-p__note { margin: 0; font-size: 11px; line-height: 1.5; color: var(--tw-faint); }

/* Timeline bar */
.tw__bar { left: 16px; right: 372px; bottom: 16px; padding: 12px 14px 10px; }
.tw__bar[hidden] { display: none; }
.tw__chapters { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.tw__chapters::-webkit-scrollbar { display: none; }
.tw__chapters button {
  flex: 0 0 auto;
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--tw-line); background: transparent;
  font: 500 12px/1 var(--font, "Source Sans 3", system-ui, sans-serif); color: var(--tw-mute);
  cursor: pointer; transition: all 0.2s ease;
}
.tw__chapters button:hover { color: #fff; border-color: rgba(255, 255, 255, 0.25); }
.tw__chapters button[aria-pressed="true"] { color: #2f3a3d; background: #7ae9ff; border-color: #7ae9ff; }
.tw__row { display: flex; align-items: center; gap: 12px; }
.tw__play {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: #fff; cursor: pointer; position: relative;
}
.tw__play::before {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 10px; height: 12px;
  border-left: 3px solid #0b8fa8; border-right: 3px solid #0b8fa8;
  box-sizing: border-box;
}
.tw__play[data-state="paused"]::before {
  width: 0; height: 0; margin-left: 14px; margin-top: 12px;
  border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent #0b8fa8;
}
.tw__track { position: relative; flex: 1; height: 24px; display: flex; align-items: center; }
.tw__track input { width: 100%; margin: 0; appearance: none; background: transparent; position: relative; z-index: 1; cursor: pointer; }
.tw__track input::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.14); }
.tw__track input::-moz-range-track { height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.14); }
.tw__track input::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #7ae9ff; box-shadow: 0 0 0 5px rgba(49, 221, 255, 0.25); }
.tw__track input::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #7ae9ff; }
.tw__stops { position: absolute; left: 8px; right: 8px; top: 50%; height: 0; pointer-events: none; }
.tw__stops i { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 3px; background: #fbbf24; transform: rotate(45deg); }
.tw__clock { flex: 0 0 auto; min-width: 48px; font: 500 14px/1 "IBM Plex Mono", ui-monospace, monospace; color: #fff; text-align: right; }
.tw__chapter { margin: 8px 0 0; font-size: 12.5px; color: var(--tw-mute); }

/* Responsive */
@media (max-width: 1100px) {
  .tw { --map-h: clamp(480px, 70vh, 680px); }
  .tw__legend { right: 16px; left: auto; top: auto; bottom: auto; top: 16px; max-width: 260px; }
  .tw__bar { right: 16px; bottom: auto; top: calc(var(--map-h) - 16px); transform: translateY(-100%); }
  .tw__panel {
    position: relative; top: auto; right: auto; bottom: auto;
    width: auto; border-radius: 0; border-width: 1px 0 0;
    max-height: none; backdrop-filter: none; background: #0b8fa8;
  }
  .tw__panel .tw-p__kpis { grid-template-columns: repeat(4, 1fr); }
  .tw__stage { display: flex; flex-direction: column; height: auto; }
  .tw__map { position: relative; inset: auto; height: var(--map-h); }
}
@media (max-width: 640px) {
  .tw { border-radius: 18px; }
  .tw-wrap { padding: 0 12px; }
  .tw__title { padding: 12px 14px; }
  .tw__title p { display: none; }
  .tw__legend { display: none; }
  .tw__panel .tw-p__kpis { grid-template-columns: 1fr 1fr; }
  .tw { --map-h: 540px; }
}
@media (prefers-reduced-motion: reduce) {
  .tw__badge i, .tw-p__log li { animation: none; }
}
