/* Diagrams on the IP and franchise pages (22 Nov 2026): look B, "sketch and notes". Linked only on pages that have
   a diagram (src/corp/templates/diagrams.mjs). Flat: ink outlines, hard shadows, one blue key element, one note.
   Caveat (the note's handwriting): SIL Open Font License 1.1, from @fontsource/caveat 5.3.0, self-hosted. */
@font-face{font-family:'Caveat';font-style:normal;font-weight:700;font-display:block;src:url('/fonts/caveat-latin-700-normal.woff2') format('woff2')}

.dg{--dg-ink:var(--valuo-navy);--dg-pen:#F0532B;margin:clamp(56px,7vw,96px) 0 0;padding:0}
.dg-title{font:800 clamp(1.75rem,3.3vw,2.7rem)/1.08 var(--sans);letter-spacing:-.032em;color:var(--valuo-navy);margin:0 0 clamp(30px,3.6vw,48px);max-width:21ch;text-wrap:balance}
.dg-at{position:relative}
.dg-box{background:#fff;border:2.5px solid var(--dg-ink);box-shadow:7px 7px 0 var(--dg-ink);padding:20px 22px;font:800 clamp(1.1rem,1.6vw,1.36rem)/1.2 var(--sans);letter-spacing:-.012em;color:var(--valuo-navy)}
.dg-box.is-key{background:var(--brand);color:#fff}
.dg-box h3{margin:0 0 10px;font:800 clamp(1.1rem,1.6vw,1.3rem)/1.2 var(--sans);letter-spacing:-.012em;color:inherit}
.dg-box p{margin:0;font:500 1rem/1.5 var(--sans);letter-spacing:0;color:#28333d}
.dg-box.is-key p{color:#fff}

/* Flow: box, labelled arrow, box; a down arrow under the last box; then the list */
.dg-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(220px,1.35fr) minmax(0,1.05fr);align-items:center;gap:0 18px}
.dg-arrow{position:relative;margin:0;padding:0 8px 16px;text-align:center;font:600 16px/1.35 var(--sans);color:#28333d;text-wrap:balance}
.dg-arrow::before{content:'';position:absolute;left:0;right:14px;bottom:0;border-top:2.5px solid var(--dg-ink)}
.dg-arrow::after{content:'';position:absolute;right:0;bottom:-7.5px;border-left:15px solid var(--dg-ink);border-top:8.5px solid transparent;border-bottom:8.5px solid transparent}
.dg-arrow b{font-weight:800;color:var(--valuo-navy)}
.dg-down{grid-column:3;grid-row:2;position:relative;justify-self:center;height:64px;margin:14px 0 6px;padding-left:16px;display:flex;align-items:center;font:600 15px/1.3 var(--sans);color:#28333d}
.dg-down::before{content:'';position:absolute;left:0;top:0;bottom:12px;border-left:2.5px solid var(--dg-ink)}
.dg-down::after{content:'';position:absolute;left:-7.25px;bottom:0;border-top:14px solid var(--dg-ink);border-left:8.5px solid transparent;border-right:8.5px solid transparent}
/* The key can be the arrow itself: its label sits on the line, in the blue box */
.dg-arrow.is-key{padding:0 22px 0 14px}
.dg-arrow.is-key::before{top:50%;bottom:auto;margin-top:-1.25px}
.dg-arrow.is-key::after{top:50%;bottom:auto;margin-top:-8.5px}
.dg-arrow.is-key span{position:relative;display:inline-block;padding:14px 18px;background:var(--brand);border:2.5px solid var(--dg-ink);box-shadow:7px 7px 0 var(--dg-ink);color:#fff;font:600 clamp(1.05rem,1.5vw,1.25rem)/1.2 var(--sans)}
.dg-arrow.is-key b{color:#fff}
/* A box that stands for a whole network carries a row of small outlets */
.dg-net{display:flex;flex-wrap:wrap;gap:6px;margin-top:14px}
.dg-net i{box-sizing:border-box;width:12px;height:12px;border:2px solid var(--dg-ink)}

/* The list a result is tested against: square bullets in one ink box */
.dg-list{position:relative;list-style:none;margin:0;padding:28px 34px 28px 44px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:18px 40px;border:2.5px solid var(--dg-ink);box-shadow:7px 7px 0 var(--dg-ink);background:#fff}
.dg-list li{margin:0}
.dg-item{display:flex;align-items:flex-start;gap:12px;font:800 1.08rem/1.2 var(--sans);color:var(--valuo-navy)}
/* A long item wraps; the bullet stays at the middle of its first line (.6em of a 1.2 line, less half the bullet) */
.dg-item::before{content:'';flex:0 0 auto;width:10px;height:10px;margin-top:calc(.6em - 5px);background:var(--dg-ink)}
.dg-pair{position:relative}
/* The loop is drawn round the pair's own wrapper, so a note under the pair (phones) does not grow it */
.dg-pair-in{position:relative;width:max-content}
.dg-pair-list{list-style:none;margin:0;padding:0;display:flex;gap:18px 44px;align-items:center}
.dg-loop{position:absolute;left:-22px;top:-17px;width:calc(100% + 50px);height:calc(100% + 34px);overflow:visible;pointer-events:none}

/* Steps: boxes in a row joined by arrows, ending in the key box */
.dg-step-list{list-style:none;margin:0;padding:0;display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:0 56px}
.dg-step{position:relative;margin:0}
.dg-step > .dg-at,.dg-step .dg-box{height:100%}
.dg-step .dg-box{display:flex;align-items:center;font-size:clamp(1rem,1.25vw,1.12rem)}
.dg-step + .dg-step::before{content:'';position:absolute;left:-44px;width:22px;top:50%;margin-top:-1.25px;border-top:2.5px solid var(--dg-ink)}
.dg-step + .dg-step::after{content:'';position:absolute;left:-23px;top:50%;margin-top:-8.5px;border-left:15px solid var(--dg-ink);border-top:8.5px solid transparent;border-bottom:8.5px solid transparent}

/* Fork: one box splitting into branches */
.dg-fork-top{position:relative;display:flex;justify-content:center;padding-bottom:36px}
.dg-fork-top .dg-box{min-width:min(100%,240px);text-align:center}
.dg-fork-top::after{content:'';position:absolute;left:50%;bottom:0;height:27px;margin-left:-1.25px;border-left:2.5px solid var(--dg-ink)}
.dg-branches{position:relative;list-style:none;margin:0;padding:36px 0 0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0 28px}
.dg-branches::before{content:'';position:absolute;top:0;left:calc((100% - 56px) / 6);right:calc((100% - 56px) / 6);border-top:2.5px solid var(--dg-ink)}
.dg-branch{position:relative;margin:0}
.dg-branch::before{content:'';position:absolute;left:50%;top:-36px;height:22px;margin-left:-1.25px;border-left:2.5px solid var(--dg-ink)}
.dg-branch::after{content:'';position:absolute;left:50%;top:-15px;margin-left:-8.5px;border-top:14px solid var(--dg-ink);border-left:8.5px solid transparent;border-right:8.5px solid transparent}
.dg-branch > .dg-at,.dg-branch .dg-box{height:100%}

/* Bars: lives to scale on one axis. Solid is the term, dashed is an extension */
.dg-bar-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:30px}
.dg-bar{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2.2fr);gap:0 32px;align-items:center;margin:0;padding-right:14px}
.dg-bar-label{margin:0;font:800 clamp(1.02rem,1.4vw,1.2rem)/1.25 var(--sans);letter-spacing:-.01em;color:var(--valuo-navy)}
.dg-bar-label b{display:block;font-weight:800}
.dg-bar-label span{display:block;margin-top:4px;font:600 15px/1.35 var(--sans);letter-spacing:0;color:#28333d}
.dg-track{position:relative;height:46px}
.dg-fill,.dg-extra{position:absolute;top:0;bottom:7px;left:0}
.dg-fill{width:var(--w);background:#fff;border:2.5px solid var(--dg-ink);box-shadow:7px 7px 0 var(--dg-ink)}
.dg-fill.is-key{background:var(--brand)}
.dg-extra{left:var(--w);width:var(--x);background:#fff;border:2.5px dashed var(--dg-ink);border-left:0}
.dg-bar .dg-note{grid-column:2}
/* The note's arrow points at the middle of its bar */
.dg-bar .dg-note.is-below{margin-left:calc(var(--w) / 2 + 32px);max-width:min(12em,calc(100% - var(--w) / 2 - 32px))}
.dg-axis-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2.2fr);gap:0 32px;margin-top:26px;padding-right:14px}
.dg-axis{position:relative;height:34px;border-top:2.5px solid var(--dg-ink)}
.dg-axis span{position:absolute;left:var(--at);top:12px;transform:translateX(-50%);font:700 14px/1 var(--sans);color:var(--valuo-navy);white-space:nowrap}
.dg-axis span::before{content:'';position:absolute;left:50%;top:-14px;height:9px;margin-left:-1.25px;border-left:2.5px solid var(--dg-ink)}
.dg-axis span:first-child{transform:none}
.dg-axis span:first-child::before{left:0;margin-left:0}
.dg-axis span:last-child{transform:translateX(-100%)}
.dg-axis span:last-child::before{left:auto;right:0;margin-left:0}

/* Swap: two sides, an arrow each way */
.dg-swap-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(260px,1.6fr) minmax(0,1fr);align-items:center;gap:0 18px}
.dg-ways{display:flex;flex-direction:column;gap:30px}
.dg-way{position:relative;margin:0;text-align:center;font:600 16px/1.35 var(--sans);color:#28333d;text-wrap:balance}
.dg-way b{font-weight:800;color:var(--valuo-navy)}
.dg-way::before{content:'';position:absolute;border-top:2.5px solid var(--dg-ink)}
.dg-way::after{content:'';position:absolute;border-top:8.5px solid transparent;border-bottom:8.5px solid transparent}
.dg-way.is-there{padding:0 8px 16px}
.dg-way.is-there::before{left:0;right:14px;bottom:0}
.dg-way.is-there::after{right:0;bottom:-7.5px;border-left:15px solid var(--dg-ink)}
.dg-way.is-back{padding:16px 8px 0}
.dg-way.is-back::before{left:14px;right:0;top:0}
.dg-way.is-back::after{left:0;top:-7.5px;border-right:15px solid var(--dg-ink)}
.dg-swap-row .dg-note{grid-column:2}
.dg-swap-row .dg-note.is-below{margin-left:30%}

/* The handwritten note: one per diagram, with a pen arrow */
.dg-note{position:absolute;z-index:1;margin:0;max-width:13em;font:700 27px/1.02 'Caveat',cursive;color:var(--dg-pen);transform:rotate(-2.5deg);transform-origin:left top;text-wrap:balance}
.dg-pen{position:absolute;overflow:visible}
.dg-note.is-pair{left:56px;bottom:calc(100% + 44px);width:max-content}
.dg-note.is-pair .dg-pen.is-up{left:-42px;top:30px;width:34px;height:46px;transform:scaleY(-1)}
/* Under its box, positioned against it, with room kept for it */
.dg-note.is-under{left:64px;top:calc(100% + 28px);width:max-content;max-width:12em}
.dg-note.is-under .dg-pen.is-up,.dg-note.is-below .dg-pen.is-up{left:-40px;top:-24px;width:30px;height:39px}
.has-note-below .dg-down{height:92px}
.has-note-pair .dg-down{height:84px}
.dg.has-note-foot{padding-bottom:104px}
/* Below its target, in the flow of the layout */
.dg-note.is-below{position:relative;justify-self:start;margin:26px 0 0 64px;width:max-content;max-width:12em}

/* A fork with two branches: two columns on a computer, the line across joining their middles. The query is the exact
   opposite of the phone block below, so no width (820.8px under zoom or display scaling) falls between the two. */
@media not all and (max-width:820px){
  .dg-fork.is-2 .dg-branches{grid-template-columns:repeat(2,minmax(0,1fr))}
  .dg-fork.is-2 .dg-branches::before{left:calc((100% - 28px) / 4);right:calc((100% - 28px) / 4)}
}

@media (max-width:820px){
  .dg-row{grid-template-columns:1fr;gap:0}
  .dg-arrow{text-align:left;padding:18px 0 22px 26px;margin-left:24px}
  .dg-arrow::before{left:0;right:auto;top:0;bottom:14px;border-top:0;border-left:2.5px solid var(--dg-ink)}
  .dg-arrow::after{left:-7.25px;right:auto;bottom:0;border-left:8.5px solid transparent;border-right:8.5px solid transparent;border-top:14px solid var(--dg-ink);border-bottom:0}
  .dg-down{grid-column:1;grid-row:auto;justify-self:start;margin-left:24px;padding-left:26px;height:70px}
  /* On a phone the key arrow's box takes the full width, with an arrow into it and one out of it */
  .dg-arrow.is-key{margin-left:0;padding:40px 0}
  .dg-arrow.is-key::before{left:24px;top:0;bottom:14px;margin-top:0}
  .dg-arrow.is-key::after{left:16.75px;top:auto;bottom:0;margin-top:0}
  .dg-arrow.is-key span{display:block}
  .dg-arrow.is-key span::before{content:'';position:absolute;left:14.25px;top:-16.5px;border-top:14px solid var(--dg-ink);border-left:8.5px solid transparent;border-right:8.5px solid transparent}
  .dg-net i:nth-child(n+7){display:none}
  .dg-list{flex-direction:column;align-items:flex-start;padding:28px 22px 26px 36px;gap:16px}
  .dg-pair-list{flex-direction:column;align-items:flex-start;gap:16px}
  .dg-pair{margin-bottom:4px}

  .dg-step-list{grid-auto-flow:row;grid-template-columns:minmax(0,1fr);gap:48px 0}
  .dg-step > .dg-at,.dg-step .dg-box{height:auto}
  .dg-step + .dg-step::before{left:24px;width:0;top:-38px;height:23px;margin-top:0;border-top:0;border-left:2.5px solid var(--dg-ink)}
  .dg-step + .dg-step::after{left:16.75px;top:-16px;margin-top:0;border-top:14px solid var(--dg-ink);border-left:8.5px solid transparent;border-right:8.5px solid transparent;border-bottom:0}

  /* Fork on a phone: a spine down the left, an arrow into each branch */
  .dg-fork-top{justify-content:flex-start;padding-bottom:20px}
  .dg-fork-top .dg-box{min-width:0;text-align:left}
  .dg-fork-top::after{display:none}
  .dg-branches{grid-template-columns:minmax(0,1fr);gap:20px 0;padding:0 0 0 46px}
  .dg-branches::before{display:none}
  .dg-branch::before,.dg-branch::after{display:none}
  /* Every upright line is drawn against a branch's wrapper, never against a box: Chrome draws a 2.5px border at
     2px, so a line placed from inside a box would sit half a pixel off one placed from outside it. The box draws
     only its stub and arrowhead, at its own middle, so a note under the box does not move the arrow. */
  .dg-branch .dg-box{position:relative}
  .dg-branch .dg-box::before{content:'';position:absolute;left:-24.25px;top:50%;width:8px;margin-top:-1.25px;border-top:2.5px solid var(--dg-ink)}
  .dg-branch .dg-box::after{content:'';position:absolute;left:-17.5px;top:50%;margin-top:-8.5px;border-left:15px solid var(--dg-ink);border-top:8.5px solid transparent;border-bottom:8.5px solid transparent}
  .dg-branches > .dg-branch > .dg-at::before{content:'';position:absolute;left:-23.25px;top:-20px;bottom:0;border-left:2.5px solid var(--dg-ink)}
  /* The spine stops at the last arrow; the renderer keeps the note off the last branch, so its wrapper is its box */
  .dg-branches > .dg-branch:last-child > .dg-at::before{bottom:50%}
  .dg-branch > .dg-at,.dg-branch .dg-box{height:auto}

  .dg-bar{grid-template-columns:minmax(0,1fr);gap:12px 0}
  .dg-bar .dg-note{grid-column:1}
  .dg-axis-row{grid-template-columns:minmax(0,1fr)}
  .dg-axis-row > span{display:none}

  /* Swap on a phone: the boxes stack and the two arrows run side by side between them, each from one box all the
     way to the other (down, then back up), with both labels beside them in reading order */
  .dg-swap-row{grid-template-columns:minmax(0,1fr)}
  .dg-ways{position:relative;gap:14px;padding:26px 0 26px 66px}
  .dg-way,.dg-way.is-there,.dg-way.is-back{position:static;padding:0;text-align:left;font-size:15px}
  .dg-way::before{border-top:0;border-left:2.5px solid var(--dg-ink)}
  .dg-way.is-there::before{left:20px;right:auto;top:0;bottom:14px}
  .dg-way.is-there::after{left:12.75px;right:auto;top:auto;bottom:0;border-left:8.5px solid transparent;border-right:8.5px solid transparent;border-top:14px solid var(--dg-ink);border-bottom:0}
  .dg-way.is-back::before{left:42px;right:auto;top:14px;bottom:0}
  .dg-way.is-back::after{left:34.75px;right:auto;top:0;bottom:auto;border-left:8.5px solid transparent;border-right:8.5px solid transparent;border-bottom:14px solid var(--dg-ink);border-top:0}
  .dg-swap-row .dg-note{grid-column:1}
  .dg-swap-row .dg-note.is-below{margin-left:48px}

  /* Notes on a phone: every note sits in the flow under what it points at, so nothing is squeezed or pushed off
     the screen, and each keeps clear of the right edge when tilted (down to a 320px screen) */
  .has-note-below .dg-down,.has-note-pair .dg-down{height:70px}
  .dg.has-note-foot{padding-bottom:0}
  .dg-note{transform:rotate(-3deg);font-size:22px}
  /* The looped pair's note goes under the loop, inside the list, pointing up at it */
  .dg-note.is-pair{position:relative;left:auto;bottom:auto;width:auto;max-width:none;margin:40px 8px 0 44px}
  .dg-note.is-pair .dg-pen.is-up{left:-36px;top:-22px;width:28px;height:36px;transform:none}
  /* A note under its box keeps the box at full width. The down line carries on past the note, behind the box. */
  .dg-at.has-note{isolation:isolate;display:flow-root}
  .dg-at.has-note::before{content:'';position:absolute;z-index:-1;left:24px;top:0;bottom:0;border-left:2.5px solid var(--dg-ink)}
  .dg-note.is-under{position:relative;left:auto;top:auto;margin:28px 8px 8px 70px;width:auto;max-width:15em}
  .dg-note.is-under .dg-pen.is-up{left:-38px;top:-22px;width:28px;height:36px}
  /* In the steps the next arrow starts 10px below a step, so the line under a noted step reaches down to it */
  .dg-step .dg-note.is-under{margin-bottom:0}
  .dg-step .dg-at.has-note::before{bottom:-10px}
  .dg-note.is-below{margin:30px 0 0 48px;max-width:min(12em,calc(100% - 56px))}
}
