/* ============================================================
   Indicator detail: head sub-line, layout, formula hero, definition, variables,
   "In cities", profile list, pick-a-city modal. Also .back-link (the city header uses it).
   ============================================================ */

.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink-dim); font-size: 13px; font-weight: 700; margin-bottom: 18px;
  transition: color var(--t-fast);
}
.back-link:hover { color: var(--accent); }

/* head: code tag (status dot) + the other-language name */
.det-sub { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.det-alt { font-size: 15px; color: var(--ink-dim); }
.det-screen .page-head { margin-bottom: var(--s-6); }
.det-screen .page-head.long-title .ph-title { font-size: clamp(24px, 2.3vw, 30px); }   /* official SDG names run to 3+ lines */

/* ---------- layout: main column + side column ---------- */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s-6) var(--s-5); align-items: start; }
.det-main, .det-side { display: flex; flex-direction: column; min-width: 0; }
.det-main { gap: var(--s-7); }
.det-side { gap: var(--s-5); }

.det-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: var(--s-4); }
.det-h2 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: 800; color: var(--ink-hi); }

/* ---------- formula: the hero ---------- */
.formula-hero {
  padding: var(--s-5) var(--s-6) var(--s-6);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 62%),
    var(--surface);
}
.fh-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.fh-title { font-size: var(--fs-eyebrow); font-weight: 700; color: var(--accent); }
html[lang="en"] .fh-title { letter-spacing: 0.12em; text-transform: uppercase; font-size: 11.5px; }
.fh-unit { display: inline-flex; gap: 6px; font-size: 13px; color: var(--ink-dim); }
.fh-unit b { color: var(--ink-hi); font-weight: 700; }

.formula-eq {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  flex-wrap: wrap; direction: ltr;
  min-height: 150px; padding: var(--s-6) 0 var(--s-5);
  overflow-x: auto;
}
/* Arabic mathematical reading order: the fraction first (right), then × 100 */
html[lang="ar"] .formula-eq { direction: rtl; }
.fr-frac { display: inline-flex; flex-direction: column; align-items: stretch; }
.fr-frac .fr-top, .fr-frac .fr-bot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; text-align: center; }
.fr-frac .fr-top { border-bottom: 2px solid var(--accent); }
.fr-var {
  display: inline-block; padding: 9px 18px; border-radius: 12px;
  background: var(--bg-soft); color: var(--ink-hi);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  font-size: 17px; font-weight: 700; line-height: 1.5;
  box-shadow: var(--card-rim);
}
.fr-var.total { border-style: dashed; }
.fr-op { color: var(--accent); font-family: var(--f-num); font-weight: 500; font-size: 24px; line-height: 1; }
.fr-num { color: var(--ink-hi); font-size: var(--fs-num-m); font-weight: 650; }

.fh-desc {
  max-width: 62ch; margin: 0 auto; text-align: center;
  font-size: 15px; line-height: 1.85; color: var(--ink); text-wrap: pretty;
}
.fh-assum { margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--line); }
.fh-assum h3 { font-size: 13px; font-weight: 700; color: var(--ink-dim); margin-bottom: 6px; }
.fh-assum ul { margin: 0; padding-inline-start: 18px; font-size: 13.5px; line-height: 1.8; color: var(--ink-dim); text-align: start; }

.fh-none { display: flex; gap: 12px; align-items: baseline; padding: var(--s-5) 0 var(--s-2); }
.fh-none-title { font-weight: 800; color: var(--ink-hi); margin-bottom: 4px; }
.fh-none p { color: var(--ink-dim); max-width: 64ch; line-height: 1.8; }

/* ---------- definition: body text ---------- */
.det-def-text { font-size: 16px; line-height: 1.9; color: var(--ink); max-width: 70ch; text-wrap: pretty; }
html[lang="en"] .det-def-text, .det-def-text[lang="en"] { line-height: 1.7; }
.det-def-alt { margin-top: var(--s-3); max-width: 80ch; font-size: 13.5px; line-height: 1.65; color: var(--ink-dim); text-align: start; }

/* ---------- variables table ---------- */
.det-vars .tbl td.key div { line-height: 1.5; }
.var-id { display: block; margin-top: 2px; font-family: var(--f-mono); font-size: 11.5px; font-weight: 500; color: var(--ink-faint); text-align: start; }

/* ---------- in cities ---------- */
.det-cities { padding: var(--s-5); }
.det-cities .card-head { margin-bottom: var(--s-2); }
.dc-none { color: var(--ink-dim); font-size: 14px; line-height: 1.8; }
.dc-list { list-style: none; margin: 0; padding: 0; }
.dc-row { padding: var(--s-4) 0; border-top: 1px solid var(--line); }
.dc-row:first-child { border-top: none; }
.dc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.dc-name { font-size: 15px; font-weight: 800; color: var(--ink-hi); }
.dc-name:hover { color: var(--accent); }
.dc-period { font-size: 12.5px; color: var(--ink-dim); }
.dc-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 6px; }
.dc-figure { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dc-val .num { font-size: var(--fs-num-l); font-weight: 650; line-height: 1.15; color: var(--ink-hi); letter-spacing: -0.02em; }
.dc-figure .delta-badge { align-self: flex-start; }
.dc-spark { flex: none; padding-bottom: 4px; }
.dc-spark svg { display: block; }
.dc-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: var(--s-3); }
.dc-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--accent); }
.dc-link .ico { width: 15px; height: 15px; }
.dc-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.dc-wait { margin-top: 6px; font-size: 13.5px; color: var(--ink-dim); line-height: 1.7; }
.dc-row.waiting .dc-link { margin-top: 6px; }

/* ---------- profile: a quiet definition list ---------- */
.det-profile { padding: var(--s-4) var(--s-5); border-radius: var(--radius); background: var(--bg-soft); border: 1px solid var(--line); }
.dp-title { font-size: 13px; font-weight: 700; color: var(--ink-dim); margin-bottom: 4px; }
.det-profile dl { margin: 0; }
.dp-item { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; line-height: 1.6; }
.dp-item:first-child { border-top: none; }
.dp-item dt { color: var(--ink-dim); font-weight: 500; }
.dp-item dd { margin: 0; color: var(--ink-hi); font-weight: 600; }
.dp-item dd a { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); }
.dp-item dd a .ico { width: 14px; height: 14px; }
.dp-item dd a:hover { text-decoration: underline; }

/* ---------- pick a city (modal) ---------- */
.pick-city { display: flex; flex-direction: column; gap: 8px; }
.pick-city-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  padding: 14px 16px; text-align: start;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.pick-city-row:not(:disabled):hover { border-color: var(--accent); background: var(--surface-2); }
.pick-city-row:disabled { cursor: default; }
.pc-name { font-weight: 700; color: var(--ink-hi); }
.pc-meta { font-size: 12.5px; color: var(--ink-dim); margin-top: 2px; }
.pc-add { display: inline-grid; place-content: center; width: 32px; height: 32px; border-radius: 50%; color: var(--accent); background: var(--accent-soft); }

/* ---------- small screens: one column, the city panel right after the formula ---------- */
@media (max-width: 1100px) {
  .detail-layout { display: flex; flex-direction: column; align-items: stretch; gap: var(--s-6); }
  .det-main, .det-side { display: contents; }
  .formula-hero { order: 1; }
  .det-cities { order: 2; }
  .det-def { order: 3; }
  .det-vars { order: 4; }
  .det-disagg { order: 5; }
  .det-profile { order: 6; }
}
@media (max-width: 760px) {
  .formula-hero { padding: var(--s-4) var(--s-4) var(--s-5); }
  .formula-eq { gap: 12px; min-height: 0; padding: var(--s-5) 0 var(--s-4); }
  .fr-var { font-size: 15px; padding: 7px 12px; }
  .fr-frac .fr-top, .fr-frac .fr-bot { padding: 8px 6px; }
  .fr-frac { max-width: calc(100% - 92px); }   /* leaves room for "× 100" on the same line; the pills wrap */
  .det-def-text { font-size: 15.5px; }
  .det-alt { font-size: 14px; }
}
