/*
 * The Vizag AI hub story (/stories/making-way-for-ai-in-vizag/): the locator,
 * before-and-after maps, timelines, land-cover bars and trade graphic. Page
 * rhythm comes from story-system.css and the figure frame from
 * chart-system.css; this file owns what the story's own figures draw.
 * vizag-ai-hub-story.js reads the colour tokens below for the map layers, so
 * they keep one owner.
 */
.vizag-ai-hub-story {
  /* Map overlays sit on Sentinel-2 imagery, so they use saturated colours that
   * stay visible on red earth and dark canopy. The figure notes name them:
   * orange cleared outlines, white filed boundaries, a dotted yellow site. */
  --vizag-cleared: #ff6a3d;
  --vizag-cleared-halo: #2a0d02;
  --vizag-boundary: #ffffff;
  --vizag-whole-site: #ffd84d;
  --vizag-overlay-halo: #11181b;
  --vizag-imagery-surface: var(--basalt-deep);
  /* Everything drawn on paper uses the publication palette. */
  --vizag-tree: var(--positive);
  --vizag-grassland: var(--brass);
  --vizag-cropland: var(--warning);
  --vizag-other-land: var(--e20-slate);
  --vizag-uses: var(--basalt);
  --vizag-uses-recycled: var(--mist);
  --vizag-builds: var(--info);
  --vizag-official: var(--basalt);
  --vizag-satellite: var(--warning);
  --vizag-reported: var(--e20-slate);
  --vizag-clearance: var(--negative);
  --vizag-clearance-text: var(--e20-red-text);
}

/* ---------- Figure spacing, and the caveat between a visual and its source ---------- */
/* The same 32px before and 28px after a figure as the other investigations. */
.vizag-viz {
  clear: both;
  margin-block: 32px 28px;
}

/* Matches the consumer-choice figure note (chart-system.css styles it). */
.vizag-viz__note {
  margin: 0;
  padding: 0 var(--chart-header-inline) 24px;
  color: var(--basalt);
  font-size: var(--chart-note-size);
  line-height: 1.55;
}

/* ---------- Visual downloads ----------
 * While figure-export.js builds a PNG, vizag-ai-hub-story.js lays one image
 * over each map, the locator and the timelines, redrawing what the shared
 * exporter cannot. The HTML that image replaces is hidden until it finishes;
 * unchecked map layers and checkboxes stay out of the download. */
.vizag-export-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.vizag-viz--exporting :is(.vizag-compare__stage, .vizag-locator) > :not(.vizag-export-layer),
.vizag-viz--exporting :is(.vizag-timeline__marker, .vizag-timeline__stem, .visually-hidden) {
  visibility: hidden;
}

.vizag-viz--exporting .vizag-compare__layer input,
.vizag-viz--exporting .vizag-compare__layer:has(input:not(:checked)) {
  display: none;
}

/* figure-export.js draws each word with a canvas font at the position the
 * page laid it out, so the page must lay text out as the canvas draws it.
 * - The canvas font comes from the CSS font shorthand, which cannot carry
 *   tabular numerals; a shorthand with them is ignored.
 * - The canvas has no letter-spacing, so the titles' negative tracking
 *   would squeeze the spaces between words.
 * - The canvas always draws the system font's text cut; at title sizes the
 *   page switches to the narrower display cut, and each canvas word would
 *   overrun the next. "opsz" 17 holds the page to the text cut.
 * The double class outranks the figures' own rules below. */
.vizag-viz.vizag-viz--exporting * {
  font-variant-numeric: normal;
  font-variation-settings: "opsz" 17;
  letter-spacing: normal;
}

/* chart-system.css sets the title tracking with a more specific selector. */
.vizag-ai-hub-story .vizag-viz.vizag-viz--exporting > .e20-viz__header h3 {
  letter-spacing: normal;
}

/* ---------- Site insets: “Site 1 of 3” beside each site's opening ---------- */
.vizag-site-inset {
  float: right;
  width: 150px;
  margin: 6px 0 16px 28px;
}

.vizag-site-inset figcaption {
  margin-top: 6px;
  color: var(--graphite);
  font-size: var(--article-type-supporting);
  line-height: 1.35;
  text-align: center;
}

/* ---------- Locator: numbered sites on a Sentinel-2 mosaic ---------- */
.vizag-locator {
  position: relative;
  overflow: hidden;
  background: var(--vizag-imagery-surface);
  container-type: inline-size;
}

.vizag-locator img {
  width: 100%;
  height: auto;
}

.vizag-locator__pin,
.vizag-locator__label,
.vizag-locator__city,
.vizag-locator__sea {
  position: absolute;
  top: var(--y);
  left: var(--x);
}

.vizag-locator__pin {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--vizag-cleared);
  color: var(--white);
  font: 700 13px/1 var(--font-sans);
  box-shadow: 0 0 0 2.5px var(--white), 0 2px 6px rgb(0 0 0 / 45%);
  transform: translate(-50%, -50%);
}

.vizag-locator__label {
  padding: 3px 7px 4px;
  background: rgb(17 24 27 / 80%);
  color: var(--white);
  font: 600 13px/1.25 var(--font-sans);
  white-space: nowrap;
  transform: translate(18px, -50%);
}

.vizag-locator__label small {
  display: block;
  color: var(--limestone);
  font-size: 12px;
  font-weight: 400;
}

.vizag-locator__label--start {
  text-align: right;
  transform: translate(calc(-100% - 18px), -50%);
}

.vizag-locator__city {
  color: var(--white);
  font: 600 13px/1.2 var(--font-sans);
  text-shadow: 0 1px 3px #000000, 0 0 8px rgb(0 0 0 / 67%);
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.vizag-locator__city::before {
  content: "";
  display: block;
  width: 7px;
  height: 7px;
  margin: 0 auto 4px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 0 0 2px rgb(0 0 0 / 55%);
}

.vizag-locator__sea {
  color: #c9d9e3;
  font: italic 400 14px/1.2 var(--font-sans);
  letter-spacing: 0.1em;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

/* The scale bar sits over open sea, clear of the Rambilli pin on small screens. */
.vizag-locator__scale {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: var(--scale-width);
  color: var(--white);
  font: 600 12px/1 var(--font-sans);
  text-shadow: 0 1px 2px #000000;
}

.vizag-locator__scale::before {
  content: "";
  display: block;
  height: 5px;
  margin-bottom: 4px;
  border: 2px solid var(--white);
  border-top: 0;
  box-shadow: 0 1px 2px rgb(0 0 0 / 55%);
}

.vizag-locator__north {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 28px;
  height: 34px;
  place-items: center;
  color: var(--white);
  font: 700 12px/1 var(--font-sans);
  text-shadow: 0 1px 2px #000000;
}

.vizag-locator__north::before {
  content: "";
  margin-bottom: 3px;
  border: 6px solid transparent;
  border-top: 0;
  border-bottom: 11px solid var(--white);
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 60%));
}

@container (max-width: 520px) {
  .vizag-locator__label {
    padding: 2px 6px 3px;
    font-size: 12px;
  }

  .vizag-locator__sea {
    font-size: 12px;
  }
}

.vizag-locator--inset .vizag-locator__pin {
  width: 9px;
  height: 9px;
  background: var(--white);
  box-shadow: 0 0 0 1.5px rgb(29 35 38 / 67%);
}

.vizag-locator--inset .vizag-locator__pin--active {
  width: 13px;
  height: 13px;
  background: var(--vizag-cleared);
  box-shadow: 0 0 0 1.5px var(--white);
}

.vizag-locator--inset .vizag-locator__city {
  font-size: 12px;
}

.vizag-locator--inset .vizag-locator__city::before {
  width: 4px;
  height: 4px;
  margin-bottom: 2px;
}

/* ---------- Before-and-after maps ---------- */
.vizag-compare {
  font-family: var(--font-sans);
}

.vizag-compare__still {
  width: 100%;
  height: auto;
}

.vizag-compare__dates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
  color: var(--graphite);
  font-size: var(--chart-label-size);
}

.vizag-compare__date-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vizag-compare__date {
  display: flex;
  min-height: 44px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--ink);
  font-size: var(--article-type-supporting);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}

.vizag-compare__date small {
  color: var(--vizag-clearance-text);
  font-size: var(--article-type-meta);
  font-weight: 500;
}

.vizag-compare__date[aria-checked="true"] {
  border-color: var(--basalt);
  background: var(--basalt);
  color: var(--white);
}

.vizag-compare__date[aria-checked="true"] small {
  color: var(--limestone);
}

.vizag-compare__stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--vizag-imagery-surface);
  /* Pages keep scrolling over the map; MapLibre's cooperative gestures ask
   * for two fingers, or a modifier key with the wheel, to move it. */
  touch-action: pan-y;
}

.vizag-compare__map {
  position: absolute;
  inset: 0;
}

.vizag-compare__map--after {
  clip-path: inset(0 0 0 50%);
}

.vizag-compare__map .maplibregl-canvas:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: -2px;
}

.vizag-compare .maplibregl-cooperative-gesture-screen {
  font-family: var(--font-sans);
  font-size: 16px;
}

/* MapLibre draws its attribution (i) button at 24 px; an invisible margin
 * makes the touch target 44 px without changing how it looks. */
.vizag-compare .maplibregl-ctrl-attrib-button::after {
  content: "";
  position: absolute;
  inset: -10px;
}

.vizag-compare__tag {
  position: absolute;
  top: 10px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 9px 7px;
  background: rgb(29 35 38 / 85%);
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  pointer-events: none;
}

.vizag-compare__tag span {
  color: var(--limestone);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.vizag-compare__tag--before {
  left: 10px;
}

.vizag-compare__tag--after {
  right: 10px;
  align-items: flex-end;
  text-align: right;
}

.vizag-compare__divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 5;
  width: 44px;
  margin-left: -22px;
  cursor: ew-resize;
  touch-action: none;
}

.vizag-compare__divider:focus-visible {
  outline: none;
}

.vizag-compare__divider-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 21px;
  width: 2px;
  background: var(--white);
  box-shadow: 0 0 0 1px rgb(0 0 0 / 18%);
}

.vizag-compare__knob {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  place-items: center;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 8px rgb(0 0 0 / 30%);
}

.vizag-compare__divider:focus-visible .vizag-compare__knob {
  outline: 3px solid var(--info);
  outline-offset: 2px;
}

.vizag-compare__icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.vizag-compare__knob .vizag-compare__icon {
  color: var(--basalt);
}

.vizag-compare__tools {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  background: var(--white);
}

.vizag-compare__tool {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-bottom: 1px solid var(--limestone);
  background: var(--white);
  color: var(--basalt);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.vizag-compare__tool:last-child {
  border-bottom: 0;
}

.vizag-compare__tool:hover {
  background: var(--pearl-warm);
}

.vizag-compare__tool[aria-pressed="true"] {
  background: var(--basalt);
  color: var(--white);
}

.vizag-compare__message {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 7;
  max-width: 70%;
  padding: 6px 10px;
  background: rgb(255 255 255 / 94%);
  color: var(--graphite);
  font-size: 13px;
}

.vizag-compare__layers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 20px;
  padding-top: 6px;
  color: var(--graphite);
  font-size: var(--chart-label-size);
}

.vizag-compare__layer {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.vizag-compare__layer input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--basalt);
}

.vizag-compare__swatch {
  display: inline-block;
  width: 22px;
  flex: none;
}

.vizag-compare__swatch--boundary {
  border-top: 2px solid var(--basalt);
}

.vizag-compare__swatch--cleared {
  border-top: 3px solid var(--vizag-cleared);
}

.vizag-compare__swatch--sharper {
  height: 10px;
  background: repeating-linear-gradient(45deg, #6f8a5a 0 3px, #4b6340 3px 6px);
}

.vizag-compare__composite {
  margin: 4px 0 0;
  color: var(--graphite);
  font-size: var(--article-type-meta);
  line-height: 1.45;
}

/* ---------- Simple timelines: one line, markers by kind of record ---------- */
.vizag-timeline {
  position: relative;
  font-family: var(--font-sans);
}

.vizag-timeline__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 0 0 6px;
  padding: 0;
  color: var(--graphite);
  font-size: var(--chart-label-size);
  line-height: 1.4;
  list-style: none;
}

.vizag-timeline__legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.vizag-timeline__marker {
  display: inline-block;
  flex: none;
  width: 11px;
  height: 11px;
}

.vizag-timeline__marker--official {
  border-radius: 50%;
  background: var(--vizag-official);
}

.vizag-timeline__marker--satellite {
  background: var(--vizag-satellite);
}

.vizag-timeline__marker--reported {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: inset 0 0 0 2.5px var(--vizag-reported);
}

.vizag-timeline__marker--clearance {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: inset 0 0 0 3px var(--vizag-clearance);
}

.vizag-timeline__track {
  position: relative;
  height: 320px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.vizag-timeline__track::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 2px;
  margin-top: -1px;
  background: var(--e20-slate);
}

.vizag-timeline__event {
  position: absolute;
  top: 50%;
  left: var(--x);
  width: 0;
  height: 0;
}

.vizag-timeline__event > .vizag-timeline__marker {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
}

.vizag-timeline__event--clearance > .vizag-timeline__marker {
  width: 19px;
  height: 19px;
  box-shadow: inset 0 0 0 3.5px var(--vizag-clearance);
}

.vizag-timeline__stem {
  position: absolute;
  left: -0.5px;
  width: 1px;
  height: 34px;
  background: var(--mist);
}

.vizag-timeline__event--above .vizag-timeline__stem {
  bottom: 8px;
}

.vizag-timeline__event--below .vizag-timeline__stem {
  top: 8px;
}

.vizag-timeline__label {
  position: absolute;
  left: 0;
  width: var(--label-width, 150px);
  line-height: 1.3;
  text-align: center;
  transform: translateX(-50%);
}

.vizag-timeline__event--above .vizag-timeline__label {
  bottom: 46px;
}

.vizag-timeline__event--below .vizag-timeline__label {
  top: 46px;
}

/* The first and last labels turn inward so they stay inside the figure. */
.vizag-timeline__event--first .vizag-timeline__label {
  width: calc(var(--label-width, 150px) * 0.6 + 14px);
  text-align: left;
  transform: translateX(-14px);
}

.vizag-timeline__event--last .vizag-timeline__label {
  width: calc(var(--label-width, 150px) * 0.6 + 14px);
  text-align: right;
  transform: translateX(calc(-100% + 14px));
}

.vizag-timeline__date {
  display: block;
  color: var(--ink);
  font-size: var(--article-type-caption);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.vizag-timeline__title {
  display: block;
  margin-top: 2px;
  color: var(--graphite);
  font-size: var(--article-type-supporting);
}

.vizag-timeline__event--clearance :is(.vizag-timeline__date, .vizag-timeline__title) {
  color: var(--vizag-clearance-text);
}

.vizag-timeline__event--clearance .vizag-timeline__title {
  font-weight: 600;
}

/* ---------- Land cover of the cleared acres ---------- */
.vizag-landcover {
  position: relative;
  font-family: var(--font-sans);
}

.vizag-landcover__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0 0 10px;
  padding: 0;
  color: var(--graphite);
  font-size: var(--chart-label-size);
  line-height: 1.4;
  list-style: none;
}

.vizag-landcover__legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.vizag-landcover__swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
}

.vizag-landcover svg {
  display: block;
  width: 100%;
  overflow: visible;
}

/* The script sets SVG font sizes, because the chart's margins depend on them. */
.vizag-landcover__grid {
  stroke: var(--limestone);
}

.vizag-landcover__tick {
  fill: var(--graphite);
  font-variant-numeric: tabular-nums;
}

.vizag-landcover__site,
.vizag-landcover__total {
  fill: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.vizag-landcover__value {
  fill: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.vizag-landcover__value--on-dark {
  fill: var(--white);
}

.vizag-landcover__segment:hover {
  filter: brightness(1.08);
}

.vizag-landcover__tooltip {
  position: absolute;
  z-index: 5;
  min-width: 140px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--graphite);
  font-size: var(--article-type-supporting);
  line-height: 1.35;
  pointer-events: none;
  transform: translate(-50%, -100%);
}

.vizag-landcover__tooltip strong {
  display: block;
  color: var(--ink);
  font-size: var(--article-type-caption);
  font-variant-numeric: tabular-nums;
}

/* ---------- The trade, site by site ---------- */
.vizag-trade {
  border: 1px solid var(--limestone);
  background: var(--white);
}

.vizag-trade svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--font-sans);
}

/* The script sets SVG font sizes, because the layout's line spacing depends on them. */
.vizag-trade__badge {
  fill: var(--basalt);
}

.vizag-trade__badge-number {
  fill: var(--white);
  font-weight: 700;
}

.vizag-trade__site-name {
  fill: var(--ink);
  font-weight: 700;
}

.vizag-trade__big-value {
  fill: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.vizag-trade__row-label {
  fill: var(--ink);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.vizag-trade__text {
  fill: var(--basalt);
}

.vizag-trade__muted {
  fill: var(--graphite);
}

.vizag-trade__value {
  fill: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.vizag-trade__rule {
  stroke: var(--limestone);
}

.vizag-trade__pixels {
  shape-rendering: crispEdges;
}

.vizag-trade__pixels--outside {
  fill-opacity: 0.32;
}

.vizag-trade__boundary {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.3;
  vector-effect: non-scaling-stroke;
}

.vizag-trade__boundary--whole-site {
  stroke-dasharray: 3 2.5;
  stroke-width: 1.1;
}

.vizag-trade__track {
  fill: var(--limestone);
}

.vizag-trade__scale {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.2;
}

.vizag-trade__bar--uses {
  fill: var(--vizag-uses);
}

.vizag-trade__bar--uses-recycled {
  fill: var(--vizag-uses-recycled);
}

.vizag-trade__bar--builds {
  fill: var(--vizag-builds);
}

/* ---------- ESA WorldCover classes, shared by the two land charts ---------- */
.vizag-land-class--tree {
  background: var(--vizag-tree);
  fill: var(--vizag-tree);
}

.vizag-land-class--grassland {
  background: var(--vizag-grassland);
  fill: var(--vizag-grassland);
}

.vizag-land-class--cropland {
  background: var(--vizag-cropland);
  fill: var(--vizag-cropland);
}

.vizag-land-class--other {
  background: var(--vizag-other-land);
  fill: var(--vizag-other-land);
}

/* ---------- Responsive, motion and print ---------- */
@media (max-width: 760px) {
  .vizag-viz {
    margin-block: 24px;
  }

  .vizag-viz__note {
    padding-bottom: 18px;
  }

  /* A float would squeeze the opening paragraph to a narrow column; the
   * section eyebrow and the locator above already place each site. */
  .vizag-site-inset {
    display: none;
  }

  .vizag-compare__stage {
    aspect-ratio: 4 / 3.4;
  }

  .vizag-compare__tag {
    padding: 5px 7px 6px;
    font-size: 13px;
  }

  /* Phones read the timeline down the page, one event per line. */
  .vizag-timeline__track {
    height: auto;
    padding-top: 4px;
  }

  .vizag-timeline__track::before {
    top: 6px;
    right: auto;
    bottom: 10px;
    left: 9px;
    width: 2px;
    height: auto;
    margin: 0;
  }

  .vizag-timeline__event {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    height: auto;
    padding: 0 0 14px 34px;
  }

  .vizag-timeline__event > .vizag-timeline__marker {
    top: 10px;
    left: 10px;
  }

  .vizag-timeline__stem {
    display: none;
  }

  .vizag-timeline__label,
  .vizag-timeline__event--first .vizag-timeline__label,
  .vizag-timeline__event--last .vizag-timeline__label {
    position: static;
    width: auto;
    text-align: left;
    transform: none;
  }
}

@media print {
  .vizag-compare__divider,
  .vizag-compare__tools {
    display: none;
  }
}
