/* Cookie banner (consent.js): a traffic light that stands in the corner of the window. Its three lamps are the
   choices, a small card above it explains the one pointed at. Loaded by every page of the site. */

.semafor{--case:#0B0E14;--spring:cubic-bezier(.3,1.35,.45,1);position:fixed;left:max(24px,env(safe-area-inset-left));bottom:0;z-index:40;display:grid;justify-items:start;gap:10px;font-size:13px;line-height:1.4;pointer-events:none}
.sem-say,.sem button{pointer-events:auto}
.sem-say{width:min(272px,100vw - 36px);padding:12px 14px;border:1px solid var(--line);border-radius:16px;background:var(--card);box-shadow:var(--shadow-2);color:var(--muted);transition:opacity var(--dur-2),translate var(--dur-2) var(--ease)}
.semafor h2{margin-bottom:2px;color:var(--ink);font-size:15px;letter-spacing:-.01em;line-height:1.3;outline:0}
.semafor a{color:var(--link);text-decoration:underline}
/* every explanation sits in the same place, so the card keeps its size and the lines only fade */
.sem-hints{display:grid;margin:0 0 4px}
.sem-hints span{grid-area:1/1;opacity:0;transition:opacity .12s}
.sem-hints .on{opacity:1;transition:opacity .22s .1s}
.sem{position:relative;display:grid;padding:6px 0 calc(30px + env(safe-area-inset-bottom)) 10px}
.sem::before{content:"";position:absolute;left:0;top:0;width:68px;height:180px;border-radius:34px;background:var(--case);box-shadow:var(--shadow-2);pointer-events:auto}
.sem::after{content:"";position:absolute;left:28px;top:178px;bottom:0;width:12px;background:var(--case)}
.sem button{position:relative;display:flex;justify-self:start;align-items:center;gap:20px;padding:4px 0;border:0;border-radius:28px;background:none;color:var(--ink);font:600 14px/1.25 var(--body);text-align:left;cursor:pointer}
.sem-red{--c:#F2493F;--dim:#4A232C}
.sem-yellow{--c:#F6B62B;--dim:#4A3E27}
.sem-green{--c:#35C57A;--dim:#1C4239}
.lamp{flex:none;width:48px;height:48px;border-radius:50%;background:var(--c);transition:background var(--dur-2),box-shadow var(--dur-2)}
.sem b{display:flex;align-items:center;height:40px;padding:0 16px;border:1px solid var(--line);border-radius:20px;background:var(--card);box-shadow:var(--shadow-1);font-weight:600;white-space:nowrap;transition:opacity var(--dur-2),translate .45s var(--spring),background var(--dur-1),color var(--dur-1),border-color var(--dur-1)}
.sem small{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
/* pointed at, focused or just chosen: a dark label and a ring around the lamp; the stored choice has an outlined label */
@media (hover:hover){
  .sem button:hover b{background:var(--ink);border-color:var(--ink);color:var(--bg)}
  .sem button:hover .lamp{box-shadow:0 0 0 5px color-mix(in srgb,var(--c) 28%,transparent)}
  /* like a real light: the other two lamps go dark */
  .sem:has(button:hover) button:not(:hover) .lamp{background:var(--dim)}
}
.sem button:focus-visible b,.picked [aria-pressed=true] b{background:var(--ink);border-color:var(--ink);color:var(--bg)}
.sem [aria-pressed=true] b{border-color:var(--ink);box-shadow:inset 0 0 0 1px var(--ink)}
.sem button:focus-visible .lamp,.sem [aria-pressed=true] .lamp{box-shadow:0 0 0 5px color-mix(in srgb,var(--c) 28%,transparent)}
.sem:has(button:focus-visible) button:not(:focus-visible) .lamp,.picked [aria-pressed=false] .lamp{background:var(--dim)}
/* first visit: the light rises dark, the lamps switch on one by one (classes s1 to s3), then the labels arrive */
.boot:not(.s1) .sem-red .lamp,.boot:not(.s2) .sem-yellow .lamp,.boot:not(.s3) .sem-green .lamp{background:var(--dim)}
.boot .sem-say{opacity:0;translate:0 8px}
.boot .sem b,.picked [aria-pressed=false] b{opacity:0;translate:-18px 0}
.sem-yellow b{transition-delay:.07s,.07s,0s,0s,0s}
.sem-green b{transition-delay:.14s,.14s,0s,0s,0s}
.picked b{transition-delay:0s}
.boot button,.picked button{pointer-events:none}

@media (prefers-color-scheme:dark){:root:not([data-theme=light]) .semafor{--case:#2B3446}}
:root[data-theme=dark] .semafor{--case:#2B3446}
/* a phone: a smaller light, and the card shrinks to one line so the page stays readable above it */
@media (max-width:599px){
  .semafor{left:max(12px,env(safe-area-inset-left));gap:8px}
  .sem{padding-bottom:calc(20px + env(safe-area-inset-bottom))}
  .sem::before{width:60px;height:156px}
  .sem::after{left:25px;top:154px;width:10px}
  .sem button{gap:18px}
  .lamp{width:40px;height:40px}
  .sem b{height:36px;padding:0 14px}
}
@media (max-width:599px),(max-height:620px){
  .sem-hints{display:none}
  .sem-say{display:flex;align-items:baseline;gap:14px;width:auto;padding-block:10px}
  .semafor h2{margin:0}
}
@media (prefers-reduced-motion:no-preference){
  .semafor{animation:sem-in .75s var(--spring) backwards}
  .semafor.out{animation:sem-out .5s var(--ease) forwards}
}
@keyframes sem-in{from{translate:0 110%}}
@keyframes sem-out{to{translate:0 110%}}
@media print{.semafor{display:none}}
