/* Trustybits Lab. One screen on desktop: question and answers left, the matching offer right.
   Black ink on white graph paper. Every card, tile and button starts and ends on a grid line, and the
   gaps between them are whole cells of bare paper. --u is one cell; all sizes are multiples of it.
   Colour belongs to the answers: each has a colour tile, and the picked answer's colour (--sel, set in
   app.js) tints the button, the offer header and the stroke under "we". */
:root{
  color-scheme:light;
  --u:28px; --p:1; /* one grid cell, and the page margin in cells */
  --bg:#ffffff; --grid:#eeeeea; --fg:#111211; --mut:#63666b; --line:#d8d8d4;
  --mid:#b9b9b4; --soft:#f3f3f0;
  --sel:#1d4ed8; --self:#ffffff;
  --hl:color-mix(in srgb,var(--sel) 36%,var(--bg)); --tint:color-mix(in srgb,var(--sel) 12%,var(--bg)); --head:color-mix(in srgb,var(--sel) 24%,var(--bg));
  --deep:color-mix(in srgb,var(--sel) 50%,#2e2e2a); --dark:color-mix(in srgb,var(--sel) 42%,#0b0c0b); /* a dark value of the picked colour, for the offer title and facts */
  --artc:color-mix(in srgb,var(--deep) 36%,var(--bg)); /* the drawings: a muted, darker value so every answer colour stays visible, yellow included */ --step:color-mix(in srgb,var(--tint) 55%,var(--bg));
  --mono:"IBM Plex Mono",ui-monospace,Menlo,Consolas,monospace;
  --sans:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;
  --disp:"Bricolage Grotesque","Figtree",system-ui,sans-serif;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
/* The paper is centred, and the site is an odd number of cells wide and centred too, so its edges land on grid lines. */
body{margin:0;background:var(--bg);color:var(--fg);font-family:var(--sans);font-size:15px;line-height:1.45;
  background-image:linear-gradient(var(--grid) 1px,transparent 1px),linear-gradient(90deg,var(--grid) 1px,transparent 1px);
  background-size:var(--u) var(--u);background-position:center top}
h1,h2,p,ol,ul{margin:0}
button{font:inherit;color:inherit;cursor:pointer}
a{color:inherit}
:focus-visible{outline:2px solid var(--fg);outline-offset:2px}

/* A card covers the grid lines it sits on: the inset shadow draws its top and left edge, the outer one its right and bottom. */
.o,.hd,.bits li,.cols>div,.btn,.tog,.yes{--bd:var(--line)}
.o,.hd,.bits li,.btn,.tog{background:#fff;border:0;box-shadow:inset 1px 1px 0 var(--bd),1px 1px 0 var(--bd)}

.site{max-width:calc(100% - 2*var(--p)*var(--u));width:calc(var(--u) + round(down,min(100% - (2*var(--p) + 1)*var(--u),56*var(--u)),2*var(--u)));margin-inline:auto;
  display:flex;flex-direction:column;gap:var(--u);
  padding-top:max(var(--p)*var(--u),env(safe-area-inset-top,0px));padding-bottom:max(var(--p)*var(--u),env(safe-area-inset-bottom,0px))}
.split{display:flex;flex-direction:column;gap:var(--u);min-width:0}

/* brand, question, answers */
.ask{display:contents}
.brand{display:flex;align-items:center;gap:10px;height:var(--u);font-weight:700;font-size:17px}
.logo{display:block;flex:none;width:var(--u);height:var(--u)}
.h1{font-family:var(--disp);font-weight:800;font-size:calc(var(--u)*1.4);line-height:calc(var(--u)*1.5);letter-spacing:-.025em}

/* "we": a highlighter mark that reveals Matt and Denis */
.we{position:relative;display:inline-block;white-space:nowrap;cursor:pointer;-webkit-tap-highlight-color:transparent;padding:0 .06em;background:linear-gradient(transparent 56%,var(--hl) 56% 90%,transparent 90%)}
.pop{position:absolute;left:50%;bottom:92%;display:flex;padding-bottom:6px;opacity:0;pointer-events:none;
  transform:translate(-50%,8px) scale(.7);transform-origin:50% 100%;transition:opacity .16s,transform .16s}
.we.on .pop,.we:focus-visible .pop{opacity:1;pointer-events:auto;transform:translate(-50%,0) scale(1)}
/* the photos are cut-outs, so the picked answer's colour shows behind each face */
.av{width:44px;height:44px;border-radius:50%;display:grid;place-items:center;background:var(--sel);color:var(--self);
  font:700 18px/1 var(--disp);letter-spacing:0;text-decoration:none;border:3px solid #fff;box-shadow:0 3px 12px rgba(11,27,63,.28);
  background-size:cover;background-position:center}
.av:first-child{transform:translate(0,4px) rotate(-6deg)} /* the two faces sit a little off axis, like photos dropped on a desk */
.av+.av{margin-left:-14px;transform:translate(0,-3px) rotate(5deg)}
@media (prefers-reduced-motion:reduce){.pop{transition:none}}

.list{display:flex;flex-direction:column;gap:var(--u)}
.o{display:flex;align-items:stretch;height:calc(3*var(--u));padding:0;text-align:left;min-width:0;transition:background-color .12s}
.o .q{flex:none;width:calc(2*var(--u));margin-bottom:-1px; /* runs over the card's bottom edge line, so no line shows under the colour */display:grid;place-items:center;background:var(--c);color:var(--cf);font-family:var(--mono);font-size:11px}
.o .tx{display:flex;flex-direction:column;justify-content:center;gap:2px;padding:0 12px;min-width:0}
.o b{font-family:var(--disp);font-weight:700;font-size:calc(var(--u)*.62);line-height:1.15;letter-spacing:-.01em}
.o small{color:var(--mut);font-size:13px;line-height:1.3}
@media (hover:hover){.o[aria-pressed="false"]:hover{background:var(--soft)}}
.o[aria-pressed="true"]{background:var(--fg);--bd:var(--fg);color:#fff}
.o[aria-pressed="true"] small{color:inherit;opacity:.8}

/* the offer: header card, step tiles and two list cards, each its own piece on the paper */
.mono{font-family:var(--mono);font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--mut)}
.sheet{display:flex;flex-direction:column;gap:var(--u);min-width:0;scroll-margin-top:var(--u);order:2}
.hd{padding:14px 16px;background:var(--head);display:grid;grid-template-columns:minmax(0,1fr);gap:10px 24px;align-content:start} /* header copy hangs from the top */
.ttl{font-family:var(--disp);font-weight:700;font-size:calc(var(--u)*1.2);line-height:1.1;letter-spacing:-.02em;margin-top:4px}
.sum{color:var(--fg);font-weight:500;max-width:62ch;margin-top:4px}
.hd .mono{color:var(--fg);font-weight:500}
.hd .ttl,.hd .facts b,.hd .sum,.hd .mono{color:var(--dark)} /* the whole header band uses the dark value of the picked colour */
.sheet{--fg:var(--dark);--mut:color-mix(in srgb,var(--dark) 86%,var(--bg));color:var(--fg)} /* and so does all the text in the offer */ /* the header copy sits on a tinted band, so it runs at full ink and medium weight */
.facts{display:flex;gap:22px;font-variant-numeric:tabular-nums}
.facts b{display:block;font-family:var(--disp);font-size:22px;line-height:1.1;white-space:nowrap}

.sec{display:flex;flex-direction:column;gap:var(--u);min-width:0}
.cols{display:contents}
.tog{display:flex;justify-content:space-between;align-items:center;gap:12px;width:100%;height:calc(2*var(--u));padding:0 16px;text-align:left}
.tog::after{content:"+";font-size:18px;line-height:1;color:var(--fg);letter-spacing:0}
.tog[aria-expanded="true"]::after{content:"\2013"}
.sec>:not(.tog){display:none}
.sec.open>.bits{display:grid}
.sec.open>.yes{display:grid}

.bits{list-style:none;padding:0;display:grid;grid-template-columns:minmax(0,1fr);gap:var(--u)}
.bits li{padding:calc(var(--u)/2);display:flex;flex-direction:column;gap:4px;min-width:0;font-size:14px;overflow:hidden}
/* Step tiles: a checkerboard in the header tint at 55% (--step); the numbers are set in a deep value (--deep).
   Odd steps fill the whole card with it; even steps stay white and fill only the number chip. */
.bits li{position:relative;padding-top:calc(var(--u)*1.3)}
/* step card fills are 55% opaque, so the graph paper shows through them */
.bits li{background:color-mix(in srgb,#fff 55%,transparent)}
.bits li:nth-child(odd){background:color-mix(in srgb,var(--tint) 55%,transparent)}
.bits em{position:absolute;top:1px;left:1px;width:calc(var(--u) - 1px);height:calc(var(--u) - 1px);display:grid;place-items:center;font-size:11px;letter-spacing:0;
  background:var(--step);color:var(--deep)}
.bits li:nth-child(odd) em{background:none}
.bits em{font-family:var(--mono);font-style:normal}
.bits b{order:1;font-family:var(--disp);font-size:calc(var(--u)*.68);line-height:1.1;letter-spacing:-.01em}
.bits span{color:color-mix(in srgb,var(--fg) 80%,var(--bg));font-size:13.5px;line-height:1.4;padding-top:4px;order:2} /* the description sits right under the title */
/* A drawing fills the space under the step title and description, and moves when the card is hovered. */
.art{order:3;display:block;width:100%;height:calc(4*var(--u));margin-top:calc(var(--u)/2);overflow:visible;pointer-events:none; /* below the text, never under it */
  color:var(--artc);fill:none;stroke:currentColor;stroke-width:3}
.art *{vector-effect:non-scaling-stroke} /* one pen weight at every size, like a plotter */
.art .reg{stroke-width:1} /* registration marks at two corners */
.art .a-draw{vector-effect:none;stroke-width:4}
.art .f{fill:currentColor;stroke:none}
.art .h{fill:url(#tb-hatch);stroke:none}
.art .dt{fill:url(#tb-dots);stroke:none}
/* k and kn fill a front shape with the card's own colour, so a texture behind it does not show through */
.bits li{--card:#fff}
.bits li:nth-child(odd){--card:color-mix(in srgb,var(--tint) 55%,#fff)}
.art .k,.art .kn{fill:var(--card,#fff)}
.art .kn{stroke:none}
.art *{transform-box:fill-box;transform-origin:center}
.art .a-spin{transform-box:view-box}
.art .a-grow{transform-origin:50% 100%}
.art .a-sweep{transform-box:view-box;transform-origin:25% 80%}
.art .a-key{transform-box:view-box;transform-origin:25% 52%}
.art .a-needle{transform-box:view-box;transform-origin:50% 50%}
.art .hi{stroke:color-mix(in srgb,currentColor 78%,#2e2e2a)}
.art .a-bwipe{transform-origin:0 50%}
.art .ck{stroke:var(--card,#fff);stroke-width:3}
.art .hw{stroke-linecap:round;stroke-linejoin:round} /* hand-written strokes */
.art .hf{fill:color-mix(in srgb,currentColor 78%,#2e2e2a);stroke:none} /* the chosen route, in the full picked colour */
.art .a-slot{transform:var(--from,translate(10px,-20px) rotate(14deg))} /* a piece waits just off its place and settles on hover */
.bits b,.bits span{position:relative}
@media (prefers-reduced-motion:no-preference){
  li:hover .a-draw{animation:a-draw .7s ease-out both}
  li:hover .a-spin{animation:a-spin .8s ease-in-out both}
  li:hover .a-drop{animation:a-drop .5s ease-out both}
  li:hover .a-nudge{animation:a-nudge .8s ease-in-out both}
  li:hover .a-turn{animation:a-turn .7s ease-in-out both}
  li:hover .a-pop{animation:a-pop .5s ease-in-out both}
  li:hover .a-hop{animation:a-hop .5s ease-in-out both}
  li:hover .a-in-l{animation:a-in-l .7s ease-in-out both}
  li:hover .a-in-r{animation:a-in-r .7s ease-in-out both}
  li:hover .a-grow{animation:a-grow .5s ease-out both}
  li:hover .a-sweep{animation:a-sweep 1s ease-in-out both}
  li:hover .a-key{animation:a-key .8s ease-in-out both}
  li:hover .a-part{animation:a-part 1.2s ease-in-out both}
  li:hover .a-crop{animation:a-crop .6s cubic-bezier(.3,1.3,.6,1) both}
  li:hover .a-tap{animation:a-tap .7s ease-in-out both}
  li:hover .a-burst{animation:a-burst .5s cubic-bezier(.2,1.4,.5,1) both}
  li:hover .a-lift{animation:a-lift .9s cubic-bezier(.3,1.2,.6,1) both}
  li:hover .a-build{animation:a-build .3s ease-out both}
  li:hover .a-bdrop{animation:a-bdrop .35s cubic-bezier(.3,1.4,.6,1) both}
  li:hover .a-bwipe{animation:a-bwipe .35s ease-out both}
  li:hover .a-bspring{animation:a-bspring .45s ease-out both}
  li:hover .a-plant{animation:a-plant .45s cubic-bezier(.3,1.4,.6,1) both}
  li:hover .a-rise{animation:a-rise .6s cubic-bezier(.3,1.3,.6,1) .1s both}
  li:hover .a-shot{animation:a-shot .3s cubic-bezier(.5,0,.9,.6) both;animation-delay:var(--d,0s)}
  li:hover .a-needle{animation:a-needle 1s ease-out both}
  .a-slot,.a-home,.a-tune{transition:transform .4s cubic-bezier(.3,1.3,.6,1)}
  li:hover .a-slot{transform:none}
  li:hover .a-home{transform:translate(-16px,16px)}
  li:hover .a-tune{animation:a-tune var(--t,.7s) ease-in-out var(--d,0s) both}
  li:hover .a-tune.hes{animation-name:a-tune-hes}
  li:hover .d2{animation-delay:.1s}
  li:hover .d3{animation-delay:.2s}
}
@keyframes a-draw{from{stroke-dasharray:1;stroke-dashoffset:1}to{stroke-dasharray:1;stroke-dashoffset:0}}
@keyframes a-spin{to{transform:rotate(360deg)}}
@keyframes a-drop{from{transform:translateY(-34px);opacity:0}}
@keyframes a-nudge{50%{transform:translate(-16px,-16px)}}
@keyframes a-turn{50%{transform:rotate(-35deg)}}
@keyframes a-pop{50%{transform:scale(1.3)}}
@keyframes a-hop{40%{transform:translateY(-12px)}}
@keyframes a-in-l{50%{transform:translateX(12px)}}
@keyframes a-in-r{50%{transform:translateX(-12px)}}
@keyframes a-sweep{50%{transform:rotate(-20deg)}}
@keyframes a-needle{0%{transform:rotate(-80deg)}55%{transform:rotate(14deg)}80%{transform:rotate(-6deg)}100%{transform:none}}
@keyframes a-shot{from{transform:translate(40px,-52px);opacity:0}}
@keyframes a-tune{45%{transform:translateY(calc(var(--dy)*1.2))}65%{transform:translateY(calc(var(--dy)*.9))}82%{transform:translateY(calc(var(--dy)*1.04))}100%{transform:translateY(var(--dy))}}
@keyframes a-tune-hes{28%,46%{transform:translateY(calc(var(--dy)*.5))}72%{transform:translateY(calc(var(--dy)*1.12))}88%{transform:translateY(calc(var(--dy)*.97))}100%{transform:translateY(var(--dy))}}
@keyframes a-part{50%{transform:translateX(-3px)}}
@keyframes a-crop{from{transform:scale(1.55)}}
@keyframes a-tap{0%{transform:translate(14px,14px)}60%{transform:none}75%{transform:scale(.88)}100%{transform:none}}
@keyframes a-burst{from{transform:translateY(26px) scale(.2);opacity:0}}
@keyframes a-lift{0%,35%{transform:translateY(44px)}100%{transform:none}}
@keyframes a-bdrop{from{transform:translateY(-16px);opacity:0}}
@keyframes a-bwipe{from{transform:scaleX(0)}}
@keyframes a-bspring{0%{transform:scale(0)}60%{transform:scale(1.18)}80%{transform:scale(.95)}100%{transform:none}}
@keyframes a-build{from{transform:scaleY(0);opacity:0}}
@keyframes a-plant{from{transform:translateY(-22px);opacity:0}}
@keyframes a-rise{from{transform:translateY(34px)}}
@keyframes a-key{50%{transform:rotate(-24deg)}}
@keyframes a-grow{from{transform:scaleY(.2)}}


.yes{list-style:none;display:grid;align-content:start;gap:6px;font-size:14px;
  padding:14px 16px;background:#fff;box-shadow:inset 1px 1px 0 var(--bd),1px 1px 0 var(--bd)}
.yes li{padding-left:16px;position:relative}
.yes li::before{content:"";position:absolute;left:0;top:.5em;width:7px;height:7px;background:var(--fg)}

/* the button and the address sit under the answers, with a spare row above them.
   In the stacked layout the left column dissolves so they can follow the offer instead. */
.foot{display:flex;flex-direction:column;align-items:flex-start;gap:var(--u);margin-top:var(--u);order:3}
.btn{width:100%;height:calc(2*var(--u));display:flex;align-items:center;justify-content:center;
  background:var(--sel);--bd:var(--sel);color:var(--self);font-weight:600;font-size:15px;text-decoration:none}
.mail{font-family:var(--mono);font-size:14px;height:var(--u);line-height:var(--u);text-underline-offset:3px}
.nojs{max-width:60ch;margin:24px auto;padding:0 20px}

/* Cell size and page margin step with the window. The margin around the content is two cells wherever
   there is room and one cell on phones and on the smallest one-screen windows; the cell is 24px on
   mid-size windows, 28px on larger ones and 32px on big screens. */
@media (min-width:700px){:root{--p:2}}
@media (min-width:1128px) and (min-height:696px){:root{--u:24px;--p:1}}
@media (min-width:1176px) and (min-height:744px){:root{--p:2}}
@media (min-width:1316px) and (min-height:868px){:root{--u:28px}}
@media (min-width:1504px) and (min-height:992px){:root{--u:32px}}
@media (min-width:1128px) and (min-height:696px) and (max-width:1315.98px), (min-width:1128px) and (min-height:696px) and (max-height:867.98px){
  .sum{font-size:14px;line-height:1.4}
  .bits span{font-size:12.5px;line-height:1.35}
  .yes{font-size:13.5px}
  .o small{display:none}
  .hd{padding-block:8px !important}
}

/* Desktop: everything on one screen, no page scroll. Heights are fixed in cells:
   the smallest window gives 27. Left: brand 1, gap 1, question 4, gap 1, five answers of 2 with gaps, gap 2,
   button 2, gap 1, address 1. Right: header 5, gap 1, steps 11, gap 1, lists 9. Taller windows give the extra
   rows to the steps and lists on the right and to the gap above the button on the left. */
@media (min-width:1128px) and (min-height:696px){
  html,body{height:100%}
  body{overflow:hidden}
  .site{height:round(down,100%,var(--u));padding-block:calc(var(--p)*var(--u));display:grid;grid-template-rows:minmax(0,1fr)}
  .split{display:grid;grid-template-columns:calc(15*var(--u)) minmax(0,1fr);min-height:0;container-type:size}
  .ask{display:flex;flex-direction:column;gap:var(--u);min-width:0} /* fills the column: answers at the top, button and address at the bottom */
  .foot{margin-top:clamp(var(--u),100cqh - 26*var(--u),3*var(--u))} /* four rows under the answers; fewer only when the window is too short */
  .foot{flex:1}
  .mail{margin-top:auto} /* the address rests on the last row of the column, level with the bottom of the offer */
  .h1{font-size:calc(var(--u)*1.85);line-height:calc(2*var(--u));height:calc(4*var(--u))}
  .o{height:calc(2*var(--u))}

  .sheet{display:grid;gap:0;height:100cqh;
    /* header 5, then a gap row plus the steps, which take what is left, then the lists, which hug their text (see snap() in app.js) */
    grid-template-rows:calc(5*var(--u)) minmax(0,1fr) auto}
  .hd{grid-template-columns:minmax(0,1fr) auto;align-items:start;padding:calc(var(--u)/2) 18px;overflow:hidden}
  .sec{display:block}
  .sec>:not(.tog){display:revert}
  .run{display:grid;grid-template-rows:var(--u) minmax(0,1fr);gap:0}
  .run>.lab{display:none}
  .run>.bits{grid-row:2}
  .bits li .art{flex:1 1 0;min-height:0;height:auto} /* on one screen the drawing fills whatever the card has left */
  .run>.bits{display:grid;grid-template-rows:minmax(0,1fr);
    grid-template-columns:repeat(var(--m),round(down,(100% - var(--m)*var(--u))/var(--n),var(--u))) minmax(0,1fr)}
  .run>.bits.two{grid-template-rows:repeat(2,minmax(0,1fr))}
  .cols{display:grid;grid-template-columns:round(down,(100% - var(--u))/2,var(--u)) minmax(0,1fr);gap:var(--u);margin-top:var(--u);min-height:0;align-items:start}
  .cols>div{display:flex;flex-direction:column;gap:10px;padding:calc(var(--u)/2) 18px;min-width:0;overflow:hidden;
    background:#fff;box-shadow:inset 1px 1px 0 var(--bd),1px 1px 0 var(--bd)}
  .cols .yes{display:grid;padding:0;background:none;box-shadow:none}

}

/* Very tall screens (over 1080px): the layout stops growing at 34 cells (30 of content plus the two-cell
   margins) and sits in the middle of the screen, still on the grid, so the step cards stay a sensible height. */
@media (min-width:1128px) and (min-height:1081px){
  body{display:flow-root} /* keeps the margin below inside the page, so it never scrolls */
  .site{height:calc(34*var(--u));margin-top:max(0px,round(down,(100dvh - 34*var(--u))/2,var(--u)))}
}
