/* valt-network: placement only. Each component styles itself; the shell sets --content-top / --content-bottom. */
[data-screen="network"] { display: contents; --drawer-w: 232px; }   /* network.js reads it for the globe's inset */
/* clip, not hidden: a hidden box still scrolls, and a tap on a filter scrolled the whole field 8 to 30px
 * sideways (the list's region chips run past its edge). hidden stays for a WebKit without clip. */
[data-screen="network"] .field { position: fixed; inset: 0; overflow: hidden; overflow: clip; background: var(--canvas); color: var(--text); font-family: var(--font); }
/* The map surface runs 120px past the bottom of the display, so Mapbox's wordmark and the
 * attribution (anchored bottom-left of the container) sit below the screen edge. Same trick as
 * the old app. The overflow is clipped by .field. */
[data-screen="network"] .globe { position: absolute; inset: 0 0 -120px 0; width: 100%; height: calc(100% + 120px); display: block; }

/* Hero at the top of the field, the drawer below it with 21 clear, down to the content line (the
 * trigger pair is in the dock's tier, dock.css, and --content-bottom already counts the tier). */
[data-screen="network"] .stack { position: absolute; left: 0; right: 0; top: var(--content-top); bottom: calc(var(--content-bottom) + 21px);
  display: flex; flex-direction: column; gap: 21px; z-index: 4; pointer-events: none; }
[data-screen="network"] .stack > * { pointer-events: auto; }
[data-screen="network"] valt-hero { flex: none; margin: 0 var(--gutter); }
[data-screen="network"] valt-node-drawer { width: var(--drawer-w); flex: 1 1 auto; min-height: 0; }

[data-screen="network"] valt-node-list { position: absolute; inset: 0; z-index: 5; }
/* The sheet stands 12 above the dock's tier, centred like the dock, and reaches no higher than the
 * content line. --sheet-max is what is left between the two, so the plate scrolls inside itself
 * instead of running off the top of the screen: at 812x375 landscape it was 206px above it, with no
 * way to reach the four order rows. */
[data-screen="network"] valt-sort-sheet { position: absolute; left: calc(50% - var(--sheet-w) / 2); bottom: calc(var(--content-bottom) - 4px); z-index: 6;
  --sheet-max: calc(100dvh - var(--content-top) - var(--content-bottom) - 60px); }
/* The edge rail (dock.css, the default layout) stands on the map's edge, above the sheet (the dock is
 * z 7), and the centred sheet ran under it: the rail took the sheet's right 33px, the checks on two rows
 * and the top of Reset. So the sheet is the wide card, gutter to
 * gutter, standing 12 above the rail's two buttons (where the rail was moved to, --rail-lift) and growing out
 * of the rail's corner. Above the rail whichever side it is on; above it too when the rail lies down in a
 * bottom corner. */
:root[data-dock-layout="rail"] [data-screen="network"] valt-sort-sheet { --rail-gap: calc(var(--tap) + 18px);
  --rail-top: calc(var(--rail-lift, calc(var(--content-bottom) + 21px)) + 2 * var(--tap) + 24px);   /* the rail is its two buttons and 12 of chrome; 12 clear */
  /* A rail dragged high leaves less than 200 above it: the plate then stands at the content line, 200 tall and
   * scrolling, and its near edge steps in by --rail-gap so the rail (z 7) covers none of it (reviewer, lift 416
   * and up on 812). --crowd is that step: 0 while the plate fits above the rail, --rail-gap once it cannot. */
  --room: calc(100dvh - var(--content-top) - 212px);
  --crowd: clamp(0px, (var(--rail-top) - var(--room)) * 1000, var(--rail-gap));
  --sheet-w: min(100% - 2 * var(--gutter) - var(--crowd), 480px); left: auto; right: calc(var(--gutter) + var(--crowd));
  bottom: min(var(--rail-top), var(--room)); transform-origin: 90% 100%;
  --sheet-max: max(200px, 100dvh - var(--content-top) - var(--rail-top) - 12px); }
:root[data-dock-layout="rail"][data-rail-side="left"] [data-screen="network"] valt-sort-sheet { right: auto; left: calc(var(--gutter) + var(--crowd)); transform-origin: 10% 100%; }
:root[data-dock-layout="rail"][data-rail-row] [data-screen="network"] valt-sort-sheet { right: auto; left: var(--gutter); --sheet-w: min(343px, 100% - 2 * var(--gutter));
  bottom: calc(var(--rail-lift, calc(var(--content-bottom) + 21px)) + var(--rail-gap));
  --sheet-max: calc(100dvh - var(--content-top) - var(--rail-lift, calc(var(--content-bottom) + 21px)) - var(--rail-gap) - 56px); }
/* A short screen (a phone on its side) has no room above the rail: there the plate stands beside it, as it
 * did before the wide card, and scrolls inside itself. */
@media (max-height: 560px) {
  :root[data-dock-layout="rail"]:not([data-rail-row]) [data-screen="network"] valt-sort-sheet { --sheet-w: min(343px, 100% - 2 * var(--gutter) - var(--rail-gap));
    left: auto; right: calc(var(--gutter) + var(--rail-gap)); bottom: calc(var(--content-bottom) + 21px); transform-origin: 100% 100%;
    --sheet-max: calc(100dvh - var(--content-top) - var(--content-bottom) - 77px); }
  :root[data-dock-layout="rail"][data-rail-side="left"]:not([data-rail-row]) [data-screen="network"] valt-sort-sheet { right: auto; left: calc(var(--gutter) + var(--rail-gap)); transform-origin: 0 100%; }
}
/* While the sheet is open the field behind it stands down: the strip that leaks past a 300 plate is
 * half-drawn flags and clipped cities, and it was live (a tap on it changed the exit). network.js
 * makes the column and the list inert; this is the dim behind it and the press that closes it. At 55%
 * the hero's green Connect still came through the glass under "Nearest to me" as a second lit row, and
 * the hero's cut title read as a layout slip; at 80% the field drops back behind the plate. */
[data-screen="network"] .field::after { content: ''; position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background: color-mix(in srgb, var(--canvas) 80%, transparent); opacity: 0;
  transition: opacity var(--t-move) var(--ease); }
[data-screen="network"] .field[data-sort-open]::after, [data-screen="network"] .field[data-rate-open]::after { opacity: 1; }
/* And the column itself steps back: through the dim the hero's star, its protocol cell and a slab of
 * Connect still stood in the strip beside the sheet, and the sheet's top edge cut the hero's title
 * (the 2026-09-22 review). Inert already (network.js), so nothing is lost with it. */
[data-screen="network"] .stack { transition: opacity var(--t-move) var(--ease); }
[data-screen="network"] .field[data-sort-open] .stack, [data-screen="network"] .field[data-rate-open] .stack { opacity: .2; }

/* The rating card (components/rate-sheet.js) asks about the connection the hero just ended; the field
 * steps back behind it as it does for the sheet. It is as wide as the hero and never taller than the
 * space down to the content line. Above the list (5) as well, so a Disconnect from the list's open card
 * is asked about the same way.
 * Low on the screen:
 * its top is set so that the card at its tallest (a star picked: the word, the note, Send; --rate-full,
 * measured at 343) ends 12 above the content line, over the dock. The map controls step aside while it
 * is up (dock.js standDown), so nothing else stands there. The unrated card's middle lands at 60% on a
 * 375x812. Its top holds while it grows, so the star just tapped does not move under the finger. */
/* It takes the hero's place, so the hero goes rather than showing its Connect under the card's edge. */
[data-screen="network"] .field[data-rate-open] .stack valt-hero { opacity: 0; }
[data-screen="network"] valt-rate-sheet { position: absolute; left: var(--gutter); z-index: 6;
  width: min(343px, calc(100% - 2 * var(--gutter)));
  --rate-full: 304px;
  top: max(var(--content-top), calc(100dvh - var(--content-bottom) - 12px - var(--rate-full)));
  --rate-max: calc(100dvh - var(--content-top) - var(--content-bottom) - 21px); }
/* Writing a note it goes back to the head of the column: the keyboard comes up from the bottom and the
 * field has to stay above it. It stays there while the note has words in it, so a Send does not drop
 * the card back down under the thanks. The move is the card's open transition plus its top. */
[data-screen="network"] valt-rate-sheet:has(textarea:focus),
[data-screen="network"] valt-rate-sheet:has(textarea:not(:placeholder-shown)) { top: var(--content-top); }
[data-screen="network"] valt-rate-sheet[open] { transition: opacity var(--t-feedback) var(--ease), transform var(--t-move) var(--ease), top var(--t-move) var(--ease), visibility 0s linear 0s; }
/* What went wrong, after a rating of three or under (components/feedback.js): it takes the rating card's
 * place on the same terms, the hero gone, the field dimmed, the map controls stood aside. At its tallest
 * (failed: the line under the chips; --fb-full, measured at 347 on a 375 with the five reasons on two
 * rows) its foot lands 12 above the content line, as the rated card's does; while the line has the focus
 * or words it goes to the head of the column, above the keyboard. */
[data-screen="network"] valt-feedback { position: absolute; left: var(--gutter); z-index: 6;
  width: min(343px, calc(100% - 2 * var(--gutter)));
  --fb-full: 347px;
  top: max(var(--content-top), calc(100dvh - var(--content-bottom) - 12px - var(--fb-full)));
  --fb-max: calc(100dvh - var(--content-top) - var(--content-bottom) - 21px); }
[data-screen="network"] valt-feedback[data-typing] { top: var(--content-top); }
[data-screen="network"] valt-feedback[open] { transition: opacity var(--t-feedback) var(--ease), transform var(--t-move) var(--ease), top var(--t-move) var(--ease), visibility 0s linear 0s; }

/* The 17 Pro Max at default zoom (440): the list beside the globe is 288, past the
 * midline, and the globe takes what is left; network.js lands the selected exit in the middle of that strip. */
@media (min-width: 440px) and (max-width: 447.98px) { [data-screen="network"] { --drawer-w: 288px; } }

/* The wide window (448 and up: anything wider than an iPhone Pro Max, network.js WIDE): the phone's
 * surface keeps to a 375 column at the left, the drawer flush to its edge as before, and the globe is
 * the rest of the window, interactive. From 608 (network.js FLOAT) the hero is not in the column:
 * network.js moves it onto the globe (below). The list view keeps to the column; the trigger pair is
 * in the dock and the sort sheet stands above the dock, both centred on the window as the dock is. */
@media (min-width: 448px) {
  [data-screen="network"] .stack { right: auto; width: 375px; }
  /* Not the list: in list view the list is the whole screen at every width, its rows
   * in a readable column centred like the dock (node-list.css --list-col). */
}

/* Desktop (app.css): the sidebar is the navigation here too, so the field starts at its
 * 208 edge and the drawer hangs off its hairline. And the drawer is wide enough to set every city and country
 * whole. Not the country cut short: DESIGN.md binds the row to the flag, the city and the country.
 * 296 is the longest name in the live catalog on 2026-10-09 ("Khwaeng Thung Song Hong, Thailand", 225 at
 * 14/600) plus the row's 59 of flag, gap and padding, the border, and 11 for WebKit's slightly wider setting.
 * A longer name still takes the ellipsis. */
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
  [data-screen="network"] { --drawer-w: 296px; }
  [data-screen="network"] .field { left: 208px; }
}

/* The hero on the globe (lib/globe-mapbox.js showCard): a Mapbox popup carries it at the selected
 * exit, at the phone's 343, 26 clear of the node so the beacon's pulse (31 at its widest) ends short
 * of the slab. Mapbox's own white box, shadow and tip go: the tip was glass on the canvas, invisible
 * at night and a white wedge by day. In its place a hairline leader from the card's edge to the
 * beacon's edge (9 out from the centre), on whichever side the card opens; a card at a corner gets
 * none. z-index 5 puts it above the column (.stack is 4), for the moment a drag carries it across. */
/* The pulse round the selected exit (globe-mapbox.js applySelection): a ring from 9 to 31 out,
 * fading from .7. It runs outside the map, so the map
 * redraws only when the camera moves. Three pulses when the exit or the tunnel state changes, then a
 * still dot (U12: even a looping ring kept the GPU compositing). Two since U23:
 * a ripple that slows as it spreads, then a rest. None while connecting: a ring every
 * 0.9s read as the beacon flashing, and the card's band already breathes through the wait (U13).
 * Paused while the globe is stopped; gone with reduced motion. */
/* !important: Mapbox writes pointer-events inline on its markers, and the ring must never take the pin's tap. */
[data-screen="network"] .valt-ring { width: 62px; height: 62px; pointer-events: none !important; --period: 1.8s; --ring: var(--node); --pulses: 2; }
[data-screen="network"] .valt-ring[data-mode="connecting"] { --pulses: 0; }
[data-screen="network"] .valt-ring[data-mode="connected"] { --ring: var(--signal); }
[data-screen="network"] .valt-ring::before { content: ''; position: absolute; inset: 0; margin: auto; box-sizing: border-box; border-radius: 50%; border: 1.8px solid var(--ring); opacity: 0; animation: valt-ring var(--period) linear var(--pulses); }
[data-screen="network"] .globe.still .valt-ring::before { animation-play-state: paused; }
/* Scale, not size (U23): a ring sized each frame laid the page out 22 times a second while it ran. The stroke starts
   thin and thickens as it spreads, as a ripple does. */
@keyframes valt-ring {
  0% { transform: scale(.28); opacity: .7; animation-timing-function: cubic-bezier(.22, .61, .36, 1); }
  40% { opacity: .5; }
  72%, 100% { transform: scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { [data-screen="network"] .valt-ring { display: none; } }
[data-screen="network"] .valt-popup { z-index: 5; }
[data-screen="network"] .valt-popup valt-hero { width: 343px; margin: 0; }
[data-screen="network"] .valt-popup .mapboxgl-popup-content { position: relative; background: transparent; padding: 0; border-radius: 0; box-shadow: none; }
[data-screen="network"] .valt-popup .mapboxgl-popup-tip { display: none; }
[data-screen="network"] .valt-popup .mapboxgl-popup-content::after { content: ''; position: absolute; background: color-mix(in srgb, var(--text) 35%, transparent); pointer-events: none; }
[data-screen="network"] .valt-popup.mapboxgl-popup-anchor-bottom .mapboxgl-popup-content::after { left: 50%; top: 100%; width: 1px; height: 17px; }
[data-screen="network"] .valt-popup.mapboxgl-popup-anchor-top .mapboxgl-popup-content::after { left: 50%; bottom: 100%; width: 1px; height: 17px; }
[data-screen="network"] .valt-popup.mapboxgl-popup-anchor-left .mapboxgl-popup-content::after { top: 50%; right: 100%; width: 17px; height: 1px; }
[data-screen="network"] .valt-popup.mapboxgl-popup-anchor-right .mapboxgl-popup-content::after { top: 50%; left: 100%; width: 17px; height: 1px; }
/* The phone's globe view (globe-mapbox.js placeCentred, U15): the card stays in the middle of the screen, so the
 * leader starts under the node, not under the card's middle, and on the card's head when the card is below the node. */
[data-screen="network"] .valt-popup[data-centred] .mapboxgl-popup-content::after { left: calc(50% + var(--lead-x, 0px)); }
[data-screen="network"] .valt-popup[data-centred][data-below] .mapboxgl-popup-content::after { top: auto; bottom: 100%; }
[data-screen="network"] .valt-popup[data-centred][data-far] .mapboxgl-popup-content::after { opacity: 0; }

/* The way back (network.js syncBack): the drawer's return chip restated on the globe, centred under
 * the strip right of the column, on the triggers' row. Node blue, the informational accent (live count,
 * pending, active), with the canvas as its ink: signal green is the main action's alone.
 * Hidden it is visibility:hidden as
 * well, so it is never a stop nobody can see; the 44 tap target is taken outward from the 32 pill. */
[data-screen="network"] .back { position: absolute; left: calc(375px + (100% - 375px) / 2); bottom: var(--content-bottom); z-index: 5;
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border: 0; border-radius: var(--r-pill);
  background: var(--node); color: var(--canvas); box-shadow: var(--shadow-control); font: 600 12px/1 var(--font); letter-spacing: -.01em;
  white-space: nowrap; cursor: pointer; -webkit-appearance: none;
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateX(-50%) translateY(6px);
  transition: opacity var(--t-feedback) var(--ease), transform var(--t-feedback) var(--ease), visibility 0s linear var(--t-feedback); }
[data-screen="network"] .back[shown] { opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(-50%);
  transition: opacity var(--t-feedback) var(--ease), transform var(--t-feedback) var(--ease), visibility 0s linear 0s; }
[data-screen="network"] .back::after { content: ''; position: absolute; inset: -6px -8px; }
[data-screen="network"] .back:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[data-screen="network"] .back svg { flex: none; opacity: .8; }
[data-screen="network"] .back b { font-weight: 600; }

/* Mapbox globe (lib/globe-mapbox.js): the .globe element is its container. The canvas fills it; the
 * Mapbox wordmark and the compact attribution are anchored to the container bottom, which is off-screen. */
[data-screen="network"] .globe.mapboxgl-map { background: var(--canvas); }
/* The canvas is a tab stop on the wide window (keys turn the globe), so it shows the kit's ring
 * when the keyboard puts focus on it, and nothing when the pointer does. */
[data-screen="network"] .globe .mapboxgl-canvas { width: 100% !important; height: 100% !important; outline: none; }
[data-screen="network"] .globe .mapboxgl-canvas:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
[data-screen="network"] .globe .mapboxgl-ctrl-bottom-left { bottom: 0; left: var(--gutter); }

/* The globe view (network.js, U9): the drawer tucked away, the card stands on the globe at every width, so on
 * a phone the popup is the column's width and the way back to the exit is centred, as the dock is. */
[data-screen="network"] .field[data-view="globe"] .valt-popup valt-hero { width: min(343px, calc(100vw - 2 * var(--gutter))); }
/* Folded to the exit's pin (network.js onUserMove): the card fades (valt-hero[closed]), its leader with it, and
 * the box it stood in stops taking taps, so the servers under it can be picked. */
[data-screen="network"] .valt-popup .mapboxgl-popup-content::after { transition: opacity var(--t-move) var(--ease); }
/* !important: Mapbox writes pointer-events: auto inline on the popup content, and the folded card's box kept
 * swallowing the drags and taps that started in it. */
[data-screen="network"] .field[data-card-tucked] .valt-popup .mapboxgl-popup-content { pointer-events: none !important; }
[data-screen="network"] .field[data-card-tucked] .valt-popup .mapboxgl-popup-content::after { opacity: 0; }
@media (max-width: 447.98px) {
  [data-screen="network"] .field[data-view="globe"] .back { left: 50%; bottom: calc(var(--content-bottom) + 8px); }
}

/* The phone (hero.css has the card): the column starts 12 under the menu button.
   The 64 is the number to play with; under 64 the card runs into the menu button's own row (8 + 44 + 12,
   and the chrome band in app.css is that 64 too). The globe view's card stands under the same line (lib/globe-mapbox.js
   landing, centre). */
@media (max-width: 447.98px) { [data-screen="network"] { --content-top: calc(var(--safe-top) + 64px); } }
