/* Questions: the interrogation lamp.
   A dark wall of questions in one face, justified, every line filled (Barbara Kruger, Untitled (Questions)). Above it one persimmon
   lamp, our own full stop hung on our own line. The wall is one DOM: its text is painted by a radial gradient with a hard stop,
   Paper outside the lamp and Ink inside, so a letter is always dark on the lit disc and light on the dark wall, whatever it crosses.
   First paint is the final layout: nothing here fades or slides; the lamp is the only thing that moves. */

.p-faq{background:var(--ink);color:var(--paper);--focus:var(--paper)}
.p-faq .bar{color:var(--paper);--focus:var(--paper)}
.p-faq ::selection{background:var(--persimmon);color:var(--ink);-webkit-text-fill-color:var(--ink)}
.p-faq .btn ::selection,.p-faq .btn::selection{background:var(--paper);color:var(--ink);-webkit-text-fill-color:var(--ink)}

/* ---------------------------------------------------------------- the room: one coordinate system for wall, lamp and cord */
.room{
  /* The wall's type is set from the wall's own width: 26.8 em to a line is where Newsreader at this weight justifies evenly
     (the widest word gap stays under .4 em; at the 46px of the first sketch one line opened to .6 em). 43px at 1280. */
  --fs:clamp(30px,5.4vw,58px);
  --lh:1.07;
  --af:clamp(18px,calc(var(--fs) * .413),21px);   /* the answer: 19px at 1280 */
  --aw:calc(var(--fs) * 7.7);               /* one measure for every answer: the width of "How do we start?" */
  position:relative;isolation:isolate;overflow:clip;background:var(--ink);color:var(--paper);
  container-type:inline-size;
}
@media (max-width:699px){.room{--fs:clamp(26px,8.33vw,44px);--lh:1.354;--af:18px}}
@media (min-width:700px){.room{--fs:clamp(40px,4.4vw,50px);--lh:1.2}}
@media (min-width:1100px){.room{--fs:min(calc((100cqw - 2 * var(--mx)) / 26.8),6.85vh);--lh:1.07}}

/* the lamp and its cord sit under the wall, so the cord passes behind the letters and never cuts one */
.rig{position:absolute;inset:0;width:100%;height:100%;z-index:0;pointer-events:none;overflow:hidden;display:none}
.has-lamp .rig{display:block}
.rig__cord{fill:none;stroke:var(--persimmon);stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round}
.rig__lamp{fill:var(--persimmon)}

/* ---------------------------------------------------------------- the wall */
.wall{
  position:relative;z-index:1;margin:0;
  padding:64px var(--mx) calc(var(--fs) * 3.3);
  font:500 var(--fs)/var(--lh) var(--serif);font-variation-settings:"opsz" 72;letter-spacing:-.012em;
  font-kerning:normal;font-feature-settings:"kern" 1,"liga" 1;
  text-align:left;color:var(--paper);
}
@media (min-width:1100px){.wall{text-align:justify;text-justify:inter-word}}

/* the lamp is on: Paper outside the disc, Ink inside, one hard edge (--r1 to --r2 is the last pixel inside the disc) */
.has-lamp .wall{
  -webkit-text-fill-color:transparent;-webkit-background-clip:text;background-clip:text;background-repeat:no-repeat;
  background-image:radial-gradient(circle at var(--x,50%) var(--y,50%),#17120F var(--r1,0px),#FBF8F4 var(--r2,1px));
}
.wall__h{display:inline;font:inherit;font-style:italic}
.wall__lead{display:inline;font-style:italic}
.stop{color:var(--persimmon)}
.has-lamp .wall .stop{-webkit-text-fill-color:var(--persimmon)}

.qs{display:inline;margin:0;padding:0;list-style:none}
.item,.qh{display:inline;list-style:none}
.qh{font:inherit;margin:0}   /* each question is a real h2 holding its button, as in an accordion; set as running text */

/* ---------------------------------------------------------------- a question */
.q{color:inherit;text-decoration:none;cursor:pointer;-webkit-tap-highlight-color:transparent;padding-block:.08em}   /* a 44px target even where the line is 44px */
.q:hover,.q:focus-visible{text-decoration:underline;text-decoration-thickness:max(2px,.055em);text-underline-offset:.12em;text-decoration-skip-ink:none}
.q[aria-expanded="true"]{text-decoration:underline;text-decoration-thickness:max(1.5px,.035em);text-underline-offset:.12em;text-decoration-skip-ink:none}
.q[aria-expanded="true"]:hover,.q[aria-expanded="true"]:focus-visible{text-decoration-thickness:max(2px,.055em)}
.q:focus-visible{outline:3px solid var(--paper);outline-offset:3px;border-radius:2px}
@media (hover:none){
  .q{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:.14em;text-decoration-color:rgb(251 248 244 / .5)}
  .q[aria-expanded="true"]{text-decoration-color:currentColor}
}

/* ---------------------------------------------------------------- an answer
   Closed: nothing. Open: a zero-width box at the end of its question's line that is exactly as tall as the answer, so only the
   lines below move and the line above stays justified. The answer inside it is set to the width of "How do we start?" and shifted
   (by the script) to sit under its question. */
.a{
  display:inline-block;vertical-align:top;width:0;margin:0;
  padding:calc((var(--lh) + .12) * 1em) 0 0;
  font-size:var(--fs);line-height:var(--lh);font-style:normal;text-align:left;
}
.a__in{
  display:block;width:var(--aw);margin-left:var(--ax,0px);padding:0 0 .3em;
  font:500 var(--af)/1.4 var(--sans);font-variation-settings:normal;letter-spacing:0;text-align:left;
  hyphens:manual;overflow-wrap:break-word;
}
.a .btn{
  display:flex;width:max-content;margin-top:.75em;min-height:48px;padding:0 24px;font-size:18px;
  background:var(--ink);color:var(--paper);border:2px solid var(--paper);
}
.a .btn:hover{background:var(--paper);color:var(--ink)}
.has-lamp .wall .btn{-webkit-text-fill-color:currentColor}
/* Where the engine is not one this was drawn and checked in, an answer also paints itself with the same light (offset to its own box),
   so its words can never depend on the wall's clip reaching into the box. */
.own-clip.has-lamp .a__in{
  -webkit-text-fill-color:transparent;-webkit-background-clip:text;background-clip:text;background-repeat:no-repeat;
  background-image:radial-gradient(circle at calc(var(--x,0px) - var(--ox,0px)) calc(var(--y,0px) - var(--oy,0px)),#17120F var(--r1,0px),#FBF8F4 var(--r2,1px));
  font-weight:450;   /* two coats of light on an edge are a little heavier than one */
}

/* the last question closes the wall: alone, with its answer under it; on the right where the wall is justified */
.item--last{display:block;margin-top:.03em}
.item--last .a{display:block;width:auto;padding:0}
.item--last .a__in{margin:.5em 0 0;padding:0}
@media (min-width:1100px){.item--last{text-align:right}.item--last .a__in{margin-left:auto}}

/* before the script, and where hidden="until-found" is not understood: closed answers are simply not there */
.js .a:not(.is-open){display:none}
/* where it is understood the closed answer keeps its words findable (Ctrl+F opens it); the box has no size */
.js.has-find .wall .a[hidden]{display:inline-block !important;padding:0}
.js.has-find .wall .item--last .a[hidden]{display:block !important}

/* ---------------------------------------------------------------- the lamp can be taken and thrown (mouse and pen) */
.wall.is-over{cursor:grab}
.wall.is-held{cursor:grabbing;user-select:none;-webkit-user-select:none}

/* ---------------------------------------------------------------- no script: every question with its answer, plainly */
html:not(.js) .qs{display:block;margin-top:.7em}
html:not(.js) .item,html:not(.js) .item--last{display:block;text-align:left;margin:0 0 .6em}
html:not(.js) .a,html:not(.js) .item--last .a{display:block;width:auto;padding:.3em 0 0}
html:not(.js) .a__in,html:not(.js) .item--last .a__in{margin:0;width:min(100%,24em)}
html:not(.js) .wall{text-align:left}
html:not(.js) .qh{display:block}
html:not(.js) .a .btn{-webkit-text-fill-color:currentColor}

/* ---------------------------------------------------------------- forced colours: the clip goes, the system draws */
@media (forced-colors:active){
  .has-lamp .wall{-webkit-text-fill-color:currentColor;-webkit-background-clip:border-box;background-clip:border-box;background-image:none;color:CanvasText}
  .rig{display:none !important}
  .a__in{border-left:2px solid CanvasText;padding-left:.8em}
  .a .btn{border-color:ButtonText}
  .q,.q[aria-expanded="true"]{text-decoration:underline}
}

/* ---------------------------------------------------------------- print: black on white, every answer, no lamp */
@media print{
  .p-faq{background:#fff;color:#000}
  .room{background:none;overflow:visible;color:#000}
  .rig{display:none !important}
  .wall,.has-lamp .wall{padding:0 0 12pt;font-size:17pt;line-height:1.25;text-align:left;color:#000;-webkit-text-fill-color:#000;background:none;-webkit-background-clip:border-box;background-clip:border-box;background-image:none}
  .has-lamp .wall .stop,.stop{color:#000;-webkit-text-fill-color:#000}
  .qs{display:block}
  .item,.item--last,.js .item{display:block;text-align:left;margin:0 0 9pt}
  .a,.js .a:not(.is-open),.js.has-find .wall .a[hidden],.item--last .a{display:block !important;content-visibility:visible !important;width:auto;padding:2pt 0 0}
  .a__in,.item--last .a__in{width:auto;max-width:34em;margin:0;padding:0;font-size:11pt;color:#000;-webkit-text-fill-color:#000}
  .q,.q[aria-expanded]{text-decoration:none;color:#000;-webkit-text-fill-color:#000}
  .a .btn{border:1px solid #000;background:none;color:#000;-webkit-text-fill-color:#000;min-height:0;padding:2pt 8pt}
}

/* the running head stands on solid Ink above the lamp's cord: the cord begins under the bar, never through its button */
.p-faq .bar{z-index:65;background:var(--ink);box-shadow:inset 0 -1px 0 rgba(251,248,244,.16)}   /* a visible rail the cord hangs from */
