/* Extracted from go-to-market-demo.html */

  @import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

  :root {
    --green: #3C9E76;
    --green-deep: #0F3D2C;
    --green-mid: #1F6B4D;
    --green-pale: #DDEDE4;
    --ink: #0B1A14;
    --ink-3: #56675F;
    --ink-4: #8A9892;
    --line: #C7DDD2;
    --paper: #FFFFFF;
    --paper-off: #E8F2EC;

    /* Tone variables — JS sets these per segment so circle colours
       darken smoothly across the timeline. CSS `transition: fill`
       on each consuming element interpolates the colour. */
    --circle-fill: #4A9F7C;
    --integration-fill: #76C2A0;
    --stream-color: #4A9F7C;
  }

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html, body {
    width: 100%; height: 100%;
    font-family: 'IBM Plex Sans', sans-serif;
    background: var(--paper-off);
    color: var(--ink);
    overflow: hidden;
  }

  /* One-time page fade-in. Animation runs once on load; never re-triggers. */
  body { animation: pageIn 500ms ease both; }
  @keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

  /* Fixed-size stage that scales to fit the viewport. */
  #stage-wrap {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--paper-off);
  }
  #stage {
    width: 1600px; height: 900px;
    flex: none;
    background: var(--paper-off);
    position: relative;
    overflow: hidden;
    transform-origin: center;
    padding: 50px 80px 30px;
    display: flex;
    flex-direction: column;
  }

  /* ---------- Top-right counter ---------- */
  .status {
    position: absolute;
    top: 36px; right: 80px;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-3);
    font-weight: 600;
    background: white;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 18px;
    z-index: 10;
  }
  .status .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(60,158,118,0.18);
  }
  .status .stat {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
  }
  .status .count {
    color: var(--ink);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.08em;
    min-width: 32px;
    text-align: right;
    display: inline-block;
  }
  .status .sep {
    width: 1px;
    height: 14px;
    background: var(--line);
  }

  /* ---------- SVG canvas (the diagram) ---------- */
  .canvas-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
  }
  #canvas {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: block;
  }
  /* One transform on one group — all flicker risk lives here, so we
     GPU-promote it explicitly. Transition is a single property, short
     duration, no overshoot. */
  #scene {
    transition: transform var(--scene-duration, 600ms) var(--scene-ease, cubic-bezier(0.55, 0, 0.25, 1));
    will-change: transform;
  }

  /* ---------- Circles ---------- */
  /* Every named or unnamed circle is the same visual primitive:
     white fill, thin green border. The .on toggle controls opacity
     via a single property — no transform, no background, no shadow
     animations. */
  .node {
    opacity: 0;
    transition: opacity 380ms ease;
    will-change: opacity;
  }
  .node.on { opacity: 1; }

  /* --- GTM map backdrop + new-market node styling --- */
  /* Map backdrop: colour grade (saturate .82 / brightness 1.05) is BAKED into
     gtm-atlantic-graded.png — do NOT use a live CSS filter here. A CSS filter
     on this oversized SVG <image> (≈5750×3460 user units) overruns the
     renderer's filter buffer and the image silently fails to paint. */
  .map-backdrop { opacity: 0.92; }
  /* Globe backdrop — only visible in the final global zoom-out segment. */
  #globe-bg {
    position: absolute; inset: 0;
    background: #05070a url('assets/gtm-globe.png') center / contain no-repeat;
    opacity: 0;
    transition: opacity 900ms ease;
    pointer-events: none;
    z-index: 0;
  }
  body.show-globe #globe-bg { opacity: 1; }
  body.show-globe #layer-map { opacity: 0; transition: opacity 700ms ease; }
  .node-circle.is-partner { fill: #E88358; }
  .node-circle.is-rec { fill: var(--integration-fill); }
  #l-partner-dk, #l-partner-pc1, #l-partner-pc2,
  #l-partner-pc3, #l-partner-pc4, #l-partner-pc5,
  #l-se-partner-1, #l-se-partner-2, #l-se-partner-3, #l-se-partner-4,
  #l-ams-1, #l-ams-2, #l-ams-3, #l-ams-4,
  #l-lon-1, #l-lon-2, #l-lon-3, #l-lon-4 { stroke: #E88358 !important; stroke-dasharray: 7 6; }

  /* Embed mode — hide status badge + controls so the demo can be
     iframe'd into a slide as a pure visual. Toggled via #chrome=off. */
  body.embed-chromeless .status,
  body.embed-chromeless .controls {
    display: none !important;
  }
  body.embed-chromeless #stage {
    padding: 20px 40px;
  }
  body.embed-chromeless .canvas-wrap {
    margin-top: 0;
  }
  /* Markings (eyebrow / name / logo) fade out of every named circle
     node once we reach Grow +6 (segment 11). The circles themselves
     stay — just the chrome inside disappears so the late segments read
     as a pure dot mesh. */
  /* Phantom labels — names rendered next to a subset of the inner-band
     phantoms. Same fade/hide rules as the other markings. */
  .phantom-label {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.005em;
    fill: var(--green-deep);
    text-anchor: middle;
    pointer-events: none;
    opacity: 0;
    transition: opacity 380ms ease, fill 600ms ease;
  }
  /* Hard-guard: inactive labels are always at opacity 0 regardless of
     cascade order. !important beats any rule that might leak through
     during transitions or mid-frame state. */
  .phantom-label:not(.on) {
    opacity: 0 !important;
  }
  .phantom-label.on { opacity: 0.92; }

  body.markings-hidden .node-eyebrow,
  body.markings-hidden .node-name,
  body.markings-hidden .node image,
  body.markings-hidden .integration,
  body.markings-hidden .integration-line,
  body.markings-hidden .integration-label,
  body.markings-hidden .phantom-label {
    opacity: 0 !important;
    transition: opacity 600ms ease;
  }
  .node-eyebrow,
  .node-name,
  .node image {
    transition: opacity 600ms ease;
  }
  /* Logo images sit inside dark-green circles. They use transparent-background
     PNG variants (assets/customer-logos/tt/) so colours render at full
     opacity and any whites inside the logos (e.g. N1, Lego) are preserved. */
  .node image {
    mix-blend-mode: normal;
  }
  /* Company circles — every node, hub or supplier, shares one tone
     variable so the whole network darkens together segment-by-segment.
     Hubs distinguish themselves by size, not colour. */
  .node-circle {
    fill: var(--circle-fill);
    stroke: none;
    transition: fill 600ms ease;
  }
  .node-circle.is-hub {
    fill: var(--circle-fill);
    stroke: none;
  }

  .node-eyebrow {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.22em;
    fill: rgba(255,255,255,0.85);
    font-weight: 700;
    text-transform: uppercase;
    text-anchor: middle;
  }
  .node-name {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    letter-spacing: -0.01em;
    fill: #FFFFFF;
    text-anchor: middle;
  }
  .node-name.size-md { font-size: 18px; }
  .node-name.size-sm { font-size: 14px; }
  .node-name.size-hub { font-size: 16px; font-weight: 700; }
  /* Denmark hub: label until Partner segment, then cross-fade to Klappir leaf */
  .mk-dk-logo { opacity: 0; }
  body.dk-partnered .mk-dk-label { opacity: 0; }
  body.dk-partnered .mk-dk-logo { opacity: 1; }

  /* Faint dashed orbit ring around hubs */
  .hub-ring {
    fill: none;
    stroke: rgba(15,61,44,0.45);
    stroke-width: 1;
    stroke-dasharray: 4 6;
    vector-effect: non-scaling-stroke;
    opacity: 0;
    transition: opacity 380ms ease;
  }
  .hub-ring.on { opacity: 1; }

  /* ---------- Connection lines ---------- */
  .stream {
    stroke: var(--stream-color);
    stroke-width: 1.4;
    fill: none;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    opacity: 0;
    transition: opacity 380ms ease;
    /* Perf: 5k+ of these. No per-element will-change (layer explosion),
       skip AA, and never hit-test — they're decorative. */
    shape-rendering: optimizeSpeed;
    pointer-events: none;
  }
  .stream.on { opacity: 0.62; }
  .stream.thin { stroke-width: 0.8; }
  .stream.thin.on { opacity: 0.22; }
  /* Motion level-of-detail: while the camera is gliding, drop the ~5k faint
     intra-cluster spokes (you can't resolve them mid-move anyway). They snap
     back the instant the camera settles, so the resting frame is unchanged —
     this is what keeps the wide zoom-outs (last two segments) smooth when the
     demo is embedded inside the transform-scaled deck slide. */
  body.scene-moving .stream.thin { display: none; }

  /* Phantom circles for growth segments — share the same tone variable
     as the named circles, so they darken in lockstep. */
  .phantom {
    opacity: 0;
    /* Perf: 5.5k+ of these. Fade in on reveal, but don't run a 600ms fill
       transition across all of them on every tone change; adopt the new
       tone instantly (imperceptible on tiny dots, big raster saving). */
    transition: opacity 380ms ease;
    fill: var(--circle-fill);
    shape-rendering: optimizeSpeed;
    pointer-events: none;
  }
  .phantom.on { opacity: 0.85; }
  .phantom.is-partner { fill: #E88358 !important; }
  /* City anchor markers — sit on top of their company cluster, slightly
     larger with a thin light ring so each seeded city reads as a local hub. */
  .phantom.city-marker {
    fill: var(--circle-fill);
    stroke: rgba(255,255,255,0.7);
    stroke-width: 1.2;
    vector-effect: non-scaling-stroke;
  }
  .phantom.city-marker.on { opacity: 1; }
  /* Release-to-publish dialog (after "Save to segment") */
  .gtm-release-ov { position:fixed; inset:0; background:rgba(11,26,20,0.42); display:none; align-items:center; justify-content:center; z-index:9999; -webkit-backdrop-filter:blur(2px); backdrop-filter:blur(2px); }
  .gtm-release-ov.on { display:flex; }
  .gtm-release-card { width:min(440px,90vw); background:#fff; border:1px solid var(--line); border-radius:16px; padding:22px 24px; box-shadow:0 24px 60px -16px rgba(11,26,20,0.45); font-family:'IBM Plex Sans',sans-serif; }
  .gtm-release-title { font-size:18px; font-weight:700; color:var(--green-deep); margin-bottom:8px; }
  .gtm-release-body { font-size:14px; line-height:1.5; color:var(--ink-2); }
  .gtm-release-actions { display:flex; gap:10px; justify-content:flex-end; margin-top:18px; }
  .gtm-release-actions button { font-family:inherit; font-size:14px; font-weight:600; padding:10px 18px; border-radius:9px; cursor:pointer; border:1px solid var(--line); }
  .gtm-rel-wait { background:#fff; color:var(--ink-2); }
  .gtm-rel-wait:hover { border-color:var(--ink-4); }
  .gtm-rel-go { background:var(--green-deep); border-color:var(--green-deep); color:#fff; }
  .gtm-rel-go:hover { background:#0a4a30; }
  .gtm-rel-go:disabled { opacity:0.6; cursor:default; }
  .gtm-release-hint { font-size:13px; line-height:1.45; color:var(--green-deep); margin-top:14px; }

  /* Calibration tool */
  .calib-panel { position:absolute; top:64px; right:80px; width:288px; max-height:74%; overflow:auto; background:#fff; border:1px solid var(--line); border-radius:10px; padding:12px 14px; font-family:'IBM Plex Mono',monospace; font-size:11px; color:var(--ink); z-index:30; display:none; box-shadow:0 10px 28px rgba(0,0,0,0.16); }
  body.calibrate .calib-panel { display:block; }
  body.calibrate #canvas { cursor:crosshair; }
  .calib-panel h4 { font-size:11px; letter-spacing:0.12em; text-transform:uppercase; margin:0 0 8px; }
  .calib-h { display:flex; align-items:center; justify-content:space-between; gap:8px; }
  .calib-h button { font:inherit; font-size:14px; line-height:1; width:22px; height:22px; padding:0; margin:0; border:1px solid var(--line); border-radius:5px; background:#fff; cursor:pointer; }
  .calib-panel.folded { width:auto; max-height:none; padding-bottom:12px; }
  .calib-panel.folded > *:not(.calib-h) { display:none !important; }
  .calib-panel.folded .calib-h { margin:0; }
  .calib-target { font-weight:700; color:var(--green-deep); margin-bottom:8px; font-size:12px; }
  .calib-target span { color:#d6177f; }
  .calib-list { white-space:pre-wrap; line-height:1.5; max-height:300px; overflow:auto; background:#f6faf8; padding:6px; border-radius:6px; }
  .calib-panel button { font:inherit; margin:8px 4px 0 0; padding:4px 9px; border:1px solid var(--line); border-radius:5px; background:#fff; cursor:pointer; }
  .calib-modes { display:flex; gap:6px; margin-bottom:10px; }
  .calib-modes button { flex:1; margin:0; padding:6px 0; }
  .calib-modes button.active { background:var(--green-deep); color:#fff; border-color:var(--green-deep); }
  .calib-field { display:block; margin:0 0 8px; font-weight:700; color:var(--green-deep); }
  .calib-field input { display:block; width:100%; box-sizing:border-box; margin-top:3px; font:inherit; padding:4px 6px; border:1px solid var(--line); border-radius:5px; }
  .calib-field select { display:block; width:100%; box-sizing:border-box; margin-top:3px; font:inherit; padding:4px 6px; border:1px solid var(--line); border-radius:5px; background:#fff; }
  .calib-dim { color:#9bb0a6; font-weight:400; }
  .calib-hint { color:#5a7268; line-height:1.45; margin:4px 0 2px; }
  .calib-panel button.city-save { background:var(--green-deep); color:#fff; border-color:var(--green-deep); font-weight:700; }
  .calib-panel button.city-save.saved { background:#2f8f5b; border-color:#2f8f5b; }
  .calib-marker circle { fill:#d6177f; stroke:#fff; stroke-width:3; }
  .calib-marker text { fill:#d6177f; font-family:'IBM Plex Mono',monospace; font-weight:700; paint-order:stroke; stroke:#fff; stroke-width:3px; }

  /* Integration dots — slightly lighter than the company circles so
     they still read as smaller, dependent satellites at every tone. */
  .integration {
    opacity: 0;
    transition: opacity 380ms ease, fill 600ms ease;
    fill: var(--integration-fill);
  }
  .integration.on { opacity: 0.95; }
  .integration-line {
    stroke: var(--stream-color);
    stroke-width: 1.4;
    fill: none;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    opacity: 0;
    transition: opacity 380ms ease, stroke 600ms ease;
  }
  .integration-line.on { opacity: 0.55; }
  /* Integration label — small caps text next to each integration dot. */
  .integration-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.18em;
    font-weight: 700;
    fill: var(--green-deep);
    opacity: 0;
    transition: opacity 380ms ease;
    pointer-events: none;
    text-transform: uppercase;
  }
  .integration-label.on { opacity: 0.85; }

  /* Concentric zone backgrounds — slightly darker green discs over the
     light-green page background. They stack so the centre darkens. */
  .zone {
    fill: rgba(15,61,44,0.06);
    opacity: 0;
    transition: opacity 450ms ease;
  }
  .zone.on { opacity: 1; }

  /* Arched zone labels (PARTNERS / CUSTOMERS / THE VALUE CHAIN /
     LETS MAKE AN IMPACT TOGETHER). Each follows a circular text-path. */
  .zone-label {
    opacity: 0;
    transition: opacity 450ms ease;
  }
  .zone-label.on { opacity: 1; }
  .zone-label text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 700;
    fill: var(--green-deep);
    letter-spacing: 0.22em;
  }
  .zone-label-outer text {
    fill: var(--ink);
    font-weight: 700;
  }

  /* Klappir centerpiece — white circle with logo. Drawn inside #scene
     but with a fixed *visual* size by inverse-scaling against the scene
     transform. JS sets `style.transform` on this group to undo the
     scene's scale so the Klappir disc looks the same size as in the
     reference image regardless of zoom level. */
  .klappir-center {
    opacity: 0;
    transition: opacity 450ms ease;
    transform-box: fill-box;
    transform-origin: center;
  }
  .klappir-center.on { opacity: 1; }

  /* ---------- Controls bar (below the canvas) ---------- */
  .controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 14px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: var(--ink-3);
    border-top: 1px solid var(--line);
    margin-top: 12px;
  }
  .controls button {
    appearance: none;
    border: 1px solid #C9D5CF;
    background: white;
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
    white-space: nowrap;
  }
  .controls button:hover {
    border-color: var(--green);
    color: var(--green);
  }
  .controls .btn-icon {
    min-width: 32px;
    padding: 6px 9px;
  }
  .controls .btn-seg.is-active {
    background: var(--green-deep);
    border-color: var(--green-deep);
    color: white;
  }
  .controls .seg-label {
    font-weight: 700;
    color: var(--ink-4);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0 6px 0 4px;
    font-size: 10px;
  }
  .controls .seg-divider {
    width: 1px;
    height: 16px;
    background: var(--line);
    margin: 0 4px;
  }
  .controls .phase-readout {
    margin-left: auto;
    font-size: 10px;
    color: var(--ink-4);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .controls .phase-readout b {
    color: var(--green-deep);
    margin-left: 6px;
    font-weight: 700;
  }
