/* Deceptive Manipulations. Street look (tokens from the street kit), laid out for a book.
   Type: Montserrat 800 caps for names, Manrope for prose (Google Fonts, linked in index.html). */
:root{
  --ground:#000000; --navy:#020308; --navy-2:#0a1220;
  --ink:#eae6dc; --ink-2:#a6adbf; --ink-3:#c9d0de; --ice:#dfe3ea; --rule:#182338;
  --light-a:44,76,138; --light-b:176,200,246; --blue:94,142,226;
  --ombre-bright:linear-gradient(135deg,#f4f0e6,#ece7db 52%,#e2dccd);
  --ombre:linear-gradient(135deg,#e9e4d8,#e1dbcd 52%,#d6cfbf);
  --ombre-dim:linear-gradient(135deg,#a3a8b6,#979daa 52%,#8a909e);
  --ombre-mark:linear-gradient(135deg,#a9c6f7,#d3dcf4 52%,#eef0f4);
  --caps:"Montserrat",ui-sans-serif,system-ui,sans-serif;
  --sans:"Manrope",ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --axis:24px; --gap:48px; --bar:48px;
  --slow:1.1s; --out:cubic-bezier(.2,.7,.3,1); --fold:cubic-bezier(.65,0,.35,1);
}
*,*::before,*::after{box-sizing:border-box}
html{background:var(--ground);color-scheme:dark;scrollbar-gutter:stable;-webkit-text-size-adjust:100%}
/* the page moves up and down only: it can't be dragged or bounced sideways on a phone.
   clip (not hidden) so the sticky masthead keeps working. */
html,body{overflow-x:clip;overscroll-behavior-x:none}
body{touch-action:pan-y pinch-zoom}
body{margin:0;font:400 17px/1.62 var(--sans);color:var(--ink);font-variant-numeric:tabular-nums;
  -webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent}
h1,h2,h3,p,ol,ul{margin:0;padding:0}
ul{list-style:none}
a{color:inherit}
img{display:block;max-width:100%}

/* ---- the one blue light ---- */
.lights{position:fixed;inset:0;z-index:-1;pointer-events:none;overflow:hidden}
.lt-broad,.lt-near{position:absolute;inset:-10%}
.lt-broad{background:radial-gradient(900px 760px at 24% 26%,rgba(var(--light-a),.24),transparent 62%);
  animation:st-drift 46s ease-in-out infinite alternate}
.lt-near{background:radial-gradient(460px 380px at 15% 15%,rgba(var(--light-b),.06),transparent 64%);
  animation:st-near 17s ease-in-out infinite alternate,st-breathe 7.5s ease-in-out infinite}
.lights::after{content:"";position:absolute;left:0;right:0;bottom:0;height:46%;
  background:linear-gradient(to bottom,transparent,rgba(0,0,0,.34))}
@keyframes st-drift{from{transform:translate3d(-2%,-1%,0)}to{transform:translate3d(5%,4%,0)}}
@keyframes st-near{from{transform:translate3d(0,0,0)}to{transform:translate3d(4%,3%,0)}}
@keyframes st-breathe{0%,100%{opacity:.7}50%{opacity:1}}
@keyframes st-wash{0%,100%{transform:translate3d(-54%,0,0)}50%{transform:translate3d(0,0,0)}}
@keyframes st-wordsweep{from{background-position:0 0}to{background-position:100% 0}}
@keyframes st-fadein{from{opacity:0}to{opacity:1}}
.appear{animation:st-fadein 1.4s ease both}

.wrap{position:relative;max-width:1680px;margin:0 auto;padding:0 var(--axis)}
.gradient,.title,.chapter h2,.tactic h3,.bar-name span,.toc h3,.toc a,.say span,.field{
  -webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}

/* ---- masthead ---- */
/* The masthead is pinned to the window (it was sticky). In iPhone Safari the page runs up under the clock, and a
   sticky masthead changes state each time the page reaches or leaves the very top, which Safari showed as a flicker
   in the masthead. Pinned, it is the same everywhere on the page. The page keeps the room under it: body's
   padding-top, set to the masthead's measured height by book.js (--mast-box), 49px plus the clock's space until then. */
body{padding-top:var(--mast-box,calc(49px + env(safe-area-inset-top,0px)))}
.top{position:fixed;top:0;left:0;right:0;z-index:60;background:var(--navy);overflow:hidden;box-shadow:0 -70px 0 70px var(--navy);
  border-bottom:1px solid var(--rule);
  border-image:linear-gradient(90deg,rgba(var(--blue),.15),rgba(var(--blue),.75) 28%,rgba(var(--light-b),.7) 72%,rgba(var(--light-b),.15)) 1;
  -webkit-user-select:none;user-select:none}
.top::before{content:"";position:absolute;top:0;bottom:0;left:0;width:220%;pointer-events:none;
  background:linear-gradient(90deg,transparent,rgba(var(--light-a),.2) 40%,rgba(var(--light-a),.06) 70%,transparent);
  animation:st-wash 46s ease-in-out infinite}
.top-in{position:relative;display:flex;align-items:center;gap:16px;max-width:1680px;margin:0 auto;
  padding:calc(12px + env(safe-area-inset-top)) var(--axis) 12px}
.bar-name{flex:1 1 auto;min-width:0;min-height:24px;display:flex;align-items:center;gap:9px;margin:0;padding:0;border:0;background:none;cursor:pointer;text-align:left;touch-action:manipulation;
  font:800 min(17px,4.15vw)/1.3 var(--caps);letter-spacing:.06em;text-transform:uppercase;white-space:nowrap}
.bar-name span{display:block;overflow:hidden;text-overflow:ellipsis;background-image:var(--ombre-mark);background-size:220% 100%;
  animation:st-wordsweep 38s steps(190) infinite alternate}
/* the name and its arrow go out and come back together, by fading the button on a layer of its own. The words are
   lettered with a gradient, and Safari redraws such words whenever a fade starts or ends on them. */
.bar-name{opacity:1;transition:opacity .7s var(--out);will-change:opacity}
.bar-name.out{opacity:0;transition:opacity .36s ease}
.bar-name i{flex:none;width:7px;height:7px;margin-top:-4px;border-right:1.5px solid #a9c6f7;border-bottom:1.5px solid #a9c6f7;transform:rotate(45deg);
  transition:transform 1.1s var(--fold),margin-top 1.1s var(--fold);opacity:.8}
.bar-name[aria-expanded="true"] i{transform:rotate(225deg);margin-top:4px}
.bar-name:focus-visible{outline:1px solid var(--ice);outline-offset:4px}
/* the chapters, let down from the masthead */
.shade{position:fixed;inset:0;z-index:58;background:rgba(0,0,0,.6);opacity:0;pointer-events:none;transition:opacity 1.1s ease}
.outlined .shade{opacity:1;pointer-events:auto}
.outline{position:fixed;left:0;right:0;top:var(--top-h,49px);z-index:59;background:var(--navy);display:grid;grid-template-rows:0fr;
  transition:grid-template-rows 1.1s var(--fold);-webkit-user-select:none;user-select:none}
.outlined .outline{grid-template-rows:1fr}
.outline-in{min-height:0;overflow:hidden;visibility:hidden;transition:visibility 0s linear 1.1s}
.outlined .outline-in{visibility:visible;transition:visibility 0s}
.outline-pad{max-width:1680px;margin:0 auto;padding:8px var(--axis) 16px;display:flex;flex-direction:column;align-items:flex-start;
  border-bottom:1px solid var(--rule);opacity:0;transition:opacity .6s ease}
.outlined .outline-pad{opacity:1;transition:opacity 1.2s ease .2s}
.outline a{display:inline-flex;align-items:center;min-height:38px;text-decoration:none;font:800 12px/1.3 var(--caps);letter-spacing:.1em;text-transform:uppercase;
  color:#979daa;transition:color .6s ease}
.outline a[aria-current="true"]{color:var(--ice)}
.outline a:focus-visible{outline:1px solid var(--ice);outline-offset:4px}
.index-mark{flex:none;display:inline-flex;align-items:center;gap:6px;align-self:flex-end;height:24px;color:#a6adbf;
  text-decoration:none;white-space:nowrap;transition:color 1.1s ease}
.index-mark:hover,.index-mark:focus-visible{color:#eae6dc}
.index-mark b{font:500 10px/1 var(--sans);letter-spacing:.08em;text-transform:uppercase}
.index-mark svg{flex:none;display:block;width:18px;height:18px}
.top.tight .index-mark b{display:none}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

/* ---- title page ---- */
.hero{padding-top:clamp(24px,4vh,44px)}
.title{font:800 clamp(30px,8.7vw,148px)/.98 var(--caps);letter-spacing:.012em;text-transform:uppercase;
  background-image:var(--ombre-mark);background-size:220% 100%;animation:st-wordsweep 38s steps(190) infinite alternate,st-fadein 1.6s ease both}
.title span{display:block}
.by{font:500 12px/1.5 var(--sans);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-2)}
.front{margin-top:clamp(40px,6vw,84px)}
/* the chapters in one row, and the front matter folded away behind the first word */
.parts{display:flex;flex-direction:column;align-items:flex-start;gap:0 clamp(18px,2vw,30px);margin-top:clamp(16px,2.2vw,32px);-webkit-user-select:none;user-select:none}
.parts a,.fold-say{display:inline-flex;align-items:center;min-height:32px;margin:0;padding:0;border:0;background:none;cursor:pointer;text-decoration:none;
  font:800 12px/1.3 var(--caps);letter-spacing:.1em;text-transform:uppercase;color:#979daa;transition:color .6s ease;touch-action:manipulation}
.fold-say i{position:relative;width:9px;height:9px;margin-left:8px;transition:transform 1.1s var(--fold)}
.fold-say i::before,.fold-say i::after{content:"";position:absolute;left:0;top:4px;width:9px;height:1.5px;background:currentColor}
.fold-say i::after{transform:rotate(90deg)}
.fold-say[aria-expanded="true"]{color:var(--ice)}
.fold-say[aria-expanded="true"] i{transform:rotate(135deg)}
.fold{display:grid;grid-template-rows:0fr;transition:grid-template-rows 1.4s var(--fold)}
.fold-in{min-height:0;overflow:hidden;opacity:0;visibility:hidden;transition:opacity .8s ease,visibility 0s linear 1.4s}
.fold.on{grid-template-rows:1fr}
.fold.on .fold-in{opacity:1;visibility:visible;transition:opacity 1.5s ease .25s,visibility 0s}
.hero+.chapter{padding-top:clamp(40px,6vh,72px)}
.hero+.chapter{scroll-margin-top:calc(var(--mast-box,49px) + var(--land) - clamp(40px,6vh,72px))}
main.wrap{transition:opacity .9s ease}
.away main.wrap{opacity:0;transition:opacity .45s ease}
.epi{font:500 clamp(16px,1.3vw,19px)/1.7 var(--sans);color:var(--ink-2)}
.epi{font-style:italic}
.src{margin-top:14px;font:500 12px/1.5 var(--sans);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-2)}
.epi span{display:block;padding-left:1.3em;text-indent:-1.3em}
.front .prose{margin-top:clamp(40px,10vw,56px)}
.prose{max-width:66ch}
.prose>*+*{margin-top:1.05em}
.prose .lead{font:600 clamp(22px,2.3vw,34px)/1.3 var(--sans);color:var(--ink);letter-spacing:-.005em}
.prose ol{padding-left:1.4em}
.prose li+li{margin-top:.7em}
.prose strong{font-weight:700;color:var(--ink)}
.prose,.eg{color:var(--ink-3)}

/* ---- chapters ---- */
/* A picked chapter stops with its heading a short, fixed step under the masthead (--land), the same for every
   chapter. Each chapter's own space above its heading is taken off, so the step doesn't depend on that space; the
   first chapter has less of it, and the step is kept smaller than that, so the chapter list above it stays out of view. */
:root{--land:clamp(24px,3.6vh,36px)}
.chapter{padding-top:clamp(110px,20vh,230px);scroll-margin-top:calc(var(--mast-box,49px) + var(--land) - clamp(110px,20vh,230px))}
.chapter h2{font:800 clamp(30px,6.3vw,104px)/1.02 var(--caps);letter-spacing:.012em;text-transform:uppercase;
  background-image:var(--ombre-mark);background-size:220% 100%;animation:st-wordsweep 38s steps(190) infinite alternate;
  overflow-wrap:break-word}
.chapter .epi{margin-top:clamp(18px,2vw,30px)}
.chapter .front{margin-top:clamp(40px,6vw,80px)}

/* ---- one tactic ---- */
.tactic{margin-top:clamp(84px,10vw,150px);scroll-margin-top:72px;display:grid;grid-template-columns:minmax(0,1fr);row-gap:0}
.plate{aspect-ratio:1/1;width:calc(100% + 2 * 6%);margin:0 -6% 0}
.plate{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
.plate{position:relative}
/* each plate has its own pool of the blue light under it, and the picture is laid over by screen:
   its blacks take whatever is behind them, so the dark parts carry the light and change as the plate travels up the window */
.plate::before{content:"";position:absolute;inset:3%;border-radius:50%;pointer-events:none;opacity:.35;
  background:radial-gradient(closest-side,rgba(64,104,182,.62),rgba(44,76,138,.34) 52%,rgba(44,76,138,0) 100%)}
@supports (animation-timeline:view()){
  .live .plate::before{animation:plate-light linear both;animation-timeline:view();animation-range:entry 0% exit 100%}
}
@keyframes plate-light{0%{opacity:.06;transform:translate3d(0,9%,0) scale(.92)}50%{opacity:.36;transform:none}100%{opacity:.56;transform:translate3d(0,-9%,0) scale(1.05)}}
.plate img{position:relative;mix-blend-mode:screen;width:100%;height:100%;opacity:0;transition:opacity 1.6s ease;pointer-events:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}
.plate img.in{opacity:calc(.9 * var(--dim,1))}
.tactic h3{font:800 clamp(21px,2vw,30px)/1.14 var(--caps);letter-spacing:.045em;text-transform:uppercase;
  background-image:var(--ombre-bright);overflow-wrap:break-word}
.def{margin-top:14px;font:600 clamp(18px,1.42vw,21px)/1.45 var(--sans);color:var(--ink)}
.eg{margin-top:30px;margin-left:16px;font-size:15.5px;line-height:1.68}
.eg p+p{margin-top:1em}
.eg em,.prose em{font-style:italic}

/* ---- the last plate ---- */
.closing{padding-top:clamp(110px,18vh,220px)}
.closing .plate{width:min(100%,78vh);margin:0}

/* ---- credits ---- */
.credits{position:relative;z-index:1;margin-top:clamp(90px,12vw,160px);background:var(--navy);border-top:1px solid var(--rule);
  padding-bottom:calc(var(--bar) + env(safe-area-inset-bottom))}
/* two lines, each led by its own mark in one shared column: the copyright sign, then the Index mark */
.credits-in{max-width:1680px;margin:0 auto;padding:18px var(--axis);display:flex;flex-direction:column;align-items:flex-start;gap:8px;
  font:500 12px/18px var(--sans);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-3)}
.credits .row{display:flex;align-items:flex-start;gap:8px;margin:0}
.credits .ic{flex:0 0 14px;width:14px;height:18px;display:grid;place-items:center;line-height:18px;letter-spacing:0}
/* the Index mark is drawn to the copyright sign's own circle: book.js measures that sign in the loaded font
   and sets the mark's diameter (--c-d) and its place (--c-x, --c-y) to match */
.credits .ic svg{display:block;overflow:visible;position:relative;top:var(--c-y,0px);left:var(--c-x,0px);width:var(--c-d,10px);height:var(--c-d,10px)}
.credits a{text-decoration:none;color:var(--ice);transition:color 1.1s ease}

/* ---- bottom bar: contents and how far through ---- */
/* iPhone Safari moves its own toolbar during a scroll and a fixed bar can lag it by a few pixels, letting the
   page show in a sliver beyond the bar. Both bars carry their own colour 140px past their outer edge to cover it. */
.foot{position:fixed;left:0;right:0;bottom:0;z-index:70;background:var(--navy);border-top:1px solid var(--rule);box-shadow:0 70px 0 70px var(--navy);
  padding-bottom:env(safe-area-inset-bottom);-webkit-user-select:none;user-select:none}
.foot-in{max-width:1680px;margin:0 auto;padding:0 var(--axis);height:var(--bar);display:flex;align-items:center}
.progress{position:absolute;left:0;right:0;top:-1px;height:1px;background:var(--ice);transform:scaleX(0);transform-origin:0 50%;opacity:.85}
.say{position:relative;display:inline-grid;align-items:center;height:var(--bar);min-width:120px;margin:0;padding:0;border:0;background:none;
  cursor:pointer;text-align:left;font:800 12px/1 var(--caps);letter-spacing:.1em;text-transform:uppercase;touch-action:manipulation}
.say span{grid-area:1/1;background-image:var(--ombre-bright);transition:opacity .7s ease}
.say .b{opacity:0}
.open .say .a{opacity:0}
.open .say .b{opacity:1}
.roll{margin:0 -14px 0 auto;padding:0;border:0;background:none;width:48px;height:var(--bar);display:grid;place-items:center;cursor:pointer;
  color:var(--ink);touch-action:manipulation}
.roll svg{width:20px;height:20px;transition:transform 1.2s var(--fold)}
.roll:focus-visible{outline:1px solid var(--ice);outline-offset:-6px}
.say:focus-visible,.parts a:focus-visible,.fold-say:focus-visible,.toc a:focus-visible,.index-mark:focus-visible,.credits a:focus-visible{outline:1px solid var(--ice);outline-offset:4px}

/* ---- contents ---- */
.contents{position:fixed;inset:0 0 calc(var(--bar) + env(safe-area-inset-bottom)) 0;z-index:65;background:var(--ground);
  overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;
  opacity:0;visibility:hidden;transition:opacity .9s var(--fold),visibility 0s linear .9s;-webkit-user-select:none;user-select:none}
.contents::before{content:"";position:fixed;inset:0;pointer-events:none;
  background:radial-gradient(900px 760px at 24% 26%,rgba(var(--light-a),.24),transparent 62%)}
.open .contents{opacity:1;visibility:visible;transition:opacity .9s var(--fold),visibility 0s}
.contents-in{position:relative;max-width:1680px;margin:0 auto;padding:calc(28px + env(safe-area-inset-top)) var(--axis) 64px}
.field{display:block;width:100%;margin:0;padding:10px 0;border:0;border-radius:0;outline:0;background-color:transparent;-webkit-appearance:none;appearance:none;
  font:800 clamp(20px,3vw,40px)/1.2 var(--caps);letter-spacing:.05em;text-transform:uppercase;
  background-image:var(--ombre-bright);caret-color:var(--ice);-webkit-user-select:text;user-select:text}
.field::placeholder{-webkit-text-fill-color:#5d6474;color:#5d6474;opacity:1}
.field::-webkit-search-cancel-button{display:none}
.toc{margin-top:clamp(28px,4vw,56px);display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:44px var(--gap);
  transition:opacity .6s ease}
.toc.dim{opacity:0;transition:opacity .25s ease}
.toc section:first-child{grid-column:1/-1}
.toc h3{font:800 12px/1.3 var(--caps);letter-spacing:.1em;text-transform:uppercase}
.toc h3 a{background-image:var(--ombre-mark);display:block;padding:8px 0}
.toc li a{display:block;padding:9px 0;font:800 13px/1.35 var(--caps);letter-spacing:.06em;text-transform:uppercase;background-image:var(--ombre)}
.toc a{text-decoration:none}
.toc [hidden]{display:none}
.none{margin-top:40px;font:500 12px/1.5 var(--sans);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-2)}
@media (hover:hover){
  .toc li a:hover{background-image:var(--ombre-mark)}
  .credits a:hover,.parts a:hover,.fold-say:hover,.outline a:hover{color:var(--ice)}
}

/* ---- wider windows: plate beside the words ---- */
@media (min-width:760px){
  .tactic{grid-template-columns:minmax(0,40%) minmax(0,1fr);column-gap:var(--gap);grid-template-rows:auto auto 1fr;align-items:start}
  .plate{grid-column:1;grid-row:1/4;width:100%;margin:0}
  .tactic h3,.def,.eg{grid-column:2}
  .tactic h3{margin-top:9%}
  .front{display:grid;grid-template-columns:minmax(0,40%) minmax(0,1fr);column-gap:var(--gap);align-items:start}
  .front .prose{margin-top:0}
}
@media (min-width:1180px){
  :root{--cols:minmax(0,31%) minmax(0,1fr) minmax(0,1.3fr)}
  .tactic{grid-template-columns:var(--cols);grid-template-rows:auto 1fr}
  .plate{grid-row:1/3}
  .tactic h3{grid-column:2/4;grid-row:1;margin-top:3.6%}
  .def{grid-column:2;grid-row:2;margin-top:18px}
  .eg{grid-column:3;grid-row:2;margin-top:21px}
  .front{grid-template-columns:minmax(0,31%) minmax(0,1fr)}
}
/* the chapters share one row only where all of them fit on it */
@media (min-width:1400px){.parts{flex-direction:row;flex-wrap:wrap;align-items:center}}
/* scroll-linked motion, driven by the browser's own scroll position (nothing scripted):
   words rise and clear as they come into the window from either end and thin out as they leave it,
   and each picture drifts a little against the page */
@supports (animation-timeline:view()){
  /* only what is near the window moves (book.js marks it .live). Every moving element costs the phone a
     rendering layer, and with all 84 entries moving at once Safari ran out of memory and reloaded the page. */
  .live h3,.live .def,.live .eg,h2.live,.epi.live{
    animation:rv-in linear both,rv-out linear forwards;
    animation-timeline:view(block 49px 48px),view(block 49px 48px);
    animation-range:entry 0px entry 190px,exit 0% exit 100%}
  .live .def,.live .eg{animation-range:entry 0px entry 190px,exit calc(100% - 110px) exit 100%}
  .live .plate img{animation:plate-drift linear both;animation-timeline:view();animation-range:cover 0% cover 100%}
}
/* the italic lines only fade. The italic is slanted by the browser (the typeface has none), and moving slanted
   text by part of a pixel makes it double up, so these never shift position */
@supports (animation-timeline:view()){.epi.live{animation-name:rv-in-still,rv-out-still}}
@keyframes rv-in-still{from{opacity:0}to{opacity:1}}
@keyframes rv-out-still{from{opacity:1}to{opacity:0}}
/* What is not near the window is not painted at all (book.js sets .io on the page and .live on what is near).
   Safari was leaving a stale copy of a heading on the page at the moment it handed that heading to its own moving
   layer, so the heading showed twice. With nothing painted beforehand there is nothing to leave behind. Out of the
   window these states are identical to the moving ones (fully faded), so nothing is seen to change. */
@supports (animation-timeline:view()){
  html.io .tactic:not(.live) h3,html.io .tactic:not(.live) .def,html.io .tactic:not(.live) .eg,
  html.io .chapter h2:not(.live),html.io .chapter>.epi:not(.live){opacity:0}
  html.io .tactic:not(.live) .plate,html.io .closing:not(.live) .plate{visibility:hidden}
  html.boot main.wrap{opacity:0}
}
@keyframes rv-in{from{opacity:0;translate:0 18px}to{opacity:1;translate:0 0}}
@keyframes rv-out{from{opacity:1;translate:0 0}to{opacity:0;translate:0 -12px}}
@keyframes plate-drift{from{translate:0 5%}to{translate:0 -5%}}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation:none!important;transition-duration:.01s!important}
}
