/* Data-journalism kit for the research pages (first used by /research/india-ai-visibility).
   Loaded only by the pages that use it, so styles.css?v= never moves for it. Uses the tokens in styles.css.
   The charts are inline SVG written by fulfilment/research/india-ai-visibility/page.mjs; their engine
   colours were validated together (dataviz validator, white surface) and live in that script. */

.ra { --ra-gap: clamp(64px, 9vw, 112px); }
.ra p { max-width: 68ch; }
/* Paragraph rhythm at zero specificity, so every component's own margin still wins. */
:where(.ra) p { margin: 0 0 14px; }
:where(.ra) p:last-child { margin-bottom: 0; }
/* No single word left on a last line: headings balance, body copy wraps "pretty". */
.ra h1, .ra h2, .ra h3 { text-wrap: balance; }
.ra p, .ra figcaption, .ra li { text-wrap: pretty; }
.nw { white-space: nowrap; }
.ra h2 { margin: 0 0 16px; max-width: 22ch; }
.ra-section { padding: var(--ra-gap) 0 0; }
.ra-section > .container > p { font-size: 17px; line-height: 1.6; color: var(--color-graphite); }
.ra-sub { font-size: 18px; line-height: 1.55; color: var(--color-graphite); margin: 0 0 28px; }
.ra-note { font-size: 14px; line-height: 1.55; color: var(--color-muted-text); margin: 14px 0 0; }

/* ---------- Hero: the headline as a figure ---------- */
.ra-hero { padding: 72px 0 56px; background: var(--color-canvas-bone); }
.ra-hero-inner { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.ra-crumbs { font-size: 14px; color: var(--color-muted-text); margin: 0 0 22px; }
.ra-crumbs a { color: var(--color-graphite); text-decoration: underline; text-underline-offset: 3px; }
.ra-hero h1 { font-size: clamp(34px, 4.6vw, 54px); max-width: 15ch; margin: 0 0 28px; }
.ra-figure { display: flex; align-items: baseline; gap: 14px; margin: 0; font-family: var(--font-display); color: var(--color-ink-black); line-height: 0.9; }
.ra-figure-num { font-size: clamp(96px, 13vw, 168px); letter-spacing: -0.045em; }
.ra-figure-of { font-size: clamp(28px, 3.4vw, 40px); color: var(--color-muted-text-strong); letter-spacing: -0.02em; }
.ra-figure-cap { font-size: 19px; line-height: 1.45; max-width: 30ch !important; margin: 14px 0 0; color: var(--color-ink-black); }
.ra-byline { font-size: 14px; color: var(--color-muted-text); margin: 28px 0 0; }
.ra-hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin: 22px 0 0 !important; }
.ra-textlink { font-size: 15px; font-weight: 500; color: var(--color-ink-black); text-decoration: underline; text-underline-offset: 3px; }
.ra-byline a { color: var(--color-graphite); text-decoration: underline; text-underline-offset: 3px; }

/* The grid card sits over the street: the street's threads rise up and tuck in under the card. */
.ra-hero-viz { display: flex; flex-direction: column; }
.hero-grid { position: relative; z-index: 1; margin: 0; padding: clamp(18px, 2.4vw, 30px); background: var(--color-card-white); border: 1px solid var(--color-soft-border); border-radius: var(--radius-large-cards); }
/* The pull scales with the column (a margin % reads the column's width), so the same share of the art's
   sky tucks under the card at every desktop width: about half its height. */
.ra-hero-art { margin: -17% 0 0; }
.ra-hero-art img { display: block; width: 100%; height: auto; }
.hero-grid svg { display: block; width: 100%; height: auto; }
/* Named by none: the headline, so solid. Named by at least one: lit like the street's open shops, and quiet. */
.hero-mark.is-unnamed { fill: var(--color-ink-black); }
.hero-mark.is-named { fill: var(--color-lime-wash); stroke: var(--color-lime-ui); stroke-width: 1.25; }
.hero-grid-key { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 18px; font-size: 14px; color: var(--color-graphite); }
.hero-grid-key span { display: inline-flex; align-items: center; gap: 8px; }
.hero-grid-key .is-lead { color: var(--color-ink-black); font-weight: 600; }
.key-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.key-dot.is-unnamed { background: var(--color-ink-black); }
.key-dot.is-named { background: var(--color-lime-wash); border: 1.25px solid var(--color-lime-ui); }
/* The one orchestrated moment: the unnamed marks arrive in order, so the eye counts them, not the rest. */
@media (prefers-reduced-motion: no-preference) {
  .hero-mark.is-unnamed { animation: ra-mark .5s var(--ease-spring) both; animation-delay: calc(var(--i) * 10ms + 200ms); transform-box: fill-box; transform-origin: center; }
  @keyframes ra-mark { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: scale(1); } }
}

/* ---------- Method strip ---------- */
.ra-strip-band { background: var(--color-ink-black); color: #ffffff; padding: 30px 0; }
.ra-strip { display: grid; grid-template-columns: repeat(6, 1fr); margin: 0; }
.ra-strip > div { padding: 4px 20px; border-left: 1px solid rgba(255, 255, 255, .18); display: flex; flex-direction: column-reverse; gap: 6px; }
.ra-strip > div:first-child { border-left: 0; padding-left: 0; }
.ra-strip dt { font-size: 14px; line-height: 1.3; color: #cfcfcc; }
.ra-strip dd { margin: 0; font-family: var(--font-display); font-size: clamp(32px, 3.6vw, 44px); line-height: 1; letter-spacing: -0.02em; }
.ra-strip-date { margin: 18px 0 0; font-size: 14px; color: #cfcfcc; }

/* ---------- Intro ---------- */
.ra-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(28px, 5vw, 64px); align-items: center; }
.ra-lede { font-size: 19px !important; line-height: 1.6 !important; color: var(--color-ink-black) !important; margin: 0 0 18px; }
.ra-pull { margin: 22px 0 0; padding: 0 0 0 20px; border-left: 4px solid var(--color-lime-edge); font-family: var(--font-display); font-size: clamp(21px, 2.2vw, 26px); line-height: 1.3; color: var(--color-ink-black); max-width: 30ch; }
.ra-illo { margin: 0; }
.ra-illo img { display: block; width: 100%; }

/* ---------- Key findings ---------- */
.kf-grid { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kf-card { background: var(--color-card-white); border: 1px solid var(--color-soft-border); border-radius: var(--radius-cards); padding: 24px 22px 22px; display: flex; flex-direction: column; gap: 12px; }
.kf-fig { margin: 0; font-family: var(--font-display); font-size: clamp(44px, 4.4vw, 58px); line-height: 1; letter-spacing: -0.03em; color: var(--color-ink-black); }
.kf-fig span { font-size: .42em; letter-spacing: -0.01em; color: var(--color-muted-text-strong); }
.kf-text { margin: 0; font-size: 16px; line-height: 1.45; color: var(--color-graphite); }
.kf-dark { background: var(--color-ink-black); border-color: var(--color-ink-black); }
.kf-dark .kf-fig { color: var(--color-lime-edge); }
.kf-dark .kf-fig span { color: #cfcfcc; }
.kf-dark .kf-text { color: #ffffff; }
.ra-method-note { font-size: 14px !important; color: var(--color-muted-text) !important; margin: 16px 0 0; }

/* ---------- A chart section ---------- */
.ra-chart-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr); gap: clamp(24px, 4vw, 56px); align-items: center; margin-bottom: 28px; }
.ra-chart-head img { display: block; width: 100%; }
p + .ra-card { margin-top: 24px; }
.ra-card + p, .ra-card + .ra-note { margin-top: 24px !important; }
.ra-card { background: var(--color-card-white); border: 1px solid var(--color-soft-border); border-radius: var(--radius-large-cards); padding: clamp(20px, 3vw, 36px); }

.viz-legend { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--color-graphite); margin: 0 0 22px; max-width: none !important; }
.viz-legend svg { flex: none; }
.viz-panels { display: grid; gap: 28px clamp(24px, 3vw, 44px); }
.viz-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Four engines go two by two: four across shrinks the panel text below a readable size. */
.viz-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 40px; }
.viz-panel { margin: 0; min-width: 0; }
.viz-panel-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 0 0 12px; margin: 0 0 6px; border-bottom: 1px solid var(--color-soft-border); }
.viz-key { width: 12px; height: 12px; border-radius: 3px; background: var(--c); align-self: center; }
.viz-panel-title { font-family: var(--font-display); font-size: 21px; line-height: 1.2; color: var(--color-ink-black); }
.viz-panel-n { flex-basis: 100%; font-size: 13px; line-height: 1.4; color: var(--color-muted-text); }
.viz-svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-text); }
.viz-grid { stroke: var(--color-soft-border); stroke-width: 1; }
.viz-rule { stroke: var(--color-hairline); stroke-width: 1; }
.viz-tick { font-size: 11px; fill: var(--color-muted-text); font-variant-numeric: tabular-nums; }
.viz-label { font-size: 14px; fill: var(--color-ink-black); }
.viz-label-strong { font-weight: 700; }
.viz-sublabel { font-size: 12.5px; fill: var(--color-graphite); }
.viz-value { font-size: 13px; fill: var(--color-graphite); font-variant-numeric: tabular-nums; }
/* Hover shows a row's full figure (its <title>); keyboard and screen-reader readers get every value
   from the table under each chart, so the rows are not focus stops. */
.viz-row:hover rect { fill-opacity: .3; }

.viz-table { margin: 26px 0 0; }
.viz-table summary { cursor: pointer; font-size: 15px; font-weight: 500; color: var(--color-ink-black); text-decoration: underline; text-underline-offset: 3px; display: inline-block; padding: 6px 0; }
.viz-table-scroll { overflow-x: auto; margin-top: 12px; }
.viz-table table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
.viz-table caption { text-align: left; font-size: 13px; color: var(--color-muted-text); padding: 0 0 10px; caption-side: top; }
.viz-table th, .viz-table td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--color-soft-border); vertical-align: top; }
.viz-table thead th { font-weight: 700; color: var(--color-ink-black); border-bottom-color: var(--color-hairline); }
.viz-table tbody th { font-weight: 500; }

/* ---------- The websites waffles ---------- */
/* Two matched cards across the full width. The grids share a square size (page.mjs), so the 83 card's
   shorter grid is the data, and each card's key sits on the same baseline at the bottom. */
.waffles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(16px, 2vw, 24px); margin: 12px 0 32px; }
.waffle { margin: 0; display: flex; flex-direction: column; background: var(--color-card-white); border: 1px solid var(--color-soft-border); border-radius: var(--radius-large-cards); padding: clamp(22px, 3vw, 36px); }
.waffle figcaption { font-size: 16px; line-height: 1.45; color: var(--color-graphite); margin: 0 0 22px; max-width: 40ch; }
.waffle-engine { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--color-ink-black); margin-bottom: 14px; }
.waffle-big { display: block; font-family: var(--font-display); font-size: clamp(48px, 5vw, 72px); line-height: 1; letter-spacing: -0.03em; color: var(--color-ink-black); margin-bottom: 8px; }
.waffle figcaption strong { color: var(--color-ink-black); }
.waffle svg { display: block; width: 100%; height: auto; }
.waffle-key { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: auto 0 0 !important; padding-top: 22px; font-size: 13px; color: var(--color-muted-text); max-width: none !important; }
.waffle-key span { display: inline-flex; align-items: center; gap: 7px; }
.waffle-key .waffle-unit { margin-left: auto; }
.waffle-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 2px; background: var(--color-soft-border); }
.waffle-swatch.is-hit { background: var(--c); }
.ra-websites-close { font-size: 19px !important; line-height: 1.5 !important; color: var(--color-ink-black) !important; }
.waffle-cell { fill: var(--color-soft-border); }

/* ---------- Callout ---------- */
.ra-callout { margin: 28px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 28px; align-items: center; background: var(--tint-peach); border-radius: var(--radius-cards); padding: 24px 28px; }
.ra-callout p { margin: 0; font-size: 16px; line-height: 1.55; color: var(--color-graphite); }
.ra-callout .ra-callout-fig { font-family: var(--font-display); font-size: clamp(40px, 4vw, 52px); line-height: 1; letter-spacing: -0.03em; color: var(--color-ink-black) !important; white-space: nowrap; }

/* ---------- What this is not ---------- */
.ra-limits-band { margin-top: var(--ra-gap); background: var(--tint-sky); padding: var(--ra-gap) 0; }
.ra-limits { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ra-limits li { background: var(--color-card-white); border-radius: var(--radius-cards); padding: 22px 24px; }
.ra-limits h3 { font-size: 21px; margin: 0 0 8px; }
.ra-limits p { margin: 0; font-size: 16px; line-height: 1.55; color: var(--color-graphite); }

/* ---------- Use this ---------- */
.ra-use { display: grid; grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr); gap: clamp(24px, 5vw, 64px); align-items: center; }
.ra-use img { display: block; width: 100%; max-width: 360px; margin: 0 auto; }
.ra-use p { font-size: 17px; line-height: 1.6; color: var(--color-graphite); }
.ra-download { display: inline-flex; align-items: center; gap: 10px; margin: 6px 0 18px; }
.ra-download small { font-size: 13px; color: var(--color-muted-text); font-weight: 400; }
.ra-use .ra-licence { padding: 14px 18px; background: var(--color-lime-wash); border-radius: var(--radius-cards); color: var(--color-ink-black); }
.ra-licence a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Method, collapsed ---------- */
.ra-method { margin-top: 24px; border-top: 1px solid var(--color-hairline); }
.ra-method details { border-bottom: 1px solid var(--color-hairline); }
.ra-method summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 0; font-family: var(--font-display); font-size: 22px; line-height: 1.25; color: var(--color-ink-black); }
.ra-method summary::-webkit-details-marker { display: none; }
.ra-method summary::after { content: "+"; font-family: var(--font-text); font-size: 26px; line-height: 1; color: var(--color-graphite); }
.ra-method details[open] summary::after { content: "\2212"; }
.ra-method .ra-method-body { padding: 0 0 24px; }
.ra-method p, .ra-method li { font-size: 16px; line-height: 1.6; color: var(--color-graphite); }
.ra-method ul { padding-left: 20px; max-width: 72ch; }
.ra-method li { margin: 0 0 10px; }
.ra-method a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Close ---------- */
.ra-close { margin: var(--ra-gap) 0 0; padding: var(--ra-gap) 0; background: var(--color-lime-wash); }
.ra-close-inner { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.6fr); gap: 32px; align-items: center; }
.ra-close p { font-size: 18px; line-height: 1.55; color: var(--color-ink-black); }
.ra-close .ra-small { font-size: 14px; color: var(--color-graphite); }
.ra-close img { display: block; width: 100%; max-width: 240px; margin-left: auto; }

/* ---------- Narrower screens ---------- */
@media (max-width: 1080px) {
  .kf-grid { grid-template-columns: repeat(2, 1fr); }
  .ra-strip { grid-template-columns: repeat(3, 1fr); row-gap: 22px; }
  .ra-strip > div:nth-child(4) { border-left: 0; padding-left: 0; }
}
@media (max-width: 860px) {
  /* One column: the street opens the page, and the grid follows the 118 straight away, ahead of the
     byline and links, so the figure and its grid share the first screen. */
  .ra-hero { padding-top: 0; overflow-x: clip; }
  .ra-hero-inner { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
  .ra-hero-text, .ra-hero-viz { display: contents; }
  /* Full bleed whatever the container's gutter; the art is decorative (alt=""), so showing it first
     changes no reading order. */
  .ra-hero-art { order: -1; margin: 0 calc(50% - 50vw) 20px; }
  .ra-hero-art img { width: 100%; height: auto; }
  .hero-grid { order: 1; margin-top: 22px; }
  .ra-byline { order: 2; }
  .ra-hero-links { order: 2; }
  .ra-intro, .ra-chart-head, .ra-use, .ra-close-inner { grid-template-columns: 1fr; }
  .viz-3 { grid-template-columns: 1fr; gap: 36px; }
  .ra-limits { grid-template-columns: 1fr; }
  .ra-close img { margin: 0; max-width: 180px; }
}
@media (max-width: 600px) {
  .viz-4 { grid-template-columns: 1fr; gap: 36px; }
  .kf-grid { grid-template-columns: 1fr; }
  .waffles { grid-template-columns: 1fr; }
  .waffle-key .waffle-unit { margin-left: 0; flex-basis: 100%; }
  .ra-strip { grid-template-columns: repeat(2, 1fr); }
  .ra-strip > div { padding: 2px 0 2px 16px; }
  .ra-strip > div:nth-child(odd) { border-left: 0; padding-left: 0; }
  .ra-strip > div:nth-child(4) { border-left: 1px solid rgba(255, 255, 255, .18); padding-left: 16px; }
  .ra-callout { grid-template-columns: 1fr; }
  .ra-hero h1 { margin-bottom: 20px; }
}
