/* =====================================================================
   BAIC Iraq Homepage V2: "BAIC IN IRAQ" section (connected showroom network, design V2.1, plus service centers).
   Loaded after home-v2.css; reuses its tokens, .sec, .wrap, .sec-title and .btn. Every class is prefixed cn2-, so
   nothing here touches the rest of the homepage (the earlier .net-* rules in home-v2.css are now unused).
   Layout: desktop = large map on the left spanning the whole section; heading, filters, selected location and a light
   list on the right. Tablet = heading, map, then card + list. Phone = heading, whole-country map (optional zoom), card, list.
   Visual order: markers and the selected line > map and lines > city labels > rivers and neighbouring countries.
   Marker, label, line and light sizes are in screen pixels: JS sets --k (map units per CSS px) and the r / font-size
   attributes, so the map can scale freely.
   ===================================================================== */
/* ---------- section layout ---------- */
.cn2 { --land-bg: #eceef1; background: var(--land-bg); overflow: hidden; }
.cn2-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); grid-template-rows: auto auto 1fr;
  grid-template-areas: "map head" "map card" "map all"; gap: 0 clamp(32px, 4vw, 64px); align-items: start; }
.cn2-head { grid-area: head; }
.cn2-map { grid-area: map; min-width: 0; align-self: start; }   /* top-aligned: the whole map is in view when the section is */
.cn2-card { grid-area: card; }
.cn2-all { grid-area: all; min-width: 0; }

.cn2-eyebrow { margin-bottom: 10px; color: var(--red); font-size: 13px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.cn2-sub { margin-top: 8px; color: var(--muted); font-size: clamp(17px, 1.4vw, 20px); }
.cn2-stats { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 12px 28px; }
.cn2-stats div { display: flex; flex-direction: column-reverse; }
.cn2-stats dt { color: var(--muted); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.cn2-stats dd { color: var(--ink); font-size: 30px; font-weight: 700; line-height: 1.1; }

/* ---------- map ---------- */
/* the whole map fits the viewport below the fixed header and the section's own top padding */
.cn2-stage { position: relative; width: min(100%, calc((100vh - var(--hd-h) - var(--sec-y) - 40px) * 1.016)); min-width: min(100%, 520px); margin-inline: auto; }
.cn2-base { width: 100%; height: auto; overflow: visible; }
.cn2-fx { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.cn2-land { fill: var(--white); }
.cn2-land-halo { fill: none; stroke: #dfe2e6; stroke-width: 7px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.cn2-land-edge { fill: none; stroke: #7f8790; stroke-width: 1.4px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.cn2-grat { fill: none; stroke: #d3d7dc; stroke-width: .8px; stroke-dasharray: 1 5; vector-effect: non-scaling-stroke; }
.cn2-river { fill: none; stroke: #b5c9d8; stroke-width: 1.7px; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.cn2-base text { font-family: var(--font); }
/* geographic context: readable but secondary to the city names */
.cn2-country { fill: #aeb3b9; font-weight: 600; letter-spacing: .34em; opacity: .85; }
.cn2-river-label { fill: #8aa4b7; font-style: italic; letter-spacing: .06em; opacity: .8; }

/* connections: base line, glow under the selected one */
.cn2-link { fill: none; stroke: var(--red); stroke-width: calc(1.35px * var(--k, 1)); stroke-linecap: round; opacity: .56; transition: opacity .45s, stroke-width .45s; }
.cn2-glow { fill: none; stroke: var(--red); stroke-width: calc(7px * var(--k, 1)); stroke-linecap: round; opacity: 0; transition: opacity .45s; }
.cn2.has-hot .cn2-link { opacity: .12; }
.cn2 .cn2-link.is-hot { opacity: 1; stroke-width: calc(2.1px * var(--k, 1)); }
.cn2 .cn2-glow.is-hot { opacity: .1; }

/* light: three trail layers (long + faint to short + bright) and a head with a white core */
/* a touch brighter and wider than the line itself, so the light still reads on the emphasised (solid red) line */
.cn2-trail { fill: none; stroke: #ff3d29; stroke-linecap: round; }
.cn2-trail-1 { stroke-width: calc(2.4px * var(--k, 1)); opacity: .22; }
.cn2-trail-2 { stroke-width: calc(3.4px * var(--k, 1)); opacity: .4; }
.cn2-trail-3 { stroke-width: calc(4.4px * var(--k, 1)); opacity: .8; }
.cn2-head-glow { fill: #ff3d29; opacity: .26; }
.cn2-head-dot { fill: var(--red); }
.cn2-head-core { fill: var(--white); }

/* markers */
.cn2-node { cursor: pointer; outline: none; }
.cn2-node circle { transform-box: fill-box; transform-origin: center; }
.cn2-core { fill: #b3b8be; stroke: var(--white); stroke-width: 2px; vector-effect: non-scaling-stroke; transform: scale(.5); transition: fill .5s, transform .6s var(--ease); }
.cn2-node.is-lit .cn2-core { fill: var(--red); transform: scale(1); }
.cn2-node.is-sel .cn2-core { fill: var(--ink); }
.cn2-ring { fill: none; stroke: var(--red); stroke-width: 1.3px; vector-effect: non-scaling-stroke; opacity: 0; transform: scale(.6); transition: opacity .3s, transform .35s var(--ease); }
.cn2-node.is-hub.is-lit .cn2-ring { opacity: .5; transform: scale(1); }
.cn2-node.is-hot .cn2-ring, .cn2-node.is-sel .cn2-ring { opacity: 1; transform: scale(1); }
.cn2-halo { fill: var(--red); opacity: 0; }
.cn2-node.is-pulse .cn2-halo { animation: cn2-pulse 1.2s cubic-bezier(.2, .7, .3, 1) 1; }
.cn2.is-ambient .cn2-node.is-sel:not(.is-pulse) .cn2-halo { animation: cn2-sonar 2.8s ease-out infinite; }
.cn2.is-ambient .cn2-node.is-hub:not(.is-sel):not(.is-pulse) .cn2-halo { animation: cn2-breathe 4.5s ease-in-out infinite alternate; }
.cn2-focus { fill: none; stroke: var(--ink); stroke-width: 1.5px; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; opacity: 0; }
.cn2-node:focus-visible .cn2-focus { opacity: 1; }
.cn2-label { fill: #3f444a; font-family: var(--font); font-weight: 700; letter-spacing: .09em; paint-order: stroke; stroke: var(--white); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; opacity: 0; transition: opacity .6s, fill .2s; }
.cn2-node.is-lit .cn2-label { opacity: 1; }
.cn2.has-hot .cn2-node:not(.is-hot):not(.is-sel):not(.is-hub) .cn2-label { opacity: .45; }
.cn2-node.is-hot .cn2-label, .cn2-node.is-sel .cn2-label { fill: var(--ink); opacity: 1; }
.cn2-count { fill: var(--red); }
@keyframes cn2-pulse { from { opacity: .34; transform: scale(.3); } to { opacity: 0; transform: scale(1); } }
@keyframes cn2-sonar { 0% { opacity: .22; transform: scale(.3); } 70%, 100% { opacity: 0; transform: scale(1); } }
@keyframes cn2-breathe { from { opacity: 0; } to { opacity: .1; } }

/* tooltip and the touch chooser for markers that sit close together */
.cn2-tip { position: absolute; left: 0; top: 0; z-index: 3; padding: 8px 12px; background: var(--ink); color: var(--white); font-size: 13px; line-height: 1.35; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s; }
.cn2-tip.is-on { opacity: 1; }
.cn2-tip strong { display: block; font-size: 14px; letter-spacing: .04em; }
.cn2-tip small { color: #c8c8c8; font-size: 12px; }
.cn2-pick { position: absolute; left: 0; top: 0; z-index: 4; min-width: 210px; padding: 6px; background: var(--white); box-shadow: 0 10px 30px rgba(0, 0, 0, .16); transform: translate(-50%, 14px); }
.cn2-pick[hidden] { display: none; }
.cn2-pick p { padding: 6px 10px 4px; color: var(--muted); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.cn2-pick button { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 10px; border: 0; background: none; color: var(--ink); font-size: 15px; text-align: left; cursor: pointer; }
.cn2-pick button:hover, .cn2-pick button:focus-visible { background: var(--bg-alt); }
.cn2-pick button small { color: var(--muted); font-size: 12px; }
.cn2-note { margin-top: 8px; color: #7a7f85; font-size: 12.5px; text-align: center; }

/* labels the placer could not fit (phones only) stay hidden but measurable */
.cn2-label.is-dropped { visibility: hidden; }
/* callout leader for a label moved clear of a crowded cluster */
.cn2-leader { stroke: #5c6268; stroke-width: 1px; vector-effect: non-scaling-stroke; visibility: hidden; pointer-events: none; }
.cn2-node.is-lit .cn2-leader.is-on { visibility: visible; }
.cn2.is-zooming .cn2-leader { visibility: hidden; }

/* phone zoom (optional): the stage clips while zoomed; labels wait until the zoom settles */
.cn2-zoom { position: absolute; right: 0; top: 0; z-index: 2; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px;
  border: 1px solid #cfd3d8; background: rgba(255, 255, 255, .92); color: var(--ink); font-size: 13px; cursor: pointer; }
.cn2-zoom[hidden] { display: none; }
.cn2-zoom svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.cn2-zoom[aria-pressed="true"] .cn2-zoom-plus { display: none; }   /* magnifier + becomes magnifier − */
.cn2-zoom:hover { border-color: var(--ink); }
.cn2.is-zoomed .cn2-stage, .cn2.is-zooming .cn2-stage { overflow: hidden; }
.cn2.is-zooming .cn2-label { opacity: 0 !important; transition: none; }

/* ---------- selected showroom ---------- */
.cn2-card { margin-top: 28px; padding: 24px 26px; background: var(--white); border-left: 3px solid var(--red); box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.cn2-card-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.cn2-card h3 { margin-top: 10px; color: var(--ink); font-size: clamp(24px, 2.2vw, 32px); line-height: 1.1; }
.cn2-branch { margin-top: 4px; color: var(--text); font-size: 16px; }
.cn2-address { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink); font-size: 17px; line-height: 1.7; }
.cn2-address-alt { margin-top: 2px; color: var(--muted); font-size: 15px; line-height: 1.7; text-align: left; }   /* English mode: the Arabic address under the English one */
.cn2-actions { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cn2-nomap { color: var(--muted); font-size: 14px; }
.cn2-alt { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; color: var(--muted); font-size: 14px; }
.cn2-alt .btn-link { padding: 0; border: 0; background: none; cursor: pointer; }

/* ---------- list: light index, not a second set of cards ---------- */
.cn2-list-title { margin-top: 28px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.cn2-list { margin-top: 6px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.cn2-item { position: relative; width: 100%; min-height: 44px; display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 7px 0 7px 12px; border: 0; border-bottom: 1px solid #dcdfe3; background: none; text-align: left; cursor: pointer; }
.cn2-item::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px; background: transparent; transition: background-color .2s; }
.cn2-item strong { color: var(--ink); font-size: 14px; font-weight: 700; line-height: 1.3; transition: color .2s; }
.cn2-item small { max-width: 100%; overflow: hidden; color: var(--muted); font-size: 12.5px; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; }
.cn2-item:hover strong { color: var(--red); }
.cn2-item[aria-pressed="true"]::before { background: var(--red); }
.cn2-item[aria-pressed="true"] strong { color: var(--red); }

/* ---------- filters: All / Showrooms / Service centers (also the map legend: red dot, wrench badge) ---------- */
.cn2-filter { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.cn2-chip { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; border: 1px solid #cfd3d8; border-radius: 22px;
  background: var(--white); color: var(--ink); font-size: 14px; cursor: pointer; transition: border-color .2s, background-color .2s, color .2s; }
.cn2-chip:hover { border-color: var(--ink); }
.cn2-chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--white); }
.cn2-chip-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--white); }
.cn2-chip-badge { width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 4px; background: var(--ink); box-shadow: 0 0 0 1px var(--white); }
.cn2-chip-badge svg { width: 11px; height: 11px; fill: var(--white); }

/* filtered out: markers leave the map (and the tab order), and with showrooms hidden the line network goes too */
.cn2-node.is-off { display: none; }
.cn2.is-f-service [data-cn="links"], .cn2.is-f-service [data-cn="comets"] { display: none; }

/* ---------- service centers: a dark wrench badge beside the map position, never joined to the lines ---------- */
.cn2-node.is-service .cn2-core { fill: #8f959c; stroke: var(--white); }
.cn2-node.is-service.is-lit .cn2-core { fill: var(--ink); }
.cn2-node.is-service.is-sel .cn2-core, .cn2-node.is-service.is-hot .cn2-core { fill: var(--red); }
.cn2-node.is-service rect { transform-box: fill-box; transform-origin: center; }
.cn2-badge-icon { fill: var(--white); pointer-events: none; opacity: 0; transition: opacity .5s; }
.cn2-node.is-service.is-lit .cn2-badge-icon { opacity: 1; }
.cn2-pin { fill: var(--ink); stroke: var(--white); stroke-width: 1px; vector-effect: non-scaling-stroke; opacity: 0; transition: opacity .5s; }
.cn2-stem { stroke: var(--ink); stroke-width: 1.2px; vector-effect: non-scaling-stroke; opacity: 0; transition: opacity .5s; }
.cn2-node.is-service.is-lit .cn2-pin, .cn2-node.is-service.is-lit .cn2-stem { opacity: 1; }
.cn2-node.is-service .cn2-ring, .cn2-node.is-service .cn2-halo { stroke: var(--ink); }
.cn2-node.is-service .cn2-halo { fill: var(--ink); }
/* a service center in focus: the showroom network steps back (no route is drawn to it) */
.cn2.has-svc .cn2-link { opacity: .2; }
.cn2.has-svc .cn2-node:not(.is-service):not(.is-hub) .cn2-label { opacity: .45; }
.cn2-card.is-service { border-left-color: var(--ink); }
/* inline-block: home-v2.css makes every svg display:block */
.cn2-card-icon { display: inline-block; width: 24px; height: 24px; margin-right: 10px; vertical-align: -2px; fill: var(--ink); }
.cn2-item-icon { display: inline-block; width: 13px; height: 13px; margin-right: 6px; vertical-align: -1px; fill: currentColor; }
.cn2-list li[hidden] { display: none; }

/* ---------- tablet ---------- */
@media (max-width: 1099px) {
  .cn2-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "head head" "map map" "card all"; gap: 0 32px; }
  .cn2-map { margin-top: 28px; }
  .cn2-stage { width: min(100%, 760px); }
  .cn2-stats { margin-top: 18px; }
  .cn2-card { margin-top: 32px; }
  .cn2-all .cn2-list-title { margin-top: 32px; }
  .cn2-list { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- phone ---------- */
@media (max-width: 767px) {
  .cn2-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "map" "card" "all"; }
  .cn2-map { margin-top: 20px; }
  .cn2-stage { width: 100%; min-width: 0; }          /* whole country: the viewBox is never cropped unless the visitor zooms */
  .cn2-stats { gap: 10px 20px; }                     /* three figures on one row at 360px */
  .cn2-stats dt { font-size: 11px; letter-spacing: .06em; }
  .cn2-stats dd { font-size: 26px; }
  .cn2-card { margin-top: 16px; padding: 20px; }
  .cn2-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }   /* two short columns keep the section compact */
  .cn2-item strong { font-size: 13.5px; }
  .cn2-item small { font-size: 12px; }
}

/* ---------- Arabic (connected-iraq.js sets lang="ar" dir="rtl" on the section when <html lang> is Arabic) ----------
   The section mirrors (the grid follows the reading direction); the map keeps its geography, so its SVG text stays
   left-to-right and the label placer's start / end anchors keep their meaning. Arabic letters must join: no letter
   spacing, no synthetic italic. */
.cn2[dir="rtl"] .cn2-base, .cn2[dir="rtl"] .cn2-fx { direction: ltr; }
.cn2[lang="ar"] .cn2-eyebrow, .cn2[lang="ar"] .cn2-stats dt, .cn2[lang="ar"] .cn2-label, .cn2[lang="ar"] .cn2-country,
.cn2[lang="ar"] .cn2-river-label, .cn2[lang="ar"] .cn2-tip strong, .cn2[lang="ar"] .cn2-pick p,
.cn2[lang="ar"] .cn2-card-top, .cn2[lang="ar"] .cn2-list-title { letter-spacing: 0; }
.cn2[lang="ar"] .cn2-river-label { font-style: normal; }
.cn2[dir="rtl"] .cn2-card { border-left: 0; border-right: 3px solid var(--red); }
.cn2[dir="rtl"] .cn2-card.is-service { border-right-color: var(--ink); }
.cn2[dir="rtl"] .cn2-card-icon { margin-right: 0; margin-left: 10px; }
.cn2[dir="rtl"] .cn2-item-icon { margin-right: 0; margin-left: 6px; }
.cn2[dir="rtl"] .cn2-item { padding: 7px 12px 7px 0; text-align: right; }
.cn2[dir="rtl"] .cn2-item::before { left: auto; right: 0; }
.cn2[dir="rtl"] .cn2-pick button { text-align: right; }

/* ---------- reduced motion: final state, no travelling light, no pulsing ---------- */
@media (prefers-reduced-motion: reduce) {
  .cn2-core, .cn2-ring, .cn2-label, .cn2-link, .cn2-glow { transition: none; }
  .cn2-halo { animation: none !important; }
  [data-cn="comets"] { display: none; }
}
