/* theme switch (both themes) and the dark theme on top of style.css + app.css (+ blog, guide, guide-router).
   theme.js sets html[data-theme]; device mockups that copy someone else's light screen (Telegram, App Store, the router's
   web page, a browser bar) stay light and get the light ink back below */
html:not([data-theme]) .theme-tg,html:not([data-theme]) .theme-seg{display:none}
.theme-tg{display:inline-grid;place-items:center;flex:none;width:42px;height:42px;margin-left:6px;padding:0;border:0;border-radius:50%;background:var(--canvas);color:var(--fg);cursor:pointer;transition:background-color .15s ease}
.theme-tg:hover{background:var(--press)}
.theme-tg svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
html[data-theme=dark] .theme-tg .i-moon,html:not([data-theme=dark]) .theme-tg .i-sun{display:none}
.theme-seg{display:inline-flex;gap:2px;padding:3px;border-radius:999px;background:var(--canvas)}
.theme-seg button{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border:0;border-radius:999px;background:none;color:var(--mute);font:inherit;font-size:13px;font-weight:600;cursor:pointer;transition:background-color .15s ease,color .15s ease}
.theme-seg button:hover{color:var(--fg)}
.theme-seg button[aria-pressed=true]{background:var(--card);color:var(--fg);box-shadow:0 1px 2px rgba(11,18,32,.12)}
.theme-seg svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.foot-end{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
@media (max-width:1080px){
  .theme-tg{margin-left:0}
}
@media (max-width:420px){
  .theme-seg button span{display:none}
  .theme-seg button{padding:7px 10px}
}

/* dark: tokens */
/* blue-grey, lightness in the light theme's order: stage (wells) < canvas < card < press; brand-ink panels navy with a
   blue hairline; a selection is a yellow ring, not a yellow wash */
html[data-theme=dark]{color-scheme:dark;
  --stage:#070A11;--canvas:#0D121C;--card:#171D2A;--press:#262D3D;--press-2:#323A4C;--fg:#ECEEF3;--fg-2:#C9CED9;--mute:#959CAD;
  --sep:rgba(255,255,255,.08);--hair:rgba(160,180,230,.08);--ink-soft:rgba(236,238,243,.72);--line-dark:rgba(255,255,255,.14);
  --line-strong:#4A5266;--top-bg:rgba(23,29,42,.86);--ink-bg:#1C2B4A;--ink-line:rgba(130,165,255,.18);
  --sel-ring:var(--yellow);--sel-bg:rgba(246,202,47,.06);
  --tint-y:rgba(246,202,47,.1);--tint-g:rgba(52,199,89,.13);--tint-b:rgba(42,171,238,.13);--tint-r:rgba(255,90,79,.13);
  --ok:#5FD38A;--warn:#F2C14E;--bad:#FF8A80;--blue:#6CC4F5}
html[data-theme=dark] :where(.screen,.g-screen,.g-store,.al>div,.rg-br,.bmx-win){color-scheme:light;color:#06111F;
  --canvas:#F2F2F5;--card:#FFFFFF;--stage:#E6E6EC;--press:#E4E4EA;--fg:#0B1220;--fg-2:#2A3242;--mute:#6B7080;--sep:rgba(11,18,32,.08);
  --ink-soft:rgba(6,17,31,.72);--line-dark:rgba(6,17,31,.18);--ok:#1F7A3D;--warn:#9A6B00;--bad:#C62828;--blue:#1A7FC1;
  --tint-y:#FFF4CC;--tint-g:#E5F4EA;--tint-b:#E3F2FC;--tint-r:#FDE8E6}
:where(html[data-theme=dark]) ::selection{background:rgba(246,202,47,.35)}

/* header, menus, buttons */
:where(html[data-theme=dark]) .top .wrap,:where(html[data-theme=dark]) .g-toc .wrap{background:var(--top-bg);box-shadow:0 0 0 1px var(--sep)}
:where(html[data-theme=dark]) .dd-menu{background:var(--card);box-shadow:0 0 0 1px var(--sep),0 24px 48px -20px rgba(0,0,0,.6)}
:where(html[data-theme=dark]) .dd-menu a:hover,:where(html[data-theme=dark]) .dd-menu a[aria-current]{background:var(--press)}
:where(html[data-theme=dark]) .burger::before,:where(html[data-theme=dark]) .burger::after{background:var(--fg)}
:where(html[data-theme=dark]) .burger::before{box-shadow:0 7px 0 var(--fg)}
:where(html[data-theme=dark]) .burger.is-x::before{box-shadow:none}
@media (max-width:1080px){
  :where(html[data-theme=dark]) .menu{background:var(--card);box-shadow:0 0 0 1px var(--sep),0 24px 48px -28px rgba(0,0,0,.7)}
  :where(html[data-theme=dark]) .dd-menu{background:none;box-shadow:none}
}
:where(html[data-theme=dark]) .menu-link:hover{background:var(--press)}
:where(html[data-theme=dark]) .btn,:where(html[data-theme=dark]) .btn-yellow{background:var(--fg);color:#0B1220}
:where(html[data-theme=dark]) .btn:hover,:where(html[data-theme=dark]) .btn-yellow:hover{background:#fff;color:#0B1220}
:where(html[data-theme=dark]) .btn-ghost,:where(html[data-theme=dark]) .btn-line{background:var(--card);color:var(--fg)}
:where(html[data-theme=dark]) .btn-ghost:hover,:where(html[data-theme=dark]) .btn-line:hover{background:var(--press);color:var(--fg)}
:where(html[data-theme=dark]) .menu-end .btn-ghost,:where(html[data-theme=dark]) .doc .btn-ghost{background:var(--press)}
:where(html[data-theme=dark]) .menu-end .btn-ghost:hover:hover,:where(html[data-theme=dark]) .doc .btn-ghost:hover{background:var(--press-2)}
:where(html[data-theme=dark]) .flow-cap b{background:var(--fg);color:#0B1220}
:where(html[data-theme=dark]) :focus-visible{outline-color:var(--fg)}

/* brand-ink panels: navy with a blue hairline, so they stand out from the cards */
:where(html[data-theme=dark]) .guide .dark>.wrap,:where(html[data-theme=dark]) .lp-dark>.wrap,:where(html[data-theme=dark]) #how .route-tg,:where(html[data-theme=dark]) .pd,:where(html[data-theme=dark]) .pt-calc-out,:where(html[data-theme=dark]) .net-summary[data-state=down],:where(html[data-theme=dark]) .blog-share{
  background:var(--ink-bg);box-shadow:inset 0 0 0 1px var(--ink-line)}
/* small ink chips and numbers: inverted */
:where(html[data-theme=dark]) .card:nth-child(2) .ic,:where(html[data-theme=dark]) .card:nth-child(2):hover .ic,:where(html[data-theme=dark]) .route-web .route-ic,:where(html[data-theme=dark]) .lp-kind:nth-child(2) .lp-kind-ic,:where(html[data-theme=dark]) .lp-n,:where(html[data-theme=dark]) .pt-chips input:checked+span,:where(html[data-theme=dark]) .g-toc a[aria-current],:where(html[data-theme=dark]) .lk-act .c-copy{background:var(--fg);color:#0B1220}
:where(html[data-theme=dark]) #how .route-web .route-ic{background:var(--press);color:var(--yellow)}
:where(html[data-theme=dark]) .g-toc a[aria-current] b{background:var(--yellow);color:#06111F}
:where(html[data-theme=dark]) .pt-bars i{background:var(--line-strong)}
:where(html[data-theme=dark]) .pt-bars i:nth-child(7){background:var(--yellow)}
:where(html[data-theme=dark]) .g-dev.is-you{box-shadow:0 0 0 2px var(--yellow)}
:where(html[data-theme=dark]) .pt-calc input[type=range]{accent-color:var(--yellow)}

/* yellow and coloured tints */
:where(html[data-theme=dark]) .price.is-best,:where(html[data-theme=dark]) .app.rec,:where(html[data-theme=dark]) .rg-row.is-on,:where(html[data-theme=dark]) .rg-plist.is-up .rg-p-vpn{background:var(--sel-bg);box-shadow:inset 0 0 0 2px var(--sel-ring)}
:where(html[data-theme=dark]) :is(#pl1:checked~.prices .price:nth-child(1),#pl3:checked~.prices .price:nth-child(2),
  #pl6:checked~.prices .price:nth-child(3),#pl12:checked~.prices .price:nth-child(4)) .pr{background:var(--sel-bg);box-shadow:inset 0 0 0 2px var(--sel-ring)}
:where(html[data-theme=dark]) .pr-dot{border-color:var(--line-strong);background:var(--card)}
:where(html[data-theme=dark]) :is(#pl1:checked~.prices .price:nth-child(1),#pl3:checked~.prices .price:nth-child(2),
  #pl6:checked~.prices .price:nth-child(3),#pl12:checked~.prices .price:nth-child(4)) .pr-dot{border-color:var(--yellow)}
:where(html[data-theme=dark]) .widgets>.w:nth-child(2) .wi{background:var(--tint-g);color:var(--ok)}
:where(html[data-theme=dark]) .widgets>.w:nth-child(3) .wi{background:var(--tint-b);color:var(--blue)}
:where(html[data-theme=dark]) .w-dev .wi{background:var(--tint-y);color:var(--yellow)}
:where(html[data-theme=dark]) .lp-on,:where(html[data-theme=dark]) .ph-ok{color:var(--ok)}
:where(html[data-theme=dark]) .lk-pill{background:var(--tint-g);border-color:var(--ok);color:var(--ok)}
:where(html[data-theme=dark]) .pill.ok{background:var(--tint-g);color:var(--ok)}
:where(html[data-theme=dark]) .pill.warn{background:var(--tint-y);color:var(--warn)}
:where(html[data-theme=dark]) .pill.bad{background:var(--tint-r);color:var(--bad)}
:where(html[data-theme=dark]) .pt-yes li svg{background:var(--tint-g);color:var(--ok)}
:where(html[data-theme=dark]) .pt-no li svg{background:var(--tint-r);color:var(--bad)}
:where(html[data-theme=dark]) .pt-form .pt-form-err.is-err{color:var(--bad)}
:where(html[data-theme=dark]) .pt-f [aria-invalid="true"]{border-color:var(--bad)}
:where(html[data-theme=dark]) .net-summary[data-state=ok] .net-dot{background:var(--ok);box-shadow:0 0 0 5px rgba(95,211,138,.15)}
:where(html[data-theme=dark]) .foot .net[data-state=ok] .net-dot{background:var(--ok);box-shadow:0 0 0 4px rgba(95,211,138,.14)}

/* cards: a hairline, as white cards get from the grey canvas in the light theme */
:where(html[data-theme=dark]) :where(.card,.w,.facts,.prices,.plan-notes,.feat:not(.wlp-card),.route,.apps,.app,.loc,.faq,.foot>.wrap,.adv,.doc>.wrap,.net-summary,.net-list,.blog-card,.g-way,.g-dev,.g-facts li,.lk-card,.lp-kind,.lp-steps li,.pt-calc-in,.pt-kit,.pt-bn,.pt-rules>div,.pt-money,.pt-stats div,.alt-tabs){box-shadow:inset 0 0 0 1px var(--hair)}
/* wells (the light theme's darker grey stages): darker than the page, with the same hairline */
:where(html[data-theme=dark]) :where(.stage,.final>.wrap,.lp-scene,.pt-mock,.g-seg){box-shadow:inset 0 0 0 1px var(--hair)}
/* surfaces that were white or light grey */
:where(html[data-theme=dark]) .facts a:hover{background:var(--stage)}
:where(html[data-theme=dark]) :is(.facts,.facts-note) sup{color:var(--yellow)}
:where(html[data-theme=dark]) .pt-chips label:hover span{background:var(--press)}
:where(html[data-theme=dark]) .tv-qr:not(.frame){color:var(--fg)}
:where(html[data-theme=dark]) .tv-screen,:where(html[data-theme=dark]) .tv-stand{border-color:var(--line-strong)}
:where(html[data-theme=dark]) .tv-stand{background:var(--line-strong)}
:where(html[data-theme=dark]) .g-dev:hover{box-shadow:inset 0 0 0 1px var(--hair)}
:where(html[data-theme=dark]) .blog-card:hover{box-shadow:0 0 0 1px var(--sep),0 18px 40px -24px rgba(0,0,0,.7)}
:where(html[data-theme=dark]) :is(#pf0:checked~.pf-tabs label:nth-child(1),#pf1:checked~.pf-tabs label:nth-child(2),#pf2:checked~.pf-tabs label:nth-child(3),
  #pf3:checked~.pf-tabs label:nth-child(4),#pf4:checked~.pf-tabs label:nth-child(5),#pf5:checked~.pf-tabs label:nth-child(6),
  #pf6:checked~.pf-tabs label:nth-child(7)){background:var(--press);box-shadow:none}
:where(html[data-theme=dark]) .g-seg a[aria-current]{background:var(--press);box-shadow:none}

/* text that used the old ink on the page itself (not on yellow) */
:where(html[data-theme=dark]) .lead strong,:where(html[data-theme=dark]) .g-text b,:where(html[data-theme=dark]) .g-text .g-lead,:where(html[data-theme=dark]) .blog-post .lead,:where(html[data-theme=dark]) .blog-card,:where(html[data-theme=dark]) .dark .g-acc .g-text b,:where(html[data-theme=dark]) .dark .g-acc .g-text a:not(.btn){color:var(--fg)}
:where(html[data-theme=dark]) .g-acc{background:var(--card);color:var(--fg)}
:where(html[data-theme=dark]) .g-list li::before,:where(html[data-theme=dark]) .dark .g-acc .g-list li::before{background:var(--fg)}
:where(html[data-theme=dark]) .dark .g-acc .g-ol li::before{border-color:var(--fg);color:var(--fg)}
:where(html[data-theme=dark]) .g-n{background:var(--press);color:var(--yellow)}
:where(html[data-theme=dark]) .g-tip{background:rgba(255,255,255,.05)}
:where(html[data-theme=dark]) .light .g-tip{background:var(--sel-bg);box-shadow:inset 0 0 0 1px rgba(246,202,47,.25)}
:where(html[data-theme=dark]) .g-code{background:rgba(255,255,255,.08)}
:where(html[data-theme=dark]) .dark .g-way,:where(html[data-theme=dark]) .dark .g-way :is(h3,b,strong,a:not(.btn)){color:var(--fg)}
:where(html[data-theme=dark]) .dark .g-way :is(p,li){color:var(--mute)}
:where(html[data-theme=dark]) .dark .g-way .btn-ghost{background:var(--press);color:var(--fg)}
:where(html[data-theme=dark]) .dark .g-way .btn-ghost:hover{background:var(--press-2)}

:where(html[data-theme=dark]) .price.is-best .price-save,:where(html[data-theme=dark]) .plans .is-best .pr .price-save,
:where(html[data-theme=dark]) .pt-money li:nth-child(2) b{color:#06111F}

/* blog: the yellow call to action keeps the ink */
:where(html[data-theme=dark]) .blog-cta,:where(html[data-theme=dark]) .blog-cta p{color:#06111F}
:where(html[data-theme=dark]) .blog-cta .btn{background:#06111F;color:#fff}
:where(html[data-theme=dark]) .blog-cta .btn:hover{background:#2A3242;color:#fff}
:where(html[data-theme=dark]) .blog-cta .btn-ghost{background:rgba(255,255,255,.6);color:#06111F}
:where(html[data-theme=dark]) .blog-cta .btn-ghost:hover{background:#fff;color:#06111F}
:where(html[data-theme=dark]) .blog-cta :focus-visible{outline-color:#06111F}

/* router guide: the checklist and prices (the router's own page in the mockup stays light) */
:where(html[data-theme=dark]) .rg-check label:hover{box-shadow:inset 0 0 0 2px var(--press)}
:where(html[data-theme=dark]) .rg-check input{border-color:var(--line-strong);background:var(--card)}
:where(html[data-theme=dark]) .rg-check input:checked{border-color:var(--yellow);background:var(--yellow)}
:where(html[data-theme=dark]) .rg-check input::after{border-color:#06111F}
:where(html[data-theme=dark]) .rg-check input:focus-visible{outline-color:var(--fg)}
:where(html[data-theme=dark]) .rg-check label:has(input:checked){background:var(--sel-bg);box-shadow:inset 0 0 0 2px var(--sel-ring)}
:where(html[data-theme=dark]) .rg-ck-top i,:where(html[data-theme=dark]) .rg-prog i{background:var(--press)}
:where(html[data-theme=dark]) .rg-checks:not(:has(input:not(:checked))) .rg-ready{background:var(--tint-g)}
:where(html[data-theme=dark]) .rg-checks:not(:has(input:not(:checked))) .rg-ready .rg-prog i:nth-child(n):nth-child(n){background:var(--ok)}
:where(html[data-theme=dark]) .rg-checks:not(:has(input:not(:checked))) .rg-ready-txt b{color:var(--ok)}
:where(html[data-theme=dark]) .rg-prices li{background:var(--stage);color:var(--fg)}
:where(html[data-theme=dark]) .rg-prices b{color:var(--fg)}
:where(html[data-theme=dark]) .bmx-win,:where(html[data-theme=dark]) .bmx-bar>.bmx-slot{color:#0B1220}
:where(html[data-theme=dark]) .bmx-win{border-color:transparent}
:where(html[data-theme=dark]) .bmx-keys kbd{background:var(--card)}

/* theme switch in the dark */
:where(html[data-theme=dark]) .theme-tg{background:var(--press)}
:where(html[data-theme=dark]) .theme-tg:hover{background:var(--press-2)}
:where(html[data-theme=dark]) .theme-seg button[aria-pressed=true]{background:var(--press);box-shadow:none}
