/* ============================================================================
   craft/film.css · a film on the page: the control and the lightbox
   Loaded after the kit (scrollcraft.css, d-current.css, inner.css), whose
   tokens, .mono and .tick it uses. Script: craft/film.js. Any page can carry
   it: the Toolbox's cards open the lightbox, the Work page's cases open the
   slide-out.

   1. The control, .film-link: a plain link to the film's mp4, so it works
      without scripts. With craft/film.js it opens the lightbox instead. It
      carries a thin play mark (an inline svg, .film-link__mark), the words
      "Watch the film" and the runtime (.film-link__time).
        .film-link         a mono text link, ash, lime on hover, a 44px target
        .film-link--bar    the same control as the foot bar of a framed
                           picture, the twin of the browser bar at its head:
                           the page places it over the picture's foot (the
                           Toolbox does in craft/p-toolbox.css, .tb-film)
   2. The lightbox, dialog.film-box, built by craft/film.js when a control is
      first pressed. A native modal dialog over an ink veil: a head (a mono
      label, the film's name in the display face, Close), the film in a thin
      lime frame with registration marks at two corners, and a mono foot (the
      picture's size, the clock). Every size comes from --film-w, the widest
      the frame can be with the head and the foot still on screen.
   3. The slide-out, dialog.film-box--slide: the same dialog, opened by a
      control marked data-film="slide" (the Work page's cases). The veil thins
      so the page reads dimmed behind it, and the head, the film and the foot
      sit in one panel on the right edge, which slides in over the page and
      leaves the same way, quicker. The control there is a button,
      .film-link--btn. On a phone the panel is the whole screen.
   Reduced motion: nothing here moves or fades.
   ========================================================================== */

/* read aloud, never shown: the tool a control belongs to */
.film-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* ============ 1. THE CONTROL ============ */
.film-link{position:relative;display:inline-flex;align-items:center;gap:.6rem;min-height:44px;color:var(--ash);
  cursor:pointer;transition:color .15s var(--e-io),background-color .15s var(--e-io),border-color .15s var(--e-io)}
.film-link__mark{flex:none;width:.62rem;height:.62rem;overflow:visible;fill:none;stroke:currentColor;stroke-width:1;
  stroke-linejoin:miter;transition:fill .15s var(--e-io)}
.film-link__time{font-variant-numeric:tabular-nums}
/* hover is a mouse's: on a touch screen it would stay lit after the film closes */
@media(hover:hover){
  .film-link:hover{color:var(--lime)}
  .film-link:hover .film-link__mark{fill:currentColor}
}

/* the foot bar of a framed picture: the size and type of the bar at its head */
.film-link--bar{display:flex;height:1.55rem;min-height:0;padding:0 .6rem;gap:.55rem;background:#0b0b0f;
  border:1px solid var(--line-dim);font-size:.58rem;letter-spacing:.16em;line-height:1;color:#F4F4F0;white-space:nowrap}
/* a 44px target: the bar's own height, and the strip of the picture above it */
.film-link--bar::before{content:"";position:absolute;left:0;right:0;bottom:0;height:44px}
.film-link--bar .film-link__mark{color:var(--lime)}
.film-link--bar .film-link__time{margin-left:auto;color:var(--lime)}
/* under the pointer or the keyboard the bar fills lime, as the site's buttons do */
.film-link--bar:focus-visible{background:var(--lime);border-color:var(--lime);color:var(--ink)}
.film-link--bar:focus-visible .film-link__mark,.film-link--bar:focus-visible .film-link__time{color:var(--ink)}
.film-link--bar:focus-visible .film-link__mark{fill:currentColor}
@media(hover:hover){
  .film-link--bar:hover{background:var(--lime);border-color:var(--lime);color:var(--ink)}
  .film-link--bar:hover .film-link__mark,.film-link--bar:hover .film-link__time{color:var(--ink)}
}

/* a button on the page (the Work page's cases): the play mark, the words, the runtime */
.film-link--btn{min-height:48px;padding:0 1.15rem;gap:.7rem;border:1px solid var(--line-lime);background:rgba(9,9,12,.4);
  color:#F4F4F0;font-size:.7rem;letter-spacing:.16em;line-height:1;text-transform:uppercase;white-space:nowrap}
.film-link--btn .film-link__mark{color:var(--lime);width:.7rem;height:.7rem}
.film-link--btn .film-link__time{padding-left:.7rem;border-left:1px solid var(--line-dim);color:var(--lime)}
.film-link--btn:focus-visible{background:var(--lime);border-color:var(--lime);color:var(--ink)}
.film-link--btn:focus-visible .film-link__mark,.film-link--btn:focus-visible .film-link__time{color:var(--ink)}
.film-link--btn:focus-visible .film-link__mark{fill:currentColor}
.film-link--btn:focus-visible .film-link__time{border-left-color:rgba(24,23,28,.3)}
@media(hover:hover){
  .film-link--btn:hover{background:var(--lime);border-color:var(--lime);color:var(--ink)}
  .film-link--btn:hover .film-link__mark,.film-link--btn:hover .film-link__time{color:var(--ink)}
  .film-link--btn:hover .film-link__time{border-left-color:rgba(24,23,28,.3)}
}

/* ============ 2. THE LIGHTBOX ============ */
.film-box{--film-ar:1.7778;--film-chrome:11.5rem;
  --film-w:min(100vw - 2 * var(--gutter,1.25rem),(100vh - var(--film-chrome)) * var(--film-ar),104rem);
  position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:0;border:0;
  background:rgba(14,13,17,.94);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);color:#F4F4F0;
  overflow:hidden;overscroll-behavior:contain;touch-action:pinch-zoom}
@supports(height:100dvh){
  .film-box{--film-w:min(100vw - 2 * var(--gutter,1.25rem),(100dvh - var(--film-chrome)) * var(--film-ar),104rem)}
}
.film-box[open]{display:grid;place-items:center}
.film-box::backdrop{background:transparent}
/* furniture behind the film: one hairline down the veil, the word in katakana */
.film-box::before{content:"";position:absolute;top:0;bottom:0;left:12%;width:1px;background:var(--line-dim);pointer-events:none}
.film-box__ghost{position:absolute;right:1vw;bottom:-2%;font-family:var(--font-display);font-weight:900;
  font-size:min(23vw,340px);line-height:.8;white-space:nowrap;color:#fff;opacity:.04;pointer-events:none;user-select:none}

.film-box__in{position:relative;width:var(--film-w);display:grid;gap:.9rem}

/* the head: what is playing, and the way out */
.film-box__bar{display:flex;align-items:flex-end;justify-content:space-between;gap:1.2rem}
.film-box__tel{display:block;margin-bottom:.55rem;font-size:.64rem;letter-spacing:.2em;color:var(--lime)}
.film-box__title{margin:0;font-family:var(--font-display);font-weight:900;text-transform:uppercase;letter-spacing:-.02em;
  line-height:.9;font-size:clamp(1.5rem,2.6vw,2.4rem);color:#F4F4F0;text-wrap:balance}
.film-box__close{flex:none;display:inline-flex;align-items:center;gap:.7rem;min-height:44px;margin-bottom:-.7rem;padding:0;
  background:none;border:0;color:var(--ash);cursor:pointer;transition:color .15s var(--e-io)}
.film-box__close:hover{color:var(--lime)}
.film-box__key{padding:.28rem .42rem;border:1px solid var(--line-dim);font-size:.58rem;letter-spacing:.14em;line-height:1}
/* a cross of two hairlines */
.film-box__x{position:relative;flex:none;width:13px;height:13px}
.film-box__x::before,.film-box__x::after{content:"";position:absolute;left:-2px;right:-2px;top:6px;height:1px;background:currentColor}
.film-box__x::before{transform:rotate(45deg)}
.film-box__x::after{transform:rotate(-45deg)}

/* the frame: a thin lime line, D's registration marks at two corners */
.film-box__frame{position:relative;aspect-ratio:var(--film-ar);background:#0b0b0f;border:1px solid var(--line-lime)}
.film-box__frame::before,.film-box__frame::after{content:"";position:absolute;width:12px;height:12px;border:1px solid var(--lime);pointer-events:none}
.film-box__frame::before{top:-7px;left:-7px;border-right:0;border-bottom:0}
.film-box__frame::after{bottom:-7px;right:-7px;border-left:0;border-top:0}
.film-box__video{display:block;width:100%;height:100%;object-fit:contain;background:#0b0b0f}
.film-box__video:focus-visible{outline-offset:5px}
/* a film that did not load says so over its poster, with the file itself as the way through */
.film-box__fail{position:absolute;left:0;right:0;bottom:0;margin:0;padding:.9rem 1rem;background:rgba(11,11,15,.92);
  border-top:1px solid var(--line-dim);color:#F4F4F0;font-size:.9rem;line-height:1.5}
.film-box__fail a{color:var(--lime);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px}

/* the foot: the picture's size on the left, the clock on the right */
.film-box__foot{display:flex;justify-content:space-between;gap:1rem;font-size:.58rem;letter-spacing:.16em;line-height:1.4;
  color:var(--ash);font-variant-numeric:tabular-nums}

/* opening: the veil comes up, the head and the foot follow the frame, which
   craft/film.js grows out of the picture its control sits on */
@keyframes film-veil{from{opacity:0}}
@keyframes film-rise{from{opacity:0;transform:translate3d(0,8px,0)}}
.film-box[open]{animation:film-veil .22s var(--e-out)}
.film-box[open] .film-box__bar,.film-box[open] .film-box__foot{animation:film-rise .34s .12s var(--e-out) both}
.film-box.is-shutting{opacity:0;transition:opacity .16s var(--e-io)}

/* ============ 3. THE SLIDE-OUT ============
   One panel on the right edge, as wide as the film needs and never wider than
   the screen. --film-pad is its gutter; --film-w is the film's width inside
   it: the panel's width less the gutters, or what the screen's height leaves
   once the head, the line and the foot are counted (--film-chrome). The veil
   around it is the dialog itself, so a press there closes it. */
.film-box__line{margin:.7rem 0 0;max-width:52ch;color:var(--ash);font-size:.98rem;line-height:1.5}
.film-box:not(.film-box--slide) .film-box__line{display:none}
.film-box--slide{--film-chrome:17rem;--film-pad:clamp(1.25rem,3vw,2.6rem);--film-panel:min(100vw,max(60vw,54rem));
  --film-w:min(var(--film-panel) - 2 * var(--film-pad),(100vh - var(--film-chrome)) * var(--film-ar));
  background:rgba(14,13,17,.66);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}
@supports(height:100dvh){
  .film-box--slide{--film-w:min(var(--film-panel) - 2 * var(--film-pad),(100dvh - var(--film-chrome)) * var(--film-ar))}
}
.film-box--slide[open]{display:block}
.film-box--slide::before,.film-box--slide .film-box__ghost{display:none}
.film-box--slide .film-box__in{position:absolute;top:0;right:0;bottom:0;width:var(--film-panel);box-sizing:border-box;
  padding:var(--film-pad);align-content:center;justify-items:center;gap:1.1rem;
  background:var(--ink);border-left:1px solid var(--line-lime);box-shadow:-28px 0 60px rgba(0,0,0,.45)}
/* the head, the frame and the foot share the film's width, so they read as one column in the panel */
.film-box--slide .film-box__bar,.film-box--slide .film-box__frame,.film-box--slide .film-box__foot{width:var(--film-w)}
.film-box--slide .film-box__bar{align-items:flex-start}
.film-box--slide .film-box__close{margin:-.35rem 0 0}
/* a hairline down the panel and the word in katakana, as the lightbox carries on its veil */
.film-box--slide .film-box__in::before{content:"";position:absolute;top:0;bottom:0;left:var(--film-pad);width:1px;background:var(--line-dim);
  opacity:.5;pointer-events:none}
.film-box--slide .film-box__in::after{content:"デモ";position:absolute;right:.6rem;bottom:-1.2rem;font-family:var(--font-display);font-weight:900;
  font-size:min(30vh,240px);line-height:.8;white-space:nowrap;color:#fff;opacity:.035;pointer-events:none;user-select:none}
.film-box--slide .film-box__bar,.film-box--slide .film-box__frame,.film-box--slide .film-box__foot{position:relative;z-index:1}

@keyframes film-slide{from{transform:translate3d(100%,0,0)}}
.film-box--slide[open] .film-box__in{animation:film-slide .32s var(--e-out) both}
.film-box--slide[open] .film-box__bar,.film-box--slide[open] .film-box__foot{animation:none}
/* leaving: the panel goes back the way it came, quicker, and the veil clears with it */
.film-box--slide.is-shutting{opacity:1;background:rgba(14,13,17,0);-webkit-backdrop-filter:none;backdrop-filter:none;
  transition:background-color .2s var(--e-io)}
.film-box--slide.is-shutting .film-box__in{transform:translate3d(100%,0,0);transition:transform .2s cubic-bezier(.4,0,1,1)}

/* a phone, or any window the panel fills: no veil to press, so the panel is the screen */
@media(max-width:54rem){
  .film-box--slide .film-box__in{border-left:0;box-shadow:none}
  .film-box--slide .film-box__in::after{font-size:min(22vh,150px)}
}
@media(max-width:640px){
  .film-box--slide{--film-chrome:15rem}
  .film-box--slide .film-box__in{align-content:start;padding-top:calc(var(--film-pad) + .6rem)}
  .film-box--slide .film-box__in::before{display:none}
  .film-box__line{font-size:.92rem}
}
/* a short window (a phone on its side): the line and the furniture give their height to the film */
@media(max-height:520px){
  .film-box--slide{--film-chrome:6.6rem;--film-pad:.9rem}
  .film-box--slide .film-box__in{gap:.5rem}
  .film-box--slide .film-box__in::after,.film-box__line{display:none}
}

/* a touch screen has no Escape key, and a phone has no width to spare for the cap */
@media(hover:none),(max-width:640px){.film-box__key{display:none}}
/* a phone held upright: the frame takes the width, the hairline runs down its left edge */
@media(max-width:640px){
  .film-box::before{left:var(--gutter,1.25rem)}
  .film-box__ghost{bottom:5%}
}
/* a short window (a phone on its side): the furniture gives its height to the film */
@media(max-height:520px){
  .film-box{--film-chrome:6.2rem}
  .film-box__in{gap:.5rem}
  .film-box__tel,.film-box__ghost{display:none}
  .film-box__title{font-size:1.1rem}
  .film-box__close{margin-bottom:-.9rem}
}

@media(prefers-reduced-motion:reduce){
  .film-link,.film-link__mark,.film-box__close{transition:none!important}
  .film-box[open],.film-box[open] .film-box__bar,.film-box[open] .film-box__foot{animation:none!important}
  .film-box.is-shutting{transition:none!important}
  .film-box--slide[open] .film-box__in{animation:none!important}
  .film-box--slide.is-shutting,.film-box--slide.is-shutting .film-box__in{transition:none!important;transform:none!important}
}
