/* Alistair Vlok — Location Manager
   Black, quiet, work first. */

:root{
  --bg:#000;
  --ink:#fff;
  --ink-dim:#8c8c8c;
  --ink-dimmer:#555;
  --tile:#1b1b1b;
  --gutter:clamp(18px,2.2vw,30px);
  --pad:clamp(20px,2.6vw,38px);
  --head:clamp(104px,11vw,150px);
  --small:10.5px;
  --track:.15em;
}

*,*::before,*::after{box-sizing:border-box}

html,body{margin:0;background:var(--bg);color:var(--ink)}

body{
  font-family:"Instrument Sans","Helvetica Neue",Arial,sans-serif;
  font-weight:400;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  overflow-x:hidden;
}

body.is-locked{overflow:hidden}

a{color:inherit;text-decoration:none}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}
img,video{display:block;max-width:100%}

/* ---------- masthead ---------- */

.masthead{
  position:fixed;
  inset:0 0 auto 0;
  z-index:40;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:var(--gutter);
  padding:var(--pad) var(--pad) calc(var(--pad) * .7);
  background:linear-gradient(to bottom,rgba(0,0,0,.96) 60%,rgba(0,0,0,0));
  pointer-events:none;
}
.masthead > *{pointer-events:auto}

.identity{line-height:1}

.identity__name{
  display:block;
  font-size:clamp(15px,1.15vw,17px);
  font-weight:500;
  letter-spacing:.055em;
  text-transform:uppercase;
}

.identity__meta{
  display:block;
  margin-top:7px;
  font-size:var(--small);
  letter-spacing:var(--track);
  text-transform:uppercase;
  color:var(--ink-dim);
}
.identity__meta:first-of-type{margin-top:11px}

.viewtoggle{display:flex;gap:12px;padding-top:3px}

.viewtoggle button{
  width:16px;height:16px;
  display:grid;place-items:center;
  opacity:.38;
  transition:opacity .25s ease;
}
.viewtoggle button svg{width:11px;height:11px;fill:var(--ink)}
.viewtoggle button:hover{opacity:.75}
.viewtoggle button.is-active{opacity:1}

/* ---------- sections ---------- */

main{padding:var(--head) var(--pad) clamp(60px,8vw,110px)}

.section + .section{margin-top:clamp(64px,7vw,110px)}

.section__title{
  margin:0 0 clamp(18px,2vw,26px);
  font-size:var(--small);
  font-weight:400;
  letter-spacing:var(--track);
  text-transform:uppercase;
  color:var(--ink-dim);
}

/* ---------- grid ---------- */

.grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:var(--gutter);
}

body.view-list .grid{display:none}
body.view-grid .list{display:none}

.tile{
  display:block;
  width:100%;
  text-align:left;
  position:relative;
}

.tile__frame{
  position:relative;
  aspect-ratio:16/9;
  overflow:hidden;
  background:var(--tile);
}

.tile__frame img{
  width:100%;height:100%;
  object-fit:cover;
  transition:opacity .4s ease;
}

.tile__frame video{
  position:absolute;
  inset:0;
  width:100%;height:100%;
  object-fit:cover;
  opacity:0;
  transition:opacity .3s ease;
}
.tile__frame video.is-on{opacity:1}

/* with no clip, the still dims instead, so hover still answers */
.tile:hover .tile__frame img{opacity:.72}

@media (hover:none),(max-width:860px){
  .tile__frame video{display:none}
}

.tile__label{
  margin-top:10px;
  font-size:var(--small);
  letter-spacing:.12em;
  text-transform:uppercase;
  color:var(--ink-dim);
  transition:color .25s ease;
}
.tile:hover .tile__label{color:var(--ink)}

/* ---------- list ---------- */

.list{
  list-style:none;
  margin:0;
  padding:0;
  max-width:min(600px,46vw);
}

.list__row{border-top:1px solid rgba(255,255,255,.1)}
.list__row:last-child{border-bottom:1px solid rgba(255,255,255,.1)}

.list__link{
  display:block;
  width:100%;
  text-align:left;
  padding:clamp(13px,1.5vw,18px) 0;
  font-size:clamp(14px,1.35vw,18px);
  letter-spacing:.02em;
  color:var(--ink-dim);
  transition:color .25s ease;
}
.list__link:hover{color:var(--ink)}

.list__brand::after{content:", "}
.list__brand--only::after{content:none}

/* carried in the page, not shown in the line */
.list__hidden{display:none}

/* ---------- hover preview: level with the row ---------- */

.hoverpreview{
  position:fixed;
  top:0;
  left:0;
  width:clamp(260px,26vw,420px);
  aspect-ratio:16/9;
  background:var(--tile);
  opacity:0;
  visibility:hidden;
  transition:opacity .22s ease;
  z-index:30;
  pointer-events:none;
  overflow:hidden;
}
.hoverpreview.is-on{opacity:1;visibility:visible}

.hoverpreview video,
.hoverpreview img{
  width:100%;height:100%;
  object-fit:cover;
}
.hoverpreview video[hidden],
.hoverpreview img[hidden]{display:none}

/* no hover previews on touch devices */
@media (hover:none),(max-width:860px){
  .hoverpreview{display:none}
}

/* ---------- overlays ---------- */

.overlay{
  position:fixed;
  inset:0;
  z-index:60;
  background:#000;
  display:flex;
  align-items:center;
  justify-content:center;
  opacity:0;
  transition:opacity .3s ease;
}
.overlay.is-open{opacity:1}
.overlay[hidden]{display:none}

.overlay__close{
  position:absolute;
  top:var(--pad);
  right:var(--pad);
  width:22px;height:22px;
  z-index:2;
  opacity:.55;
  transition:opacity .25s ease;
}
.overlay__close:hover{opacity:1}
.overlay__close svg{width:100%;height:100%;stroke:var(--ink);stroke-width:1.3;fill:none}

.overlay__caption{
  position:absolute;
  top:var(--pad);
  left:var(--pad);
  right:calc(var(--pad) + 44px);
  font-size:var(--small);
  letter-spacing:var(--track);
  text-transform:uppercase;
  color:var(--ink);
  z-index:2;
}

.overlay__credits{
  display:block;
  margin-top:7px;
  color:var(--ink-dim);
}
.overlay__credits:empty{display:none}
.overlay__credit{display:block}

.overlay--player{align-items:flex-start;overflow:hidden}

.player__scroll{
  width:100%;
  height:100%;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  padding:clamp(78px,9vw,120px) var(--pad) clamp(50px,7vw,90px);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:safe center;
  gap:var(--gutter);
}

/* a film with stills under it reads top-down, not centred */
.player__scroll.has-shots{justify-content:flex-start}

.player__frame{width:min(100%,1600px)}

.player__ratio video{max-height:calc(100vh - 200px);max-height:calc(100dvh - 200px)}

.player__shot{
  max-width:min(100%,1300px);
  max-height:86vh;
  max-height:86dvh;
  width:auto;
  height:auto;
  background:var(--tile);
}

.player__ratio{position:relative;aspect-ratio:16/9;background:#000}

/* a film we host plays at its own shape, not forced into 16:9 */
.player__ratio.is-file{
  aspect-ratio:auto;
  display:flex;
  justify-content:center;
  background:none;
}
.player__ratio.is-file video{
  position:static;
  width:auto;
  height:auto;
  max-width:100%;
  max-height:calc(100vh - 190px);
  max-height:calc(100dvh - 190px);
}
.player__ratio iframe,
.player__ratio video{position:absolute;inset:0;width:100%;height:100%;border:0;background:#000}

.overlay--gallery{align-items:flex-start;overflow:hidden}

.gallery__scroll{
  width:100%;
  height:100%;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  padding:clamp(78px,9vw,120px) var(--pad) clamp(50px,7vw,90px);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:var(--gutter);
}

.gallery__scroll img{
  max-width:min(100%,1100px);
  max-height:86vh;
  max-height:86dvh;
  width:auto;
  height:auto;
  background:var(--tile);
}

/* ---------- small screens ---------- */

@media (max-width:860px){
  :root{--head:clamp(118px,26vw,150px)}
  .grid{grid-template-columns:repeat(2,1fr)}
  .list{max-width:none}
}

@media (max-width:540px){
  .grid{grid-template-columns:1fr}
}


/* ---------- iPhone ---------- */

/* 16px icons are fine for a mouse; a finger needs 44px. The icon stays the
   same size, the button around it grows, and the group is pulled flush right
   so the masthead looks unchanged. */
@media (hover:none){
  .viewtoggle{gap:0;margin:-14px -12px -14px 0}
  .viewtoggle button{width:44px;height:44px}
  .viewtoggle button svg{width:13px;height:13px}
  .overlay__close{min-width:44px;min-height:44px}
}

/* a phone on its side has almost no height: give the film what there is */
@media (orientation:landscape) and (max-height:500px){
  .player__ratio video,
  .player__ratio.is-file video{max-height:calc(100dvh - 86px)}
  .player__shot,
  .gallery__scroll img{max-height:calc(100dvh - 86px)}
  .gallery__scroll{padding-top:64px;padding-bottom:28px}
}

/* keep text and controls out of the notch and the home indicator */
@supports (padding:max(0px)){
  .masthead{
    padding-left:max(var(--pad),env(safe-area-inset-left));
    padding-right:max(var(--pad),env(safe-area-inset-right));
  }
  main{
    padding-left:max(var(--pad),env(safe-area-inset-left));
    padding-right:max(var(--pad),env(safe-area-inset-right));
    padding-bottom:max(clamp(60px,8vw,110px),env(safe-area-inset-bottom));
  }
  .gallery__scroll,.player__scroll{
    padding-left:max(var(--pad),env(safe-area-inset-left));
    padding-right:max(var(--pad),env(safe-area-inset-right));
  }
}

@media (prefers-reduced-motion:reduce){
  *{transition-duration:.01ms !important}
}
